:root {
  color-scheme: dark;
  --bg: #111214;
  --rail: #0f1012;
  --sidebar: #191b1f;
  --sidebar-hover: #24272d;
  --sidebar-active: #30333a;
  --main: #222429;
  --main-soft: #2b2e34;
  --panel: #181a1f;
  --panel-soft: #14161a;
  --line: #2a2d33;
  --ink: #f2f3f5;
  --muted: #b8bec8;
  --quiet: #7f8792;
  --accent: #f05da8;
  --accent-hover: #d64091;
  --accent-soft: rgba(240, 93, 168, 0.16);
  --green: #23a55a;
  --danger: #da373c;
  --white: #ffffff;
  font-family: "Segoe UI", "Aptos", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #3a3d45 transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #3a3d45;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #4b4f59;
  background-clip: content-box;
}

body {
  margin: 0;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

html,
#app {
  height: 100%;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.shell {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-columns: 72px 292px minmax(0, 1fr) 292px;
  background: var(--main);
}

.shell.no-side-panel {
  grid-template-columns: 72px 292px minmax(0, 1fr);
}

.server-rail {
  background: var(--rail);
  color: var(--white);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.home-button,
.server-button,
.server-dot {
  position: relative;
}

.home-button::before,
.server-button::before,
.server-dot::before {
  content: "";
  position: absolute;
  left: -12px;
  width: 4px;
  height: 0;
  border-radius: 0 999px 999px 0;
  background: var(--white);
  transition: height 140ms ease;
}

.home-button:hover::before,
.server-button:hover::before,
.server-dot:hover::before {
  height: 20px;
}

.home-button.active::before,
.server-button.active::before {
  height: 40px;
}

.home-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--main);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  transition: border-radius 140ms ease, background 140ms ease, color 140ms ease;
}

.home-button:hover,
.home-button.active {
  border-radius: 16px;
  background: var(--accent);
  color: var(--white);
}

.rail-separator {
  width: 32px;
  height: 1px;
  border-radius: 999px;
  background: var(--line);
  margin: 2px 0 4px;
}

.server-button,
.server-dot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--main);
  font-weight: 800;
  transition: border-radius 140ms ease, background 140ms ease, color 140ms ease;
}

.server-button {
  background: var(--main);
  color: var(--muted);
}

.server-button:hover,
.server-dot:hover,
.server-button.active {
  border-radius: 16px;
  background: var(--accent);
  color: var(--white);
}

.home-button.has-unread:not(.active)::before,
.server-button.has-unread:not(.active)::before {
  height: 10px;
  background: var(--accent);
}

.unread-badge {
  width: 20px;
  min-width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 20px;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  background: var(--accent);
  color: var(--white);
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 16px rgba(240, 93, 168, 0.22);
}

.unread-badge.compact {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  min-width: 10px;
  max-width: 10px;
  height: 10px;
  min-height: 10px;
  max-height: 10px;
  padding: 0;
  border: 2px solid var(--rail);
  flex: 0 0 10px;
  overflow: hidden;
  font-size: 0;
}

.sidebar {
  min-width: 0;
  min-height: 0;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
}

.server-header {
  min-height: 48px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.server-header h1 {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.2;
}

.server-header p {
  margin: 2px 0 0;
  color: var(--quiet);
  font-size: 0.78rem;
}

.mini-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.mini-icon:hover {
  background: var(--sidebar-active);
  color: var(--ink);
}

.nav-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 10px 10px 2px;
}

