/* ═══════════════════════════════════════════════════════
   D&D AI — Refined Dark Fantasy UI
   ═══════════════════════════════════════════════════════ */

:root {
  --bg-deep: #0a0b10;
  --bg-dark: #10131b;
  --bg-card: #171b25;
  --bg-card-2: #1c2230;
  --bg-hover: #232b3c;
  --panel: rgba(20, 24, 34, 0.88);
  --panel-soft: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-glow: rgba(201, 168, 76, 0.22);
  --text: #ece6d3;
  --text-muted: #a9b1c3;
  --text-dim: #73809a;
  --gold: #c9a84c;
  --gold-light: #efd78a;
  --red: #d15858;
  --green: #55b97d;
  --blue: #74a4ff;
  --purple: #8d6af1;
  --header-h: 72px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background:
    radial-gradient(circle at top, rgba(141, 106, 241, 0.16), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(201, 168, 76, 0.09), transparent 24%),
    linear-gradient(180deg, #111522 0%, var(--bg-deep) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--gold-light); text-decoration: none; }
a:hover { color: #fff; }

button, input, textarea, select { font: inherit; }

textarea, input, select {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
textarea:focus, input:focus, select:focus {
  border-color: rgba(201, 168, 76, 0.6);
  box-shadow: 0 0 0 4px rgba(201, 168, 76, 0.10);
  background: rgba(255, 255, 255, 0.045);
}
textarea:disabled, input:disabled, select:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
textarea { resize: vertical; }
select option { background: var(--bg-card); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, #8d6af1, #6d56d6);
  color: #fff;
  box-shadow: 0 8px 24px rgba(109, 86, 214, 0.28);
}
.btn-primary:hover { background: linear-gradient(135deg, #9978f4, #7862de); }

.btn-gold {
  background: linear-gradient(135deg, #d3b35a, #b88f35);
  color: #191304;
}
.btn-gold:hover { filter: brightness(1.04); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: rgba(209, 88, 88, 0.12);
  border-color: rgba(209, 88, 88, 0.3);
  color: #ffb0b0;
}
.btn-danger:hover { background: rgba(209, 88, 88, 0.18); }

.btn-success {
  background: rgba(85, 185, 125, 0.14);
  border-color: rgba(85, 185, 125, 0.3);
  color: #c0f0d0;
}

.btn-sm { padding: 8px 10px; font-size: 12px; border-radius: 12px; }
.btn-full { width: 100%; }

.alert {
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.alert-error {
  background: rgba(209, 88, 88, 0.12);
  border: 1px solid rgba(209, 88, 88, 0.28);
  color: #ffb0b0;
}

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.auth-container { width: 100%; max-width: 420px; }
.auth-logo { margin-bottom: 28px; text-align: center; }
.logo-icon { font-size: 52px; display: block; filter: drop-shadow(0 0 20px rgba(201, 168, 76, 0.3)); }
.auth-logo h1 { font-size: 2rem; color: var(--gold-light); letter-spacing: 1px; }
.logo-sub { color: var(--text-muted); font-size: 13px; margin-top: 6px; }
.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.42);
  backdrop-filter: blur(16px);
}
.auth-card h2 { margin-bottom: 18px; color: #fff; font-size: 1.25rem; }
.form-group { margin-bottom: 14px; text-align: left; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.auth-footer { margin-top: 16px; color: var(--text-muted); font-size: 13px; text-align: center; }

.lobby-page { min-height: 100vh; }
.site-header, .game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px;
}
.site-header {
  height: var(--header-h);
  background: rgba(16, 19, 27, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.header-brand { font-weight: 800; color: var(--gold-light); font-size: 1.05rem; letter-spacing: 0.5px; }
.header-user { display: flex; align-items: center; gap: 10px; }
.username { color: var(--text-muted); }
.lobby-container { max-width: 980px; margin: 0 auto; padding: 28px 20px 48px; }
.lobby-welcome { margin-bottom: 20px; }
.lobby-welcome h2 { color: #fff; margin-bottom: 4px; }
.char-summary-card, .char-form-card, .online-card, .combat-panel, .party-panel, .dice-log-panel, .online-panel, .control-card, .dm-char-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.24);
}
.char-summary-card, .char-form-card, .online-card { margin-bottom: 20px; }
.char-summary-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.char-summary-header h3, .char-form-card h3, .online-card h3 { color: #fff; }
.char-tag, .text-muted { color: var(--text-muted); }
.link-gold { color: var(--gold-light); }
.char-stats-row, .player-list, .btn-group, .form-actions, .char-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.stat-pill {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.stat-pill strong { color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ability-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.ability-box { text-align: center; }
.ability-box label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }
.ability-input { text-align: center; }
.ability-mod { display: block; font-size: 11px; margin-top: 2px; }
.mod-pos { color: var(--green); }
.mod-neg { color: var(--red); }
.player-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
}

.game-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.game-page-redesign {
  background:
    radial-gradient(circle at top, rgba(141, 106, 241, 0.18), transparent 28%),
    radial-gradient(circle at 80% 16%, rgba(201, 168, 76, 0.08), transparent 24%),
    linear-gradient(180deg, #101520 0%, var(--bg-deep) 100%);
}
.glass-header {
  height: var(--header-h);
  background: rgba(16, 19, 27, 0.72);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand-stack { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(201,168,76,0.18), rgba(141,106,241,0.24));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
}
.brand-title { font-weight: 800; letter-spacing: 0.4px; color: var(--gold-light); }
.brand-sub { font-size: 11px; color: var(--text-muted); }
.header-center {
  flex: 1;
  min-width: 0;
}
.campaign-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.campaign-chip {
  font-size: 10px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--gold-light);
  padding: 4px 9px;
  border: 1px solid rgba(201, 168, 76, 0.28);
  border-radius: 999px;
  background: rgba(201, 168, 76, 0.08);
}
.campaign-title { font-size: 16px; font-weight: 800; color: #fff; }
.campaign-scene {
  max-width: 680px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-right { display: flex; align-items: center; gap: 8px; min-width: 180px; justify-content: flex-end; }

.game-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: 18px;
  padding: 18px;
  min-height: calc(100vh - var(--header-h));
  max-height: calc(100vh - var(--header-h));
}
.game-rail, .story-stage { min-height: 0; }
.game-rail {
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.game-rail::-webkit-scrollbar, .chat-container::-webkit-scrollbar, .dice-log::-webkit-scrollbar { width: 7px; }
.game-rail::-webkit-scrollbar-thumb, .chat-container::-webkit-scrollbar-thumb, .dice-log::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.10);
  border-radius: 999px;
}

.story-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  min-width: 0;
}

.rail-card, .story-frame, .command-deck {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.28);
  backdrop-filter: blur(14px);
}
.rail-card {
  padding: 16px;
  margin-bottom: 14px;
}
.rail-card-title, .eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gold-light);
  margin-bottom: 10px;
}
.hero-card {
  text-align: center;
  padding: 18px;
  background: linear-gradient(180deg, rgba(88, 63, 140, 0.32), rgba(18, 22, 31, 0.92));
}
.portrait-orb {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  margin: 0 auto 14px;
  background: radial-gradient(circle at 30% 30%, rgba(239, 215, 138, 0.34), rgba(141, 106, 241, 0.24));
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 800;
  color: #fff;
}
.char-name, .hero-name { font-size: 22px; font-weight: 800; color: #fff; }
.char-subtitle, .hero-subtitle { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.hero-metrics { margin-bottom: 16px; }
.hero-metric, .hp-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.hp-bar-outer {
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
  height: 10px;
}
.hp-bar-outer.sm { height: 7px; flex: 1; }
.hp-bar-inner {
  height: 100%;
  border-radius: inherit;
  transition: width 0.3s ease, background 0.3s ease;
}
.hp-good { background: linear-gradient(90deg, #2fae66, #58cf8a); }
.hp-warn { background: linear-gradient(90deg, #c89d2d, #e5bf57); }
.hp-crit { background: linear-gradient(90deg, #bf3d3d, #ea6666); }
.cinematic-hp { height: 12px; }
.stat-pill-grid, .ability-showcase {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.stat-pill-card, .ability-showcase-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 16px;
  padding: 11px 8px;
  text-align: center;
}
.stat-pill-card span, .ability-showcase-item span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stat-pill-card strong { font-size: 18px; color: #fff; }
.section-title { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin: 10px 0 6px; font-weight: 700; }
.scene-lock-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
}
.scene-lock-title { font-weight: 800; color: #fff; margin-bottom: 6px; }
.scene-lock-description { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.scene-lock-meta { font-size: 11px; color: var(--text-dim); }
.stacked-action-list { display: flex; flex-direction: column; gap: 8px; }
.option-btn {
  width: 100%;
  text-align: left;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 16px;
  padding: 11px 12px;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}
.option-btn:hover {
  border-color: rgba(201,168,76,0.45);
  background: rgba(201,168,76,0.08);
  transform: translateY(-1px);
}
.option-btn-secondary {
  background: rgba(116,164,255,0.06);
  border-color: rgba(116,164,255,0.18);
}
.option-btn-secondary:hover {
  border-color: rgba(116,164,255,0.34);
  background: rgba(116,164,255,0.10);
}
.option-btn-ability {
  background: rgba(180,120,255,0.06);
  border-color: rgba(180,120,255,0.22);
}
.option-btn-ability:hover {
  border-color: rgba(180,120,255,0.42);
  background: rgba(180,120,255,0.12);
}

/* ── Spellbook section ── */
.spellbook-meta { margin-bottom: 10px; }
.spellbook-stat-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}
.spellbook-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 4px;
}
.spellbook-stat-label {
  font-size: 10px;
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.spellbook-stat strong { font-size: 14px; }
.spell-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.spell-entry {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}
.spell-name { font-size: 13px; font-weight: 600; }
.spell-badge {
  display: inline-block;
  font-size: 10px;
  background: rgba(180,120,255,0.15);
  border: 1px solid rgba(180,120,255,0.3);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
  color: #c8a0ff;
}
.spell-notes {
  font-size: 11px;
  opacity: 0.6;
  margin-top: 3px;
}
/* ── Special / class ability actions ── */
.special-action-list { display: flex; flex-direction: column; gap: 6px; }
.condition-tag, .condition-tag-sm, .inventory-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  border: 1px solid rgba(209, 88, 88, 0.26);
  background: rgba(209, 88, 88, 0.09);
  color: #ffbcbc;
  margin: 2px 6px 2px 0;
}
.inventory-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.inventory-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
}
.inventory-item.equipped, .inventory-pill.equipped {
  border-color: rgba(201,168,76,0.42);
  box-shadow: inset 0 0 0 1px rgba(201,168,76,0.16);
}
.inventory-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.inventory-form-stacked { display: flex; flex-direction: column; gap: 8px; }
.inventory-form-row { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 8px; }
.inventory-form { display: grid; grid-template-columns: 1.5fr 70px 1.2fr auto; gap: 6px; align-items: center; }

.story-frame {
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.story-frame-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}
.story-frame-header h2 { font-size: 28px; color: #fff; line-height: 1.05; }
.story-meta { color: var(--text-muted); font-size: 12px; }
.chat-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.redesigned-chat {
  padding: 4px 4px 4px 0;
}
.msg {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.025);
}
.msg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.msg-body {
  padding: 14px;
  font-size: 14px;
  line-height: 1.7;
}
.dm-msg .msg-header {
  background: rgba(141, 106, 241, 0.16);
  color: #d5c5ff;
}
.player-msg .msg-header {
  background: rgba(116, 164, 255, 0.12);
  color: #bcd5ff;
}
.admin-msg .msg-header {
  background: rgba(201, 168, 76, 0.14);
  color: var(--gold-light);
}
.msg-error .msg-header {
  background: rgba(209, 88, 88, 0.16);
  color: #ffc3c3;
}
.scene-intro-msg {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 80, 0.25);
  background: rgba(255, 200, 50, 0.06);
  padding: 18px 20px;
  text-align: center;
  margin: 8px 0;
}
.scene-intro-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-light, #d4aa40);
  margin-bottom: 6px;
  opacity: 0.75;
}
.scene-intro-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--gold-light, #d4aa40);
  margin-bottom: 10px;
}
.scene-intro-desc {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-muted, #a0a0b0);
  white-space: pre-wrap;
}
.dm-body { white-space: pre-wrap; }
.dm-section {
  margin: 12px 14px 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.028);
  border: 1px solid rgba(255,255,255,0.05);
}
.dm-section-title {
  margin-bottom: 8px;
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.dm-section-body { color: var(--text); line-height: 1.7; }
.dm-typing {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
  padding: 8px 4px;
}
.typing-dots { display: flex; gap: 5px; }
.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--purple);
  animation: typing 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.command-deck {
  padding: 14px;
}
.command-bar {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 18px;
  padding: 12px;
}
.input-status {
  font-size: 12px;
  margin-bottom: 8px;
  color: var(--text-muted);
}
.status-neutral { color: var(--text-muted); }
.status-busy { color: var(--gold-light); }
.status-ok { color: #9ce7b8; }
.status-error { color: #ffb0b0; }
.command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
  align-items: end;
}
.command-row textarea {
  min-height: 76px;
  max-height: 180px;
  border-radius: 16px;
  padding: 14px;
}
.command-send {
  height: 76px;
  border-radius: 16px;
  font-size: 15px;
}
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quick-actions-redesign { margin-top: 12px; }
.quick-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.14s ease;
}
.quick-btn:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.05);
}

.quest-line {
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 14px;
  margin-bottom: 8px;
  font-size: 13px;
}
.combat-state-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.round-badge {
  background: rgba(209, 88, 88, 0.12);
  border: 1px solid rgba(209, 88, 88, 0.24);
  color: #ffb0b0;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
}
.initiative-list, .party-list, .online-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.init-entry, .party-member, .online-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 14px;
  padding: 10px 12px;
}
.init-entry.init-active {
  border-color: rgba(201,168,76,0.4);
  background: rgba(201,168,76,0.08);
}
.init-num {
  min-width: 30px;
  text-align: center;
  font-weight: 800;
  color: var(--gold-light);
}
.init-name { flex: 1; }
.init-arrow { color: var(--gold-light); }
.party-member {
  flex-direction: column;
  align-items: stretch;
}
.party-self { border-color: rgba(141,106,241,0.38); }
.party-name { font-size: 13px; font-weight: 700; color: #fff; }
.party-class { color: var(--text-muted); font-weight: 500; font-size: 11px; }
.party-hp-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.hp-text { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.party-conds { margin-top: 6px; }
.dice-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.dice-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: var(--text-muted);
  font-size: 11px;
}
.dice-mine { color: var(--text); }
.dice-roller { color: var(--gold-light); font-weight: 700; min-width: 60px; }
.dice-total { font-size: 13px; font-weight: 800; color: #fff; }
.dice-reason { color: var(--text-dim); font-style: italic; }
.dice-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.dice-buttons-inline { margin-top: 12px; }
.dice-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--gold-light);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.dice-btn:hover {
  background: rgba(201,168,76,0.08);
  border-color: rgba(201,168,76,0.3);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-online { background: var(--green); box-shadow: 0 0 10px rgba(85,185,125,0.5); }

.dmg-flash {
  position: fixed;
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  font-weight: 800;
  color: #ff7c7c;
  text-shadow: 0 0 16px rgba(209,88,88,0.7);
  pointer-events: none;
  animation: flash-anim 1.5s forwards;
  z-index: 999;
}
@keyframes flash-anim {
  0% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40px); }
}

.game-layout, .sidebar-left, .sidebar-right, .game-main, .input-area { all: unset; }

.dm-page { display: flex; flex-direction: column; min-height: 100vh; }
.dm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px 280px; gap: 16px; padding: 18px; }
.dm-chat-col { min-width: 0; }
.dm-party-col, .dm-controls-col { display: flex; flex-direction: column; gap: 14px; }
.panel-title {
  margin-bottom: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 800;
}
.input-mode-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.mode-tab {
  flex: 1;
  padding: 8px;
  font-size: 12px;
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}
.mode-tab.active { background: rgba(141,106,241,0.18); color: #fff; border-color: rgba(141,106,241,0.35); }
.admin-quick, .hp-controls, .add-condition-row, .custom-hp-row { display: flex; flex-wrap: wrap; gap: 8px; }
.danger-card { border-color: rgba(209, 88, 88, 0.24); }
.conds-display { margin: 4px 0; min-height: 22px; }
.cond-remove { background: none; border: none; color: #ff9a9a; cursor: pointer; }

@media (max-width: 1300px) {
  .game-shell { grid-template-columns: 280px minmax(0, 1fr) 280px; }
}

@media (max-width: 1160px) {
  .game-shell {
    grid-template-columns: 1fr;
    max-height: none;
    min-height: auto;
  }
  .game-rail { overflow: visible; }
  .story-stage { min-height: 70vh; }
  .campaign-scene { white-space: normal; }
}

@media (max-width: 760px) {
  .glass-header, .site-header {
    height: auto;
    padding: 14px;
    align-items: flex-start;
    flex-direction: column;
  }
  .header-center, .campaign-hero, .header-right, .brand-stack { width: 100%; }
  .campaign-hero { align-items: flex-start; }
  .header-right { justify-content: flex-start; flex-wrap: wrap; }
  .game-shell, .dm-layout, .lobby-container { padding: 12px; }
  .command-row { grid-template-columns: 1fr; }
  .command-send { height: 52px; }
  .ability-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .inventory-item { flex-direction: column; }
}
