/* =============================================
   EPI DETECTIVE v1.5 — CORE STYLES
   Light & bright blue theme (Operation Salad Bar-inspired)
   ============================================= */

:root {
  --font-pixel: 'Press Start 2P', monospace;
  --font-mono:  'Share Tech Mono', monospace;
  --font-body:  'Share Tech Mono', monospace;

  /* ── Light blue palette ── */
  --bg:          #e8f4fb;
  --bg-panel:    #ffffff;
  --surface:     #d0eaf7;
  --surface2:    #bcdff2;
  --border:      #3a8fc4;
  --border-dark: #1f6a99;
  --text:        #0a2a40;
  --text-dim:    #2a5a7a;
  --text-faint:  #6a9ab8;

  --green:       #1a9e3f;
  --green-dim:   #a8ddb8;
  --green-bg:    #e6f7ec;
  --yellow:      #c47800;
  --yellow-bg:   #fff8e1;
  --orange:      #d45c00;
  --red:         #c0202e;
  --red-bg:      #fdecea;
  --cyan:        #0077b6;
  --cyan-light:  #90caf9;
  --magenta:     #7b2d8b;
  --blue:        #1565c0;
  --blue-light:  #e3f2fd;
  --white:       #ffffff;

  /* Rank colors (adjusted for light bg) */
  --rank-rookie:  #5a7a8a;
  --rank-epi:     #1a9e3f;
  --rank-senior:  #0077b6;
  --rank-expert:  #c47800;
  --rank-world:   #7b2d8b;

  --shadow:      0 2px 8px rgba(0,60,100,0.12);
  --shadow-lg:   0 4px 20px rgba(0,60,100,0.18);
  --transition:  120ms ease;
  --radius:      4px;
}

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

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
}

/* ============================================= 
   GAME SHELL
   ============================================= */
#game-shell {
  width: 100%;
  max-width: 960px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 10px;
}

/* ============================================= 
   HUD BAR
   ============================================= */
#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--cyan);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  gap: 8px;
}

#hud-logo {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: #fff;
  letter-spacing: 2px;
}

#hud-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.hud-stat {
  font-size: 7px;
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.hud-stat-label { color: rgba(255,255,255,0.65); font-size: 6px; font-family: var(--font-pixel); }
.hud-stat-value { color: #fff; font-family: var(--font-pixel); font-size: 8px; }
.hud-stat-value.rank { color: #ffd600; }

@keyframes blink { 0%,49%{opacity:1} 50%,100%{opacity:0} }
.blink { animation: blink 1s steps(1) infinite; }

/* XP bar */
#xp-bar-wrap { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
#xp-bar-label { font-size: 6px; color: rgba(255,255,255,0.65); font-family: var(--font-pixel); }
#xp-bar {
  width: 120px; height: 8px;
  background: rgba(0,0,0,0.2);
  border-radius: 2px;
  overflow: hidden;
}
#xp-fill {
  height: 100%;
  background: #ffd600;
  transition: width 0.4s ease;
  width: 0%;
}

/* ============================================= 
   VIEWPORT
   ============================================= */
#viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ============================================= 
   TITLE SCREEN
   ============================================= */
#title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  gap: 20px;
  min-height: 420px;
  text-align: center;
  background: linear-gradient(160deg, #0d47a1 0%, #0077b6 50%, #00b4d8 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  color: #fff;
}

#title-screen canvas {
  position: absolute; top: 0; left: 0; opacity: 0.35;
}

.title-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; z-index: 1; }
.title-main {
  font-family: var(--font-pixel);
  font-size: clamp(18px, 3.5vw, 28px);
  color: #fff;
  text-shadow: 0 2px 16px rgba(0,0,0,0.4);
  letter-spacing: 4px;
}
.title-sub {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: #ffd600;
  letter-spacing: 2px;
}
.title-tagline {
  font-family: var(--font-body);
  font-size: 14px;
  color: rgba(255,255,255,0.9);
  max-width: 500px;
  line-height: 1.6;
  z-index: 1;
}
.title-press-start {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: #ffd600;
  text-shadow: 0 1px 8px rgba(0,0,0,0.3);
  z-index: 1;
}
.title-credits {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: rgba(255,255,255,0.55);
  line-height: 1.9;
  z-index: 1;
}

@keyframes pixelFadeIn { 0%{opacity:0;transform:translateY(8px)} 100%{opacity:1;transform:translateY(0)} }
.animate-fadein { animation: pixelFadeIn 0.4s ease forwards; }