.nav-tabs.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sidebar-label {
  margin: 12px 16px 0;
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tab-button {
  position: relative;
  min-height: 32px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.tab-button.has-unread {
  color: var(--ink);
}

.tab-button .unread-badge.compact {
  position: relative;
  top: auto;
  right: auto;
  width: 8px;
  min-width: 8px;
  max-width: 8px;
  height: 8px;
  min-height: 8px;
  max-height: 8px;
  margin-left: 7px;
  border: 0;
  flex: 0 0 8px;
  overflow: hidden;
  font-size: 0;
  vertical-align: middle;
}

.tab-button:hover {
  background: var(--sidebar-hover);
  color: var(--ink);
}

.tab-button.active {
  background: var(--accent-soft);
  color: var(--ink);
}

.channel-section {
  padding: 12px 8px;
  min-height: 0;
  overflow: auto;
  flex: 1 1 auto;
  display: block;
}

.section-title {
  margin: 10px 8px 6px;
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-category {
  position: relative;
  border-radius: 8px;
}

.sidebar-category.draggable .category-title {
  cursor: grab;
}

.category-title {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drag-grip {
  color: var(--quiet);
  font-size: 0.9rem;
  letter-spacing: -0.18em;
  opacity: 0;
  transition: opacity 120ms ease;
}

.sidebar-category:hover .drag-grip,
.channel-button:hover .drag-grip {
  opacity: 0.75;
}

.channel-grip {
  margin-left: auto;
}

.draggable.dragging {
  opacity: 0.45;
}

.sidebar-category.drop-before::before,
.sidebar-category.drop-after::after,
.channel-button.drop-before::before,
.channel-button.drop-after::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(240, 93, 168, 0.55);
}

.sidebar-category.drop-before::before,
.channel-button.drop-before::before {
  top: -2px;
}

.sidebar-category.drop-after::after,
.channel-button.drop-after::after {
  bottom: -2px;
}

.channel-dropzone {
  min-height: 6px;
  border-radius: 8px;
}

.channel-dropzone.drop-active,
.category-title.drop-active {
  background: rgba(240, 93, 168, 0.08);
  outline: 1px dashed rgba(240, 93, 168, 0.45);
}

.compact-empty {
  padding: 4px 8px 8px;
}

.channel-button,
.panel-button {
  position: relative;
  width: 100%;
  min-height: 34px;
  border-radius: 6px;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.empty-note {
  padding: 6px 8px 12px;
  color: var(--quiet);
  font-size: 0.8rem;
}

.channel-button:hover,
.panel-button:hover {
  background: var(--sidebar-hover);
  color: var(--ink);
}

.channel-button.has-unread {
  color: #ffffff;
  font-weight: 900;
}

.channel-button.has-unread:not(.active) {
  background: rgba(255, 255, 255, 0.055);
}

.channel-button.has-unread:not(.active) .hash {
  color: #f6c4df;
}

.channel-button.has-unread:not(.active):hover {
  background: rgba(255, 255, 255, 0.095);
}

.channel-button.has-unread:not(.active)::before {
  content: "";
  position: absolute;
  left: -5px;
  width: 4px;
  height: 18px;
  border-radius: 0 999px 999px 0;
  background: var(--accent);
}

.channel-button.active,
.panel-button.active {
  background: var(--accent-soft);
  color: var(--white);
}

.hash {
  color: var(--quiet);
  font-weight: 800;
}

.channel-button.active .hash,
.chat-header .hash {
  color: var(--accent);
}

.account-bar {
  margin-top: auto;
  min-height: 0;
  padding: 10px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 38%),
    var(--panel-soft);
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.account-card {
  min-width: 0;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.account-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.account-controls {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.avatar-wrap {
  width: 36px;
  height: 36px;
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  flex: 0 0 auto;
  overflow: hidden;
}

.avatar.admin {
  background: #9b59b6;
}

.avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.account-name-line {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.account-settings {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--quiet);
  font-size: 0.78rem;
  flex: 0 0 auto;
}

.account-settings:hover {
  background: var(--sidebar-hover);
  color: var(--ink);
}

.presence-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 2px solid var(--panel);
  background: #9ca3af;
}

.presence-active .presence-dot {
  background: #23a55a;
}

.presence-idle .presence-dot {
  background: #f0b232;
}

.presence-dnd .presence-dot {
  background: #f23f43;
}

.presence-offline .presence-dot {
  background: #9ca3af;
}

.presence-inline {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
  background: #9ca3af;
}

.presence-inline.presence-active {
  background: #23a55a;
}

.presence-inline.presence-idle {
  background: #f0b232;
}

.presence-inline.presence-dnd {
  background: #f23f43;
}

.presence-inline.playing {
  animation: inline-playing-active 1.2s ease-out infinite;
  box-shadow: 0 0 0 3px rgba(35, 165, 90, 0.25), 0 0 10px rgba(35, 165, 90, 0.72);
}

.presence-inline.playing.presence-idle {
  animation-name: inline-playing-idle;
  box-shadow: 0 0 0 3px rgba(240, 178, 50, 0.25), 0 0 10px rgba(240, 178, 50, 0.72);
}

.presence-inline.playing.presence-dnd {
  animation-name: inline-playing-dnd;
  box-shadow: 0 0 0 3px rgba(242, 63, 67, 0.25), 0 0 10px rgba(242, 63, 67, 0.72);
}

.presence-inline.playing.presence-offline {
  animation-name: inline-playing-offline;
  box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.25), 0 0 10px rgba(156, 163, 175, 0.72);
}

@keyframes inline-playing-active {
  0% { box-shadow: 0 0 0 0 rgba(35, 165, 90, 0.68), 0 0 8px rgba(35, 165, 90, 0.9); transform: scale(1); }
  70% { box-shadow: 0 0 0 8px rgba(35, 165, 90, 0), 0 0 14px rgba(35, 165, 90, 0.45); transform: scale(1.22); }
  100% { box-shadow: 0 0 0 8px rgba(35, 165, 90, 0), 0 0 14px rgba(35, 165, 90, 0.45); transform: scale(1); }
}

@keyframes inline-playing-idle {
  0% { box-shadow: 0 0 0 0 rgba(240, 178, 50, 0.68), 0 0 8px rgba(240, 178, 50, 0.9); transform: scale(1); }
  70% { box-shadow: 0 0 0 8px rgba(240, 178, 50, 0), 0 0 14px rgba(240, 178, 50, 0.45); transform: scale(1.22); }
  100% { box-shadow: 0 0 0 8px rgba(240, 178, 50, 0), 0 0 14px rgba(240, 178, 50, 0.45); transform: scale(1); }
}

@keyframes inline-playing-dnd {
  0% { box-shadow: 0 0 0 0 rgba(242, 63, 67, 0.68), 0 0 8px rgba(242, 63, 67, 0.9); transform: scale(1); }
  70% { box-shadow: 0 0 0 8px rgba(242, 63, 67, 0), 0 0 14px rgba(242, 63, 67, 0.45); transform: scale(1.22); }
  100% { box-shadow: 0 0 0 8px rgba(242, 63, 67, 0), 0 0 14px rgba(242, 63, 67, 0.45); transform: scale(1); }
}

@keyframes inline-playing-offline {
  0% { box-shadow: 0 0 0 0 rgba(156, 163, 175, 0.68), 0 0 8px rgba(156, 163, 175, 0.9); transform: scale(1); }
  70% { box-shadow: 0 0 0 8px rgba(156, 163, 175, 0), 0 0 14px rgba(156, 163, 175, 0.45); transform: scale(1.22); }
  100% { box-shadow: 0 0 0 8px rgba(156, 163, 175, 0), 0 0 14px rgba(156, 163, 175, 0.45); transform: scale(1); }
}

.avatar-wrap.playing .presence-dot {
  animation: playing-dot-active 1.25s ease-out infinite;
}

.avatar-wrap.playing.presence-idle .presence-dot {
  animation-name: playing-dot-idle;
}

.avatar-wrap.playing.presence-dnd .presence-dot {
  animation-name: playing-dot-dnd;
}

.avatar-wrap.playing.presence-offline .presence-dot {
  animation-name: playing-dot-offline;
}

@keyframes playing-dot-active {
  0% { box-shadow: 0 0 0 0 rgba(35, 165, 90, 0.62); transform: scale(1); }
  70% { box-shadow: 0 0 0 7px rgba(35, 165, 90, 0); transform: scale(1.2); }
  100% { box-shadow: 0 0 0 7px rgba(35, 165, 90, 0); transform: scale(1); }
}

@keyframes playing-dot-idle {
  0% { box-shadow: 0 0 0 0 rgba(240, 178, 50, 0.62); transform: scale(1); }
  70% { box-shadow: 0 0 0 7px rgba(240, 178, 50, 0); transform: scale(1.2); }
  100% { box-shadow: 0 0 0 7px rgba(240, 178, 50, 0); transform: scale(1); }
}

@keyframes playing-dot-dnd {
  0% { box-shadow: 0 0 0 0 rgba(242, 63, 67, 0.62); transform: scale(1); }
  70% { box-shadow: 0 0 0 7px rgba(242, 63, 67, 0); transform: scale(1.2); }
  100% { box-shadow: 0 0 0 7px rgba(242, 63, 67, 0); transform: scale(1); }
}

@keyframes playing-dot-offline {
  0% { box-shadow: 0 0 0 0 rgba(156, 163, 175, 0.62); transform: scale(1); }
  70% { box-shadow: 0 0 0 7px rgba(156, 163, 175, 0); transform: scale(1.2); }
  100% { box-shadow: 0 0 0 7px rgba(156, 163, 175, 0); transform: scale(1); }
}

.status-picker {
  min-width: 0;
  display: block;
}

.status-picker select {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.role {
  color: var(--quiet);
  font-size: 0.74rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role:empty {
  display: none;
}

.logout {
  min-height: 30px;
  border-radius: 8px;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.logout:hover {
  background: #3a2027;
  color: #ffb8c0;
}

.play-button {
  min-height: 30px;
  border-radius: 9px;
  padding: 0 16px;
  background: var(--accent);
  color: var(--white);
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(240, 93, 168, 0.18);
}

.play-button:hover {
  background: var(--accent-hover);
}

.launch-status {
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--quiet);
  font-size: 0.72rem;
  line-height: 1.25;
}

.chat {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) auto;
  background: var(--main);
}

.chat-header {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 16px;
}

.chat-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.2;
}

.chat-header p {
  margin: 2px 0 0;
  color: var(--quiet);
  font-size: 0.82rem;
}

.pill {
  color: var(--quiet);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pin-menu {
  position: relative;
}

.pin-menu summary {
  list-style: none;
  min-height: 28px;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.pin-menu summary::-webkit-details-marker {
  display: none;
}

.pin-menu[open] summary,
.pin-menu summary:hover {
  background: var(--main-soft);
  color: var(--ink);
}

.pin-menu-empty {
  color: var(--quiet);
  font-size: 0.76rem;
  font-weight: 700;
}

.pin-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(360px, calc(100vw - 28px));
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.pin-menu-row {
  display: grid;
  gap: 5px;
  padding: 9px;
  border-radius: 9px;
}

.pin-menu-row:hover {
  background: var(--sidebar-hover);
}

.pin-menu-row div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.pin-menu-row span {
  color: var(--quiet);
  font-size: 0.72rem;
}

.pin-menu-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.pin-menu-row button {
  justify-self: start;
  min-height: 24px;
  border-radius: 6px;
  padding: 0 8px;
  background: transparent;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, background 120ms ease;
}

.pin-menu-row:hover button,
.pin-menu-row:focus-within button {
  opacity: 1;
  pointer-events: auto;
}

.pin-menu-row button:hover {
  background: var(--accent-soft);
}

.messages {
  min-height: 0;
  overflow: auto;
  padding: 18px 18px 20px;
}

.date-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 10px;
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.date-line::before,
.date-line::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.message {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  padding: 7px 0;
  position: relative;
}

.message > div:last-child {
  min-width: 0;
}

.message.grouped {
  padding-top: 2px;
  padding-bottom: 2px;
}

.message:hover {
  background: rgba(255, 255, 255, 0.025);
  margin-left: -18px;
  margin-right: -18px;
  padding-left: 18px;
  padding-right: 18px;
}

.message.mentioned {
  border-left: 3px solid var(--accent);
  margin-left: -18px;
  padding-left: 15px;
  background: rgba(240, 93, 168, 0.08);
}

.message .avatar {
  width: 40px;
  height: 40px;
}

.message .avatar-wrap {
  width: 44px;
  height: 44px;
}

.message-repeat-time {
  align-self: start;
  padding-top: 3px;
  color: transparent;
  font-size: 0.68rem;
  text-align: right;
  user-select: none;
}

.message.grouped:hover .message-repeat-time {
  color: var(--quiet);
}

.message-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.message-author {
  color: var(--ink);
  font-weight: 800;
}

.message-time {
  color: var(--quiet);
  font-size: 0.72rem;
}

.message-body {
  margin-top: 2px;
  color: #dfe3ea;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.mention {
  border-radius: 4px;
  padding: 0 3px;
  background: rgba(240, 93, 168, 0.18);
  color: #ffd5ec;
  font-weight: 800;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.message-attachment {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.message-attachment.media {
  display: inline-flex;
  max-width: 320px;
  max-height: 220px;
}

.message-attachment.image-preview-button {
  padding: 0;
  cursor: zoom-in;
  color: inherit;
}

.message-attachment.media img,
.message-attachment.media video {
  display: block;
  max-width: 320px;
  max-height: 220px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.message-attachment.file {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
  max-width: 320px;
  padding: 10px 12px;
  color: var(--ink);
}

.message-attachment.file small {
  display: block;
  margin-top: 2px;
  color: var(--quiet);
}

.file-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: 0 0 auto;
}

.image-lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(3px);
}

.image-lightbox {
  width: min(1100px, 100%);
  height: min(760px, 100%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  overflow: hidden;
  background: #0b0d12;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.image-lightbox-header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

.image-lightbox-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-lightbox-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.image-lightbox-actions button {
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-weight: 800;
}

.image-lightbox-actions button:hover {
  background: rgba(240, 93, 168, 0.28);
}

.image-lightbox-actions span {
  min-width: 48px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.image-lightbox-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 28px;
}

.image-lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  transform-origin: center;
  transition: transform 120ms ease;
  object-fit: contain;
  user-select: none;
}

.inline-emoji {
  width: 1.55em;
  height: 1.55em;
  margin: 0 0.04em;
  vertical-align: -0.36em;
  object-fit: contain;
}

.message-edit-form {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.message-edit-input {
  width: 100%;
  min-height: 76px;
  max-height: 220px;
  border: 1px solid rgba(240, 93, 168, 0.55);
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  background: var(--main-soft);
  color: var(--ink);
  outline: none;
  line-height: 1.4;
}

.message-edit-input:focus {
  border-color: rgba(240, 93, 168, 0.85);
  box-shadow: 0 0 0 2px rgba(240, 93, 168, 0.16);
}

.message-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.primary.compact,
.secondary.compact {
  min-height: 30px;
  padding: 0 12px;
}

.message-flag {
  color: var(--quiet);
  font-size: 0.72rem;
}

.message-flag.pinned {
  color: var(--accent);
}

.deleted-text {
  color: var(--quiet);
}

.message-actions {
  position: absolute;
  top: 4px;
  right: 8px;
  z-index: 3;
  display: flex;
  gap: 6px;
  margin-top: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.message:hover .message-actions,
.message:focus-within .message-actions {
  opacity: 1;
  pointer-events: auto;
}

.message-actions button,
.secondary {
  min-height: 28px;
  border-radius: 6px;
  padding: 0 9px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.message-actions button:hover,
.secondary:hover {
  background: var(--main-soft);
  color: var(--ink);
}

.composer {
  padding: 0 18px 20px;
}

.composer form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 88px;
  gap: 10px;
}

.composer-input-wrap {
  position: relative;
  min-width: 0;
}

.attach-button {
  padding-inline: 12px;
}

.attachment-preview {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.attachment-preview-pill {
  max-width: 240px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
}

.attachment-preview-pill small {
  color: var(--quiet);
}

.attachment-preview-pill span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview-pill button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--quiet);
  font-weight: 900;
  line-height: 1;
  flex: 0 0 auto;
}

.attachment-preview-pill button:hover {
  background: rgba(240, 93, 168, 0.24);
  color: var(--white);
}

.emoji-picker,
.mention-picker {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 40;
  width: min(320px, 100%);
  max-height: 270px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #111317;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  overflow: auto;
}

.emoji-option,
.mention-option {
  width: 100%;
  min-height: 38px;
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.emoji-option:hover,
.emoji-option.active,
.mention-option:hover,
.mention-option.active {
  background: var(--accent-soft);
  color: var(--white);
}

.emoji-option img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.emoji-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-option .avatar-wrap {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.mention-option .avatar {
  width: 26px;
  height: 26px;
  font-size: 0.68rem;
}

.mention-option .presence-dot {
  width: 9px;
  height: 9px;
}

.mention-option span {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.mention-option strong,
.mention-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-option strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.mention-option small {
  color: var(--quiet);
  font-size: 0.72rem;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--main-soft);
  color: var(--ink);
  outline: none;
}

.textarea {
  min-height: 78px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--quiet);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(240, 93, 168, 0.7);
  box-shadow: 0 0 0 2px rgba(240, 93, 168, 0.18);
}

.primary {
  min-height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--white);
  font-weight: 800;
}

.primary:hover {
  background: var(--accent-hover);
}

.quick-card,
.empty-panel,
.welcome-panel {
  margin: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 12px;
}

.quick-card {
  display: grid;
  gap: 8px;
}

.quick-card .primary {
  margin-top: 2px;
}

.quick-card strong,
.empty-panel strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.empty-panel span,
.welcome-panel p {
  display: block;
  margin-top: 4px;
  color: var(--quiet);
  font-size: 0.82rem;
  line-height: 1.4;
}

.welcome-panel {
  max-width: 460px;
  margin: 28px auto;
  padding: 22px;
  text-align: center;
}

.welcome-panel h3 {
  margin: 0;
  color: var(--ink);
}

.side-panel {
  min-width: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
}

.panel-header {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-weight: 800;
  font-size: 0.92rem;
}

.panel-body {
  padding: 12px 10px;
  overflow: auto;
}

.member,
.friend-row {
  width: 100%;
  border: 0;
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 7px;
  background: transparent;
  text-align: left;
}

.member {
  grid-template-columns: 36px minmax(0, 1fr);
}

.friend-row {
  grid-template-columns: 36px minmax(0, 1fr) auto;
}

.member:hover,
.friend-row:hover {
  background: var(--sidebar-hover);
}

.member.static:hover {
  background: transparent;
}

.member-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.small-action {
  min-height: 26px;
  border-radius: 6px;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.small-action:hover {
  background: var(--main-soft);
  color: var(--ink);
}

.muted-action {
  color: var(--quiet);
}

.danger-text {
  color: #ffb8c0;
}

.user-link {
  cursor: context-menu;
}

.user-link:hover {
  color: var(--white);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.friend-picker {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.friend-check {
  display: grid;
  grid-template-columns: 18px 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border-radius: 8px;
  padding: 7px;
  color: var(--muted);
  cursor: pointer;
  background: transparent;
}

.friend-check:hover {
  background: var(--sidebar-hover);
  color: var(--ink);
}

.friend-check .avatar {
  width: 28px;
  height: 28px;
  font-size: 0.7rem;
}

.friend-check .avatar-wrap {
  width: 30px;
  height: 30px;
}

.friends-sidebar-card {
  margin: 14px 10px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--panel);
  display: grid;
  gap: 3px;
}

.friends-sidebar-card strong {
  color: var(--ink);
  font-size: 1.7rem;
  line-height: 1;
}

.friends-sidebar-card span {
  color: var(--muted);
  font-weight: 800;
}

.friends-sidebar-card em,
.friends-sidebar-note {
  color: var(--quiet);
  font-size: 0.78rem;
  font-style: normal;
  line-height: 1.35;
}

.friends-sidebar-note {
  margin: 0 12px;
}

.friends-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
}

.friends-hero {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: var(--panel);
}

.friends-hero h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.18rem;
}

.friends-hero p {
  margin: 4px 0 0;
  color: var(--quiet);
  font-size: 0.86rem;
}

.friends-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 12px;
  min-width: 0;
}

.friends-card.accent-card {
  border-color: var(--line);
  background: var(--panel);
}

.friends-card h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.96rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.68);
}

.admin-modal {
  width: min(1080px, 100%);
  max-height: min(820px, calc(100vh - 56px));
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.admin-modal-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
}

.admin-modal-header p {
  margin: 3px 0 0;
  color: var(--quiet);
  font-size: 0.82rem;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  color: var(--quiet);
  font-size: 1.1rem;
  font-weight: 800;
}

.modal-close:hover {
  background: var(--sidebar-hover);
  color: var(--ink);
}

.admin-modal-body {
  min-height: 0;
  overflow: auto;
  padding: 0;
}

.permissions-section .manage-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compact-notice {
  margin: 10px 0 14px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.permission-block {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.permission-block h4 {
  margin: 0 0 10px;
  color: var(--ink);
}

.permission-roles,
.permission-users {
  display: grid;
  gap: 7px;
}

.permission-roles {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 10px;
}

.permission-pill,
.permission-user {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  min-width: 0;
}

.permission-user span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-modal {
  width: min(760px, 100%);
}

.quick-profile-card {
  position: fixed;
  z-index: 80;
  width: 280px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(13, 18, 32, 0.28);
}

.quick-profile-banner {
  height: 58px;
}

.quick-profile-body {
  min-height: 178px;
  padding: 18px 14px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.72));
  backdrop-filter: blur(2px);
}

.quick-profile-body .avatar {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  border: 3px solid rgba(255, 255, 255, 0.82);
  font-size: 1rem;
}

.quick-profile-names {
  display: grid;
  gap: 2px;
  margin-top: 8px;
}

.quick-profile-names strong {
  color: #1f2937;
}

.quick-profile-names span,
.quick-profile-body p {
  color: rgba(31, 41, 55, 0.78);
  font-size: 0.82rem;
}

.quick-profile-body p {
  margin: 10px 0 0;
  line-height: 1.4;
  white-space: pre-wrap;
}

.profile-settings-modal {
  width: min(620px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  grid-template-rows: 64px auto minmax(0, 1fr);
}

.profile-settings-body {
  display: grid;
  gap: 12px;
}

.profile-settings-content {
  padding: 18px;
  overflow: auto;
}

.profile-settings-tabs {
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
}

.profile-settings-tabs button {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 800;
}

.profile-settings-tabs button:hover,
.profile-settings-tabs button.active {
  background: var(--accent-soft);
  color: var(--white);
}

.profile-settings-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-settings-preview .quick-profile-banner {
  display: none;
}

.profile-settings-preview .avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  margin: 0;
  border: 3px solid rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
}

.profile-settings-preview strong,
.profile-settings-preview span {
  display: block;
  margin: 0;
}

.profile-settings-preview strong {
  color: #1f2937;
}

.profile-settings-preview span {
  color: rgba(31, 41, 55, 0.78);
  font-size: 0.82rem;
}

.profile-color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.color-input {
  padding: 3px;
  min-height: 34px;
}

.profile-bio-input {
  min-height: 82px;
  resize: vertical;
}

.profile-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.account-settings-body {
  gap: 14px;
}

.account-tool-card h4 {
  margin: 0;
  color: var(--ink);
}

.account-summary-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.account-mini-stat {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  display: grid;
  gap: 2px;
}

.account-mini-stat span {
  color: var(--quiet);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.account-mini-stat strong {
  color: var(--ink);
  font-size: 1.15rem;
}

.account-tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.account-tool-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  display: grid;
  grid-template-columns: minmax(130px, 0.65fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.account-tool-card h4 {
  min-width: 0;
}

.account-tool-card button {
  justify-self: end;
  white-space: nowrap;
}

#password-change-form {
  grid-template-columns: 1fr 1fr 1fr auto;
}

#password-change-form h4 {
  grid-column: 1 / -1;
}

.profile-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-body {
  padding: 18px;
}

.profile-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.profile-slot-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--panel-soft);
}

.profile-slot-card h3,
.profile-slot-card p {
  margin: 0;
}

.profile-slot-card h3 {
  font-size: 1rem;
}

.profile-slot-card .roleplay-preview-images {
  margin: 12px 0;
}

.play-choice-modal {
  width: min(560px, 100%);
  grid-template-rows: 64px minmax(0, 1fr);
}

.play-choice-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.play-choice-card {
  width: 100%;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 4px;
  align-content: center;
  background: var(--panel-soft);
  color: var(--muted);
  text-align: left;
}

.play-choice-card:hover {
  border-color: rgba(240, 93, 168, 0.55);
  background: var(--accent-soft);
  color: var(--ink);
}

.play-choice-card strong {
  color: var(--ink);
  font-size: 1rem;
}

.play-choice-card span {
  color: var(--quiet);
  font-size: 0.84rem;
}

.play-choice-card.compact-choice {
  min-height: 62px;
}

.play-choice-divider {
  margin-top: 4px;
  color: var(--quiet);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.play-choice-slots {
  display: grid;
  gap: 8px;
}

.maintenance-panel {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
  background: var(--panel-soft);
}

.maintenance-panel strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.maintenance-panel span {
  max-width: 32ch;
  color: var(--muted);
  line-height: 1.45;
}

.debug-connect-modal {
  width: min(460px, 100%);
  grid-template-rows: 64px minmax(0, 1fr);
}

.debug-connect-body {
  padding: 18px;
}

.debug-checkbox {
  margin-top: 0;
  margin-bottom: 14px;
}

.debug-connect-note {
  margin: 12px 0 0;
  color: var(--quiet);
  font-size: 0.82rem;
}

.debug-connect-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.roleplay-editor-modal {
  width: min(980px, 100%);
  grid-template-rows: 64px minmax(0, 1fr);
}

.roleplay-editor-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.roleplay-editor-summary,
.roleplay-editor-main,
.roleplay-editor-pickers {
  min-width: 0;
}

.roleplay-editor-summary {
  align-self: start;
  position: sticky;
  top: 0;
  display: grid;
  gap: 14px;
}

.rp-summary-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.rp-summary-preview img,
.rp-summary-preview div {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--main-soft);
  object-fit: contain;
}

.rp-step-list {
  display: grid;
  gap: 6px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.rp-step-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 800;
}

.rp-step-button span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--main-soft);
  color: var(--quiet);
  font-size: 0.76rem;
}

.rp-step-button:hover,
.rp-step-button.active {
  background: var(--sidebar-hover);
  color: var(--ink);
}

.rp-step-button.active span {
  background: var(--accent);
  color: var(--white);
}

.roleplay-editor-main {
  min-height: 420px;
}

.rp-step-panel {
  display: none;
}

.rp-step-panel.active {
  display: block;
}

.rp-step-panel h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
}

.rp-step-panel p {
  margin: 4px 0 14px;
  color: var(--quiet);
  font-size: 0.84rem;
  line-height: 1.45;
}

.roleplay-editor-footer {
  position: sticky;
  bottom: -18px;
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 4px -18px -18px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.settings-layout {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.settings-nav {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--sidebar);
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.settings-nav button {
  width: auto;
  flex: 0 0 auto;
  min-height: 36px;
  border-radius: 6px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 800;
}

.settings-nav button:hover {
  background: var(--sidebar-hover);
  color: var(--ink);
}

.settings-nav button.active {
  background: var(--accent-soft);
  color: var(--white);
}

.settings-content {
  min-width: 0;
  padding: 18px;
  overflow: auto;
}

.settings-section {
  max-width: none;
}

.settings-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.1rem;
}

.settings-copy {
  margin: 6px 0 18px;
  color: var(--quiet);
  line-height: 1.45;
}

.inline-create,
.channel-create {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.inline-create {
  grid-template-columns: minmax(0, 1fr) 84px 92px;
}

.settings-list {
  display: grid;
  gap: 8px;
}

.form-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--main);
  padding: 14px;
}

.form-panel h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 0.95rem;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.field label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--main-soft);
  padding: 10px;
}

