/* ─── style.css ─────────────────────────────────────────────────────────────
   SV-[NAME] | Survey roguelike
   Palette mirrors config.js COLORS. Update BOTH when changing values.
   Layout: canvas left | sidebar right | touch controls below
   ─────────────────────────────────────────────────────────────────────────── */

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

:root {
  --bg:           #080c12;
  --panel:        #090d14;
  --border:       #2a3a54;
  --border-hot:   #7a4a3a;
  --text:         #9ab0c4;
  --text-dim:     #4a5a70;
  --text-bright:  #ccdce8;
  --terminal:     #52b896;
  --item:         #c8a040;
  --danger:       #d08030;
  --hostile:      #c86040;
  --npc:          #d4b07a;
  --nature:       #4a8050;
  --mountain:     #6070a0;
  --drift-high:   #6080c0;
  --font: 'JetBrains Mono', 'Fira Mono', 'Consolas', 'Courier New', monospace;
}

html, body {
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 40%, #0c1420 0%, var(--bg) 70%);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  height: 100%;
  overflow: hidden;
  user-select: none;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  padding: 12px;
  gap: 8px;
}

#main-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-shrink: 0;
}

/* ── Game canvas ─────────────────────────────────────────────────────────── */

#canvas-wrap {
  position: relative;
  border: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(42,58,84,0.5),
    0 0  8px rgba(82,184,150,0.08),
    0 0 24px rgba(82,184,150,0.05),
    inset 0 0 30px rgba(0,0,0,0.4);
}

#game-canvas {
  display: block;
  image-rendering: pixelated;
}

/* CRT scanline overlay — pseudo-element on the wrap so canvas stays unmodified */
#canvas-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 2px,
      rgba(0,0,0,0.13) 2px,
      rgba(0,0,0,0.13) 4px
    ),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.45) 100%);
  pointer-events: none;
  z-index: 2;
  animation: scanline-flicker 10s ease-in-out infinite;
}

@keyframes scanline-flicker {
  0%, 100% { opacity: 1; }
  48% { opacity: 1; }
  50% { opacity: 0.94; }
  52% { opacity: 1; }
  78% { opacity: 1; }
  80% { opacity: 0.96; }
  82% { opacity: 1; }
}

/* Wall bump: brief border flash + canvas nudge */
#canvas-wrap.bump-n { animation: bump-n 0.15s ease-out; }
#canvas-wrap.bump-s { animation: bump-s 0.15s ease-out; }
#canvas-wrap.bump-e { animation: bump-e 0.15s ease-out; }
#canvas-wrap.bump-w { animation: bump-w 0.15s ease-out; }

@keyframes bump-n { 0%,100%{transform:translateY(0)} 40%{transform:translateY(-3px)} }
@keyframes bump-s { 0%,100%{transform:translateY(0)} 40%{transform:translateY( 3px)} }
@keyframes bump-e { 0%,100%{transform:translateX(0)} 40%{transform:translateX( 3px)} }
@keyframes bump-w { 0%,100%{transform:translateX(0)} 40%{transform:translateX(-3px)} }

/* ── HUD sidebar ─────────────────────────────────────────────────────────── */

#hud {
  width: 210px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 2px solid var(--border);
  padding: 8px 10px;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.2);
}

.hud-panel-title {
  color: var(--uiDim, #3a5060);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 3px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.hud-panel-title::before {
  content: '▸';
  color: var(--terminal);
  font-size: 8px;
  opacity: 0.6;
}

#hud-callsign {
  color: var(--text-bright);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
  text-shadow: 0 0 8px rgba(200,216,232,0.35);
}

#hud-level   { color: var(--text-dim); font-size: 10px; margin-bottom: 4px; }
#hud-credits { color: var(--item);     font-size: 11px; }

.bar-label { color: var(--text-dim); font-size: 9px;  min-width: 44px; display: inline-block; }
.bar-pct   { color: var(--text-dim); font-size: 9px;  }

#hud-hp, #hud-cargo {
  font-size: 11px;
  line-height: 1.9;
  display: block;
}

#hud-log {
  list-style: none;
  font-size: 10px;
  line-height: 1.5;
  max-height: 110px;
  overflow: hidden;
}

#hud-log li {
  border-left: 2px solid var(--border);
  padding-left: 5px;
  margin-bottom: 3px;
  opacity: 0.9;
  word-break: break-word;
}