/* ============================================= 
   OUTBREAK SELECT
   ============================================= */
#outbreak-select {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
}

.select-header { font-family: var(--font-pixel); font-size: 9px; color: var(--cyan); text-align: center; margin-bottom: 4px; }
.select-sub    { font-family: var(--font-body);  font-size: 12px; color: var(--text-faint); text-align: center; margin-bottom: 8px; }

/* Key-number hint label on select screen */
.outbreak-card-wrap {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.outbreak-key-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--cyan);
  background: var(--blue-light);
  border: 2px solid var(--border);
  border-right: none;
  min-width: 36px;
  padding: 0 8px;
  border-radius: var(--radius) 0 0 var(--radius);
  flex-shrink: 0;
}
.outbreak-key-badge.locked-key { color: var(--text-faint); background: var(--surface); }

.outbreak-card {
  flex: 1;
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: var(--transition);
  font-family: var(--font-pixel);
  text-align: left;
}

.outbreak-card:hover:not(.locked), .outbreak-card:focus:not(.locked) {
  background: var(--blue-light);
  border-color: var(--cyan);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,119,182,0.25);
}

.outbreak-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--surface);
}

.outbreak-card.unlocked { border-color: var(--border); }
.outbreak-card.completed { border-color: var(--green); background: var(--green-bg); }

.outbreak-difficulty {
  font-size: 7px;
  padding: 2px 7px;
  border: 2px solid;
  border-radius: 2px;
  flex-shrink: 0;
  margin-top: 3px;
}
.diff-easy   { color: var(--green);  border-color: var(--green);  background: var(--green-bg); }
.diff-medium { color: var(--yellow); border-color: var(--yellow); background: var(--yellow-bg); }
.diff-hard   { color: var(--red);    border-color: var(--red);    background: var(--red-bg); }

.outbreak-info  { flex: 1; }
.outbreak-name  { font-size: 9px; color: var(--text); margin-bottom: 6px; }
.outbreak-desc  { font-family: var(--font-body); font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.outbreak-xp    { font-size: 7px; color: var(--yellow); margin-top: 5px; }

/* Case status labels */
.case-status-open   { font-size: 7px; color: var(--green); }
.case-status-locked { font-size: 7px; color: var(--text-faint); }

/* Lock flash message */
#lock-flash {
  display: none;
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--red);
  background: var(--red-bg);
  border: 2px solid var(--red);
  padding: 8px;
  border-radius: var(--radius);
  margin-top: 4px;
}
#lock-flash.visible { display: block; }

/* ============================================= 
   MOBILE TOOL BAR (visible on touch / small screens)
   ============================================= */
#mobile-tool-bar {
  display: flex;   /* always visible — buttons are the only way to open panels */
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 4px 0;
}
.mobile-tool-btn {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--text);
  pointer-events: auto;
  position: relative;
  z-index: 20;
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  min-height: 40px;
  transition: var(--transition);
}
.mobile-tool-btn:hover, .mobile-tool-btn:active {
  background: var(--blue-light);
  border-color: var(--cyan);
}
@media (pointer: coarse), (max-width: 900px) {
  /* tool bar already always visible */
  #key-hints .key-hint:nth-child(n+3) { display: none; }
}

/* ============================================= 
   GAME SCENE
   ============================================= */
#game-scene { display: none; flex-direction: column; gap: 10px; }

/* Scene art — expanded to 240px tall */
#scene-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
#scene-canvas {
  width: 100%;
  height: 240px;
  display: block;
  background: #0d1b2a;
}
#scene-panel {
  display: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 240px;
  object-fit: cover;
  image-rendering: pixelated;
}

/* ============================================= 
   INVESTIGATION NOTEBOOK (editable)
   ============================================= */
#casefile-panel {
  display: none;
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.casefile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.casefile-header h3 {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--cyan);
  margin: 0;
}

.casefile-btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

.dl-btn {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--cyan);
  background: transparent;
  border: 2px solid var(--cyan);
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 2px;
  transition: var(--transition);
}
.dl-btn:hover { background: var(--cyan); color: #fff; }
.dl-btn.secondary { color: var(--text-dim); border-color: var(--border); }
.dl-btn.secondary:hover { background: var(--surface); }

/* Markdown guide collapsible */
#md-guide {
  display: none;
  background: var(--blue-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 10px;
}
#md-guide.open { display: block; }
#md-guide h4 { font-family: var(--font-pixel); font-size: 8px; color: var(--cyan); margin-bottom: 8px; }
#md-guide code { background: var(--surface2); padding: 1px 4px; border-radius: 2px; font-family: var(--font-mono); }
#md-guide .md-row { display: flex; gap: 12px; margin: 3px 0; }
#md-guide .md-syntax { min-width: 140px; color: var(--blue); }

/* Editable textarea for notes */
#casefile-editor {
  width: 100%;
  min-height: 140px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: #fafcff;
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
}
#casefile-editor:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(0,119,182,0.15); }