.stat-grid strong,
.stat-grid span {
  display: block;
}

.stat-grid strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.stat-grid span {
  color: var(--quiet);
  font-size: 0.76rem;
}

.manage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px 72px 56px 32px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.manage-row.area-row {
  grid-template-columns: minmax(0, 1fr) 80px 72px 56px 32px;
}

.manage-row.category-row {
  grid-template-columns: minmax(0, 1fr) 180px 72px 56px 32px;
}

.manage-row.stacked {
  grid-template-columns: 1fr;
}

.manage-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.manage-fields.four {
  grid-template-columns: minmax(130px, 0.8fr) minmax(200px, 1.4fr) minmax(150px, 1fr) minmax(150px, 1fr) 72px;
}

.manage-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.compact {
  min-height: 34px;
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 0.82rem;
}

.number {
  min-width: 0;
}

.mini {
  max-width: 80px;
  text-transform: uppercase;
}

.danger {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: transparent;
  color: #ffb8c0;
  font-weight: 900;
}

.danger:hover {
  background: #3a2027;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.88rem;
}

.roleplay-view {
  padding: 18px;
}

.roleplay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  align-items: start;
}

.roleplay-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--panel);
}

.roleplay-cover {
  min-height: 230px;
  display: grid;
  gap: 14px;
  align-content: space-between;
}

