/* =========================================================
   RPG.ai — desktop chat interface
   Base theme: white. Alternate themes: dark, blue.
   ========================================================= */

:root {
  color-scheme: light;

  --font-ui: "Segoe UI Variable Text", "Segoe UI", "Inter", -apple-system,
    BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", "Inter",
    -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;

  --bg: #ffffff;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --panel: #f6f6f9;
  --panel-2: #eeeef4;

  --text: #181924;
  --text-soft: #4a4c5c;
  --muted: #848695;

  --border: #e9e9f0;
  --border-strong: #dedee8;

  --accent: #5b4bff;
  --accent-hover: #4a3af0;
  --accent-deep: #4d72ff;
  --accent-soft: #f0eeff;
  --accent-text: #5040e8;
  --on-accent: #ffffff;

  --bubble-ai: #f4f4f9;
  --bubble-ai-text: #292a37;
  --bubble-user: #5b4bff;
  --bubble-user-text: #ffffff;
  --bubble-user-shadow: rgba(91, 75, 255, 0.17);

  --composer-bg: #ffffff;
  --composer-shadow: 0 12px 30px rgba(33, 32, 74, 0.06),
    0 2px 6px rgba(33, 32, 74, 0.04);
  --card-shadow: 0 1px 2px rgba(25, 25, 50, 0.03);
  --modal-shadow: 0 30px 80px rgba(20, 20, 45, 0.18);

  --header-bg: rgba(255, 255, 255, 0.88);
  --glow-1: rgba(100, 88, 255, 0.055);
  --glow-2: rgba(48, 197, 255, 0.045);

  --status: #22c55e;
  --status-soft: rgba(34, 197, 94, 0.14);
  --success: #16a34a;
  --success-text: #15803d;
  --success-soft: rgba(22, 163, 74, 0.11);

  --gear: #0f8f83;
  --gear-soft: rgba(15, 143, 131, 0.1);
  --pending: #c27609;
  --pending-soft: rgba(194, 118, 9, 0.11);

  --danger: #e5484d;
  --danger-soft: #fff0f1;

  --toast-bg: #191a24;
  --toast-text: #ffffff;

  --scrollbar: #d8d9e4;
  --scrollbar-hover: #c2c4d3;

  --hero-start: #f8f6ff;
  --hero-end: #eef8ff;
  --hero-border: #e9e5ff;

  --knob: #ffffff;

}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #101218;
  --sidebar: #0b0d12;
  --surface: #161922;
  --panel: #1a1d27;
  --panel-2: #222632;

  --text: #f4f5f9;
  --text-soft: #c4c7d2;
  --muted: #8b90a0;

  --border: #242833;
  --border-strong: #303542;

  --accent: #9d90ff;
  --accent-hover: #afa4ff;
  --accent-deep: #7cd4ff;
  --accent-soft: rgba(157, 144, 255, 0.13);
  --accent-text: #c7c0ff;
  --on-accent: #121019;

  --bubble-ai: #1a1e28;
  --bubble-ai-text: #eef0f6;
  --bubble-user: #9d90ff;
  --bubble-user-text: #14111e;
  --bubble-user-shadow: rgba(0, 0, 0, 0.22);

  --composer-bg: #171a23;
  --composer-shadow: 0 18px 45px rgba(0, 0, 0, 0.24),
    0 2px 6px rgba(0, 0, 0, 0.16);
  --card-shadow: 0 1px 0 rgba(255, 255, 255, 0.025);
  --modal-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);

  --header-bg: rgba(16, 18, 24, 0.86);
  --glow-1: rgba(130, 112, 255, 0.085);
  --glow-2: rgba(64, 170, 255, 0.05);

  --status: #4ade80;
  --status-soft: rgba(74, 222, 128, 0.12);
  --success: #4ade80;
  --success-text: #86efac;
  --success-soft: rgba(74, 222, 128, 0.12);

  --gear: #5eead4;
  --gear-soft: rgba(94, 234, 212, 0.1);
  --pending: #fbbf24;
  --pending-soft: rgba(251, 191, 36, 0.1);

  --danger: #ff7379;
  --danger-soft: rgba(255, 115, 121, 0.12);

  --toast-bg: #f1f2f7;
  --toast-text: #14151d;

  --scrollbar: #333846;
  --scrollbar-hover: #444b5d;

  --hero-start: #19162a;
  --hero-end: #121c2a;
  --hero-border: #2b2745;

  --knob: #ffffff;

}