/* ============================================= 
   FIELD REFERENCE PANEL
   ============================================= */
#fieldref-panel {
  display: none;
  background: var(--bg-panel);
  border: 2px solid var(--magenta);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.fieldref-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.fieldref-title {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--magenta);
}
.fieldref-hint {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--text-faint);
}

/* Accordion agent cards */
.agent-card { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.agent-card-header {
  background: var(--blue-light);
  padding: 9px 14px;
  cursor: pointer;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.agent-card-header:hover { background: var(--cyan-light); }
.agent-card-header .toggle { font-size: 10px; color: var(--text-faint); }
.agent-card-body {
  display: none;
  padding: 12px 14px;
  background: var(--bg-panel);
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-dim);
}
.agent-card-body.open { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.agent-row { display: contents; }
.agent-label { font-family: var(--font-pixel); font-size: 7px; color: var(--cyan); }
.agent-value { color: var(--text); }

/* Field manual — tab navigation */
.fieldref-tab-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 6px;
}
.fieldref-tab {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--text-dim);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 6px 10px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.fieldref-tab:hover { background: var(--blue-light); color: var(--cyan); border-color: var(--cyan); }
.fieldref-tab.active {
  background: var(--cyan);
  color: #fff;
  border-color: var(--cyan);
}
.fieldref-tab-dl {
  margin-left: auto;
  background: var(--bg-panel);
  color: var(--text-faint);
  border-color: var(--border);
}
.fieldref-tab-dl:hover { background: var(--blue-light); color: var(--cyan); }
.fieldref-tab-panel {
  display: none;
  padding: 4px 2px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-dim);
}
.fieldref-tab-panel.active { display: block; }
.fieldref-tab-panel h5 {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--cyan);
  margin: 12px 0 6px;
}
.fieldref-tab-panel ul { padding-left: 18px; }
.fieldref-tab-panel li { margin-bottom: 4px; }
.fieldref-tab-panel .epi-curve-example {
  background: var(--blue-light);
  border-left: 4px solid var(--cyan);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  margin: 8px 0 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Legacy accordion fieldref section styles (kept for any fallback) */
.fieldref-section {
  margin-bottom: 16px;
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  overflow: hidden;
}
.fieldref-section-header {
  background: var(--surface);
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.fieldref-section-header:hover { background: var(--blue-light); }
.fieldref-section-body {
  display: none;
  padding: 14px;
  background: var(--bg-panel);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-dim);
}
.fieldref-section-body.open { display: block; }
.fieldref-section-body h5 {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--cyan);
  margin: 12px 0 6px;
}
.fieldref-section-body ul { padding-left: 18px; }
.fieldref-section-body li { margin-bottom: 4px; }
.fieldref-section-body .epi-curve-example {
  background: var(--blue-light);
  border-left: 4px solid var(--cyan);
  padding: 10px 12px;
  margin: 10px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ============================================= 
   EPI TOOLS PANEL
   ============================================= */
#tools-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-panel);
  border: 2px solid var(--cyan);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

#tools-panel-title {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--cyan);
  text-align: center;
}

/* Epidemic curve */
#epi-curve-canvas { display: block; margin: 0 auto; max-width: 100%; }

/* 2×2 table */
.two-by-two {
  display: grid;
  grid-template-columns: 130px 1fr 1fr;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface2);
  padding: 2px;
  max-width: 500px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
}
.two-by-two .cell { background: var(--bg-panel); padding: 7px 10px; text-align: center; }
.two-by-two .cell.header { background: var(--blue-light); color: var(--cyan); font-family: var(--font-pixel); font-size: 7px; }
.two-by-two .cell.corner { background: var(--surface); }
.two-by-two .cell.highlight { color: var(--orange); font-weight: bold; }

/* Generic table */
.data-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 13px; }
.data-table th { background: var(--blue-light); color: var(--cyan); font-family: var(--font-pixel); font-size: 7px; padding: 8px 10px; text-align: left; border-bottom: 2px solid var(--border); }
.data-table td { padding: 7px 10px; border-bottom: 1px solid var(--surface2); color: var(--text-dim); }
.data-table tr:hover td { background: var(--blue-light); }