.roleplay-cover.empty {
  background: var(--panel);
}

.roleplay-card-head {
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.roleplay-card h3,
.roleplay-card p {
  margin: 0;
}

.roleplay-card h3 {
  font-size: 1rem;
}

.roleplay-card p {
  margin-top: 3px;
  color: var(--quiet);
  font-size: 0.78rem;
}

.rp-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.full-width {
  width: 100%;
}

.rp-description {
  min-height: 92px;
  resize: vertical;
}

.checkbox-line {
  margin: 10px 0 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.checkbox-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.roleplay-empty-cover {
  min-height: 112px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 16px;
  color: var(--quiet);
  background: rgba(0, 0, 0, 0.12);
}

.roleplay-empty-cover strong {
  color: var(--muted);
  font-size: 0.92rem;
}

.roleplay-preview {
  display: grid;
  gap: 12px;
}

.roleplay-preview-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.roleplay-preview-images img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--main-soft);
  object-fit: contain;
}

.roleplay-description-preview,
.profile-description {
  max-height: 7.2em;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.45;
}

.roleplay-description-preview.muted {
  color: var(--quiet);
}

.public-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--quiet);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.public-badge.public {
  border-color: rgba(240, 93, 168, 0.45);
  color: #ffd6e8;
  background: rgba(240, 93, 168, 0.18);
}