#hud-quests {
  list-style: none;
  font-size: 10px;
  line-height: 1.6;
  color: var(--text-dim);
}

/* ── Key hints panel ─────────────────────────────────────────────────────── */

#hud-keys .hud-panel-title { margin-bottom: 4px; }

.key-hint {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.8;
  display: flex;
  align-items: center;
  gap: 6px;
}

kbd {
  background: rgba(42,58,84,0.8);
  color: var(--terminal);
  font-family: var(--font);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid rgba(82,184,150,0.25);
  letter-spacing: 0.04em;
  min-width: 26px;
  text-align: center;
  display: inline-block;
}

/* Clickable key-hint rows (I=inventory, L=legend) */
.key-hint-btn {
  cursor: pointer;
  border-radius: 2px;
  padding: 1px 2px;
  margin: -1px -2px;
  transition: background 0.1s;
}
.key-hint-btn:hover { background: rgba(82,184,150,0.10); color: var(--terminal); }
.key-hint-btn:hover kbd { background: var(--terminal); color: var(--panel); }

/* Contextual hint panel */
#hud-hint {
  border-color: var(--terminal) !important;
  border-left-color: var(--terminal) !important;
  box-shadow: inset 0 0 12px rgba(82,184,150,0.06), 0 0 8px rgba(82,184,150,0.08) !important;
}
#hud-hint-text {
  color: var(--terminal);
  font-size: 10px;
  line-height: 1.7;
  text-shadow: 0 0 6px rgba(82,184,150,0.4);
  animation: hint-pulse 1.2s ease-in-out infinite alternate;
}
@keyframes hint-pulse {
  from { opacity: 0.7; }
  to   { opacity: 1.0; }
}

/* ── Earth Systems panel ─────────────────────────────────────────────────── */

#hud-earth { border-color: var(--nature); }
#hud-earth .hud-panel-title { color: var(--nature); }
#hud-earth .earth-bars { font-size: 10px; line-height: 1.9; }

/* ── Flash message ───────────────────────────────────────────────────────── */

#msg-flash {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(9,13,20,0.95);
  border: 1px solid var(--border-hot);
  border-left: 3px solid var(--border-hot);
  padding: 5px 16px 5px 12px;
  font-size: 11px;
  letter-spacing: 0.04em;
  pointer-events: none;
  z-index: 100;
  transition: opacity 0.5s;
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(122,74,58,0.2);
}

#msg-flash.hidden   { display: none; }
#msg-flash.fade-out { opacity: 0; }

/* ── Touch controls ──────────────────────────────────────────────────────── */

#touch-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-shrink: 0;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows:    repeat(3, 44px);
  gap: 3px;
}

.dpad-btn {
  background: linear-gradient(180deg, rgba(18, 26, 38, 0.95) 0%, rgba(10, 16, 24, 0.98) 100%);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: all 0.1s ease;
}

.dpad-btn:hover {
  border-color: rgba(82, 184, 150, 0.4);
  color: var(--text-bright);
}

.dpad-btn:active { 
  background: var(--terminal);
  border-color: var(--terminal); 
  color: #040810;
  box-shadow: 
    0 0 12px rgba(82, 184, 150, 0.4),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: scale(0.95);
}
.dpad-center { visibility: hidden; }

.action-btns { display: flex; flex-direction: column; gap: 6px; }

.action-btn {
  background: linear-gradient(180deg, rgba(18, 26, 38, 0.95) 0%, rgba(10, 16, 24, 0.98) 100%);
  border: 1px solid var(--border-hot);
  color: var(--npc);
  font-family: var(--font);
  font-size: 12px;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 4px;
  letter-spacing: 0.08em;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-width: 60px;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
  transition: all 0.1s ease;
}

.action-btn:hover {
  border-color: var(--npc);
  color: var(--text-bright);
}

.action-btn:active { 
  background: var(--border-hot); 
  color: var(--text-bright);
  box-shadow: 0 0 10px rgba(122, 74, 58, 0.3);
  transform: scale(0.96);
}

/* ── Dialogue overlay ────────────────────────────────────────────────────── */

#dialogue-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,12,18,0.90);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

#dialogue-overlay.hidden { display: none; }

#dialogue-box {
  background: var(--panel);
  border: 1px solid var(--border-hot);
  border-top: 2px solid var(--border-hot);
  max-width: 700px;
  width: 100%;
  display: grid;
  grid-template-columns: 180px 1fr;
  box-shadow:
    0 0 0 1px rgba(122,74,58,0.3),
    0 0 20px rgba(122,74,58,0.15),
    inset 0 0 40px rgba(0,0,0,0.3);
}

