/* ── Reset & variables ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0d1117;
  --surface:  #161b22;
  --surface2: #1c2129;
  --border:   #30363d;
  --text:     #c9d1d9;
  --muted:    #6e7681;
  --accent:   #d4a017;
  --accent2:  #f0c040;
  --red:      #f85149;
  --green:    #56d364;
  --cyan:     #79c0ff;
  --purple:   #bc8cff;
  --yellow:   #e3b341;
  --radius:   8px;
  --hud-h:    52px;
  --input-h:  56px;
}

html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; }

/* ── LOGIN OVERLAY ──────────────────────────────────────────────── */
#login-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 100;
}

#login-box {
  width: min(480px, 96vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  display: flex; flex-direction: column; gap: 20px;
}

#login-logo {
  font-family: "Courier New", monospace;
  font-size: .52rem; line-height: 1.2;
  color: var(--accent2); text-align: left;
  white-space: pre; overflow: hidden;
  margin: 0 auto;
}
@media (min-width: 480px) { #login-logo { font-size: .62rem; } }
@media (min-width: 600px) { #login-logo { font-size: .72rem; } }
#login-sub { color: var(--muted); text-align: center; font-size: .9rem; }

#login-form { display: flex; flex-direction: column; gap: 14px; }

#login-form label { font-size: .82rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.note { font-size: .78rem; text-transform: none; font-weight: 400; color: var(--muted); }

#inp-name {
  width: 100%; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 1rem; outline: none;
}
#inp-name:focus { border-color: var(--accent); }

.radio-row { display: flex; gap: 20px; }
.radio-opt { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: .95rem; color: var(--text); }
.radio-opt input { accent-color: var(--accent); }

#class-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.cls-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 8px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.cls-card:hover { border-color: var(--accent); }
.cls-card.active { border-color: var(--accent); background: #1a1507; }
.cls-icon { font-size: 1.5rem; margin-bottom: 4px; }
.cls-name { font-size: .82rem; font-weight: 600; color: var(--accent2); margin-bottom: 4px; }
.cls-stat { font-size: .72rem; color: var(--muted); }

#enter-btn {
  margin-top: 6px; padding: 12px;
  background: var(--accent); border: none; border-radius: var(--radius);
  color: #000; font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: background .15s;
}
#enter-btn:hover { background: var(--accent2); }
#login-err { color: var(--red); font-size: .88rem; min-height: 1.2em; }

/* ── ERROR MODAL ─────────────────────────────────────────────────── */
#error-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
}
#error-overlay[hidden] { display: none; }
#error-box {
  background: var(--surface); border: 1px solid var(--red);
  border-radius: 12px; padding: 32px 28px;
  text-align: center; width: min(360px, 92vw);
  display: flex; flex-direction: column; gap: 16px;
}
#error-icon { font-size: 2.4rem; }
#error-msg  { color: var(--text); font-size: .95rem; line-height: 1.5; }
#error-ok {
  padding: 10px 24px; background: var(--red); border: none;
  border-radius: var(--radius); color: #fff;
  font-weight: 700; font-size: .95rem; cursor: pointer;
  transition: opacity .15s;
}
#error-ok:hover { opacity: .85; }

/* ── GAME UI ────────────────────────────────────────────────────── */
#game-ui {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}

/* HUD */
#hud {
  height: var(--hud-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  overflow: hidden;
}

#hud-name { font-weight: 700; color: var(--accent2); white-space: nowrap; margin-right: 4px; }

.hud-stat { display: flex; align-items: center; gap: 6px; }
.stat-label { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.stat-val   { font-size: .78rem; white-space: nowrap; }
/* ── Pill-style bars with embedded text (desktop + mobile) ───────── */
.bar-wrap   {
  width: 115px; height: 20px;
  background: var(--border);
  border-radius: 10px; overflow: hidden;
  position: relative; flex-shrink: 0;
}
.bar-fill   { height: 100%; border-radius: 10px; transition: width .3s; }

/* Text overlay inside the bar */
.bar-inlabel {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-family: system-ui, sans-serif; font-weight: 500;
  color: rgba(255,255,255,0.95); white-space: nowrap;
  pointer-events: none; letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

/* Hide the separate label + number — bar shows everything */
.stat-label { display: none; }
.stat-val   { display: none; }
.bar-fill.hp { background: var(--green); }
.bar-fill.mp { background: var(--cyan); }
.bar-fill.xp { background: var(--purple); }
.xp-stat    { margin-left: auto; }

#hud-gold { font-size: .85rem; color: var(--yellow); white-space: nowrap; }

/* Main area */
#main {
  flex: 1; display: flex; overflow: hidden;
}

/* ── Resize handle between log and right panel ───────────────────── */
#resize-handle {
  width: 5px; flex-shrink: 0;
  background: var(--border);
  cursor: col-resize;
  transition: background .15s;
  position: relative; z-index: 10;
}
#resize-handle:hover { background: var(--accent); }
#resize-handle.dragging { background: var(--accent2); }
@media (max-width: 640px) { #resize-handle { display: none; } }

/* Game log */
/* log-wrap is the outer frame — does NOT scroll */
#log-wrap {
  flex: 1; overflow: hidden; position: relative;
  display: flex; flex-direction: column;
}