.field-label {
  margin: 10px 0 6px;
  display: block;
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rp-picker-stack {
  display: grid;
  gap: 12px;
}

.rp-variant-groups {
  max-height: 240px;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
}

.rp-variant-group {
  display: none;
}

.rp-variant-group.active {
  display: block;
}

.rp-variant-title {
  margin: 0 0 6px;
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rp-variant-group .rp-options {
  max-height: none;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
}

.rp-options {
  max-height: 176px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
}

.roleplay-editor-main .rp-options {
  max-height: 300px;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
}

.rp-equipment-picker {
  display: grid;
  gap: 14px;
}

.rp-equipment-row {
  display: grid;
  gap: 8px;
}

.rp-equipment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rp-equipment-current {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--main-soft);
}

.rp-equipment-preview {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--main-soft);
  color: var(--quiet);
  font-size: 0.68rem;
  text-align: center;
}

.rp-equipment-preview .rp-equipment-current {
  border: 0;
  background: transparent;
}

.rp-equipment-select {
  width: 100%;
}

.roleplay-editor-main .rp-equipment-options {
  max-height: 430px;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
}

.roleplay-editor-main .rp-lazy-equipment-options {
  grid-template-columns: repeat(auto-fill, 74px);
  justify-content: start;
  align-content: start;
  grid-auto-rows: 74px;
}