#dlg-left {
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(0,0,0,0.25);
}

#dlg-portrait {
  font-size: 12px;
  line-height: 1.4;
  color: var(--npc);
  letter-spacing: 0.04em;
  white-space: pre;
}

.no-portrait { color: var(--text-dim); font-size: 11px; text-align: center; padding-top: 16px; }

.readout        { display: flex; flex-direction: column; margin-bottom: 4px; }
.r-label        { color: var(--text-dim); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; }
.r-value        { color: var(--terminal); font-size: 11px; }

#dlg-right {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  gap: 10px;
  min-height: 280px;
}

#dlg-npc-name  { color: var(--text-bright); font-size: 13px; font-weight: bold; letter-spacing: 0.06em; text-transform: uppercase; text-shadow: 0 0 10px rgba(200,216,232,0.3); }
#dlg-npc-title { color: var(--text-dim);    font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; margin-top: -6px; }

/* NPC speech — warm amber tint so it reads as NPC voice */
#dlg-text {
  color: var(--npc);
  font-size: 12px;
  line-height: 1.7;
  flex: 1;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  overflow-y: auto;
  max-height: 220px;
}

/* Player choices — cool teal, clearly yours */
#dlg-choices {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid rgba(82,184,150,0.25);
  padding-top: 10px;
}

.dlg-choice {
  background: linear-gradient(90deg, rgba(82, 184, 150, 0.08) 0%, rgba(82, 184, 150, 0.03) 100%);
  border: 1px solid rgba(82, 184, 150, 0.25);
  color: var(--terminal);
  font-family: var(--font);
  font-size: 11px;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.12s ease;
}

.dlg-choice:hover, .dlg-choice:focus {
  border-color: var(--terminal);
  color: var(--text-bright);
  background: linear-gradient(90deg, rgba(82, 184, 150, 0.18) 0%, rgba(82, 184, 150, 0.08) 100%);
  box-shadow: 0 0 12px rgba(82, 184, 150, 0.2);
  outline: none;
  transform: translateX(2px);
}

/* Index prefix dimmed, choice text bright */
.dlg-choice .choice-idx  { color: var(--text-dim); margin-right: 4px; }
.dlg-choice .choice-text { color: var(--terminal); }
.dlg-choice:hover .choice-text,
.dlg-choice:focus .choice-text { color: var(--text-bright); }

/* ── Inventory overlay ───────────────────────────────────────────────────── */

#inventory-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,12,18,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

#inventory-overlay.hidden { display: none; }

#inventory-box {
  background: linear-gradient(180deg, rgba(12, 18, 26, 0.98) 0%, rgba(8, 12, 18, 0.99) 100%);
  border: 1px solid var(--border-hot);
  border-top: 2px solid var(--border-hot);
  width: 460px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 12px;
  box-shadow:
    0 0 0 1px rgba(122, 74, 58, 0.2),
    0 0 30px rgba(122, 74, 58, 0.12),
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 40px rgba(0, 0, 0, 0.25);
}

.overlay-title {
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

#inv-list {
  list-style: none;
  overflow-y: auto;
  max-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inv-item {
  padding: 6px 10px;
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 12px;
  border-radius: 3px;
  transition: all 0.12s ease;
}

.inv-item:hover {
  border-color: rgba(82, 184, 150, 0.5);
  background: linear-gradient(90deg, rgba(82, 184, 150, 0.1) 0%, rgba(82, 184, 150, 0.03) 100%);
  box-shadow: 0 0 8px rgba(82, 184, 150, 0.1);
}

.inv-item.selected {
  border-color: var(--terminal);
  background: linear-gradient(90deg, rgba(82, 184, 150, 0.15) 0%, rgba(82, 184, 150, 0.05) 100%);
  box-shadow: 0 0 12px rgba(82, 184, 150, 0.15);
}

.inv-empty { color: var(--text-dim); font-size: 11px; padding: 8px; }

#inv-desc {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.55;
  min-height: 40px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* ── Legend overlay ──────────────────────────────────────────────────────── */

#legend-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,12,18,0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 55;
  padding: 24px;
}

#legend-overlay.hidden { display: none; }