/* Watermark sits in a fixed overlay — never scrolls */
#log-watermark {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 20px;
  pointer-events: none; user-select: none; overflow: hidden;
}
#log-watermark pre {
  font-family: "Courier New", monospace;
  font-size: clamp(.32rem, 1.1vw, .72rem);
  line-height: 1.25; white-space: pre;
  color: var(--accent2); opacity: .04;
  text-align: left; margin: 0;
  transform: rotate(-20deg);
}

/* #log scrolls inside log-wrap */
#log {
  flex: 1; overflow-y: auto; padding: 14px 16px;
  scroll-behavior: smooth; position: relative; z-index: 1;
  font-family: "Courier New", monospace; font-size: .88rem;
  line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}

/* ANSI color classes */
/* ANSI colour classes — global so they work in log, action panel, and char panel */
.cl-yellow { color: var(--yellow); }
.cl-red    { color: var(--red);    }
.cl-cyan   { color: var(--cyan);   }
.cl-green  { color: var(--green);  }
.cl-purple { color: var(--purple); }
.cl-blue   { color: #58a6ff;       }
.cl-dim    { color: var(--muted);  }

/* Item rarity/type colours in action panel entity labels.
   Must target .entity-label specifically to override the
   inherited color: var(--text) from .entity-toggle. */
.entity-label.cl-yellow       { color: var(--yellow) !important; }
.entity-label.cl-purple       { color: var(--purple) !important; }
.entity-label.cl-blue         { color: #58a6ff       !important; }
.entity-label.cl-common-equip { color: #c8a96e       !important; }
.entity-label.cl-common-use   { color: #7db87d       !important; }

/* Actions panel */
#actions {
  width: 230px; flex-shrink: 0;
  background: var(--surface2); border-left: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden;
  padding: 10px 8px;
  display: flex; flex-direction: column; gap: 10px;
}

/* ── Character panel ─────────────────────────────────────────────── */
#char-panel {
  flex-shrink: 0;
  padding: 6px 4px 8px;
  border-bottom: 1px solid var(--border);
}

.cp-label {
  font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--accent2); margin-bottom: 5px;
}

/* 2-column grid; helmet spans both columns */
.cp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.cp-full { grid-column: 1 / -1; }

.cp-slot {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 6px;
  display: flex; flex-direction: column; gap: 1px;
  transition: border-color .15s;
}
.cp-slot.equipped { border-color: var(--accent); }

.cp-unequip-btn {
  margin-left: auto; padding: 0 5px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 3px; color: var(--muted);
  font-size: .65rem; cursor: pointer; line-height: 1.4;
  transition: background .12s, color .12s;
}
.cp-unequip-btn:hover { background: var(--red); color: #fff; border-color: var(--red); }

.cp-slot-hd {
  font-size: .72rem; line-height: 1.2;
  color: var(--muted); white-space: nowrap;
  display: flex; align-items: center; gap: 4px;
}
.cp-slot-key { font-size: .6rem; vertical-align: middle; }

.cp-slot-name {
  font-size: .68rem; color: var(--text);
  line-height: 1.25; word-break: break-word;
}
.cp-slot-name.empty { color: var(--muted); font-style: italic; }

.cp-slot-stat {
  font-size: .6rem; color: var(--cyan); line-height: 1.3;
}

/* Rarity colours */
.cp-slot-name.r-rare      { color: #58a6ff; }
.cp-slot-name.r-epic      { color: #bc8cff; }
.cp-slot-name.r-legendary { color: #e3b341; }

/* Spell list */
#cp-spell-list { display: flex; flex-direction: column; gap: 2px; }
.cp-spell {
  font-size: .68rem; color: var(--purple);
  padding: 2px 4px; background: var(--surface);
  border-radius: 4px; border: 1px solid var(--border);
}

/* ── Action groups ───────────────────────────────────────────────── */
.action-group { display: flex; flex-direction: column; gap: 4px; }

.action-group-title {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
  padding: 0 4px 2px; border-bottom: 1px solid var(--border);
}
.action-group-title.collapsible {
  cursor: pointer; user-select: none;
  display: flex; justify-content: space-between; align-items: center;
}
.action-group-title.collapsible:hover { color: var(--text); }
.grp-caret { font-size: .6rem; opacity: .6; }

/* Hide group content when collapsed */
.action-group.grp-collapsed > :not(.action-group-title) { display: none; }

/* Flat buttons (exits) */
.action-btn {
  width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 6px;
  border: 1px solid transparent;
  background: var(--surface); color: var(--text);
  font-size: .8rem; cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-height: 36px;
}
.action-btn:hover  { background: #2d333b; border-color: var(--border); }
.action-btn:active { background: #1a1507; border-color: var(--accent); }

/* Entity rows (NPC / item / player) */
.entity-row { display: flex; flex-direction: column; }

/* ── JS-driven entity tooltip (position: fixed, escapes overflow) ── */
#entity-tooltip {
  position: fixed; z-index: 800;
  background: #1a2030; border: 1px solid var(--accent);
  border-radius: 6px; padding: 8px 11px;
  font-size: .72rem; color: var(--text); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  max-width: 240px; pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.6);
  font-family: "Courier New", monospace;
  transition: opacity .15s;
  box-sizing: border-box;
}

.entity-toggle {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 7px 10px; border-radius: 6px;
  border: 1px solid transparent;
  background: var(--surface); color: var(--text);
  font-size: .8rem; cursor: pointer; text-align: left;
  transition: background .12s, border-color .12s;
  min-height: 36px;
}
.entity-toggle:hover   { background: #2d333b; border-color: var(--border); }
.entity-toggle.open    { background: #1a1e26; border-color: var(--accent); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

/* Hostile NPC rows — always visible, red tint */
.hostile-toggle { border-color: #3d1a1a !important; background: #1a0f0f !important; cursor: pointer; }
.hostile-toggle:hover { background: #2a1515 !important; border-color: var(--red) !important; }
.chip-hostile { border-color: #5a2222; color: var(--red); }
.chip-hostile:hover { background: var(--red); color: #fff; border-color: var(--red); }
.entity-icon  { flex-shrink: 0; display: none; }
.entity-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-caret { flex-shrink: 0; font-size: .65rem; color: var(--muted); transition: transform .15s; }
.entity-toggle.open .entity-caret { transform: rotate(180deg); }

.entity-chips {
  display: none; flex-wrap: wrap; gap: 4px;
  padding: 6px 8px;
  background: #131820; border: 1px solid var(--accent);
  border-top: none; border-radius: 0 0 6px 6px;
}
.entity-chips.open { display: flex; }

.chip {
  padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2); color: var(--text);
  font-size: .76rem; cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.chip:hover  { background: var(--accent); border-color: var(--accent); color: #000; }
.chip:active { opacity: .8; }

/* Input bar */
/* ── Terminal prompt line (lives inside #log) ───────────────────── */
.prompt-line {
  display: flex; align-items: baseline; gap: 6px;
  font-family: "Courier New", monospace; font-size: .88rem;
  padding-top: 6px; margin-top: 2px;
  border-top: 1px solid var(--border);
}

.prompt-gt {
  color: var(--accent);
  flex-shrink: 0;
}

.prompt-text { color: var(--text); white-space: pre; }

.prompt-cur {
  color: var(--accent); line-height: 1;
  animation: cur-blink 1s step-end infinite;
}
@keyframes cur-blink { 50% { opacity: 0; } }

/* ── Mobile input bar (hidden on desktop) ───────────────────────── */
#mobile-bar { display: none; }

/* ── RESPONSIVE (≤768px) ────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Full-screen game container */
  #game-ui {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* HUD — compact single row */
  #hud {
    gap: 6px;
    padding: 4px 10px;
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  #hud-name    { font-size: 0.82rem; max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 1; min-width: 0; }
  #hud-gold    { display: none; }
  .bar-wrap    { width: 96px; height: 18px; }   /* slightly narrower on mobile to fit */
  .bar-inlabel { font-size: 0.62rem; }
  .hud-stat    { gap: 2px; flex-shrink: 0; }
  /* xp-stat visible on mobile — shows level */

  /* Main area: log on top, actions below */
  #main {
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  /* Log: fills available space */
  #log-wrap {
    flex: 1;
    min-height: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  #log-watermark { display: none; }

  /* Hide desktop resize handle */
  #resize-handle { display: none; }

  /* Action panel: scrollable vertical strip at bottom */
  #actions {
    width: 100% !important;
    height: 240px;
    flex-shrink: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 8px;
    gap: 6px;
    flex-direction: column;
  }

  /* Char panel: compact 2-col grid */
  #char-panel { margin-bottom: 2px; }
  .cp-grid    { grid-template-columns: 1fr 1fr; gap: 3px; }
  .cp-full    { grid-column: span 2; }
  .cp-slot    { padding: 3px 6px; }
  .cp-slot-name { font-size: 0.72rem; }
  .cp-slot-stat { font-size: 0.62rem; }
  #cp-spells  { display: none; }

  /* Action groups: flex-row with wrap so buttons flow after the full-width title */
  .action-group {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 5px;
    width: 100%;
  }
  /* Title takes full width → buttons wrap onto next line */
  .action-group-title {
    writing-mode: horizontal-tb;
    border-bottom: 1px solid var(--border);
    border-right: none;
    padding: 0 0 2px 0;
    margin-right: 0;
    margin-bottom: 0;
    font-size: 0.68rem;
    width: 100%;
    flex-shrink: 0;
  }
  /* Entity rows still stack vertically */
  .entity-row { width: 100%; }

  /* Touch-friendly buttons */
  .action-btn {
    min-height: 40px;
    font-size: 0.8rem;
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .chip { min-height: 36px; padding: 6px 14px; }

  /* Entity chip rows: wrap */
  .entity-chips { flex-wrap: wrap; }

  /* Chat panel: slim */
  #chat-panel { margin-top: 4px; }
  #chat-log   { height: 60px; }
  .chat-tab   { font-size: 0.7rem; padding: 2px 6px; }

  /* Mobile input bar */
  #mobile-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
  }

  #mobile-input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: "Courier New", monospace;
    font-size: 0.92rem;
    padding: 10px 12px;
    outline: none;
    -webkit-appearance: none;
  }
  #mobile-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(212,170,84,.2); }

  #mobile-send {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #mobile-send:active { opacity: 0.8; }

  /* Hide desktop prompt line — mobile uses the input bar */
  .prompt-line { display: none; }
}

/* ── Chat panel ─────────────────────────────────────────────────── */
#chat-panel {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: 6px;
  margin-top: 8px; overflow: hidden; flex-shrink: 0;
}

#chat-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2); padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}

#chat-title {
  font-size: .74rem; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: .06em; font-weight: 600;
}

#chat-tabs { display: flex; gap: 2px; }

.chat-tab {
  font-size: .74rem; padding: 2px 8px; border-radius: 4px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-dim); cursor: pointer; position: relative;
  transition: background .12s, color .12s;
}
.chat-tab:hover   { background: var(--surface); color: var(--text); }
.chat-tab.active  { background: var(--accent); color: #000; border-color: var(--accent); }

#pm-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #e05; color: #fff; font-size: .62rem; font-weight: 700;
  border-radius: 999px; min-width: 14px; height: 14px;
  padding: 0 3px; margin-left: 3px; line-height: 1;
}
#pm-badge[hidden] { display: none; }

#chat-log {
  height: 120px; overflow-y: auto; padding: 6px 8px;
  font-size: .8rem; display: flex; flex-direction: column; gap: 2px;
  background: var(--bg);
}

.chat-msg {
  display: flex; gap: 5px; line-height: 1.4;
}
.chat-from {
  font-weight: 700; flex-shrink: 0; white-space: nowrap;
}
.chat-text { color: var(--text); word-break: break-word; }

/* channel colours */
.chat-msg.ch-room   .chat-from { color: #5bc; }
.chat-msg.ch-world  .chat-from { color: #e90; }
.chat-msg.ch-private .chat-from { color: #c7f; }
.chat-msg.ch-private_out .chat-from { color: #aaa; }
.chat-msg.ch-private_out .chat-text  { color: #aaa; }

/* ── Target-type badges (spell panel & buttons) ─────────────────── */
.sp-target {
  display: inline-block;
  font-size: .67rem; font-weight: 700;
  padding: 0 4px; border-radius: 3px;
  margin: 0 2px; vertical-align: middle; line-height: 1.4;
}
.sp-target-single { background: #1a4060; color: #7cf; border: 1px solid #2a6090; }
.sp-target-aoe    { background: #502010; color: #f94; border: 1px solid #904020; }
.sp-target-self   { background: #1a3520; color: #6d4; border: 1px solid #2a5530; }

/* ── Cinematic intro overlay ────────────────────────────────────── */
#cin-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: #000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 2s ease;
}
#cin-overlay.active  { display: flex; }
#cin-overlay.fade-out { opacity: 0; pointer-events: none; }

#cin-content {
  max-width: 480px;
  width: 88%;
  text-align: center;
  color: #b8a890;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.02rem;
  line-height: 2.3;
  letter-spacing: 0.06em;
}

.cin-line {
  display: block;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.cin-line.on  { opacity: 1; }
.cin-line.dim { color: #706050; font-size: 0.875rem; line-height: 2.7; letter-spacing: 0.04em; }
.cin-gap      { display: block; height: 1.5em; }

#cin-skip {
  position: absolute;
  bottom: 28px; right: 32px;
  background: transparent;
  border: 1px solid #2a2a2a;
  color: #383838;
  padding: 5px 16px;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s;
}
#cin-skip:hover { color: #888; border-color: #666; }

/* ── Clickable spell rows in char panel ─────────────────────────── */
.cp-spell-btn {
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s;
}
.cp-spell-btn:hover  { background: var(--surface2); }
.cp-spell-btn:active { background: var(--accent); color: #000; }
.cp-spell-btn:active .sp-target { background: rgba(0,0,0,0.2); }

/* ── Cinematic name reveal ──────────────────────────────────────── */
.cin-name {
  font-size: 1.5rem;
  letter-spacing: 0.2em;
  color: #c8b080;
  font-style: italic;
}

/* Hidden command input — off-screen, zero-size, captures keystrokes */
.cmd-input-hidden {
  position: fixed;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  width: 1px;
  height: 1px;
}

/* Spell label top margin */
#cp-spell-label { margin-top: 6px; }

.spell-cost   { color: var(--muted); }
.spell-effect { color: var(--cyan);  }

/* ── Death animation mode ────────────────────────────────────────── */
#cin-overlay.death-mode #cin-content {
  color: #8fa8b8;           /* cooler, more muted than prologue */
  letter-spacing: 0.08em;
  line-height: 2.5;
}

/* Final quote line — slightly warmer, italic, more spacing */
.cin-quote {
  color: #c8bea8;
  letter-spacing: 0.16em;
  line-height: 3;
  font-style: italic;
}

/* Mobile command echo in log */
.mobile-cmd-echo { color: var(--accent); opacity: 0.8; display: block; }

/* ── Death animation dialogue alignment ─────────────────────────── */
#cin-overlay.death-mode #cin-content {
  text-align: center;   /* narrator lines stay centered */
}
.cin-dialog-left {
  text-align: left;
  padding-left: 4px;
  letter-spacing: 0.04em;
}
.cin-dialog-right {
  text-align: right;
  padding-right: 4px;
  letter-spacing: 0.04em;
}

/* ── Ending animation — persona voices ──────────────────────────── */
/* Eden (伊登): left, warm, wide spacing */
.cin-eden  { text-align: left;  padding-left: 4px;  color: #c8b898; letter-spacing: 0.08em; }
/* Ao (奧): center, cool, minimal */
.cin-ao    { text-align: center; color: #a0b8c8; letter-spacing: 0.02em; }
/* Jian (緘): right, dim, very brief */
.cin-jian  { text-align: right; padding-right: 4px; color: #7890a0; }
/* Shi (噬): offset-left, grey-blue, irregular */
.cin-shi   { text-align: left; padding-left: 18%; color: #9090a8; letter-spacing: 0.05em; }
/* Player: center, gold italic */
.cin-player { text-align: center; color: var(--accent2); font-style: italic; letter-spacing: 0.1em; }
/* Narrator stage directions: center, dim, italic, small */
.cin-narr  { text-align: center; color: #606878; font-style: italic; font-size: 0.85rem; }
/* The END text */
.cin-end   { text-align: center; color: #c8b898; letter-spacing: 0.3em; font-size: 1.1rem; line-height: 3; }
/* Ending choice options */
.cin-choice {
  display: block; text-align: center;
  cursor: pointer; padding: 6px 0;
  color: #9aacb8; letter-spacing: 0.12em;
  transition: color 0.2s;
}
.cin-choice:hover { color: var(--accent2); }

/* XP bar wider to fit "Lv15  35/100" */
.xp-stat .bar-wrap { width: 130px; }
@media (max-width: 768px) {
  .xp-stat .bar-wrap { width: 110px; }
}

/* ── Game version label (below watermark) ───────────────────────── */
/* Version label — right panel */
#game-version {
  display: block;
  text-align: center;
  font-family: "Courier New", monospace;
  font-size: 0.68rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  padding: 8px 0 6px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  flex-shrink: 0;
  user-select: none;
}

/* Version label — login box */
.login-version {
  text-align: center;
  font-family: "Courier New", monospace;
  font-size: 0.68rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  margin-top: 4px;
  user-select: none;
}