/* ============================================= 
   FEEDBACK PANEL
   ============================================= */
#feedback-panel {
  display: none;
  padding: 14px 18px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.65;
  border-left: 4px solid var(--green);
  background: var(--green-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
}
#feedback-panel.wrong { border-left-color: var(--red);  background: var(--red-bg); }
#feedback-panel.info  { border-left-color: var(--cyan); background: var(--blue-light); }

/* Continue button inside feedback */
.continue-btn {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--cyan);
  background: var(--bg-panel);
  border: 2px solid var(--cyan);
  padding: 7px 14px;
  cursor: pointer;
  border-radius: 2px;
  transition: var(--transition);
}
.continue-btn:hover { background: var(--cyan); color: #fff; }

/* ============================================= 
   TEXT / DIALOG BOX
   ============================================= */
#text-box {
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
  position: relative;
}

#speaker-name {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--cyan);
  margin-bottom: 2px;
}

#dialog-text {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  flex: 1;
}

#continue-prompt {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--yellow);
  align-self: flex-end;
}

/* ============================================= 
   CHOICE BUTTONS
   ============================================= */
#choices-panel { display: none; flex-direction: column; gap: 7px; }

.choice-btn {
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-pixel);
  font-size: 9px;
  padding: 11px 16px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1.55;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow);
}
.choice-btn:hover:not([disabled]), .choice-btn:focus:not([disabled]) {
  background: var(--blue-light);
  border-color: var(--cyan);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,119,182,0.2);
}
.choice-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.choice-btn .choice-key { color: var(--cyan); font-size: 10px; flex-shrink: 0; min-width: 22px; }
.choice-btn.correct { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.choice-btn.wrong   { border-color: var(--red);   background: var(--red-bg);   color: var(--red); }

/* ============================================= 
   RANK UP SCREEN
   ============================================= */
#rankup-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 16px;
  text-align: center;
  min-height: 320px;
  background: linear-gradient(160deg, #1a237e 0%, #283593 60%, #3949ab 100%);
  border-radius: var(--radius);
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.rankup-star   { font-size: 14px; color: #ffd600; }
.rankup-title  { font-family: var(--font-pixel); font-size: 14px; color: #ffd600; }
.rankup-rank   { font-family: var(--font-pixel); font-size: 10px; color: #fff; margin-top: 4px; }
#rankup-msg    { font-family: var(--font-body); font-size: 14px; color: rgba(255,255,255,0.85); max-width: 500px; line-height: 1.6; }
#rankup-continue-btn {
  margin-top: 12px;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #fff;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.5);
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 2px;
  transition: var(--transition);
  pointer-events: auto;
  position: relative;
  z-index: 10;
}
#rankup-continue-btn:hover { background: rgba(255,255,255,0.3); }

/* ============================================= 
   VICTORY SCREEN
   ============================================= */
#victory-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 24px;
  text-align: center;
  background: linear-gradient(160deg, #1a237e 0%, #0077b6 100%);
  border-radius: var(--radius);
  color: #fff;
}
#victory-text  { font-family: var(--font-body); font-size: 14px; color: rgba(255,255,255,0.9); max-width: 560px; line-height: 1.7; }
#final-score   { font-family: var(--font-pixel); font-size: 10px; color: #ffd600; }
#victory-restart-btn {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #fff;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.5);
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 2px;
  pointer-events: auto;
  position: relative;
  z-index: 10;
}

/* ============================================= 
   ACTION BAR
   ============================================= */
#action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  gap: 8px;
  flex-wrap: wrap;
}
#key-hints { display: flex; gap: 12px; flex-wrap: wrap; }
.key-hint { font-family: var(--font-pixel); font-size: 7px; color: var(--text-dim); display: flex; align-items: center; gap: 5px; }
.key-badge {
  background: var(--bg-panel);
  border: 2px solid var(--border);
  padding: 2px 6px;
  font-size: 7px;
  color: var(--text);
  border-radius: 2px;
  box-shadow: 0 2px 0 var(--border);
}
#mute-btn {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--text-dim);
  background: none;
  border: 2px solid var(--border);
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 2px;
  transition: var(--transition);
}
#mute-btn:hover { color: var(--cyan); border-color: var(--cyan); }

/* ============================================= 
   PIXEL BOX VARIANTS (kept for legacy node boxStyle)
   ============================================= */
.pixel-box         { border: 2px solid var(--border); border-radius: var(--radius); }
.pixel-box-green   { border-color: var(--green); background: var(--green-bg); }
.pixel-box-yellow  { border-color: var(--yellow); background: var(--yellow-bg); }
.pixel-box-red     { border-color: var(--red);    background: var(--red-bg); }
.pixel-box-cyan    { border-color: var(--cyan);   background: var(--blue-light); }
.pixel-box-magenta { border-color: var(--magenta); }

/* Mobile warning removed — game now supports mobile/tablet */

/* ============================================= 
   RESPONSIVE — TABLET & MOBILE
   ============================================= */

/* Touch targets: make all interactive elements finger-friendly */
@media (pointer: coarse), (max-width: 900px) {
  .outbreak-card  { padding: 12px 14px; }
  .choice-btn     { font-size: 8px; padding: 13px 14px; line-height: 1.65; min-height: 48px; }
  .choice-btn .choice-key { min-width: 20px; font-size: 10px; }
  .continue-btn   { padding: 10px 16px; font-size: 8px; min-height: 44px; }
  #action-bar     { gap: 6px; padding: 8px 10px; }
  #mute-btn       { padding: 8px 12px; min-height: 40px; }
  .dl-btn         { padding: 8px 10px; min-height: 40px; }
}

/* Small tablet / large phone (≤ 768px) */
@media (max-width: 768px) {
  #game-shell     { padding: 6px; gap: 6px; }
  #hud            { padding: 8px 12px; }
  #hud-logo       { font-size: 8px; }
  .hud-stat-value { font-size: 7px; }
  #xp-bar         { width: 80px; }
  #scene-canvas,
  #scene-panel    { height: 180px; }
  #dialog-text    { font-size: 13px; }
  .outbreak-name  { font-size: 8px; }
  .outbreak-desc  { font-size: 12px; }
  .outbreak-key-badge { min-width: 28px; font-size: 8px; }
  .agent-card-body.open { grid-template-columns: 1fr; }
  .two-by-two     { grid-template-columns: 80px 1fr 1fr; font-size: 12px; }
  #key-hints      { gap: 8px; }
  .key-hint       { font-size: 6px; }
  .key-badge      { font-size: 6px; padding: 2px 4px; }
}

/* Phone (≤ 480px) */
@media (max-width: 480px) {
  #game-shell     { padding: 4px; gap: 4px; }
  #hud            { padding: 6px 8px; gap: 4px; }
  #hud-logo       { font-size: 7px; letter-spacing: 0; }
  #hud-right      { gap: 10px; }
  .hud-stat       { gap: 1px; }
  .hud-stat-label { font-size: 5px; }
  .hud-stat-value { font-size: 6px; }
  #xp-bar-wrap    { display: none; }   /* hide XP bar to save space on phones */
  #scene-canvas,
  #scene-panel    { height: 140px; }
  #text-box       { padding: 12px 14px; min-height: 80px; }
  #dialog-text    { font-size: 13px; }
  #speaker-name   { font-size: 7px; }
  #continue-prompt{ font-size: 6px; }
  .choice-btn     { font-size: 8px; padding: 12px 12px; }
  .fieldref-section-header { font-size: 7px; padding: 8px 10px; }
  .agent-card-header { font-size: 7px; }
  .fieldref-tab { font-size: 6px; padding: 5px 7px; }
  .fieldref-tab-dl { font-size: 6px; }
  .agent-card-body.open { grid-template-columns: 1fr; }
  .agent-label    { font-size: 6px; }
  .data-table th  { font-size: 6px; padding: 6px 6px; }
  .data-table td  { font-size: 11px; padding: 5px 6px; }
  .two-by-two     { grid-template-columns: 70px 1fr 1fr; font-size: 11px; }
  .two-by-two .cell { padding: 5px 6px; }
  .two-by-two .cell.header { font-size: 6px; }
  #action-bar     { padding: 6px 8px; }
  .key-hint       { display: none; }  /* hide keyboard hints on phones — not needed */
  #mute-btn       { font-size: 7px; padding: 6px 10px; }
  .outbreak-card-wrap { gap: 0; }
  .outbreak-key-badge { min-width: 24px; font-size: 7px; }
  .outbreak-difficulty { font-size: 6px; padding: 2px 5px; }
  .casefile-header h3 { font-size: 7px; }
  #casefile-editor { font-size: 12px; min-height: 100px; }
}