#legend-box {
  background: linear-gradient(180deg, rgba(12, 18, 26, 0.98) 0%, rgba(8, 12, 18, 0.99) 100%);
  border: 1px solid var(--border);
  border-top: 2px solid var(--terminal);
  max-width: 560px;
  width: 100%;
  padding: 22px 26px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow:
    0 0 0 1px rgba(82, 184, 150, 0.1),
    0 0 25px rgba(82, 184, 150, 0.08),
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 40px rgba(0, 0, 0, 0.25);
}

.legend-title {
  color: var(--text-dim);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 14px;
}

.legend-section-title {
  color: var(--text-dim);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 10px 0 6px;
  opacity: 0.7;
}

.legend-grid {
  display: grid;
  grid-template-columns: 28px 1fr 28px 1fr;
  gap: 3px 12px;
  font-size: 11px;
}

.legend-char {
  color: var(--text-bright);
  font-weight: bold;
  letter-spacing: 0.04em;
}

.legend-desc {
  color: var(--text-dim);
}

.legend-close {
  color: var(--text-dim);
  font-size: 10px;
  text-align: right;
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* ── Departure confirm overlay ───────────────────────────────────────────── */

#departure-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,12,18,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 65;
}
#departure-overlay.hidden { display: none; }

#departure-box {
  background: linear-gradient(180deg, rgba(12, 18, 26, 0.98) 0%, rgba(8, 12, 18, 0.99) 100%);
  border: 1px solid var(--nature);
  border-top: 2px solid var(--nature);
  max-width: 480px;
  width: 100%;
  padding: 28px 32px;
  box-shadow:
    0 0 0 1px rgba(74, 128, 80, 0.15),
    0 0 25px rgba(74, 128, 80, 0.1),
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 40px rgba(0, 0, 0, 0.25);
}

#departure-box .dep-header {
  color: var(--nature);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(74,128,80,0.3);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

#departure-box .dep-body {
  color: var(--text);
  font-size: 12px;
  line-height: 1.8;
  margin-bottom: 20px;
}

/* Pod launch scene (animated text) */
#pod-launch {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
  padding: 40px;
}
#pod-launch.hidden { display: none; }

#pod-launch-text {
  color: var(--terminal);
  font-size: 13px;
  line-height: 2.1;
  max-width: 480px;
  text-align: left;
  font-family: var(--font);
  letter-spacing: 0.04em;
  white-space: pre-line;
  text-shadow: 0 0 10px rgba(82, 184, 150, 0.4);
}

#pod-launch-text .launch-line {
  opacity: 0;
  animation: fadein-line 0.4s ease forwards;
}

@keyframes fadein-line {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Diagnose overlay ────────────────────────────────────────────────────── */

#diagnose-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,12,18,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 62;
  padding: 24px;
}
#diagnose-overlay.hidden { display: none; }

#diagnose-box {
  background: linear-gradient(180deg, rgba(12, 18, 26, 0.98) 0%, rgba(8, 12, 18, 0.99) 100%);
  border: 1px solid var(--border);
  border-top: 2px solid var(--terminal);
  max-width: 500px;
  width: 100%;
  padding: 22px 26px;
  box-shadow:
    0 0 0 1px rgba(82, 184, 150, 0.1),
    0 0 25px rgba(82, 184, 150, 0.08),
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 40px rgba(0, 0, 0, 0.25);
}

.diag-header {
  color: var(--text-dim);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 14px;
}

.diag-section { margin-bottom: 14px; }

.diag-section-title {
  color: var(--text-dim);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
  opacity: 0.7;
}

.diag-row {
  display: grid;
  grid-template-columns: 90px 1fr 40px;
  gap: 4px 8px;
  font-size: 11px;
  line-height: 2;
  align-items: center;
}

.diag-label  { color: var(--text-dim); }
.diag-close  {
  color: var(--text-dim);
  font-size: 10px;
  text-align: right;
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* ── Note / lore overlay ─────────────────────────────────────────────────── */

#note-overlay {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse at 50% 50%, rgba(20, 30, 45, 0.4) 0%, transparent 60%),
    #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  cursor: pointer;
  padding: 40px;
  outline: none;
}

#note-overlay.hidden { display: none; }

#note-text {
  color: #e8e8e8;
  font-size: 15px;
  line-height: 2;
  max-width: 640px;
  text-align: center;
  font-family: var(--font);
  letter-spacing: 0.05em;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
  animation: note-fade-in 0.8s ease-out;
}