html[data-theme="blue"] {
  color-scheme: dark;

  --bg: #0a2e69;
  --sidebar: #07214c;
  --surface: #0f3778;
  --panel: #103e86;
  --panel-2: #15488f;

  --text: #f5f9ff;
  --text-soft: #d2e2f8;
  --muted: #9cb8dd;

  --border: rgba(180, 210, 255, 0.15);
  --border-strong: rgba(180, 210, 255, 0.25);

  --accent: #72c4ff;
  --accent-hover: #8fd1ff;
  --accent-deep: #a3f0ff;
  --accent-soft: rgba(114, 196, 255, 0.14);
  --accent-text: #a9d9ff;
  --on-accent: #062b5c;

  --bubble-ai: #124182;
  --bubble-ai-text: #f3f8ff;
  --bubble-user: #72c4ff;
  --bubble-user-text: #062b5c;
  --bubble-user-shadow: rgba(2, 15, 37, 0.24);

  --composer-bg: #0e3675;
  --composer-shadow: 0 18px 40px rgba(2, 15, 37, 0.28),
    0 2px 6px rgba(2, 15, 37, 0.18);
  --card-shadow: 0 1px 0 rgba(255, 255, 255, 0.035);
  --modal-shadow: 0 30px 90px rgba(1, 12, 30, 0.55);

  --header-bg: rgba(10, 46, 105, 0.86);
  --glow-1: rgba(95, 198, 255, 0.1);
  --glow-2: rgba(140, 110, 255, 0.08);

  --status: #65e6b4;
  --status-soft: rgba(101, 230, 180, 0.13);
  --success: #65e6b4;
  --success-text: #b6f5df;
  --success-soft: rgba(101, 230, 180, 0.13);

  --gear: #8df0e2;
  --gear-soft: rgba(141, 240, 226, 0.1);
  --pending: #ffd166;
  --pending-soft: rgba(255, 209, 102, 0.1);

  --danger: #ff8c9b;
  --danger-soft: rgba(255, 140, 155, 0.13);

  --toast-bg: #f4f9ff;
  --toast-text: #082a59;

  --scrollbar: rgba(178, 212, 255, 0.28);
  --scrollbar-hover: rgba(178, 212, 255, 0.46);

  --hero-start: #0f3b7e;
  --hero-end: #082655;
  --hero-border: rgba(160, 210, 255, 0.22);


  --knob: #ffffff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

html {
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
label {
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------
   App frame: sidebar is exactly 15% of the window width.
   --------------------------------------------------------- */

.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.sidebar {
  position: relative;
  z-index: 4;
  display: flex;
  flex: 0 0 15%;
  flex-direction: column;
  width: 15%;
  min-width: 0;
  height: 100%;
  padding: 25px clamp(11px, 1.5vw, 22px) 19px;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: 24px;
}

.logo-mark {
  position: relative;
  display: grid;
  flex: none;
  width: 40px;
  height: 40px;
  place-items: center;
}

.logo-mark-image {
  display: block;
  width: 100%;
  height: 100%;
  content: url("logo-light.svg");
  user-select: none;
  -webkit-user-drag: none;
}

html[data-theme="dark"] .logo-mark-image {
  content: url("logo-dark.svg");
}

html[data-theme="blue"] .logo-mark-image {
  content: url("logo-blue.svg");
}

.logo-mark--small {
  width: 38px;
  height: 38px;
}

.logo-mark--large {
  width: 72px;
  height: 72px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.brand-name {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 710;
  line-height: 1.2;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-name span {
  color: var(--accent);
}

.brand-tagline {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.045em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: var(--on-accent);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.002em;
  white-space: nowrap;
  cursor: pointer;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 7px 18px rgba(91, 75, 255, 0.2);
  transition:
    background-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

html[data-theme="dark"] .new-chat-btn,
html[data-theme="blue"] .new-chat-btn {
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.16);
}

.new-chat-btn .icon {
  flex: none;
  width: 17px;
  height: 17px;
  margin-right: 8px;
  stroke-width: 2;
}

.new-chat-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.new-chat-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 9px 24px rgba(91, 75, 255, 0.28);
  transform: translateY(-1px);
}

.new-chat-btn:active {
  transform: translateY(0);
}

.navigation {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.primary-nav {
  margin-top: 25px;
}

.utility-nav {
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
}

.utility-nav .nav-item {
  color: var(--muted);
}

.utility-nav .nav-item:hover {
  color: var(--text);
}

.utility-nav .nav-item.is-active {
  color: var(--accent-text);
}

.nav-label {
  margin: 0 8px 8px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 42px;
  padding: 0 10px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 540;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 11px;
  transition:
    color 150ms ease,
    background-color 150ms ease;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  margin-right: 9px;
  opacity: 0.84;
}

.nav-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item--wrap {
  min-height: 42px;
  height: auto;
  padding-top: 5px;
  padding-bottom: 5px;
}

.nav-item--wrap .nav-text {
  overflow: visible;
  line-height: 1.18;
  text-overflow: clip;
  white-space: normal;
}

.nav-active-mark {
  flex: none;
  width: 5px;
  height: 5px;
  margin-left: auto;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.nav-item:hover {
  color: var(--text);
  background: var(--panel);
}

.nav-item.is-active {
  color: var(--accent-text);
  font-weight: 650;
  background: var(--accent-soft);
}

.nav-item.is-active .icon {
  opacity: 1;
}

.nav-item.is-active .nav-active-mark {
  opacity: 1;
  transform: scale(1);
}

.sidebar-spacer {
  flex: 1;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin-top: 14px;
  padding: 10px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.status-dot {
  position: relative;
  flex: none;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.status-dot--small {
  width: 6px;
  height: 6px;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.mode-card.is-connected .status-dot,
.chat-status.is-connected .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.mode-card.is-connected {
  border-color: var(--success-soft);
}

.mode-card.is-connected .mode-copy strong {
  color: var(--text);
}

.mode-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.mode-copy strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-copy span {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.055em;
}

.meta-separator {
  width: 2px;
  height: 2px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.7;
}

.main-area {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

/* ---------------------------------------------------------
   Views
   --------------------------------------------------------- */

.view {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.view.is-active {
  display: flex;
  animation: view-in 260ms ease both;
}

.chat-view {
  position: relative;
  background: var(--bg);
}

.chat-view::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(720px 330px at 90% -10%, var(--glow-1), transparent 70%),
    radial-gradient(620px 300px at 10% 112%, var(--glow-2), transparent 72%);
}

/* ---------------------------------------------------------
   Chat header
   --------------------------------------------------------- */

.chat-header {
  position: relative;
  z-index: 3;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(20px, 3vw, 36px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.chat-identity {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.chat-heading {
  min-width: 0;
}

.chat-header h1 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 680;
  line-height: 1.3;
  letter-spacing: -0.012em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.3;
}

.chat-status #chat-status-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-status.is-connected #chat-status-text {
  color: var(--text-soft);
}

.chat-status.is-typing #chat-status-text {
  color: var(--accent-text);
}

.chat-status.is-typing .status-dot {
  animation: status-pulse 1.1s ease-in-out infinite;
}

.header-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  place-items: center;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease;
}

.icon-button .icon {
  width: 18px;
  height: 18px;
}

.icon-button:hover {
  color: var(--text-soft);
  background: var(--panel);
  border-color: var(--border);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 620;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.button .icon {
  width: 16px;
  height: 16px;
}

.button--ghost {
  background: transparent;
  border-color: var(--border);
}

.button--ghost:hover {
  color: var(--text);
  background: var(--panel);
  border-color: var(--border-strong);
}

.button--primary {
  color: var(--on-accent);
  background: var(--accent);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(91, 75, 255, 0.17);
}

.button--primary:hover {
  background: var(--accent-hover);
}

.button--danger-ghost {
  color: var(--danger);
  background: transparent;
  border-color: transparent;
}

.button--danger-ghost:hover {
  background: var(--danger-soft);
}

.button:disabled {
  cursor: default;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.button--compact {
  height: 34px;
  padding: 0 11px;
  font-size: 11px;
}

.button--danger {
  color: #ffffff;
  background: var(--danger);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(229, 72, 77, 0.2);
}

.button--danger:hover {
  filter: brightness(0.95);
}

.button--danger .icon {
  width: 15px;
  height: 15px;
}

/* ---------------------------------------------------------
   Conversation
   --------------------------------------------------------- */

.chat-scroll {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.conversation {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 820px;
  min-height: 100%;
  padding: 32px clamp(20px, 3vw, 34px) 18px;
  margin: 0 auto;
}

.message-row {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  min-width: 0;
}

.message-row.is-new {
  animation: message-in 300ms cubic-bezier(0.22, 0.7, 0.32, 1) both;
}

.message-row.user {
  align-items: flex-end;
  justify-content: flex-end;
  padding-left: 12%;
}

.message-avatar {
  position: relative;
  display: grid;
  flex: none;
  width: 32px;
  height: 32px;
  margin-top: 1px;
  place-items: center;
}

.message-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: min(78%, 650px);
  min-width: 0;
}

.message-row.user .message-body {
  align-items: flex-end;
  max-width: min(72%, 600px);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
}

.message-author {
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 650;
}

.message-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.message-row.user .message-meta {
  justify-content: flex-end;
}

.bubble {
  max-width: 100%;
  padding: 11px 15px;
  color: var(--bubble-ai-text);
  font-size: 13.5px;
  line-height: 1.62;
  letter-spacing: 0.001em;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  background: var(--bubble-ai);
  border-radius: 5px 16px 16px 16px;
  box-shadow: 0 1px 1px rgba(18, 19, 31, 0.02);
}

html[data-theme="dark"] .bubble,
html[data-theme="blue"] .bubble {
  box-shadow: none;
}

.message-row.user .bubble {
  color: var(--bubble-user-text);
  background: var(--bubble-user);
  border-radius: 16px 5px 16px 16px;
  box-shadow: 0 9px 22px var(--bubble-user-shadow);
}

.message-row.is-error .message-author {
  color: var(--danger);
}

.message-row.is-error .bubble {
  color: var(--text);
  background: var(--danger-soft);
  border: 1px solid var(--danger-soft);
  border-radius: 5px 16px 16px 16px;
  box-shadow: none;
}

.message-row.is-error .message-avatar .logo-mark-image {
  opacity: 0.55;
}

.suggestions-block {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 690px;
  padding-left: 43px;
  margin-top: -7px;
  animation: fade-up 340ms 80ms ease both;
}

html[data-tips="off"] .suggestions-block {
  display: none;
}

.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 33px;
  padding: 0 12px;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 550;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.suggestion-chip .icon {
  width: 13px;
  height: 13px;
  color: var(--accent-text);
}

.suggestion-chip:hover {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: transparent;
  transform: translateY(-1px);
}

.typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  height: 38px;
  padding: 0 14px;
  background: var(--bubble-ai);
  border-radius: 5px 16px 16px 16px;
}

.typing-dot {
  width: 5px;
  height: 5px;
  background: var(--muted);
  border-radius: 50%;
  animation: typing-bounce 1.15s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 130ms;
}

.typing-dot:nth-child(3) {
  animation-delay: 260ms;
}

/* ---------------------------------------------------------
   Composer
   --------------------------------------------------------- */

.composer-area {
  position: relative;
  z-index: 2;
  flex: none;
  padding: 8px clamp(20px, 3vw, 36px) 19px;
  background: linear-gradient(
    to top,
    var(--bg) 0%,
    var(--bg) 78%,
    transparent 100%
  );
}

.composer-inner {
  width: 100%;
  max-width: 820px;
  padding: 0 clamp(0px, 0.1vw, 2px);
  margin: 0 auto;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 8px 8px 8px 16px;
  background: var(--composer-bg);
  border: 1.5px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--composer-shadow);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow:
    0 0 0 4px var(--accent-soft),
    var(--composer-shadow);
}

.composer textarea {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 25px;
  max-height: 148px;
  padding: 7px 0 6px;
  overflow-y: auto;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.55;
  resize: none;
  background: transparent;
  border: 0;
  outline: 0;
  scrollbar-width: thin;
}

.composer textarea::placeholder {
  color: var(--muted);
  opacity: 0.86;
}

.send-button {
  display: grid;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--on-accent);
  cursor: pointer;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 5px 14px rgba(91, 75, 255, 0.2);
  place-items: center;
  transition:
    background-color 150ms ease,
    opacity 150ms ease,
    transform 150ms ease;
}

.send-button .icon {
  width: 19px;
  height: 19px;
  stroke-width: 2;
}

.send-button:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.send-button:active:not(:disabled) {
  transform: translateY(0);
}

.send-button:disabled {
  cursor: default;
  box-shadow: none;
  opacity: 0.34;
}

.composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 4px 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.4;
}

.composer-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hint-separator {
  margin: 0 2px;
  opacity: 0.6;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 17px;
  padding: 0 4px;
  color: var(--text-soft);
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
}

.char-count {
  flex: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 150ms ease;
}

.char-count.is-visible {
  opacity: 1;
}

/* ---------------------------------------------------------
   Settings and About page headers
   --------------------------------------------------------- */

.settings-view,
.about-view {
  background: var(--bg);
}

.page-header {
  position: relative;
  z-index: 1;
  display: flex;
  flex: none;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 30px clamp(24px, 4vw, 52px) 23px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.eyebrow,
.card-eyebrow {
  margin: 0;
  color: var(--accent-text);
  font-size: 9.5px;
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.page-header h1 {
  margin: 6px 0 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(24px, 2.8vw, 30px);
  font-weight: 690;
  line-height: 1.12;
  letter-spacing: -0.032em;
}

.page-subtitle {
  max-width: 520px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.page-header-icon {
  display: grid;
  flex: none;
  width: 42px;
  height: 42px;
  margin-top: 3px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 13px;
  place-items: center;
}

.page-header-icon .icon {
  width: 19px;
  height: 19px;
}

.page-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.page-header-tools {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 3px;
}

.page-header-tools .button {
  height: 34px;
  padding: 0 11px;
  font-size: 10.5px;
}

.character-container,
.inventory-container,
.codex-container,
.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 980px;
  padding: 26px clamp(24px, 4vw, 52px) 38px;
  margin: 0 auto;
}

/* ---------------------------------------------------------
   Character stats
   --------------------------------------------------------- */

.character-hero {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
}

.level-medallion {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  color: var(--on-accent);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.26), transparent 45%),
    linear-gradient(135deg, var(--accent), var(--accent-deep));
  border-radius: 22px;
  box-shadow: 0 12px 26px rgba(91, 75, 255, 0.22);
}

.level-medallion span {
  font-size: 8.5px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.8;
}

.level-medallion strong {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.06em;
}

.character-progress {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 8px;
}

.xp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.xp-head strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.xp-head span {
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.xp-bar {
  position: relative;
  width: 100%;
  height: 8px;
  overflow: hidden;
  background: var(--panel-2);
  border-radius: 999px;
}

.xp-bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  border-radius: inherit;
  transition: width 260ms ease;
}

.xp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  margin-top: 2px;
}

.xp-award-label {
  margin-right: 3px;
  color: var(--muted);
  font-size: 9.5px;
}

.xp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 23px;
  padding: 0 8px;
  color: var(--accent-text);
  font-size: 9.5px;
  font-weight: 650;
  cursor: pointer;
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 6px;
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.xp-button:hover {
  color: var(--on-accent);
  background: var(--accent);
}

.xp-button:disabled {
  cursor: default;
  opacity: 0.5;
}

.free-points {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  min-height: 76px;
  padding: 10px 13px;
  text-align: center;
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 14px;
}

.free-points span {
  color: var(--accent-text);
  font-size: 8.5px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}

.free-points strong {
  margin-top: 3px;
  color: var(--accent-text);
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 720;
  line-height: 1;
}

.stats-section-head {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 3px 1px 0;
}

.stats-section-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 670;
  letter-spacing: -0.01em;
}

.stats-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.stat-legend {
  display: flex;
  flex: none;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 9.5px;
}

.legend-item {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.legend-dot {
  width: 6px;
  height: 6px;
  background: var(--text-soft);
  border-radius: 50%;
}

.legend-dot--gear {
  background: var(--gear);
}

.legend-dot--pending {
  background: var(--pending);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 13px 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--card-shadow);
}

.stat-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  content: "";
  background: transparent;
}

.stat-card.has-gear::before {
  background: var(--gear);
}

.stat-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stat-abbr {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 20px;
  color: var(--muted);
  font-size: 7.5px;
  font-weight: 750;
  letter-spacing: 0.06em;
  background: var(--panel);
  border-radius: 5px;
}

.stat-name {
  flex: 1;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-plus {
  display: grid;
  flex: none;
  width: 25px;
  height: 25px;
  padding: 0;
  color: var(--accent-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 7px;
  transition:
    background-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
  place-items: center;
}

.stat-plus:hover:not(:disabled) {
  color: var(--on-accent);
  background: var(--accent);
  transform: translateY(-1px);
}

.stat-plus:disabled {
  color: var(--muted);
  cursor: default;
  background: var(--panel);
  opacity: 0.45;
}

.stat-card-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.stat-total {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.stat-card.has-gear .stat-total {
  color: var(--gear);
}

.stat-breakdown {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.stat-gear {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 5px;
  color: var(--gear);
  font-size: 9px;
  font-weight: 650;
  background: var(--gear-soft);
  border-radius: 4px;
}

.stat-pending {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 5px;
  color: var(--pending);
  font-size: 9px;
  font-weight: 650;
  background: var(--pending-soft);
  border-radius: 4px;
}

.stat-confirm {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--pending-soft);
  border: 1px solid var(--pending-soft);
  border-radius: 13px;
}

.stat-confirm-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text-soft);
  font-size: 10.5px;
  line-height: 1.4;
}

.stat-confirm-copy strong {
  color: var(--pending);
  font-size: 11px;
  font-weight: 650;
}

.stat-confirm-actions {
  display: flex;
  flex: none;
  gap: 7px;
}

.stat-confirm-actions .button {
  height: 30px;
  padding: 0 10px;
  font-size: 10px;
}

.gear-bonus-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  padding: 11px 13px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.4;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.gear-bonus-summary strong {
  color: var(--text-soft);
  font-size: 9.5px;
  font-weight: 650;
}

.gear-summary-chip {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  color: var(--gear);
  font-size: 9px;
  font-weight: 650;
  background: var(--gear-soft);
  border-radius: 5px;
}

/* ---------------------------------------------------------
   Inventory
   --------------------------------------------------------- */

.inventory-card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
}

.inventory-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.inventory-card-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 670;
  letter-spacing: -0.01em;
}

.inventory-card-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.inventory-bonus-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
}

.equipment-layout {
  display: grid;
  grid-template-columns: 1.12fr 1fr 1fr;
  gap: 11px;
}

.equipment-panel {
  min-width: 0;
  padding: 11px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 13px;
}

.equipment-panel h3 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.equipment-panel-slots {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.equipment-slot {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 71px;
  padding: 9px;
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    transform 150ms ease;
}

.equipment-slot:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.equipment-slot.is-empty {
  color: var(--muted);
  cursor: default;
  background: transparent;
  border-style: dashed;
}

.equipment-slot.is-empty:hover {
  border-color: var(--border);
  transform: none;
}

.equipment-slot.is-blocked {
  color: var(--muted);
  cursor: default;
  background: transparent;
  border-style: dashed;
}

.equipment-slot-label {
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.equipment-slot-main {
  display: flex;
  flex: 1;
  gap: 7px;
  align-items: center;
  min-width: 0;
  margin-top: 4px;
}

.slot-icon {
  display: grid;
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 8px;
  place-items: center;
}

.slot-icon .icon {
  width: 14px;
  height: 14px;
}

.equipment-slot.is-empty .slot-icon,
.equipment-slot.is-blocked .slot-icon {
  color: var(--muted);
  background: var(--panel);
}

.slot-item-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.slot-item-name {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 620;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-item-bonus {
  margin-top: 2px;
  overflow: hidden;
  color: var(--gear);
  font-size: 8.5px;
  font-weight: 550;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-item-empty {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.equipment-slot--offhand.is-blocked .slot-item-name {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  white-space: normal;
}

.rings-grid .equipment-slot {
  padding: 8px;
}

.rings-grid .slot-icon {
  width: 24px;
  height: 24px;
}

.rings-grid .slot-icon .icon {
  width: 12px;
  height: 12px;
}

.rings-grid .equipment-slot-main {
  align-items: flex-start;
}

.rings-grid .slot-item-name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 9.5px;
  line-height: 1.18;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rings-grid .slot-item-bonus {
  font-size: 8px;
}

.inventory-bag-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.bag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 8px;
}

.bag-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 91px;
  padding: 10px;
  overflow: hidden;
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: 10px;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.bag-cell:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.bag-cell.is-empty {
  color: var(--muted);
  cursor: default;
  background: transparent;
  border: 1px dashed var(--border);
}

.bag-cell.is-empty:hover {
  background: transparent;
  border-color: var(--border);
  transform: none;
}

.bag-cell-icon {
  display: grid;
  width: 28px;
  height: 28px;
  margin-bottom: 6px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 8px;
  place-items: center;
}

.bag-cell-icon .icon {
  width: 14px;
  height: 14px;
}

.bag-cell.is-empty .bag-cell-icon {
  color: var(--muted);
  background: var(--panel);
}

.bag-cell-name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 9.5px;
  font-weight: 590;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.bag-cell-bonus {
  margin-top: 3px;
  color: var(--gear);
  font-size: 8.5px;
  line-height: 1.25;
}

.bag-empty-label {
  margin-top: auto;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ---------------------------------------------------------
   Bestiary and NPC
   --------------------------------------------------------- */

.codex-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.codex-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.codex-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.codex-card-head {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.codex-card-icon {
  display: grid;
  flex: none;
  width: 36px;
  height: 36px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 10px;
  place-items: center;
}

.codex-card-icon .icon {
  width: 17px;
  height: 17px;
}

.codex-card h2 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 660;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-card-snippet {
  display: -webkit-box;
  margin: 11px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.codex-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 12px;
}

.codex-card-footer-label {
  margin-right: 2px;
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.weakness-chip {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  color: var(--danger);
  font-size: 8.5px;
  font-weight: 600;
  background: var(--danger-soft);
  border-radius: 5px;
}

.weakness-chip--empty {
  color: var(--muted);
  background: var(--panel);
}

.codex-empty {
  min-height: 280px;
}

/* ---------------------------------------------------------
   Timeline
   --------------------------------------------------------- */

.timeline-day {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.timeline-date {
  margin: 0 0 1px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.timeline-events {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-left: 17px;
}

.timeline-events::before {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 3px;
  width: 1px;
  content: "";
  background: var(--border);
}

.timeline-event {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
}

.timeline-event::before {
  position: absolute;
  top: 17px;
  left: -17px;
  width: 7px;
  height: 7px;
  content: "";
  background: var(--border-strong);
  border: 2px solid var(--bg);
  border-radius: 50%;
}

.timeline-event.is-user::before {
  background: var(--accent);
}

.timeline-event.is-assistant::before {
  background: var(--gear);
}

.timeline-event.is-system::before {
  background: var(--border-strong);
}

.timeline-time {
  padding-top: 12px;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.timeline-card {
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.timeline-card-head {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--text-soft);
  font-size: 9.5px;
  font-weight: 650;
  line-height: 1.3;
}

.timeline-role-mark {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--border-strong);
  border-radius: 50%;
}

.timeline-event.is-user .timeline-role-mark {
  background: var(--accent);
}

.timeline-event.is-assistant .timeline-role-mark {
  background: var(--gear);
}

.timeline-event.is-system .timeline-card {
  background: var(--panel);
}

.timeline-event.is-system .timeline-card p {
  font-size: 9.5px;
}

.timeline-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.timeline-recap {
  padding: 13px 15px;
  background: var(--accent-softer);
  border: 1px solid var(--border);
  border-radius: 13px;
}

.timeline-recap-label {
  display: block;
  color: var(--accent-text);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.timeline-recap p {
  max-width: 92ch;
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.55;
}

.timeline-beat-card {
  padding: 12px 14px;
}

.timeline-beat-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 9px;
  align-items: flex-start;
  justify-content: space-between;
}

.timeline-beat-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 680;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-beat-scene {
  flex: none;
  max-width: 150px;
  padding: 2px 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.timeline-beat-summary {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.timeline-beat-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.timeline-flag {
  padding: 2px 7px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
  line-height: 1.4;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.timeline-flag--success {
  color: var(--success-text);
  background: var(--success-soft);
  border-color: transparent;
}

.timeline-flag--danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}

.timeline-flag--battle {
  color: var(--accent-text);
  background: var(--accent-softer);
  border-color: transparent;
}

.timeline-flag--milestone {
  color: var(--gear);
  background: var(--gear-soft);
  border-color: transparent;
}

.timeline-empty {
  min-height: 260px;
}

/* ---------------------------------------------------------
   Empty states and dialogs for game pages
   --------------------------------------------------------- */

.empty-state {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 18px;
}

.empty-state-icon {
  display: grid;
  width: 56px;
  height: 56px;
  margin-bottom: 13px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 16px;
  place-items: center;
}

.empty-state-icon .icon {
  width: 25px;
  height: 25px;
}

.empty-state h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 680;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.empty-state p {
  max-width: 370px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.modal--wide {
  width: min(92vw, 500px);
  max-width: 500px;
}

.modal--item {
  width: min(92vw, 440px);
  max-width: 440px;
}

.modal--wide .modal-card,
.modal--item .modal-card {
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.modal-description {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.entry-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.text-area {
  height: auto;
  min-height: 88px;
  padding: 9px 11px;
  line-height: 1.5;
  resize: vertical;
  white-space: pre-wrap;
}

.item-detail-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-right: 25px;
}

.item-detail-icon {
  display: grid;
  flex: none;
  width: 46px;
  height: 46px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 13px;
  place-items: center;
}

.item-detail-icon .icon {
  width: 21px;
  height: 21px;
}

.item-detail-heading {
  min-width: 0;
}

.item-detail-heading h2 {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
}

.item-detail-description {
  margin: 14px 0 0;
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.item-dialog-bonuses {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 11px;
}

.item-transfer {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 11px;
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.item-transfer-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.item-transfer-copy strong {
  color: var(--text-soft);
  font-size: 9.5px;
  font-weight: 650;
}

.item-transfer-copy span {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
}

.item-transfer-controls {
  display: flex;
  flex: 1;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  min-width: 190px;
}

.item-transfer-controls .text-input {
  width: auto;
  min-width: 120px;
  max-width: 190px;
  height: 30px;
  padding: 0 8px;
  font-size: 9px;
}

.item-transfer-controls .button {
  flex: none;
}

@media (max-width: 520px) {
  .item-transfer {
    align-items: stretch;
    flex-direction: column;
  }

  .item-transfer-controls {
    min-width: 0;
    justify-content: stretch;
  }

  .item-transfer-controls .text-input {
    flex: 1;
    max-width: none;
  }
}

.item-bonus-chip {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 7px;
  color: var(--gear);
  font-size: 9px;
  font-weight: 650;
  background: var(--gear-soft);
  border-radius: 5px;
}

.item-bonus-empty {
  color: var(--muted);
  font-size: 9.5px;
}

.entry-detail-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-right: 25px;
}

.entry-detail-icon {
  display: grid;
  flex: none;
  width: 46px;
  height: 46px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 13px;
  place-items: center;
}

.entry-detail-icon .icon {
  width: 21px;
  height: 21px;
}

.entry-detail-head h2 {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
}

.entry-detail-description {
  margin: 15px 0 0;
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.entry-weakness-block {
  padding: 12px;
  margin-top: 15px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.entry-weakness-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.weakness-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.weakness-list .weakness-chip {
  height: 21px;
  padding: 0 7px;
  font-size: 9px;
}

.entry-date {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.settings-container,
.about-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 100%;
  max-width: 980px;
  padding: 26px clamp(24px, 4vw, 52px) 38px;
  margin: 0 auto;
}

/* ---------------------------------------------------------
   Settings
   --------------------------------------------------------- */

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.section-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 670;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.section-badge {
  flex: none;
  padding: 3px 8px;
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.ai-badge.is-connected {
  color: var(--success-text);
  background: var(--success-soft);
  border-color: transparent;
}

.ai-badge.is-off {
  color: var(--muted);
  background: var(--panel);
  border-color: var(--border);
}

.ai-card {
  padding: 0 17px 16px;
}

.ai-connection-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 1px;
  border-bottom: 1px solid var(--border);
}

.ai-connection-icon {
  display: grid;
  flex: none;
  width: 34px;
  height: 34px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 10px;
  place-items: center;
}

.ai-connection-icon .icon {
  width: 16px;
  height: 16px;
}

.ai-connection-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.ai-connection-copy strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-connection-copy span {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 3px;
  background: var(--muted);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--panel);
  transition:
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.ai-card.is-connected .connection-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.ai-card.is-connected .ai-connection-icon {
  color: var(--success-text);
  background: var(--success-soft);
}

.ai-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding-top: 15px;
}

.ai-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.3;
}

.text-input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 11.5px;
  line-height: 38px;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

.text-input::placeholder {
  color: var(--muted);
  opacity: 0.76;
}

.text-input:hover {
  border-color: var(--muted);
}

.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select.text-input {
  appearance: none;
  padding-right: 34px;
  cursor: pointer;
}

.select-wrap {
  position: relative;
  display: flex;
  width: 100%;
}

.select-chevron {
  position: absolute;
  top: 50%;
  right: 11px;
  width: 14px !important;
  height: 14px !important;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.secret-field {
  position: relative;
  display: flex;
  width: 100%;
}

.secret-field .text-input {
  padding-right: 42px;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 11px;
  letter-spacing: 0.025em;
}

.secret-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  width: 31px;
  height: 31px;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 7px;
  transform: translateY(-50%);
  place-items: center;
}

.secret-toggle:hover {
  color: var(--text-soft);
  background: var(--panel);
}

.secret-toggle .icon {
  width: 15px;
  height: 15px;
}

.field-hint {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.45;
}

.ai-endpoint {
  padding: 7px 9px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ai-actions .button {
  height: 35px;
  padding: 0 12px;
  font-size: 10.5px;
}

.form-message {
  min-height: 15px;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.form-message.is-error {
  color: var(--danger);
}

.form-message.is-success {
  color: var(--success-text);
}

.form-message.is-loading {
  color: var(--accent-text);
}

.privacy-note {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  padding-top: 1px;
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.45;
}

.privacy-note .icon {
  width: 13px;
  height: 13px;
  margin-top: 1px;
  color: var(--accent-text);
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.theme-option {
  display: flex;
  flex-direction: column;
  padding: 8px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.theme-option:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.theme-option.is-selected {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px var(--accent-soft),
    var(--card-shadow);
}

.theme-preview {
  display: flex;
  width: 100%;
  height: 103px;
  overflow: hidden;
  border: 1px solid rgba(122, 128, 146, 0.1);
  border-radius: 10px;
}

.preview-sidebar {
  width: 27%;
  height: 100%;
  border-right: 1px solid transparent;
}

.preview-main {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  padding: 10px 9px;
}

.preview-header {
  width: 44%;
  height: 4px;
  margin-bottom: 5px;
  border-radius: 999px;
}

.preview-bubble {
  width: 60%;
  height: 12px;
  border-radius: 3px 7px 7px 7px;
}

.preview-bubble--short {
  width: 51%;
}

.preview-bubble--user {
  width: 42%;
  margin-top: 0;
  margin-left: auto;
  border-radius: 7px 3px 7px 7px;
}

.preview-input {
  position: absolute;
  right: 9px;
  bottom: 8px;
  left: 9px;
  height: 15px;
  border: 1px solid transparent;
  border-radius: 5px;
}

.theme-preview--light {
  background: #ffffff;
}

.theme-preview--light .preview-sidebar {
  background: #f6f6f9;
  border-right-color: #ececf2;
}

.theme-preview--light .preview-header {
  background: #d9dae4;
}

.theme-preview--light .preview-bubble--short {
  background: #eeeef5;
}

.theme-preview--light .preview-bubble--user {
  background: #5b4bff;
}

.theme-preview--light .preview-input {
  background: #ffffff;
  border-color: #e5e5ee;
}

.theme-preview--dark {
  background: #141720;
}

.theme-preview--dark .preview-sidebar {
  background: #0c0e13;
  border-right-color: #222631;
}

.theme-preview--dark .preview-header {
  background: #4d5364;
}

.theme-preview--dark .preview-bubble--short {
  background: #262b37;
}

.theme-preview--dark .preview-bubble--user {
  background: #9d90ff;
}

.theme-preview--dark .preview-input {
  background: #1b1f29;
  border-color: #2c313e;
}

.theme-preview--blue {
  background: #0b2e69;
}

.theme-preview--blue .preview-sidebar {
  background: #07214c;
  border-right-color: #14386f;
}

.theme-preview--blue .preview-header {
  background: #5f8ecb;
}

.theme-preview--blue .preview-bubble--short {
  background: #154686;
}

.theme-preview--blue .preview-bubble--user {
  background: #72c4ff;
}

.theme-preview--blue .preview-input {
  background: #0f3a7d;
  border-color: rgba(169, 204, 255, 0.24);
}

.theme-option-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 9px 5px 3px;
}

.theme-option-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.theme-option-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-option-copy small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-check {
  display: grid;
  flex: none;
  width: 19px;
  height: 19px;
  color: var(--on-accent);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.72);
  place-items: center;
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    background-color 160ms ease;
}

.theme-check .icon {
  width: 11px;
  height: 11px;
  stroke-width: 2.4;
}

.theme-option.is-selected .theme-check {
  background: var(--accent);
  border-color: var(--accent);
  opacity: 1;
  transform: scale(1);
}

.settings-card {
  padding: 2px 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 1px;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-icon {
  display: grid;
  flex: none;
  width: 34px;
  height: 34px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 10px;
  place-items: center;
}

.setting-icon .icon {
  width: 16px;
  height: 16px;
}

.setting-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding-right: 8px;
}

.setting-copy strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 630;
  line-height: 1.35;
}

.setting-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
}

.switch {
  position: relative;
  display: inline-flex;
  flex: none;
  width: 40px;
  height: 23px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  opacity: 0;
}

.switch-track {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition:
    background-color 180ms ease,
    border-color 180ms ease;
}

.switch-track::before {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  content: "";
  background: var(--knob);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(20, 20, 40, 0.16);
  transition:
    transform 190ms ease,
    background-color 180ms ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch-track::before {
  background: var(--on-accent);
  transform: translateX(17px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.reset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 17px;
  background: var(--panel);
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
}

.reset-row strong {
  display: block;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 630;
}

.reset-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

/* ---------------------------------------------------------
   About
   --------------------------------------------------------- */

.about-container {
  gap: 16px;
}

.about-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 176px;
  padding: 27px 30px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--hero-start), var(--hero-end));
  border: 1px solid var(--hero-border);
  border-radius: 22px;
  box-shadow: var(--card-shadow);
}

.hero-orb {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(1px);
}

.hero-orb--one {
  top: -90px;
  right: -40px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, var(--glow-1), transparent 68%);
}

.hero-orb--two {
  bottom: -120px;
  left: 34%;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, var(--glow-2), transparent 70%);
}

.about-hero .logo-mark {
  z-index: 1;
}

.about-hero-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.about-hero-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.version-pill,
.platform-pill {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.platform-pill {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: transparent;
}

.about-hero h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(27px, 3vw, 33px);
  font-weight: 720;
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.about-hero p {
  max-width: 470px;
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
}

.hero-signature {
  position: absolute;
  right: 28px;
  bottom: 15px;
  color: var(--accent);
  pointer-events: none;
  opacity: 0.16;
  transform: rotate(-8deg);
}

.hero-signature .icon {
  width: 88px;
  height: 88px;
  stroke-width: 1.1;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.info-card {
  padding: 21px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
}

.info-card h2 {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 670;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.developer-head {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}

.developer-avatar {
  display: grid;
  flex: none;
  width: 49px;
  height: 49px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 720;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #6a5bff 0%, #4f7cff 52%, #39c5ff 100%);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(89, 76, 255, 0.2);
  place-items: center;
}

.developer-head h2 {
  margin-top: 4px;
}

.developer-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.developer-text {
  margin: 14px 0 13px;
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.62;
}

.developer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.developer-tags span {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 550;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
}

.feature-list {
  padding: 0;
  margin: 13px 0 0;
  list-style: none;
}

.feature-list li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.feature-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.feature-icon {
  display: grid;
  flex: none;
  width: 30px;
  height: 30px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 9px;
  place-items: center;
}

.feature-icon .icon {
  width: 14px;
  height: 14px;
}

.feature-list li > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.feature-list strong {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 620;
  line-height: 1.35;
}

.feature-list small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.35;
}

.shortcut-list,
.tech-list {
  display: flex;
  flex-direction: column;
  margin: 9px 0 0;
}

.shortcut-list > div,
.tech-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.shortcut-list > div:last-child,
.tech-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.shortcut-list dt,
.tech-list dt {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
}

.shortcut-list dd,
.tech-list dd {
  display: flex;
  gap: 3px;
  align-items: center;
  margin: 0;
  color: var(--text-soft);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.shortcut-list dd span {
  color: var(--muted);
  font-size: 9px;
}

.shortcut-list kbd {
  height: 18px;
  padding: 0 5px;
  font-size: 9px;
}

.about-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 2px 3px 8px;
  color: var(--muted);
  font-size: 9.5px;
}

.footer-heart {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.footer-heart .icon {
  width: 12px;
  height: 12px;
  color: var(--accent);
  stroke-width: 1.9;
}

/* ---------------------------------------------------------
   Dialog and toast
   --------------------------------------------------------- */

.modal {
  width: min(92vw, 410px);
  max-width: 410px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
}

.modal::backdrop {
  background: rgba(10, 12, 20, 0.46);
  backdrop-filter: blur(4px);
}

.modal[open] {
  animation: modal-in 200ms ease both;
}

.modal-card {
  position: relative;
  padding: 25px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--modal-shadow);
}

.modal-close-icon {
  position: absolute;
  top: 11px;
  right: 11px;
  width: 30px;
  height: 30px;
}

.modal-close-icon .icon {
  width: 15px;
  height: 15px;
}

.modal-icon {
  display: grid;
  width: 43px;
  height: 43px;
  margin-bottom: 14px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 13px;
  place-items: center;
}

.modal-icon .icon {
  width: 19px;
  height: 19px;
}

.modal h2 {
  padding-right: 24px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.modal p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.toast {
  position: fixed;
  bottom: 91px;
  left: 50%;
  z-index: 100;
  max-width: min(86vw, 420px);
  padding: 9px 14px;
  color: var(--toast-text);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
  background: var(--toast-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(10, 12, 20, 0.2);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------------------------------------------------
   Motion
   --------------------------------------------------------- */

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.996);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typing-bounce {
  0%,
  60%,
  100% {
    opacity: 0.45;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes status-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.001ms !important;
  animation-delay: 0ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------------------------------------------------------
   D&D character sheet
   --------------------------------------------------------- */

.stats-empty,
.inventory-empty {
  min-height: 300px;
}

.stats-empty .button,
.inventory-empty .button {
  margin-top: 14px;
}

.wizard-error {
  margin: 0;
  color: var(--danger);
  font-size: 10.5px;
  line-height: 1.45;
}

.dnd-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
}

.dnd-hero-identity {
  display: flex;
  flex: 1;
  gap: 13px;
  align-items: center;
  min-width: 250px;
}

.dnd-level-badge {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  color: var(--on-accent);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.25), transparent 45%),
    linear-gradient(135deg, var(--accent), var(--accent-deep));
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(91, 75, 255, 0.2);
}

.dnd-level-badge span {
  font-size: 7px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.dnd-level-badge strong {
  margin-top: 1px;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 750;
  line-height: 1;
}

.dnd-hero-copy {
  min-width: 0;
}

.dnd-hero-copy h2 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dnd-hero-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
}

.dnd-hero-tagline {
  display: block;
  margin-top: 4px;
  color: var(--accent-text);
  font-size: 9.5px;
  line-height: 1.35;
}

.dnd-health-card {
  flex: 0 1 210px;
  min-width: 180px;
  padding: 11px;
  background: var(--panel);
  border-radius: 11px;
}

.dnd-health-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
}

.dnd-health-head strong {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.dnd-hp-bar {
  height: 7px;
}

.dnd-health-note {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.35;
}

.dnd-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.dnd-metric {
  display: flex;
  flex-direction: column;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
}

.dnd-metric span {
  color: var(--muted);
  font-size: 7.5px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dnd-metric strong {
  margin-top: 3px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.dnd-metric small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.25;
}

.dnd-section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 2px 1px 0;
}

.dnd-section-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 670;
  line-height: 1.3;
}

.dnd-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.dnd-ability-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.dnd-ability-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--card-shadow);
}

.dnd-ability-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  content: "";
  background: transparent;
}

.dnd-ability-card.has-gear::before {
  background: var(--gear);
}

.dnd-ability-top {
  display: flex;
  gap: 7px;
  align-items: center;
}

.dnd-ability-name {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dnd-ability-value {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.dnd-ability-value strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.dnd-ability-card.has-gear .dnd-ability-value strong {
  color: var(--gear);
}

.dnd-ability-value span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.dnd-ability-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.3;
}

.dnd-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: 10px;
}

.dnd-list-card,
.dnd-traits-card {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
}

.dnd-list-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.dnd-list-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.3;
}

.dnd-saves-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dnd-save-row,
.dnd-skill-row {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
  padding: 5px 6px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.35;
  border-radius: 6px;
}

.dnd-save-row.is-proficient,
.dnd-skill-row.is-proficient {
  background: var(--accent-softer);
}

.proficiency-dot {
  flex: none;
  width: 5px;
  height: 5px;
  background: var(--border-strong);
  border-radius: 50%;
}

.dnd-save-row.is-proficient .proficiency-dot,
.dnd-skill-row.is-proficient .proficiency-dot {
  background: var(--accent);
}

.dnd-row-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dnd-skill-row small {
  flex: none;
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.03em;
}

.dnd-save-row strong,
.dnd-skill-row strong {
  flex: none;
  min-width: 22px;
  color: var(--text-soft);
  font-size: 9.5px;
  font-weight: 650;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dnd-skills-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px 5px;
}

.dnd-combat-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
}

.dnd-combat-summary .card-eyebrow {
  font-size: 8px;
}

.dnd-combat-summary h2 {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 670;
  line-height: 1.3;
}

.dnd-combat-summary p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.dnd-combat-action {
  display: flex;
  flex: none;
  align-items: center;
}

.dnd-milestone-note {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.4;
}

.dnd-traits-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dnd-trait-block {
  min-width: 0;
  padding: 9px;
  background: var(--panel);
  border-radius: 8px;
}

.dnd-trait-block strong {
  display: block;
  color: var(--text-soft);
  font-size: 9.5px;
  font-weight: 650;
  line-height: 1.35;
}

.dnd-trait-block p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.campaign-entry-avatar--text {
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 1120px) {
  .dnd-ability-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dnd-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dnd-detail-grid {
    grid-template-columns: 1fr;
  }

  .dnd-traits-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .dnd-hero {
    gap: 12px;
    padding: 14px;
  }

  .dnd-hero-identity {
    min-width: 210px;
  }

  .dnd-health-card {
    flex-basis: 180px;
  }

  .dnd-ability-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dnd-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---------------------------------------------------------
   Campaign
   --------------------------------------------------------- */

.campaign-view {
  background: var(--bg);
}

.campaign-wizard-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.campaign-onboarding {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  max-width: 940px;
  padding: 30px clamp(24px, 4vw, 58px) 42px;
  margin: 0 auto;
}

.campaign-onboarding-header {
  padding: 4px 2px 2px;
}

.campaign-kicker {
  color: var(--accent-text);
  font-size: 9px;
  font-weight: 720;
  line-height: 1.3;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.campaign-onboarding h1 {
  max-width: 620px;
  margin: 6px 0 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(28px, 3.5vw, 38px);
  font-weight: 720;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.campaign-onboarding-header > p {
  max-width: 580px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.wizard-section {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
}

.wizard-section-head {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.wizard-section-head > span {
  display: grid;
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--accent-text);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.04em;
  background: var(--accent-soft);
  border-radius: 9px;
  place-items: center;
}

.wizard-section-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 680;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.wizard-section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.wizard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.wizard-grid--3 {
  grid-template-columns: 1.25fr 1fr 1fr;
}

.wizard-class-preview {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 12px;
  margin-top: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.wizard-class-icon {
  display: grid;
  flex: none;
  width: 32px;
  height: 32px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 9px;
  place-items: center;
}

.wizard-class-icon .icon {
  width: 16px;
  height: 16px;
}

.wizard-class-preview strong {
  display: block;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
}

.wizard-class-preview p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.wizard-derived {
  padding: 12px;
  margin-top: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.wizard-derived-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wizard-derived-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.wizard-derived-value {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.wizard-derived-value span {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wizard-derived-value strong {
  color: var(--text-soft);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.wizard-derived-value em {
  color: var(--gear);
  font-size: 8.5px;
  font-style: normal;
  font-weight: 600;
}

.wizard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 2px;
}

.wizard-actions .button {
  height: 38px;
  padding: 0 15px;
  font-size: 11px;
}

.wizard-ai-note {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.4;
}

.wizard-ai-note .icon {
  width: 13px;
  height: 13px;
  color: var(--accent-text);
}

.text-button {
  padding: 0;
  color: var(--accent-text);
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  border: 0;
}

.text-button:hover {
  text-decoration: underline;
}

.ability-assignment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ability-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px 56px;
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.ability-row-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ability-row-label strong {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
}

.ability-row-label span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.25;
}

.ability-row select {
  width: 100%;
  height: 29px;
  padding: 0 6px;
  color: var(--text);
  font-size: 10.5px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  outline: none;
}

.ability-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ability-row-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 0;
  text-align: right;
}

.ability-row-total strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.ability-row-total span {
  margin-top: 2px;
  color: var(--gear);
  font-size: 8px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

/* Campaign game */

.campaign-game {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.campaign-header {
  display: flex;
  flex: none;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 17px clamp(20px, 3vw, 34px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.campaign-heading {
  min-width: 0;
}

.campaign-heading h1 {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 710;
  line-height: 1.15;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-scene-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

#campaign-scene-title {
  color: var(--text-soft);
  font-weight: 600;
}

.dot-separator {
  opacity: 0.55;
}

.campaign-hud {
  display: flex;
  flex: none;
  gap: 7px;
  align-items: center;
}

.hud-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 57px;
  height: 44px;
  padding: 4px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.hud-pill span {
  color: var(--muted);
  font-size: 7.5px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-pill strong {
  margin-top: 2px;
  color: var(--text-soft);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.campaign-hud .icon-button {
  margin-left: 2px;
}

.campaign-body {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 252px;
  gap: 16px;
  width: 100%;
  max-width: 1320px;
  min-height: 0;
  padding: 15px clamp(16px, 2.5vw, 30px) 17px;
  margin: 0 auto;
}

.campaign-story {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.campaign-scene-bar {
  display: flex;
  flex: none;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.campaign-scene-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.campaign-scene-copy .eyebrow {
  font-size: 8px;
}

.campaign-scene-copy strong {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-log {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 13px;
  min-height: 0;
  padding: 16px 5px 5px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.campaign-entry {
  display: flex;
  gap: 9px;
  max-width: min(89%, 690px);
  min-width: 0;
}

.campaign-entry--dm {
  align-self: flex-start;
}

.campaign-entry--player {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.campaign-entry-avatar {
  display: grid;
  flex: none;
  width: 29px;
  height: 29px;
  margin-top: 1px;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 9px;
  place-items: center;
}

.campaign-entry-avatar .icon {
  width: 15px;
  height: 15px;
}

.campaign-entry--player .campaign-entry-avatar {
  color: var(--on-accent);
  background: var(--accent);
}

.campaign-entry-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.campaign-entry--player .campaign-entry-copy {
  align-items: flex-end;
}

.campaign-entry-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 0 2px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 500;
  line-height: 1.2;
}

.campaign-entry-meta strong {
  color: var(--text-soft);
  font-size: 9.5px;
  font-weight: 650;
}

.campaign-entry-text {
  padding: 10px 13px;
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px 14px 14px 14px;
  box-shadow: 0 1px 1px rgba(18, 19, 31, 0.02);
}

.campaign-entry--player .campaign-entry-text {
  color: var(--bubble-user-text);
  background: var(--bubble-user);
  border-color: transparent;
  border-radius: 14px 5px 14px 14px;
  box-shadow: var(--bubble-user-shadow);
}

.campaign-entry--roll,
.campaign-entry--system {
  align-self: center;
  max-width: min(92%, 680px);
  padding: 6px 10px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.45;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.campaign-entry--roll {
  color: var(--text-soft);
}

.campaign-entry--roll.is-failure {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}

.campaign-entry--system {
  background: transparent;
  border-style: dashed;
}

.campaign-log-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.campaign-log-empty .empty-state-icon {
  margin-bottom: 10px;
}

.campaign-log-empty h2 {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 650;
}

.campaign-log-empty p {
  max-width: 300px;
  margin: 5px 0 0;
  font-size: 10.5px;
  line-height: 1.5;
}

.campaign-check {
  display: flex;
  flex: none;
  gap: 11px;
  align-items: center;
  padding: 10px 12px;
  margin: 7px 4px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
  border-radius: 11px;
}

.campaign-check-die {
  display: grid;
  flex: none;
  width: 36px;
  height: 36px;
  color: var(--accent-text);
  background: var(--surface);
  border-radius: 10px;
  place-items: center;
}

.campaign-check-die .icon {
  width: 18px;
  height: 18px;
}

.campaign-check-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.campaign-check-copy .eyebrow {
  font-size: 8px;
}

.campaign-check-copy strong {
  margin-top: 1px;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.3;
}

.campaign-check-copy span:last-child {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
}

.campaign-check .button {
  flex: none;
  height: 31px;
  padding: 0 11px;
  font-size: 10px;
}

.campaign-choices {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 4px 0;
}

.campaign-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 28px;
  padding: 5px 10px;
  color: var(--text-soft);
  font-size: 10.5px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease;
}

.campaign-choice .icon {
  width: 12px;
  height: 12px;
  color: var(--accent-text);
}

.campaign-choice:hover {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: transparent;
}

.campaign-pending {
  display: flex;
  flex: none;
  gap: 4px;
  align-items: center;
  padding: 7px 5px;
  color: var(--muted);
  font-size: 9.5px;
}

.campaign-pending .typing-dot {
  width: 4px;
  height: 4px;
}

.campaign-pending span:last-child {
  margin-left: 4px;
}

.campaign-composer {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  margin-top: 4px;
  background: var(--composer-bg);
  border: 1.5px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--composer-shadow);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.campaign-composer:focus-within {
  border-color: var(--accent);
  box-shadow:
    0 0 0 4px var(--accent-soft),
    var(--composer-shadow);
}

.campaign-composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 24px;
  max-height: 112px;
  padding: 5px 0 4px;
  overflow-y: auto;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  resize: none;
  background: transparent;
  border: 0;
  outline: none;
}

.campaign-composer textarea::placeholder {
  color: var(--muted);
  opacity: 0.86;
}

.campaign-composer .send-button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.campaign-composer .send-button .icon {
  width: 17px;
  height: 17px;
}

.campaign-composer-meta {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 5px 4px 0;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.4;
}

.campaign-composer-meta kbd {
  height: 15px;
  min-width: 14px;
  font-size: 8px;
}

.campaign-ai-hint {
  padding: 6px 4px 0;
  margin: 0;
  color: var(--danger);
  font-size: 9.5px;
  line-height: 1.4;
}

.campaign-sidebar {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.campaign-sidebar::-webkit-scrollbar {
  width: 0;
}

.campaign-side-card {
  flex: none;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--card-shadow);
}

.side-card-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.side-card-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

.section-badge--gold {
  color: var(--pending);
  background: var(--pending-soft);
  border-color: transparent;
}

.campaign-hero-line {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 9px;
}

.campaign-hero-line strong {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-hero-line span {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-mini-hp {
  padding: 8px;
  background: var(--panel);
  border-radius: 8px;
}

.mini-hp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.3;
}

.mini-hp-head span:last-child {
  color: var(--text-soft);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.hp-bar {
  height: 5px;
  overflow: hidden;
  background: var(--panel-2);
  border-radius: 99px;
}

.hp-bar > span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--success);
  border-radius: inherit;
  transition: width 200ms ease;
}

.hp-bar > span.is-low {
  background: var(--danger);
}

.campaign-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 7px;
}

.campaign-mini-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 3px;
  background: var(--panel);
  border-radius: 6px;
}

.campaign-mini-stat span {
  color: var(--muted);
  font-size: 7px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.campaign-mini-stat strong {
  margin-top: 1px;
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.2;
}

.campaign-side-card .button--full {
  width: 100%;
  height: 29px;
  margin-top: 8px;
  font-size: 9.5px;
}

.campaign-quest-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.campaign-quest-item {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  color: var(--text-soft);
  font-size: 9.5px;
  line-height: 1.4;
}

.campaign-quest-item .icon {
  flex: none;
  width: 12px;
  height: 12px;
  margin-top: 1px;
  color: var(--accent-text);
}

.campaign-quest-empty {
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.4;
}

.campaign-combat-card {
  border-color: var(--danger-soft);
}

.initiative-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  margin: 0 0 9px;
  list-style: none;
}

.initiative-item {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 5px 7px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  background: var(--panel);
  border-radius: 6px;
}

.initiative-item.is-current {
  color: var(--text);
  background: var(--accent-soft);
}

.initiative-item.is-defeated {
  opacity: 0.45;
  text-decoration: line-through;
}

.initiative-item strong {
  flex: none;
  width: 15px;
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 650;
}

.initiative-hp {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.initiative-tag {
  color: var(--muted);
  font-size: 7.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.campaign-combat-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.campaign-combat-actions .button {
  flex: 1;
  height: 30px;
  padding: 0 7px;
  font-size: 9px;
}

.campaign-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.campaign-meta-row strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-meta-card > .text-button {
  margin-top: 5px;
  font-size: 9px;
}

@media (max-width: 1120px) {
  .campaign-body {
    grid-template-columns: minmax(0, 1fr) 228px;
    gap: 12px;
    padding-right: 18px;
    padding-left: 18px;
  }

  .campaign-onboarding {
    padding-right: 34px;
    padding-left: 34px;
  }

  .wizard-grid--3 {
    grid-template-columns: 1.15fr 1fr 1fr;
  }
}

@media (max-width: 980px) {
  .campaign-header {
    padding: 13px 18px;
  }

  .campaign-hud {
    gap: 5px;
  }

  .hud-pill {
    min-width: 50px;
    height: 39px;
    padding: 3px 6px;
  }

  .hud-pill strong {
    font-size: 10px;
  }

  .campaign-body {
    grid-template-columns: minmax(0, 1fr) 214px;
    padding: 11px 14px 13px;
  }

  .campaign-entry-text {
    font-size: 11.5px;
  }

  .campaign-onboarding {
    padding-right: 24px;
    padding-left: 24px;
  }

  .wizard-grid,
  .wizard-grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ability-assignment {
    grid-template-columns: 1fr;
  }

  .wizard-derived-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-height: 700px) {
  .campaign-onboarding {
    gap: 12px;
    padding-top: 18px;
    padding-bottom: 24px;
  }

  .wizard-section {
    padding: 13px;
  }

  .wizard-section-head {
    margin-bottom: 10px;
  }

  .campaign-header {
    padding-top: 11px;
    padding-bottom: 11px;
  }

  .campaign-hud .hud-pill {
    height: 36px;
  }

  .campaign-composer textarea {
    max-height: 80px;
  }
}

/* ---------------------------------------------------------
   Responsive refinements — the sidebar remains 15%.
   --------------------------------------------------------- */

@media (max-width: 1120px) {
  .sidebar {
    padding-top: 21px;
    padding-bottom: 15px;
  }

  .brand {
    margin-bottom: 20px;
  }

  .new-chat-btn {
    padding: 0 9px;
    font-size: 11px;
  }

  .new-chat-btn .icon {
    margin-right: 6px;
  }

  .nav-item {
    padding: 0 8px;
    font-size: 12px;
  }

  .nav-item .icon {
    margin-right: 7px;
  }

  .navigation {
    margin-top: 23px;
  }

  .setting-row {
    gap: 10px;
  }

  .chat-header {
    padding-top: 15px;
    padding-bottom: 15px;
  }
}

@media (min-width: 1001px) and (max-width: 1220px) {
  .sidebar {
    padding-right: clamp(10px, 1.1vw, 14px);
    padding-left: clamp(10px, 1.1vw, 14px);
  }

  .nav-item {
    padding: 0 6px;
    font-size: 11px;
  }

  .nav-item .icon {
    width: 17px;
    height: 17px;
    margin-right: 5px;
  }
}

@media (max-width: 1000px) {
  .sidebar {
    padding-top: 18px;
    padding-right: 8px;
    padding-bottom: 13px;
    padding-left: 8px;
  }

  .brand {
    gap: 8px;
    margin-bottom: 18px;
  }

  .logo-mark {
    width: 35px;
    height: 35px;
  }

  .brand-name {
    font-size: 16px;
  }

  .brand-tagline {
    display: none;
  }

  .new-chat-btn {
    height: 38px;
    padding: 0 8px;
    font-size: 10.5px;
  }

  .new-chat-btn .icon {
    width: 15px;
    height: 15px;
    margin-right: 5px;
  }

  .navigation {
    gap: 2px;
    margin-top: 20px;
  }

  .nav-label {
    margin-right: 3px;
    margin-left: 3px;
    font-size: 8.5px;
  }

  .nav-item {
    height: 38px;
    padding: 0 5px;
    font-size: 10.75px;
    border-radius: 9px;
  }

  .nav-item .icon {
    width: 15px;
    height: 15px;
    margin-right: 5px;
  }

  .nav-active-mark {
    display: none;
  }

  .mode-card {
    gap: 7px;
    padding: 8px;
  }

  .mode-copy strong {
    font-size: 9.5px;
  }

  .mode-copy span {
    font-size: 8px;
  }

  .sidebar-meta {
    font-size: 8px;
  }

  .button-label {
    display: none;
  }

  .button--compact {
    width: 34px;
    padding: 0;
  }

  .composer-meta {
    font-size: 9px;
  }

  .composer-hint {
    gap: 3px;
  }

  .theme-preview {
    height: 88px;
  }

  .theme-option-copy strong {
    font-size: 11px;
  }

  .theme-option-copy small {
    font-size: 9px;
  }

  .page-header {
    padding-top: 25px;
    padding-bottom: 20px;
  }

  .settings-container,
  .about-container {
    padding-top: 22px;
    gap: 23px;
  }

  .about-hero {
    padding: 23px;
  }
}

@media (max-width: 820px) {
  .theme-options {
    grid-template-columns: 1fr;
  }

  .ai-field-grid {
    grid-template-columns: 1fr;
  }

  .theme-preview {
    height: 100px;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .page-header-icon {
    display: none;
  }

  .stat-grid,
  .codex-grid,
  .equipment-layout {
    grid-template-columns: 1fr;
  }

  .character-hero {
    flex-wrap: wrap;
  }

  .character-progress {
    flex-basis: 100%;
    order: 3;
  }

  .free-points {
    margin-left: auto;
  }

  .bag-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }

  .timeline-event {
    grid-template-columns: 36px minmax(0, 1fr);
  }
}

@media (max-height: 700px) {
  .sidebar {
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .brand {
    margin-bottom: 12px;
  }

  .brand .logo-mark {
    width: 34px;
    height: 34px;
  }

  .brand-name {
    font-size: 16px;
  }

  .new-chat-btn {
    height: 36px;
  }

  .primary-nav {
    gap: 1px;
    margin-top: 12px;
  }

  .nav-label {
    display: none;
  }

  .nav-item {
    height: 34px;
  }

  .nav-item--wrap {
    min-height: 34px;
    padding-top: 2px;
    padding-bottom: 2px;
  }

  .utility-nav {
    padding-top: 7px;
    margin-top: 7px;
  }

  .utility-nav .nav-item {
    height: 32px;
  }

  .mode-card {
    padding: 7px 8px;
    margin-top: 8px;
  }

  .sidebar-meta {
    margin-top: 6px;
  }

  .page-header {
    padding-top: 18px;
    padding-bottom: 15px;
  }

  .page-header h1 {
    font-size: 23px;
  }

  .page-subtitle {
    margin-top: 4px;
    font-size: 11px;
  }

  .character-container,
  .inventory-container,
  .codex-container,
  .timeline-container {
    padding-top: 18px;
    padding-bottom: 24px;
    gap: 12px;
  }

  .character-hero {
    padding: 14px;
  }

  .level-medallion {
    width: 72px;
    height: 72px;
  }

  .level-medallion strong {
    font-size: 28px;
  }

  .stat-grid {
    gap: 8px;
  }

  .stat-card {
    padding: 10px 12px;
    gap: 6px;
  }

  .stat-total {
    font-size: 25px;
  }

  .equipment-slot {
    min-height: 62px;
    padding: 8px;
  }

  .bag-cell {
    min-height: 82px;
  }
}

@media (max-height: 720px) {
  .sidebar {
    padding-top: 16px;
    padding-bottom: 12px;
  }

  .brand {
    margin-bottom: 16px;
  }

  .navigation {
    margin-top: 17px;
  }

  .mode-card {
    padding: 8px;
    margin-top: 10px;
  }

  .sidebar-meta {
    margin-top: 8px;
  }

  .chat-header {
    padding-top: 13px;
    padding-bottom: 13px;
  }

  .conversation {
    padding-top: 24px;
    gap: 17px;
  }

  .composer-area {
    padding-bottom: 12px;
  }

  .page-header {
    padding-top: 22px;
    padding-bottom: 18px;
  }

  .page-header h1 {
    font-size: 25px;
  }

  .settings-container,
  .about-container {
    padding-top: 20px;
    padding-bottom: 28px;
  }
}

@media (max-height: 700px) {
  .sidebar {
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .brand {
    margin-bottom: 12px;
  }

  .primary-nav {
    margin-top: 12px;
  }

  .utility-nav {
    margin-top: 7px;
  }

  .mode-card {
    padding: 7px 8px;
    margin-top: 8px;
  }

  .sidebar-meta {
    margin-top: 6px;
  }

  .page-header {
    padding-top: 18px;
    padding-bottom: 15px;
  }

  .page-header h1 {
    font-size: 23px;
  }

  .settings-container,
  .about-container {
    padding-top: 18px;
    padding-bottom: 24px;
  }
}

/* Local scrollbars */
::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
  background-clip: padding-box;
  border: 3px solid transparent;
}

/* ---------------------------------------------------------
   LAN multiplayer
   --------------------------------------------------------- */

.campaign-party-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.campaign-party-member {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) 54px;
  gap: 7px;
  align-items: center;
  padding: 5px 0;
}

.campaign-party-member + .campaign-party-member {
  border-top: 1px solid var(--border);
}

.campaign-party-member.is-offline {
  opacity: 0.52;
}

.campaign-party-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.campaign-party-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.campaign-party-copy strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-party-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 7.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-party-hp {
  display: block;
  height: 4px;
  overflow: hidden;
  background: var(--panel);
  border-radius: 999px;
}

.campaign-party-hp span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.modal--network {
  width: min(94vw, 700px);
  max-width: 700px;
}

.modal--network .modal-card {
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.network-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 17px;
}

.network-head .modal-icon {
  flex: none;
}

.network-head h2 {
  padding-right: 20px;
}

.network-head p {
  max-width: 54ch;
}

.network-panel {
  padding-top: 14px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
}

.network-panel-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.network-panel-head h3 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 670;
  line-height: 1.3;
}

.network-copy {
  max-width: 62ch;
  margin: 5px 0 10px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.network-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.network-fields .field {
  margin: 0;
}

.network-fields .field-label {
  font-size: 8px;
}

.network-address {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  margin: 7px 0;
  background: var(--accent-softer);
  border-radius: 8px;
}

.network-address code {
  color: var(--text);
  font-family: var(--font-mono, Consolas, monospace);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
  white-space: pre-line;
}

.network-address span {
  color: var(--muted);
  font-size: 8.5px;
}

.network-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.network-players {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0;
  margin: 9px 0 0;
  list-style: none;
}

.network-player {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 6px 1px;
  color: var(--text-soft);
  font-size: 9.5px;
  border-top: 1px solid var(--border);
}

.network-player small {
  color: var(--muted);
  font-size: 8px;
}

.network-guest-status {
  padding: 9px 10px;
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 9.5px;
  line-height: 1.45;
  background: var(--panel);
  border-radius: 8px;
}

.network-guest-status strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 10px;
}

body.is-guest .new-chat-btn,
body.is-guest #campaign-menu,
body.is-guest #campaign-ai-settings-2,
body.is-guest #campaign-rest,
body.is-guest .settings-section.ai-section {
  display: none !important;
}

@media (max-width: 980px) {
  .network-fields {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------
   Network room code, lobby and discovery
   --------------------------------------------------------- */

.network-code-field {
  margin: 8px 0 0;
}

.network-code-field .text-input {
  max-width: 170px;
  font-family: var(--font-mono, Consolas, monospace);
  font-weight: 650;
  letter-spacing: 0.12em;
}

.network-code-display {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 5px 9px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 8.5px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.network-code-display strong {
  color: var(--accent-text);
  font-family: var(--font-mono, Consolas, monospace);
  font-size: 13px;
  letter-spacing: 0.16em;
}

.network-discovery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.network-scan-status {
  color: var(--muted);
  font-size: 8px;
}

.network-rooms {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 7px;
}

.network-room {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  color: var(--text-soft);
  font-size: 9px;
  text-align: left;
  cursor: pointer;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.network-room:hover {
  border-color: var(--accent);
}

.network-room strong {
  color: var(--text);
  font-size: 9.5px;
}

.network-room small {
  color: var(--muted);
  font-size: 8px;
}

.network-player-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.network-player-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.network-ready-badge {
  padding: 2px 6px;
  color: var(--muted);
  font-size: 7.5px;
  font-weight: 650;
  background: var(--panel);
  border-radius: 999px;
}

.network-ready-badge.is-ready {
  color: var(--success-text);
  background: var(--success-soft);
}

.network-kick {
  padding: 0;
  color: var(--danger);
  font-size: 8px;
}

#network-ready.is-active {
  color: var(--success-text);
  background: var(--success-soft);
  border-color: transparent;
}

.network-abilities {
  margin-top: 9px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.network-abilities summary {
  color: var(--text-soft);
  font-size: 8.5px;
  font-weight: 650;
  cursor: pointer;
}

.network-abilities > p {
  margin: 5px 0 7px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.45;
}

.network-ability-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px 7px;
}

.network-ability-grid label {
  display: flex;
  gap: 4px;
  align-items: center;
  color: var(--muted);
  font-size: 7.5px;
  font-weight: 650;
}

.network-ability-grid .text-input {
  width: 100%;
  height: 28px;
  padding: 0 6px;
  font-size: 9px;
}