.rp-lazy-equipment-options .rp-option {
  width: 74px;
  height: 74px;
  min-width: 74px;
  min-height: 74px;
  aspect-ratio: auto;
}

.rp-lazy-equipment-options .rp-option img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.rp-none-option {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--muted);
}

.rp-model-options {
  max-height: 126px;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  margin-bottom: 10px;
}

.roleplay-editor-main .rp-model-options {
  max-height: 220px;
}

.rp-option {
  position: relative;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--main-soft);
  cursor: pointer;
  overflow: hidden;
}

.rp-option:hover,
.rp-option.selected,
.rp-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.rp-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rp-option img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.context-menu {
  position: fixed;
  z-index: 100;
  min-width: 190px;
  max-width: 260px;
  padding: 6px;
  border: 1px solid #353942;
  border-radius: 8px;
  background: #111317;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.context-menu button {
  width: 100%;
  min-height: 32px;
  border-radius: 6px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 0.84rem;
  font-weight: 700;
}

.context-menu button:hover {
  background: var(--accent);
  color: var(--white);
}

.context-header {
  padding: 7px 10px 5px;
  color: var(--quiet);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

.context-menu button.danger-item {
  color: #ffb8c0;
}

.context-menu button.danger-item:hover {
  background: var(--danger);
  color: var(--white);
}

.context-separator {
  height: 1px;
  margin: 5px 4px;
  background: var(--line);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 30% 20%, rgba(240, 93, 168, 0.16), transparent 30%),
    radial-gradient(circle at 78% 72%, rgba(240, 93, 168, 0.08), transparent 34%),
    var(--bg);
}

.login-card {
  width: min(380px, 100%);
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--main);
  overflow: hidden;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

.brand-panel {
  padding: 36px;
  background:
    linear-gradient(180deg, rgba(240, 93, 168, 0.08), transparent),
    var(--sidebar);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}

.brand-panel h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 6vw, 3.8rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.brand-panel p {
  color: var(--muted);
  max-width: 34ch;
  line-height: 1.5;
}

.brand-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-badges span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--accent-soft);
  color: #ffd2e7;
  font-size: 0.78rem;
  font-weight: 800;
}

.error {
  margin-bottom: 14px;
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(218, 55, 60, 0.14);
  color: #ffb8c0;
  font-size: 0.86rem;
  line-height: 1.35;
}

.documents-rail-button {
  font-size: 1.15rem;
}

.documents-sidebar {
  display: grid;
  align-content: start;
  gap: 4px;
}

.document-create-wide {
  width: calc(100% - 16px);
  margin: 0 8px 8px;
}

.document-list-item {
  align-items: flex-start;
}

.document-list-item span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.document-list-item strong {
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-list-item small {
  color: var(--quiet);
  font-size: 0.72rem;
}

.document-icon {
  width: 20px;
  color: var(--accent);
  text-align: center;
}

.document-workspace {
  padding: 22px;
  overflow: auto;
  background:
    radial-gradient(circle at 20% 0%, rgba(240, 93, 168, 0.08), transparent 26%),
    #101114;
}

.document-empty {
  max-width: 520px;
  margin: 10vh auto 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
  text-align: center;
}

.document-empty h3 {
  margin: 0 0 8px;
}

.document-empty p {
  margin: 0 0 18px;
  color: var(--muted);
}

.document-editor {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(520px, 1fr);
  gap: 12px;
}

.document-toolbar,
.document-page-header,
.document-share-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.document-title-block {
  min-width: 0;
  display: grid;
  gap: 4px;
  flex: 1;
}

.document-title-block span {
  color: var(--quiet);
  font-size: 0.78rem;
}

.document-title-input,
.document-page-title-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
}

