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

:root {
  /* ── Light / SaaS theme (game area) ── */
  --bg-deep:       #f0f4f8;
  --bg-panel:      #ffffff;
  --bg-card:       #f8fafc;
  --bg-card-hover: #f1f5f9;
  --border:        #e2e8f0;
  --border-bright: #cbd5e1;

  --accent:        #4f46e5;
  --accent-dim:    #4338ca;
  --accent-glow:   rgba(79, 70, 229, 0.14);

  --hp-color:      #ef4444;
  --hp-glow:       rgba(239, 68, 68, 0.2);
  --atk-color:     #f59e0b;
  --def-color:     #3b82f6;

  --text-primary:  #0f172a;
  --text-muted:    #475569;
  --text-dim:      #94a3b8;

  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --font-ui:   system-ui, -apple-system, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ── Dashboard keeps its own dark theme ───────────────────────── */
.dashboard {
  --bg-deep:       #0d0f14;
  --bg-panel:      #12151c;
  --bg-card:       #181c26;
  --bg-card-hover: #1e2330;
  --border:        #1f2535;
  --border-bright: #2a3048;

  --accent:        #00e5a0;
  --accent-dim:    #00b87c;
  --accent-glow:   rgba(0, 229, 160, 0.18);

  --hp-color:      #e05c5c;
  --hp-glow:       rgba(224, 92, 92, 0.25);
  --atk-color:     #f5a623;
  --def-color:     #5b8cff;

  --text-primary:  #d4dbe8;
  --text-muted:    #5a6480;
  --text-dim:      #3a4260;
}

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ───────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  flex-direction: row;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ─── Game Area (Left) ─────────────────────────────────────────── */
.game-area {
  flex: 1;
  min-width: 0;
  background: var(--bg-deep);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;

  /* Subtle grid overlay */
  background-image:
    linear-gradient(rgba(0, 229, 160, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 160, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.game-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(0, 229, 160, 0.05) 0%, transparent 65%);
  pointer-events: none;
}

/* Thin right-border separator */
.game-area::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px; height: 100%;
  background: linear-gradient(to bottom, transparent, var(--border-bright) 30%, var(--border-bright) 70%, transparent);
}

.game-area__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  z-index: 1;
}

.game-title {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  text-shadow: 0 0 40px rgba(0, 229, 160, 0.2);
}

.game-title__prefix {
  color: var(--text-dim);
  font-weight: 400;
}

.game-title__accent {
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow), 0 0 40px var(--accent-glow);
}

.game-area__placeholder {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  animation: blink-cursor 1.2s step-end infinite;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

/* ─── Dashboard (Right) ────────────────────────────────────────── */
.dashboard {
  width: 320px;
  flex-shrink: 0;
  height: 100%;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--border);
}

/* Header */
.dashboard__header {
  padding: 18px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg-deep);
}

.dashboard__logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 1.1rem;
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
}