@keyframes note-fade-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* ── Name entry screen ───────────────────────────────────────────────────── */

#name-screen {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse at 50% 25%, rgba(82, 184, 150, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(82, 184, 150, 0.03) 0%, transparent 35%),
    radial-gradient(ellipse at 50% 50%, #0a1018 0%, #040608 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  z-index: 80;
}

#name-screen.hidden { display: none; }

#name-header { text-align: center; }

#name-header h1 {
  color: var(--text-bright);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  margin-bottom: 14px;
  text-shadow: 
    0 0 20px rgba(82, 184, 150, 0.35),
    0 0 40px rgba(82, 184, 150, 0.15);
  animation: title-glow 4s ease-in-out infinite;
}

@keyframes title-glow {
  0%, 100% { 
    opacity: 0.9; 
    text-shadow: 0 0 20px rgba(82, 184, 150, 0.35), 0 0 40px rgba(82, 184, 150, 0.15); 
  }
  50% { 
    opacity: 1; 
    text-shadow: 0 0 25px rgba(82, 184, 150, 0.5), 0 0 50px rgba(82, 184, 150, 0.25); 
  }
}

#name-header p {
  color: var(--text-dim);
  font-size: 12px;
  max-width: 380px;
  line-height: 1.8;
  opacity: 0.85;
}

#name-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#name-prefix { 
  color: var(--text-dim); 
  font-size: 16px; 
  letter-spacing: 0.15em;
  text-shadow: 0 0 10px rgba(154, 176, 196, 0.2);
}

#name-input {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-hot);
  color: var(--text-bright);
  font-family: var(--font);
  font-size: 20px;
  padding: 10px 18px;
  text-align: center;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  width: 260px;
  outline: none;
  box-shadow: 
    inset 0 0 20px rgba(0, 0, 0, 0.4),
    0 0 15px rgba(0, 0, 0, 0.3);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#name-input:focus { 
  border-color: var(--terminal); 
  box-shadow: 
    inset 0 0 20px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(82, 184, 150, 0.15);
}

/* Pronoun selector */
#pronoun-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.pronoun-btn {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 11px;
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 2px;
  letter-spacing: 0.06em;
  transition: all 0.15s ease;
}

.pronoun-btn:hover  { 
  border-color: var(--border-hot); 
  color: var(--text);
  background: rgba(122, 74, 58, 0.1);
}
.pronoun-btn.active { 
  border-color: var(--terminal);   
  color: var(--text-bright);
  background: rgba(82, 184, 150, 0.1);
  box-shadow: 0 0 10px rgba(82, 184, 150, 0.15);
}

#name-submit {
  background: rgba(82, 184, 150, 0.08);
  border: 1px solid rgba(82, 184, 150, 0.4);
  color: var(--terminal);
  font-family: var(--font);
  font-size: 12px;
  padding: 10px 28px;
  cursor: pointer;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 8px;
  text-shadow: 0 0 8px rgba(82, 184, 150, 0.3);
  transition: all 0.15s ease;
}

#name-submit:hover { 
  border-color: var(--terminal); 
  color: var(--text-bright);
  background: rgba(82, 184, 150, 0.15);
  box-shadow: 0 0 20px rgba(82, 184, 150, 0.25);
  transform: translateY(-1px);
}

/* ── Departure confirm buttons ───────────────────────────────────────────── */
.dep-btn-row { display: flex; gap: 10px; justify-content: flex-end; }

.dep-btn {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 11px;
  padding: 8px 20px;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: all 0.12s ease;
  border-radius: 2px;
}
.dep-btn:hover { 
  border-color: var(--text); 
  color: var(--text-bright);
  background: rgba(154, 176, 196, 0.08);
}
.dep-btn.dep-confirm { 
  border-color: var(--nature); 
  color: var(--nature);
  background: rgba(74, 128, 80, 0.08);
}
.dep-btn.dep-confirm:hover { 
  background: rgba(74, 128, 80, 0.18); 
  color: var(--text-bright);
  box-shadow: 0 0 15px rgba(74, 128, 80, 0.2);
}

/* ── Responsive / mobile ─────────────────────────────────────────────────── */

@media (max-width: 700px) {
  #main-row { flex-direction: column; }
  #hud { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .hud-panel { flex: 1; min-width: 130px; }
  #dialogue-box { grid-template-columns: 1fr; }
  #dlg-left { border-right: none; border-bottom: 1px solid var(--border); }
}