.document-title-input {
  padding: 6px 0;
  font-size: 1.55rem;
}

.document-page-title-input {
  padding: 9px 12px;
  border-color: var(--line);
  background: var(--panel-soft);
  font-size: 1rem;
}

.document-title-input:focus,
.document-page-title-input:focus,
.document-visual-editor:focus {
  border-color: var(--accent);
  outline: 0;
}

.document-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.document-share-box {
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  flex-wrap: wrap;
}

.document-share-box label {
  color: var(--quiet);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.document-share-box select {
  min-width: 180px;
  margin-top: 5px;
  display: block;
}

.document-user-share {
  width: 100%;
  max-height: 190px;
  padding-top: 6px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px;
  overflow: auto;
}

.document-user-pill {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink) !important;
  font-size: 0.82rem !important;
  text-transform: none !important;
}

.document-user-pill > span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-user-pill select {
  min-width: 96px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--main);
  color: var(--ink);
}

.document-user-pill .avatar {
  width: 24px;
  height: 24px;
  font-size: 0.65rem;
}

.document-pages {
  display: flex;
  gap: 6px;
  overflow: auto;
}

.document-page-tab,
.document-page-add {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  white-space: nowrap;
}

.document-page-tab:hover,
.document-page-add:hover,
.document-page-tab.active {
  background: var(--accent-soft);
  color: var(--white);
}

.document-page-add {
  min-width: 34px;
  padding: 0;
  color: var(--accent);
}

.document-format-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(20, 22, 26, 0.96);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
}

.document-format-toolbar button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--main-soft);
  color: var(--muted);
  font-weight: 800;
}

.document-format-toolbar button:hover {
  background: var(--accent-soft);
  color: var(--white);
}