.logo-text {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.dashboard__version {
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* Sections */
.dashboard__section {
  padding: 16px 20px;
}

.dashboard__section--log {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.section-label {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.dashboard__divider {
  height: 1px;
  background: var(--border);
  margin: 0 20px;
}

/* Player Identity */
.player-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.player-avatar__icon {
  font-size: 1.2rem;
  color: var(--accent);
  opacity: 0.5;
}

.player-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.player-class {
  font-size: 0.65rem;
  color: var(--accent-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Stat row (Level) */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.stat-row__label {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-row__value {
  font-size: 1.4rem;
  font-weight: 700;
}

.stat-row__value.accent {
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent-glow);
}

/* XP Bar */
.xp-block__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
}

.xp-label {
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.xp-values {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.xp-sep {
  margin: 0 2px;
  color: var(--text-dim);
}

.xp-bar {
  position: relative;
  height: 6px;
  background: var(--bg-card);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.xp-bar__fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.xp-bar__glow {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  filter: blur(4px);
  opacity: 0.5;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stats Grid */
.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s, background 0.2s;
}

.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
}

.stat-card__icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.stat-card--hp    .stat-card__icon { color: var(--hp-color); }
.stat-card--attack .stat-card__icon { color: var(--atk-color); }
.stat-card--defense .stat-card__icon { color: var(--def-color); }

.stat-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card__label {
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-card__bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-card__bar {
  flex: 1;
  height: 4px;
  background: var(--bg-deep);
  border-radius: 99px;
  overflow: hidden;
}

.stat-card__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #b03030, var(--hp-color));
  border-radius: 99px;
  transition: width 0.4s ease;
  box-shadow: 0 0 6px var(--hp-glow);
}

.stat-card__value {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-card__value.large {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.stat-card--attack .stat-card__value.large { color: var(--atk-color); }
.stat-card--defense .stat-card__value.large { color: var(--def-color); }

.stat-sep {
  color: var(--text-dim);
  margin: 0 2px;
}

/* Log */
.log-output {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}

.log-output::-webkit-scrollbar {
  width: 4px;
}
.log-output::-webkit-scrollbar-track {
  background: transparent;
}
.log-output::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 99px;
}

.log-line {
  font-size: 0.7rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.log-line--system  { color: var(--text-dim); }
.log-line--info    { color: var(--accent-dim); }
.log-line--warn    { color: var(--atk-color); }
.log-line--damage  { color: var(--hp-color); }

/* Footer */
.dashboard__footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-deep);
}

.footer-ping {
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.footer-info {
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* ─── Character Creation ───────────────────────────────────────── */
.cc-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 0 0 28px;          /* top padding handled by term-bar */
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 10;
  position: relative;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.7), 0 0 60px rgba(0, 229, 160, 0.07);
  animation: cc-breathe 4s ease-in-out infinite;
}

/* CRT scanlines overlay — very subtle on light bg */
.cc-panel::after {
  content: '';
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(79, 70, 229, 0.025) 3px,
    rgba(79, 70, 229, 0.025) 4px
  );
  z-index: 0;
  border-radius: var(--radius-lg);
}

.cc-header {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.cc-header__prefix {
  color: var(--text-dim);
  font-weight: 400;
}

.cc-header__accent {
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}

.cc-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cc-label {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.cc-input {
  background: var(--bg-deep);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  outline: none;
  padding: 10px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cc-input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.cc-input::placeholder {
  color: var(--text-dim);
}

.cc-roles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cc-role-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  padding: 10px 14px;
  transition: border-color 0.2s, background 0.2s;
}

.cc-role-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
}

.cc-role-btn.selected {
  background: rgba(0, 229, 160, 0.06);
  border-color: var(--accent-dim);
}

.cc-role-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.cc-role-desc {
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.cc-start-btn {
  background: var(--accent-dim);
  border: none;
  border-radius: var(--radius-md);
  color: var(--bg-deep);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 13px;
  text-transform: uppercase;
  transition: background 0.2s;
}

.cc-start-btn:hover:not(:disabled) {
  background: var(--accent);
}

.cc-start-btn:disabled {
  cursor: not-allowed;
  opacity: 0.25;
}

/* ─── Game Canvas ──────────────────────────────────────────────── */
#game-canvas {
  display: block;
  left: 0;
  position: absolute;
  top: 0;
  z-index: 1;
}

/* ─── Combat Overlay ───────────────────────────────────────────── */
.combat-overlay {
  align-items: center;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
  z-index: 30;
}

.combat-overlay.hidden {
  display: none;
}

.combat-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.22), 0 0 0 1px var(--border);
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 500px;
  padding: 28px;
  width: 100%;
}

/* Enemy row */
.combat-enemy-row {
  align-items: center;
  display: flex;
  gap: 16px;
}

.combat-enemy-badge {
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  display: flex;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  height: 54px;
  justify-content: center;
  width: 54px;
}

.combat-enemy-meta {
  flex: 1;
  min-width: 0;
}

.combat-name {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.combat-hp-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.combat-hp-track {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 99px;
  flex: 1;
  height: 6px;
  overflow: hidden;
}

.combat-hp-fill {
  background: linear-gradient(90deg, #8b2222, var(--hp-color));
  border-radius: 99px;
  box-shadow: 0 0 6px var(--hp-glow);
  height: 100%;
  transition: width 0.35s ease;
}

.combat-hp-label {
  color: var(--text-muted);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Separator */
.combat-sep {
  background: var(--border);
  height: 1px;
}

/* Question */
.combat-q-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.combat-q-label {
  color: var(--text-dim);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.combat-q-text {
  color: var(--text-primary);
  font-size: 0.88rem;
  line-height: 1.65;
}

/* Answer buttons */
.combat-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.combat-option-btn {
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  font-family: var(--font-mono);
  gap: 12px;
  padding: 10px 14px;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
}

.combat-option-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
}

.combat-option-btn:disabled {
  cursor: not-allowed;
}

.combat-option-btn.correct {
  background: rgba(0, 229, 160, 0.08);
  border-color: var(--accent-dim);
  color: var(--accent);
}

.combat-option-btn.wrong {
  background: rgba(224, 92, 92, 0.08);
  border-color: var(--hp-color);
  color: var(--hp-color);
}

.combat-option-key {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  flex-shrink: 0;
  font-size: 0.6rem;
  margin-top: 1px;
  padding: 2px 6px;
}

.combat-option-text {
  flex: 1;
  font-size: 0.78rem;
  line-height: 1.5;
}

/* Game Over panel — reuses game-area__inner centering */
.gameover-panel {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 360px;
  padding: 36px;
  text-align: center;
  width: 100%;
  z-index: 10;
}

.gameover-title {
  color: var(--hp-color);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 0 20px rgba(224, 92, 92, 0.4);
}

.gameover-msg {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ─── Level-Up Overlay ─────────────────────────────────────────── */
.levelup-overlay {
  align-items: center;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
  z-index: 30;
}

.levelup-overlay.hidden {
  display: none;
}

.levelup-panel {
  background: var(--bg-panel);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.22), 0 0 28px rgba(79, 70, 229, 0.12);
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 460px;
  padding: 28px;
  width: 100%;
}

.levelup-header {
  align-items: center;
  display: flex;
  gap: 16px;
}

.levelup-badge {
  align-items: center;
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-md);
  color: var(--accent);
  display: flex;
  flex-shrink: 0;
  font-size: 1.4rem;
  height: 52px;
  justify-content: center;
  text-shadow: 0 0 14px var(--accent);
  width: 52px;
}

.levelup-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.levelup-eyebrow {
  color: var(--text-dim);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.levelup-headline {
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 0 16px var(--accent-glow);
}

.levelup-prompt {
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* Option buttons */
.levelup-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.levelup-btn {
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  font-family: var(--font-mono);
  gap: 14px;
  padding: 12px 16px;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  width: 100%;
}

.levelup-btn:hover {
  background: rgba(0, 229, 160, 0.06);
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.levelup-btn:active {
  background: rgba(0, 229, 160, 0.12);
}

.lu-key {
  align-items: center;
  background: var(--bg-deep);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--accent-dim);
  display: flex;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  height: 22px;
  justify-content: center;
  margin-top: 1px;
  width: 22px;
}

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

.lu-label {
  color: var(--text-primary);
  font-size: 0.82rem;
  line-height: 1.4;
}

.lu-bonus {
  color: var(--accent);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

/* ─── Stairs Overlay ───────────────────────────────────────────── */
.stairs-overlay {
  align-items: center;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
  z-index: 30;
}

.stairs-overlay.hidden {
  display: none;
}

.stairs-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 320px;
  padding: 32px 36px;
  text-align: center;
  width: 100%;
}

.stairs-icon {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 10px currentColor);
}

.stairs-msg {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.stairs-prompt {
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.stairs-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.stairs-btn {
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 9px 22px;
  text-transform: uppercase;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid var(--border);
  flex: 1;
}

.stairs-btn--yes {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: var(--bg-deep);
}

.stairs-btn--yes:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.stairs-btn--no {
  background: transparent;
  color: var(--text-muted);
}

.stairs-btn--no:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
  color: var(--text-primary);
}

/* ─── Easter Egg Overlay ───────────────────────────────────────── */
.easteregg-overlay {
  align-items: center;
  background: rgba(10, 4, 4, 0.92);
  backdrop-filter: blur(5px);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
  z-index: 40;
}

.easteregg-panel {
  align-items: center;
  animation: eg-pulse 1.4s ease-in-out infinite;
  background: var(--bg-panel);
  border: 2px solid var(--hp-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 40px rgba(224, 92, 92, 0.35);
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 420px;
  padding: 36px 32px;
  text-align: center;
  width: 100%;
}

@keyframes eg-pulse {
  0%, 100% {
    box-shadow: 0 0 30px rgba(224, 92, 92, 0.35);
    border-color: var(--hp-color);
  }
  50% {
    box-shadow: 0 0 60px rgba(224, 92, 92, 0.7), 0 0 100px rgba(224, 92, 92, 0.2);
    border-color: #ff6b6b;
  }
}

.easteregg-icon {
  font-size: 3rem;
  line-height: 1;
}

.easteregg-title {
  color: var(--hp-color);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-shadow: 0 0 20px rgba(224, 92, 92, 0.6);
  text-transform: uppercase;
}

.easteregg-subtitle {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.easteregg-msg {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.75;
  text-align: left;
}

.easteregg-btn {
  background: transparent;
  border: 1px solid var(--hp-color);
  border-radius: var(--radius-md);
  color: var(--hp-color);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-top: 6px;
  padding: 10px 20px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.easteregg-btn:hover {
  background: rgba(224, 92, 92, 0.12);
  border-color: #ff6b6b;
  color: #ff8888;
}

/* ─── Boss Combat Panel ────────────────────────────────────────── */
.combat-panel--boss {
  border-color: #ff3366 !important;
  animation: boss-pulse 1.5s ease-in-out infinite;
}

@keyframes boss-pulse {
  0%, 100% {
    border-color: #ff3366;
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 51, 102, 0.18);
  }
  50% {
    border-color: #ff6688;
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.8), 0 0 70px rgba(255, 51, 102, 0.40);
  }
}

/* ─── Victory Panel ────────────────────────────────────────────── */
.victory-panel {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.8), 0 0 60px rgba(0, 229, 160, 0.12);
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 440px;
  padding: 36px;
  text-align: center;
  width: 100%;
  z-index: 10;
  animation: victory-glow 2.2s ease-in-out infinite;
}

@keyframes victory-glow {
  0%, 100% {
    border-color: var(--accent-dim);
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.18), 0 0 40px rgba(79, 70, 229, 0.12);
  }
  50% {
    border-color: var(--accent);
    box-shadow: 0 8px 60px rgba(0, 0, 0, 0.22), 0 0 80px rgba(79, 70, 229, 0.28);
  }
}

.victory-emoji {
  font-size: 3.2rem;
  line-height: 1;
}

.victory-title {
  color: var(--accent);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 0 24px var(--accent-glow), 0 0 48px var(--accent-glow);
}

.victory-subtitle {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.victory-msg {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.75;
  text-align: left;
}

.victory-stats {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
}

.vs-row {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  padding: 9px 16px;
}

.vs-row:last-child {
  border-bottom: none;
}

.vs-label {
  color: var(--text-muted);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.vs-val {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
}

/* ─── Character Creation — retro terminal styles ─────────────────── */

@keyframes cc-breathe {
  0%, 100% { box-shadow: 0 4px 40px rgba(0,0,0,0.12), 0 0 40px rgba(79,70,229,0.08); }
  50%       { box-shadow: 0 8px 60px rgba(0,0,0,0.18), 0 0 70px rgba(79,70,229,0.20); }
}

/* Terminal title bar */
.cc-term-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.35);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 9px 14px;
  position: relative;
  z-index: 1;
}

.cc-term-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cc-term-dot--red    { background: #ff5f57; }
.cc-term-dot--orange { background: #febc2e; }
.cc-term-dot--green  { background: #28c840; }

.cc-term-id {
  margin-left: 8px;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Protocol / company header */
.cc-protocol {
  padding: 0 28px;
  position: relative;
  z-index: 1;
}

.cc-protocol__eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.cc-protocol__title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.cc-protocol__accent {
  color: var(--accent);
  text-shadow: 0 0 22px var(--accent-glow);
}

.cc-protocol__lead {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
  border-left: 2px solid var(--accent-dim);
  padding-left: 12px;
}

/* Instructions box */
.cc-instructions {
  margin: 0 28px;
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  position: relative;
  z-index: 1;
}

.cc-instructions__hdr {
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  color: var(--accent-dim);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.cc-instr-row {
  display: flex;
  gap: 14px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.75rem;
  line-height: 1.5;
  align-items: flex-start;
}

.cc-instr-row--last {
  border-bottom: none;
}

.cc-instr-key {
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  min-width: 110px;
  padding-top: 1px;
}

.cc-instr-val {
  color: var(--text-muted);
  flex: 1;
}

.cc-instr-hl {
  color: var(--accent);
  font-weight: 700;
}

.cc-instr-hp {
  color: #f97316;
  font-weight: 700;
}

/* Item badges */
.cc-badge {
  display: inline-block;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  letter-spacing: 0.04em;
}
.cc-badge--b { background: rgba(255,215,0,0.15);   color: #ffd700; border: 1px solid rgba(255,215,0,0.3); }
.cc-badge--i { background: rgba(96,165,250,0.15);  color: #60a5fa; border: 1px solid rgba(96,165,250,0.3); }
.cc-badge--s { background: rgba(52,211,153,0.15);  color: #34d399; border: 1px solid rgba(52,211,153,0.3); }
.cc-badge--r { background: rgba(192,132,252,0.15); color: #c084fc; border: 1px solid rgba(192,132,252,0.3); }

/* Field & button spacing inside panel */
.cc-panel .cc-field {
  padding: 0 28px;
  position: relative;
  z-index: 1;
}

.cc-panel .cc-start-btn {
  margin: 0 28px;
  position: relative;
  z-index: 1;
}


/* ═══════════════════════════════════════════════════════════════
   MOBILE HUD  (hidden on desktop, shown via media query below)
   ═══════════════════════════════════════════════════════════════ */
.mobile-hud {
  display: none;  /* shown only on mobile via @media */
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 20;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.mobile-hud__stats {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(13, 15, 20, 0.72);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  padding: 6px 10px;
}

.mobile-hud__hp-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mobile-hud__hp-track {
  flex: 1;
  height: 5px;
  background: var(--bg-deep);
  border-radius: 99px;
  overflow: hidden;
}

.mobile-hud__hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b2222, var(--hp-color));
  border-radius: 99px;
  transition: width 0.3s ease;
}

.mobile-hud__hp-text {
  font-size: 0.6rem;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.mobile-hud__floor {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.mobile-hud__toggle {
  pointer-events: all;
  background: rgba(13, 15, 20, 0.72);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.1rem;
  height: 34px;
  width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.mobile-hud__toggle:active {
  background: var(--bg-card);
  border-color: var(--accent);
}


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE  (≤ 768 px)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Stack layout: canvas on top, drawer below */
  .app-wrapper {
    flex-direction: column;
  }

  /* Game area fills the whole viewport */
  .game-area {
    flex: 1;
    width: 100%;
    min-height: 0;
  }

  /* Show the floating HUD */
  .mobile-hud {
    display: flex;
  }

  /* Dashboard becomes a slide-up bottom drawer */
  .dashboard {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 65%;
    border-left: none;
    border-top: 1px solid var(--border-bright);
    border-radius: 16px 16px 0 0;
    transform: translateY(calc(100% - 52px));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    overflow: hidden;
  }

  .dashboard--open {
    transform: translateY(0);
  }

  /* Drag handle indicator on top of the header */
  .dashboard__header::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border-bright);
    border-radius: 99px;
    margin: 0 auto 10px;
  }

  .dashboard__header {
    cursor: pointer;
    padding-top: 14px;
  }

  /* Combat panel: full-width, scrollable */
  .combat-panel {
    max-width: 100%;
    max-height: 85dvh;
    overflow-y: auto;
    padding: 20px 16px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .combat-overlay {
    align-items: flex-end;
    padding: 0;
  }

  /* Bigger tap targets for answer buttons */
  .combat-option-btn {
    min-height: 48px;
    padding: 12px 14px;
  }

  /* Question text slightly smaller to save space */
  .combat-q-text {
    font-size: 0.84rem;
  }

  /* Character creation: full-width, scrollable */
  .cc-panel {
    width: calc(100% - 24px);
    max-width: 100%;
    max-height: 88dvh;
    margin: 0 12px;
  }
}