.document-body-grid {
  min-height: 0;
  max-width: 920px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.document-body-grid.read-mode {
  grid-template-columns: minmax(0, 1fr);
}

.document-paper {
  min-height: 620px;
  padding: 52px 58px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  background: linear-gradient(180deg, #20232a, #191b21);
  color: var(--ink);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  overflow: auto;
}

.document-visual-editor,
.document-reader {
  font: 1rem/1.65 Georgia, "Times New Roman", serif;
}

.document-visual-editor {
  cursor: text;
}

.document-visual-editor:empty::before {
  content: "Start writing...";
  color: var(--quiet);
}

.document-visual-editor h1,
.document-visual-editor h2,
.document-visual-editor h3,
.document-reader h1,
.document-reader h2,
.document-reader h3 {
  margin: 0.2em 0 0.45em;
  color: var(--ink);
}

.document-visual-editor p,
.document-visual-editor li,
.document-reader p,
.document-reader li {
  color: #dfe3ea;
}

.document-visual-editor p,
.document-reader p {
  margin: 0 0 0.8em;
}

.document-visual-editor ul,
.document-reader ul {
  margin: 0 0 0.8em 1.2em;
}

.document-visual-editor blockquote,
.document-reader blockquote {
  margin: 0 0 0.8em;
  padding: 0.2em 0 0.2em 0.9em;
  border-left: 4px solid rgba(240, 93, 168, 0.55);
  color: var(--muted);
}

.document-justify {
  text-align: justify;
  text-justify: inter-word;
}

.document-visual-editor code,
.document-visual-editor pre,
.document-reader code,
.document-reader pre {
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
}

.document-visual-editor code,
.document-reader code {
  padding: 0.1em 0.35em;
}

.document-visual-editor pre,
.document-reader pre {
  padding: 12px;
  overflow: auto;
}

.hidden {
  display: none !important;
}

.chat-preview {
  display: grid;
  gap: 10px;
  max-width: 380px;
}

.preview-line {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.preview-bubble {
  min-height: 28px;
  border-radius: 6px;
  background: var(--main-soft);
}

.login-panel {
  padding: 34px 28px 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--panel);
}

.login-panel h2 {
  margin: 0 0 22px;
  color: var(--ink);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.login-panel > p {
  margin: 0 0 22px;
  color: var(--muted);
}

.helper {
  margin-top: 14px;
  color: var(--quiet);
  font-size: 0.8rem;
  line-height: 1.45;
}

@media (max-width: 1040px) {
  .shell {
    grid-template-columns: 72px 280px minmax(0, 1fr);
  }

  .shell.no-side-panel {
    grid-template-columns: 72px 280px minmax(0, 1fr);
  }

  .side-panel {
    display: none;
  }

  .side-panel.panel-open {
    display: grid;
    grid-template-rows: 48px auto;
    grid-column: 3;
    border-left: 1px solid var(--line);
  }

  .inline-create,
  .manage-fields.four,
  .manage-row,
  .manage-row.area-row,
  .manage-row.category-row {
    grid-template-columns: 1fr;
  }

  .friends-dashboard {
    grid-template-columns: 1fr;
  }

  .permission-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .server-rail {
    display: none;
  }

  .sidebar {
    min-height: auto;
  }

  .channel-section {
    max-height: 220px;
    overflow: auto;
    padding: 8px;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, 1fr);
  }

  .channel-button,
  .panel-button {
    width: 100%;
  }

  .account-bar {
    grid-template-columns: 1fr;
  }

  .chat {
    min-height: calc(100vh - 156px);
  }

  .composer form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .composer .primary[type="submit"] {
    grid-column: 1 / -1;
  }

  .side-panel.panel-open {
    grid-column: 1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .modal-backdrop {
    padding: 12px;
  }

  .admin-modal {
    max-height: calc(100vh - 24px);
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 6px;
    overflow: auto;
  }

  .settings-nav button {
    width: auto;
    white-space: nowrap;
  }

  .login-panel {
    padding: 28px;
  }

  .settings-content {
    padding: 16px;
  }

  .account-tools-grid {
    grid-template-columns: 1fr;
  }

  .roleplay-editor-body {
    grid-template-columns: 1fr;
  }

  .roleplay-editor-summary {
    position: static;
  }

  .roleplay-editor-footer {
    bottom: -18px;
  }

  .document-body-grid {
    grid-template-columns: 1fr;
  }

  .document-toolbar,
  .document-page-header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .chat-header,
  .messages,
  .composer {
    padding-left: 12px;
    padding-right: 12px;
  }

  .composer form {
    grid-template-columns: 1fr;
  }

  .pill {
    display: none;
  }
}

.power-settings-section {
  display: grid;
  gap: 18px;
}

.power-page-heading,
.power-list-heading {
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.power-page-heading {
  align-items: start;
}

.power-page-heading h3,
.power-list-heading h4 {
  margin: 0;
}

.power-page-heading p,
.power-list-heading p {
  color: var(--muted);
  margin: 5px 0 0;
}

.power-page-heading > span {
  background: rgba(240, 93, 168, 0.14);
  border: 1px solid rgba(240, 93, 168, 0.24);
  border-radius: 999px;
  color: var(--ink);
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 10px;
}

.power-editor-card {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.power-editor-card > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  list-style: none;
  padding: 14px 16px;
}

.power-editor-card > summary::-webkit-details-marker {
  display: none;
}

.power-editor-card > summary::after {
  color: var(--muted);
  content: "Open";
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.power-editor-card[open] > summary {
  border-bottom: 1px solid var(--line);
}

.power-editor-card[open] > summary::after {
  content: "Close";
}

.power-editor-card > summary span {
  color: var(--ink);
  font-weight: 900;
}

.power-editor-card > summary small {
  color: var(--muted);
}

.power-create,
.power-existing-body {
  display: grid;
  gap: 18px;
  padding: 16px;
}

.power-name-field {
  display: grid;
  gap: 7px;
}

.power-name-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.power-list {
  display: grid;
  gap: 10px;
}

.power-card-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin: 4px -16px -16px;
  padding: 14px 16px;
}

.power-editor-mode-tabs {
  align-items: center;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: inline-flex;
  justify-self: start;
  overflow: hidden;
  padding: 3px;
}

.power-editor-mode-tabs button {
  background: transparent;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 8px 14px;
}

.power-editor-mode-tabs button.active {
  background: linear-gradient(135deg, rgba(240, 93, 168, 0.95), rgba(255, 137, 199, 0.82));
  color: #fff;
  box-shadow: 0 10px 24px rgba(240, 93, 168, 0.18);
}

.power-raw-code-editor {
  display: grid;
  gap: 8px;
}

.power-code-textarea {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  font: 13px/1.55 "Cascadia Code", "Consolas", monospace;
  min-height: 360px;
  outline: none;
  padding: 16px;
  resize: vertical;
  tab-size: 2;
  width: 100%;
}

.power-code-textarea:focus {
  border-color: rgba(240, 93, 168, 0.75);
  box-shadow: 0 0 0 3px rgba(240, 93, 168, 0.16);
}

.power-block-builder,
.power-trigger-list,
.power-action-list {
  display: grid;
  gap: 12px;
}

.power-code-preview code {
  color: var(--text);
}

.power-trigger-block {
  background: linear-gradient(180deg, rgba(26, 30, 40, 0.88), rgba(18, 20, 27, 0.86));
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 16px;
  padding: 18px;
}

.power-trigger-header,
.power-builder-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.power-trigger-header h4 {
  color: var(--ink);
  font-size: 20px;
  margin: 2px 0 0;
}

.power-card-kicker,
.power-actions-title,
.power-trigger-grid label > span,
.power-action-row label > span,
.power-action-value > span,
.power-notification-color > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.power-trigger-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 0.9fr) minmax(240px, 1.2fr) minmax(120px, 0.55fr);
}

.power-trigger-grid label,
.power-action-row label {
  display: grid;
  gap: 5px;
}

.power-action-list {
  border-left: 3px solid rgba(240, 93, 168, 0.45);
  display: grid;
  gap: 12px;
  padding-left: 16px;
}

.power-action-row {
  align-items: end;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: 28px minmax(150px, 0.85fr) minmax(220px, 1fr) minmax(120px, 0.5fr) auto;
  padding: 12px;
  position: relative;
}

.power-action-value {
  grid-column: 2 / -2;
  min-width: 0;
}

.power-action-row.is-wait {
  grid-template-columns: 28px minmax(150px, 0.7fr) minmax(180px, 1fr) auto;
}

.power-action-row.is-no-value {
  grid-template-columns: 28px minmax(150px, 0.8fr) minmax(240px, 1fr) minmax(120px, 0.5fr) auto;
}

.power-action-row.is-wait .power-action-value {
  grid-column: auto;
}

.power-action-row.dragging {
  opacity: 0.45;
}

.power-action-row.drop-before::before,
.power-action-row.drop-after::after {
  background: var(--pink);
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(240, 93, 168, 0.45);
  content: "";
  height: 3px;
  left: 12px;
  pointer-events: none;
  position: absolute;
  right: 12px;
}

.power-action-row.drop-before::before {
  top: -8px;
}

.power-action-row.drop-after::after {
  bottom: -8px;
}

.power-drag-handle {
  align-self: stretch;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: var(--muted);
  cursor: grab;
  font-size: 16px;
  font-weight: 900;
  min-height: 40px;
  padding: 0;
}

.power-drag-handle:active {
  cursor: grabbing;
}

.power-drag-handle:hover {
  background: rgba(240, 93, 168, 0.16);
  color: #fff;
}

.power-field {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  outline: none;
  padding: 8px 11px;
  width: 100%;
}

.power-field:focus {
  border-color: rgba(240, 93, 168, 0.75);
  box-shadow: 0 0 0 3px rgba(240, 93, 168, 0.16);
}

.power-field option {
  color: #11131a;
}

.power-notification-builder {
  display: grid;
  gap: 10px;
}

.power-notification-builder label,
.power-notification-color {
  display: grid;
  gap: 5px;
}

.power-notification-text textarea {
  min-height: 84px;
  resize: vertical;
}

.power-color-fields {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(54px, 1fr));
}

.power-notification-builder.is-hide .power-notification-text,
.power-notification-builder.is-hide .power-notification-color {
  display: none;
}

.power-add-action {
  justify-self: start;
}

.power-block-x {
  align-items: center;
  align-self: center;
  background: rgba(255, 255, 255, 0.08);
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 17px;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.power-block-x:hover {
  background: rgba(240, 93, 168, 0.2);
  color: #fff;
}

.power-code-preview {
  color: var(--muted);
  font-size: 12px;
  min-width: 260px;
}

.power-code-preview summary {
  cursor: pointer;
  font-weight: 800;
}

.power-code-preview pre {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  margin: 8px 0 0;
  max-height: 190px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .power-trigger-grid,
  .power-action-row {
    grid-template-columns: 1fr;
  }

  .power-action-value,
  .power-action-row.is-wait .power-action-value {
    grid-column: auto;
  }

  .power-builder-actions,
  .power-trigger-header {
    align-items: stretch;
    flex-direction: column;
  }
}
