/* ============================================================
   game.css — Transmission Planner: The Game
   ALL rules scoped to #game-container to prevent style leakage
   into the global site CSS.
   Exception: body scroll lock when result modal is open (uses :has).
   ============================================================ */

/* Prevent page scroll behind fixed result modal; :has() requires modern browsers */
body:has(#game-modal.game-modal-overlay.visible) {
  overflow: hidden;
}

/* ---- Page Wrapper ------------------------------------------- */
#game-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  font-family: 'Inter', sans-serif;
  color: rgba(255, 255, 255, 0.85);
  box-sizing: border-box;
}

#game-container *,
#game-container *::before,
#game-container *::after {
  box-sizing: border-box;
}

/* ---- Header -------------------------------------------------- */
#game-container #game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(197, 160, 5, 0.25);
}

#game-container #game-title h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  margin: 0;
  line-height: 1.2;
}

#game-container #game-title h2 span {
  color: #D4AF37;
}

#game-container #game-subtitle {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.35);
  font-style: italic;
  margin-top: 0.15rem;
}

#game-container .game-challenge-line {
  font-size: 0.72rem;
  color: rgba(34, 197, 94, 0.85);
  margin-top: 0.35rem;
  line-height: 1.4;
  max-width: 42rem;
}

#game-container .planner-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.85rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(197, 160, 5, 0.12);
}

#game-container .planner-streak {
  font-size: 0.72rem;
  color: rgba(250, 204, 21, 0.9);
}

#game-container .planner-lb-widget {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  font-size: 0.72rem;
}

#game-container .planner-lb-widget .gp-lb-list {
  margin: 0;
  padding-left: 1rem;
}

#game-container .planner-lb-widget .gp-lb-row {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.2rem;
}

#game-container .planner-lb-widget .gp-lb-loading,
#game-container .planner-lb-widget .gp-lb-empty {
  margin: 0;
  color: rgba(255, 255, 255, 0.45);
}

#game-container .game-seo-intro {
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.45);
  margin: 0 0 0.65rem;
  max-width: 52rem;
}

#game-container #new-game-btn {
  background: transparent;
  border: 1px solid rgba(197, 160, 5, 0.4);
  color: #D4AF37;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  font-family: 'Inter', sans-serif;
}

#game-container #new-game-btn:hover {
  background: rgba(197, 160, 5, 0.12);
  border-color: #D4AF37;
}

#game-container #daily-challenge-btn {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.55);
  color: #22c55e;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  font-family: 'Inter', sans-serif;
}

#game-container #daily-challenge-btn:hover {
  background: rgba(34, 197, 94, 0.22);
  border-color: #22c55e;
}

/* When already in daily-challenge mode, highlight the button */
#game-container #daily-challenge-btn.active {
  background: rgba(34, 197, 94, 0.28);
  border-color: #22c55e;
  color: #86efac;
}

/* ---- Main Game Layout --------------------------------------- */
#game-container #game-main {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

/* ---- Canvas Column (canvas + explainer stacked) ------------- */
#game-container #game-canvas-col {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  flex-shrink: 0;
}

/* ---- Canvas Wrapper ----------------------------------------- */
#game-container #game-canvas-wrapper {
  position: relative;
  flex-shrink: 0;
  border: 2px solid rgba(197, 160, 5, 0.3);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.55);
}

#game-container canvas {
  display: block;
  width: 800px;
  height: 600px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: default;
}

/* ---- Toast Notification ------------------------------------- */
#game-container #game-toast {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(10, 25, 47, 0.94);
  border: 1px solid rgba(197, 160, 5, 0.55);
  color: #D4AF37;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.38rem 1.1rem;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  font-family: 'Inter', sans-serif;
}

#game-container #game-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Sidebar ------------------------------------------------ */
#game-container #game-sidebar {
  flex: 1;
  min-width: 240px;
  max-width: 272px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* ---- Sidebar Sections --------------------------------------- */
#game-container .sidebar-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(197, 160, 5, 0.15);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

#game-container .sidebar-heading {
  font-family: 'Playfair Display', serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #D4AF37;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  margin: 0 0 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(197, 160, 5, 0.15);
}

/* ---- Tool Buttons ------------------------------------------- */
#game-container .tool-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 7px;
  padding: 0.48rem 0.65rem;
  margin-bottom: 0.38rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
  color: rgba(255, 255, 255, 0.78);
  font-family: 'Inter', sans-serif;
}

#game-container .tool-btn:last-of-type {
  margin-bottom: 0;
}

#game-container .tool-btn:hover {
  background: rgba(197, 160, 5, 0.09);
  border-color: rgba(197, 160, 5, 0.3);
}

#game-container .tool-btn.active {
  background: rgba(197, 160, 5, 0.13);
  border-color: #D4AF37;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.28);
}

#game-container .tool-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  line-height: 1;
}

#game-container .tool-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.2;
}

#game-container .tool-stats {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.3;
  margin-top: 0.08rem;
}

#game-container .tool-hint {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.28);
  margin: 0.6rem 0 0;
  line-height: 1.5;
  font-style: italic;
}

/* ---- Metrics ------------------------------------------------ */
#game-container .metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.12rem;
}

#game-container .metric-label {
  font-size: 0.73rem;
  color: rgba(255, 255, 255, 0.48);
}

#game-container .metric-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  font-variant-numeric: tabular-nums;
}

#game-container .metric-status {
  font-size: 0.68rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  display: inline-block;
  line-height: 1.5;
}

#game-container .status-ok   { color: #64ffda; background: rgba(100, 255, 218, 0.08); }
#game-container .status-warn { color: #ffd966; background: rgba(255, 217, 102, 0.09); }
#game-container .status-bad  { color: #ff6b6b; background: rgba(255, 107, 107, 0.10); }

/* ---- Score Bars --------------------------------------------- */
#game-container .score-section {
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
}

#game-container .score-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#game-container .score-label {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.45);
  width: 76px;
  flex-shrink: 0;
}

#game-container .bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 3px;
  overflow: hidden;
}

#game-container .bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.45s ease, background-color 0.3s ease;
  min-width: 0;
}

#game-container .bar-good   { background: #64ffda; }
#game-container .bar-medium { background: #ffd966; }
#game-container .bar-poor   { background: #ff6b6b; }

/* ---- Overall Score ------------------------------------------ */
#game-container .overall-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

#game-container .overall-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#game-container .overall-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
  transition: color 0.3s ease;
}

#game-container .overall-value.bar-good   { color: #64ffda; }
#game-container .overall-value.bar-medium { color: #ffd966; }
#game-container .overall-value.bar-poor   { color: #ff6b6b; }

/* ---- Legend ------------------------------------------------- */
#game-container .legend-items {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

#game-container .legend-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.73rem;
  color: rgba(255, 255, 255, 0.6);
  cursor: help;
  position: relative;
}

#game-container .legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

#game-container .legend-swatch-intertie {
  background: rgba(100, 200, 255, 0.22);
  border: 2px solid rgba(100, 200, 255, 0.85);
}

/* ---- Status Bar --------------------------------------------- */
#game-container #game-statusbar {
  margin-top: 0.6rem;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  font-size: 0.73rem;
  min-height: 28px;
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.45);
}

#game-container #tile-info .tt-terrain { color: rgba(255, 255, 255, 0.82); font-weight: 600; }
#game-container #tile-info .tt-asset   { color: #D4AF37; }
#game-container #tile-info .tt-coords  { color: rgba(255, 255, 255, 0.28); font-size: 0.68rem; }

/* ---- Floating Tooltip --------------------------------------- */
#game-container .game-tooltip {
  position: fixed;
  z-index: 9500;
  pointer-events: none;
  background: #0b1e38;
  border: 1px solid rgba(197, 160, 5, 0.4);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  min-width: 200px;
  max-width: 300px;
  box-shadow: 0 6px 28px rgba(0,0,0,0.65);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.8);
}

#game-container .game-tooltip .gtt-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: #D4AF37;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid rgba(197, 160, 5, 0.2);
  padding-bottom: 0.25rem;
}

#game-container .game-tooltip .gtt-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.18rem 0;
  font-size: 0.75rem;
}

#game-container .game-tooltip .gtt-label {
  color: rgba(255,255,255,0.45);
  flex-shrink: 0;
}

#game-container .game-tooltip .gtt-val {
  color: rgba(255,255,255,0.88);
  text-align: right;
  font-weight: 600;
}

#game-container .game-tooltip .gtt-connected {
  color: #2ecc71;
  font-weight: 700;
}

#game-container .game-tooltip .gtt-disconnected {
  color: #e74c3c;
  font-weight: 700;
}

#game-container .game-tooltip .gtt-warn {
  margin-top: 0.35rem;
  padding: 0.25rem 0.4rem;
  background: rgba(230, 126, 34, 0.12);
  border-left: 2px solid #e67e22;
  border-radius: 0 4px 4px 0;
  font-size: 0.72rem;
  color: rgba(255,200,130,0.9);
}

#game-container .game-tooltip .gtt-hint {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: rgba(100,200,255,0.6);
  font-style: italic;
}

#game-container .game-tooltip .gtt-nris {
  color: #2ecc71;
}
#game-container .game-tooltip .gtt-eris {
  color: #e67e22;
}

/* ---- Transmission Line Tool --------------------------------- */
#game-container .tool-btn.line-btn:hover {
  background:   rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.40);
}
#game-container .tool-btn.line-btn.active {
  background:   rgba(212, 175, 55, 0.16);
  border-color: #D4AF37;
  box-shadow:   0 0 0 1px rgba(212, 175, 55, 0.30);
}
#game-container .tool-btn.line-btn .tool-name {
  color: #D4AF37;
}

/* ---- Erase Tool --------------------------------------------- */
#game-container .tool-btn.erase-btn:hover {
  background:   rgba(255, 107, 107, 0.08);
  border-color: rgba(255, 107, 107, 0.40);
}
#game-container .tool-btn.erase-btn.active {
  background:   rgba(255, 107, 107, 0.14);
  border-color: #ff6b6b;
  box-shadow:   0 0 0 1px rgba(255, 107, 107, 0.28);
}
#game-container .tool-btn.erase-btn .tool-name {
  color: rgba(255, 107, 107, 0.88);
}

/* ---- Responsive --------------------------------------------- */
@media (max-width: 1100px) {
  #game-container canvas {
    width: 100%;
    height: auto;
    max-width: 800px;
  }
  #game-container #game-main {
    flex-direction: column;
  }
  #game-container #game-sidebar {
    max-width: 100%;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  #game-container .sidebar-section {
    flex: 1;
    min-width: 220px;
  }
}

@media (max-width: 640px) {
  #game-container #game-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  #game-container #game-title h2 {
    font-size: 1.15rem;
  }
}

/* ---- Submit Grid Plan Button --------------------------------- */
#game-container .submit-btn {
  width: 100%;
  padding: 0.65rem 1rem;
  background: linear-gradient(135deg, rgba(100,255,218,0.14), rgba(100,255,218,0.05));
  border: 1.5px solid rgba(100, 255, 218, 0.5);
  border-radius: 7px;
  color: #64ffda;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#game-container .submit-btn:hover {
  background: linear-gradient(135deg, rgba(100,255,218,0.26), rgba(100,255,218,0.12));
  border-color: #64ffda;
  box-shadow: 0 0 14px rgba(100, 255, 218, 0.22);
}

#game-container .secondary-stress-btn {
  margin-top: 0.5rem;
  background: linear-gradient(135deg, rgba(180, 160, 255, 0.12), rgba(180, 160, 255, 0.04));
  border-color: rgba(180, 160, 255, 0.45);
  color: #d0c4ff;
  font-weight: 600;
  font-size: 0.82rem;
}

#game-container .secondary-stress-btn:hover {
  border-color: #c4b5fd;
  box-shadow: 0 0 12px rgba(180, 160, 255, 0.2);
}

#game-container .sidebar-section-heading-supply {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.45);
  margin: 0.75rem 0 0.35rem;
}

#game-container .modal-report {
  margin: 0.75rem 1.25rem 0;
  padding: 0.65rem 0.75rem;
  background: rgba(100, 200, 255, 0.06);
  border: 1px solid rgba(100, 200, 255, 0.2);
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(230, 240, 255, 0.92);
}

#game-container .modal-report-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: #9ecbff;
}

#game-container .modal-report-row {
  margin: 0.2rem 0;
}

/* ---- Result Modal Overlay ------------------------------------ */
#game-container .game-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 9000;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#game-container .game-modal-overlay.visible {
  display: flex;
}

#game-container .game-modal-box {
  background: #0e1f38;
  border: 1.5px solid rgba(197, 160, 5, 0.35);
  border-radius: 12px;
  width: min(480px, 92vw);
  flex-shrink: 0;
  box-shadow: 0 14px 52px rgba(0, 0, 0, 0.72);
  overflow: hidden;
  font-family: 'Inter', sans-serif;
}

/* Modal header — base */
#game-container .game-modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.4rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

#game-container .game-modal-header.modal-header-pass {
  background: rgba(100, 255, 218, 0.1);
  border-bottom-color: rgba(100, 255, 218, 0.25);
}

#game-container .game-modal-header.modal-header-fail {
  background: rgba(255, 75, 75, 0.12);
  border-bottom-color: rgba(255, 75, 75, 0.3);
}

#game-container .modal-result-icon {
  font-size: 1.65rem;
  line-height: 1;
  font-weight: 700;
}

#game-container .modal-header-pass .modal-result-icon { color: #64ffda; }
#game-container .modal-header-fail .modal-result-icon { color: #ff6b6b; }

#game-container .game-modal-header h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
}

#game-container .game-modal-dismiss {
  flex-shrink: 0;
  margin-left: auto;
  padding: 0.2rem 0.45rem;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

#game-container .game-modal-dismiss:hover {
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(100, 255, 218, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

#game-container .modal-header-pass h2 { color: #64ffda; }
#game-container .modal-header-fail h2 { color: #ff6b6b; }

/* Modal body */
#game-container .game-modal-body {
  padding: 1.2rem 1.4rem;
}

#game-container .modal-subtitle {
  margin: 0 0 0.65rem;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.52);
  text-align: center;
}

/* Causal headline (why this result) */
#game-container #modal-causal.modal-causal {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: rgba(100, 255, 218, 0.06);
  border: 1px solid rgba(100, 255, 218, 0.2);
}

#game-container .modal-causal-inner {
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
  text-align: left;
}

/* Failure / soft coaching */
#game-container #modal-coach.modal-coach {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  background: rgba(100, 180, 255, 0.08);
  border: 1px solid rgba(100, 180, 255, 0.22);
}

#game-container .modal-coach-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(100, 200, 255, 0.85);
  margin-bottom: 0.45rem;
}

#game-container .modal-coach-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}

#game-container .modal-coach-soft {
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.78);
}

/* Score rows */
#game-container .modal-scores {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.7rem;
}

#game-container .modal-score-row {
  display: flex;
  align-items: center;
  padding: 0.28rem 0;
  font-size: 0.83rem;
}

#game-container .modal-score-label {
  flex: 1;
  color: rgba(255, 255, 255, 0.75);
}

#game-container .modal-score-weight {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.75rem;
  margin-right: 0.75rem;
}

#game-container .modal-score-value {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  min-width: 6rem;
  text-align: right;
}

#game-container .modal-score-total {
  display: flex;
  align-items: center;
  padding: 0.55rem 0 0.15rem;
  margin-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.95rem;
  font-weight: 700;
}

#game-container .modal-score-total .modal-score-label {
  color: rgba(255, 255, 255, 0.9);
}

#game-container .modal-score-total .modal-score-value {
  font-size: 1.15rem;
}

/* Failure message */
#game-container .modal-failure {
  padding: 0.8rem 1rem;
  border-radius: 6px;
  background: rgba(255, 75, 75, 0.1);
  border: 1px solid rgba(255, 75, 75, 0.3);
  color: #ffaaaa;
  font-size: 0.85rem;
  line-height: 1.55;
}

/* Modal footer */
#game-container .game-modal-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

#game-container .modal-play-again {
  padding: 0.6rem 2.2rem;
  background: transparent;
  border: 1.5px solid rgba(197, 160, 5, 0.45);
  border-radius: 7px;
  color: #D4AF37;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#game-container .modal-play-again:hover {
  background: rgba(212, 175, 55, 0.12);
  border-color: #D4AF37;
}

/* ---- Header Button Group ------------------------------------ */
#game-container #game-header-btns {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  max-width: min(52rem, 100%);
}

#game-container .game-header-mode-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding-left: 0.5rem;
  margin-left: 0.15rem;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

#game-container .game-header-mode {
  background: transparent;
  border: 1px solid rgba(167, 243, 208, 0.35);
  color: rgba(167, 243, 208, 0.92);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#game-container .game-header-mode:hover {
  background: rgba(167, 243, 208, 0.08);
  border-color: rgba(167, 243, 208, 0.55);
}

#game-container .game-header-scenario {
  border-color: rgba(212, 175, 55, 0.4);
  color: rgba(255, 224, 130, 0.9);
}

#game-container .game-header-scenario:hover {
  background: rgba(212, 175, 55, 0.1);
  border-color: rgba(212, 175, 55, 0.65);
}

#game-container #how-to-play-btn {
  background: transparent;
  border: 1px solid rgba(100, 200, 255, 0.35);
  color: rgba(100, 200, 255, 0.8);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  font-family: 'Inter', sans-serif;
}

#game-container #how-to-play-btn:hover {
  background: rgba(100, 200, 255, 0.1);
  border-color: rgba(100, 200, 255, 0.7);
}

/* ---- Rules / How-to-Play Modal ------------------------------ */
#game-container .rules-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  z-index: 9100;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

#game-container .rules-modal-overlay.visible {
  display: flex;
}

#game-container .rules-modal-box {
  background: #0a1628;
  border: 1.5px solid rgba(100, 200, 255, 0.25);
  border-radius: 12px;
  width: min(820px, 96vw);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  flex-shrink: 0;
}

#game-container .rules-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  background: rgba(100, 200, 255, 0.07);
  border-bottom: 1px solid rgba(100, 200, 255, 0.15);
  position: sticky;
  top: 0;
  z-index: 1;
}

#game-container .rules-modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(100, 200, 255, 0.9);
}

#game-container .rules-close-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.55);
  font-size: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

#game-container .rules-close-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

#game-container .rules-modal-body {
  padding: 1.4rem 1.6rem 2rem;
  color: rgba(255,255,255,0.82);
  font-size: 0.85rem;
  line-height: 1.65;
}

#game-container .rules-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

#game-container .rules-section-last {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

#game-container .rules-h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: #D4AF37;
  margin: 0 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

#game-container .rules-h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  margin: 1.1rem 0 0.55rem;
}

#game-container .rules-modal-body p {
  margin: 0 0 0.75rem;
}

#game-container .rules-list {
  margin: 0 0 0.75rem 1.1rem;
  padding: 0;
}

#game-container .rules-list li {
  margin-bottom: 0.4rem;
}

#game-container .rules-callout {
  background: rgba(255, 100, 100, 0.08);
  border: 1px solid rgba(255, 100, 100, 0.25);
  border-radius: 7px;
  padding: 0.75rem 1rem;
  margin-top: 0.6rem;
}

#game-container .rules-callout ul {
  margin: 0.4rem 0 0 1.1rem;
  padding: 0;
}

#game-container .rules-callout li {
  margin-bottom: 0.3rem;
  color: rgba(255,180,180,0.9);
}

#game-container .rules-note {
  background: rgba(212, 175, 55, 0.07);
  border-left: 3px solid rgba(212, 175, 55, 0.4);
  padding: 0.5rem 0.8rem;
  border-radius: 0 5px 5px 0;
  color: rgba(255,255,255,0.7);
  margin-top: 0.6rem;
  font-size: 0.82rem;
}

/* Rules table */
#game-container .rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.81rem;
  margin: 0.6rem 0;
}

#game-container .rules-table th {
  background: rgba(100, 200, 255, 0.08);
  color: rgba(100, 200, 255, 0.85);
  font-weight: 700;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid rgba(100, 200, 255, 0.2);
}

#game-container .rules-table td {
  padding: 0.42rem 0.65rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.78);
  vertical-align: top;
}

#game-container .rules-table tr:last-child td {
  border-bottom: none;
}

#game-container .rules-table tr:hover td {
  background: rgba(255,255,255,0.03);
}

/* ERIS / NRIS two-column cards */
#game-container .rules-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-top: 0.6rem;
}

@media (max-width: 600px) {
  #game-container .rules-two-col {
    grid-template-columns: 1fr;
  }
}

#game-container .rules-card {
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-size: 0.81rem;
  line-height: 1.6;
}

#game-container .rules-card ul {
  margin: 0.4rem 0 0 1.1rem;
  padding: 0;
}

#game-container .rules-card li {
  margin-bottom: 0.35rem;
}

#game-container .rules-card-eris {
  background: rgba(230, 126, 34, 0.09);
  border: 1px solid rgba(230, 126, 34, 0.3);
}

#game-container .rules-card-nris {
  background: rgba(46, 204, 113, 0.09);
  border: 1px solid rgba(46, 204, 113, 0.3);
}

#game-container .rules-card-title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

#game-container .rules-card-eris .rules-card-title {
  color: #e67e22;
}

#game-container .rules-card-nris .rules-card-title {
  color: #2ecc71;
}

/* ================================================================
   RFP SIDEBAR PANEL
   ================================================================ */

#game-container #rfp-panel .rfp-intro {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.5);
  margin: 0 0 0.6rem;
  line-height: 1.5;
}

#game-container .rfp-sidebar-card {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  background: rgba(100,200,255,0.06);
  border: 1px solid rgba(100,200,255,0.18);
  border-radius: 7px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.55rem;
}

#game-container .rfp-sidebar-card:last-child {
  margin-bottom: 0;
}

#game-container .rfp-sidebar-icon {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

#game-container .rfp-sidebar-body {
  flex: 1;
  min-width: 0;
}

#game-container .rfp-sidebar-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  margin-bottom: 0.2rem;
}

#game-container .rfp-sidebar-desc {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

#game-container .rfp-sidebar-pts {
  font-size: 0.7rem;
  color: #64ffda;
  font-weight: 600;
}

/* ================================================================
   RFP MODAL RESULTS
   ================================================================ */

#game-container .modal-rfp {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 0.9rem;
  padding-top: 0.8rem;
}

#game-container .modal-rfp-header {
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#game-container .modal-rfp-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.5rem;
  border-radius: 5px;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
}

#game-container .rfp-result-met {
  background: rgba(46,204,113,0.1);
  border: 1px solid rgba(46,204,113,0.25);
}

#game-container .rfp-result-missed {
  background: rgba(255,107,107,0.07);
  border: 1px solid rgba(255,107,107,0.18);
}

#game-container .modal-rfp-badge {
  flex-shrink: 0;
  font-size: 0.9rem;
}

#game-container .modal-rfp-label {
  flex: 1;
  color: rgba(255,255,255,0.82);
}

#game-container .modal-rfp-pts {
  font-weight: 700;
  color: #64ffda;
  white-space: nowrap;
}

#game-container .modal-rfp-pts.rfp-pts-missed {
  color: rgba(255,255,255,0.3);
}

#game-container .modal-rfp-total {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64ffda;
  text-align: right;
}

/* ── Same Map / Retry Button ──────────────────────────────── */
#game-container .modal-retry-map {
  padding: 0.6rem 2rem;
  background: transparent;
  border: 1.5px solid rgba(100, 200, 255, 0.35);
  border-radius: 7px;
  color: rgba(100, 200, 255, 0.85);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#game-container .modal-retry-map:hover {
  background: rgba(100, 200, 255, 0.1);
  border-color: rgba(100, 200, 255, 0.75);
}

/* ================================================================
   EDUCATIONAL ENHANCEMENTS (Phases 1-14)
   ================================================================ */

/* ── Asset / Terrain description in tile tooltip (#1–4) ─── */
#game-container .gtt-desc {
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.52);
  line-height: 1.55;
  font-style: italic;
}

/* ── Tool info button and collapsible panel (#6) ─────────── */
#game-container .tool-btn-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 0.38rem;
}

#game-container .tool-btn-row .tool-btn {
  flex: 1;
  margin-bottom: 0;
  border-radius: 7px 0 0 7px;
  border-right: none;
}

#game-container .tool-btn-row .tool-btn:hover,
#game-container .tool-btn-row .tool-btn.active {
  border-right: none;
}

#game-container .tool-info-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-left: 1px solid rgba(197,160,5,0.2);
  border-radius: 0 7px 7px 0;
  color: rgba(100,200,255,0.6);
  font-size: 0.9rem;
  width: 28px;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-container .tool-info-btn:hover {
  background: rgba(100,200,255,0.1);
  color: rgba(100,200,255,0.95);
}

#game-container .tool-info-panel {
  background: rgba(100,200,255,0.04);
  border: 1px solid rgba(100,200,255,0.14);
  border-radius: 6px;
  padding: 0 0.75rem;
  margin-top: 0;
  margin-bottom: 0;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.58);
  line-height: 1.55;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.28s ease, opacity 0.22s ease, padding 0.28s ease, margin 0.28s ease;
}

#game-container .tool-info-panel.is-open {
  max-height: 320px;
  opacity: 1;
  padding: 0.55rem 0.75rem;
  margin-top: -0.1rem;
  margin-bottom: 0.38rem;
}

/* ── RFP "Why this exists" toggle (#10) ─────────────────── */
#game-container .rfp-sidebar-basis-toggle {
  margin-top: 0.3rem;
}

#game-container .rfp-basis-btn {
  background: none;
  border: none;
  color: rgba(100,200,255,0.6);
  font-size: 0.68rem;
  cursor: pointer;
  padding: 0;
  font-family: 'Inter', sans-serif;
  transition: color 0.12s ease;
}

#game-container .rfp-basis-btn:hover {
  color: rgba(100,200,255,1);
}

#game-container .rfp-sidebar-basis {
  margin-top: 0.35rem;
  font-size: 0.69rem;
  color: rgba(255,255,255,0.48);
  line-height: 1.5;
  font-style: italic;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(100,200,255,0.1);
}

/* ── Educational Debrief in result modal (#11) ───────────── */
#game-container #modal-debrief {
  border-top: 1px solid rgba(255,255,255,0.09);
  margin-top: 1rem;
  padding-top: 0.8rem;
}

#game-container .modal-debrief-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: #D4AF37;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}

#game-container .modal-debrief-item {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  margin-bottom: 0.6rem;
  padding-left: 0.5rem;
  border-left: 2px solid rgba(212,175,55,0.3);
}

#game-container .modal-debrief-item strong {
  color: rgba(255,255,255,0.9);
}

/* ── "What You Learned" collapsible (#12) ────────────────── */
#game-container #modal-learned {
  margin-top: 0.7rem;
}

#game-container .modal-learned-toggle {
  width: 100%;
  background: rgba(100,255,218,0.05);
  border: 1px solid rgba(100,255,218,0.18);
  border-radius: 6px;
  color: #64ffda;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  text-align: left;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#game-container .modal-learned-toggle:hover {
  background: rgba(100,255,218,0.09);
}

#game-container .modal-learned-arrow {
  font-size: 0.65rem;
  opacity: 0.7;
}

#game-container .modal-learned-body {
  margin-top: 0.4rem;
  padding: 0.6rem 0.75rem;
  background: rgba(100,255,218,0.03);
  border: 1px solid rgba(100,255,218,0.1);
  border-radius: 6px;
}

#game-container .modal-learned-item {
  font-size: 0.77rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.55;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

#game-container .modal-learned-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

#game-container .modal-learned-term {
  font-weight: 700;
  color: #64ffda;
}

/* ── Mini-quiz modal (#13) ───────────────────────────────── */
#quiz-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 4000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#quiz-modal.visible {
  display: flex;
}

#quiz-modal .quiz-modal-box {
  background: #0f1e35;
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,0.7);
  overflow: hidden;
}

#quiz-modal .quiz-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(212,175,55,0.07);
}

#quiz-modal .quiz-modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: #D4AF37;
}

#quiz-modal .quiz-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.12s ease;
}

#quiz-modal .quiz-close-btn:hover {
  color: rgba(255,255,255,0.9);
}

#quiz-modal .quiz-modal-body {
  overflow-y: auto;
  padding: 1.2rem 1.4rem 1.4rem;
}

#quiz-modal .quiz-intro {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.48);
  margin-bottom: 1rem;
}

#quiz-modal .quiz-question {
  margin-bottom: 1.4rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

#quiz-modal .quiz-question:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

#quiz-modal .quiz-q-text {
  font-size: 0.86rem;
  color: rgba(255,255,255,0.88);
  line-height: 1.55;
  margin-bottom: 0.65rem;
}

#quiz-modal .quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#quiz-modal .quiz-opt-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: rgba(255,255,255,0.72);
  font-size: 0.8rem;
  padding: 0.45rem 0.75rem;
  text-align: left;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.12s ease, border-color 0.12s ease;
  line-height: 1.4;
}

#quiz-modal .quiz-opt-btn:hover:not(:disabled) {
  background: rgba(212,175,55,0.1);
  border-color: rgba(212,175,55,0.4);
}

#quiz-modal .quiz-opt-btn:disabled {
  cursor: default;
}

#quiz-modal .quiz-opt-correct {
  background: rgba(46,204,113,0.13);
  border-color: rgba(46,204,113,0.5);
  color: #2ecc71;
  font-weight: 600;
}

#quiz-modal .quiz-opt-wrong {
  background: rgba(255,107,107,0.1);
  border-color: rgba(255,107,107,0.35);
  color: rgba(255,107,107,0.8);
}

#quiz-modal .quiz-explain {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.55;
  background: rgba(100,200,255,0.04);
  border-left: 2px solid rgba(100,200,255,0.3);
  padding: 0.45rem 0.7rem;
  border-radius: 0 5px 5px 0;
}

/* ── Continue editing (dismiss without reset) ───────────── */
#game-container .modal-continue-editing {
  padding: 0.55rem 1.25rem;
  background: rgba(100, 255, 218, 0.1);
  border: 1.5px solid rgba(100, 255, 218, 0.45);
  border-radius: 7px;
  color: #a7f3d0;
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#game-container .modal-continue-editing:hover {
  background: rgba(100, 255, 218, 0.18);
  border-color: #64ffda;
}

/* ── Take Quiz button in modal footer ────────────────────── */
#game-container #take-quiz-btn {
  padding: 0.55rem 1.4rem;
  background: rgba(212,175,55,0.08);
  border: 1.5px solid rgba(212,175,55,0.4);
  border-radius: 7px;
  color: #D4AF37;
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#game-container #take-quiz-btn:hover {
  background: rgba(212,175,55,0.16);
  border-color: #D4AF37;
}

/* ── Legend items with data-tip tooltip (#4) ─────────────── */
#game-container .legend-item[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  top: 130%;
  background: rgba(10,25,47,0.97);
  border: 1px solid rgba(100,200,255,0.25);
  color: rgba(255,255,255,0.75);
  font-size: 0.72rem;
  line-height: 1.5;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  width: 240px;
  z-index: 9999;
  pointer-events: none;
  white-space: normal;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

/* ── Glossary term links (server-rendered, #5 & #14) ──────── */
#game-container a.gloss-link,
.rules-modal-body a.gloss-link {
  color: #64ffda;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(100,255,218,0.35);
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

#game-container a.gloss-link:hover,
.rules-modal-body a.gloss-link:hover {
  color: #a7ffed;
  text-decoration-color: rgba(100,255,218,0.7);
}

/* ── Terms Used sidebar panel (#14) ─────────────────────── */
#game-container #terms-panel .terms-list {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}

#game-container #terms-panel .term-link {
  font-size: 0.74rem;
  color: #64ffda;
  text-decoration: none;
  padding: 0.18rem 0;
  border-bottom: 1px solid rgba(100,255,218,0.08);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.12s ease;
}

#game-container #terms-panel .term-link:last-child {
  border-bottom: none;
}

#game-container #terms-panel .term-link:hover {
  color: #a7ffed;
}

#game-container #terms-panel .term-link::before {
  content: '\2192';
  font-size: 0.68rem;
  opacity: 0.5;
}

/* ── Educational Explainer ────────────────────────────────── */
#game-explainer {
  width: 800px;
}

#game-explainer .explainer-inner {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(100, 200, 255, 0.12);
  border-radius: 10px;
  padding: 1.4rem 1.8rem;
}

#game-explainer .explainer-badge {
  display: inline-block;
  background: rgba(100, 200, 255, 0.08);
  border: 1px solid rgba(100, 200, 255, 0.22);
  color: rgba(100, 200, 255, 0.85);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.2em 0.7em;
  border-radius: 4px;
  margin-bottom: 0.55rem;
}

#game-explainer .explainer-title {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #e0e0e0;
  margin: 0.2rem 0 0.6rem 0;
}

#game-explainer .explainer-lead {
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.65;
  margin: 0 0 0.65rem 0;
}

#game-explainer .explainer-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(100, 200, 255, 0.06);
  border: 1px solid rgba(100, 200, 255, 0.25);
  color: rgba(100, 200, 255, 0.95);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  margin-bottom: 0.65rem;
  transition: background 0.15s ease;
}

#game-explainer .explainer-more-btn:hover {
  background: rgba(100, 200, 255, 0.12);
}

#game-explainer .explainer-more-panel {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.58);
  line-height: 1.65;
  margin: 0 0 0.85rem 0;
}

#game-explainer .explainer-body {
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.7;
  margin: 0 0 0.9rem 0;
}

#game-explainer .explainer-body strong {
  color: rgba(255, 255, 255, 0.88);
}

#game-explainer .explainer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

#game-explainer .explainer-tags span {
  background: rgba(100, 255, 218, 0.05);
  border: 1px solid rgba(100, 255, 218, 0.18);
  color: #64ffda;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2em 0.65em;
  border-radius: 3px;
  letter-spacing: 0.03em;
}

/* ---- Onboarding: win hint, mode banners, demand bar ---- */

#game-container .game-win-hint {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.42);
  margin: 0.35rem 0 0;
  max-width: 44rem;
  line-height: 1.45;
}

#game-container .planner-mode-banner {
  font-size: 0.75rem;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(100, 255, 218, 0.25);
  background: rgba(10, 30, 50, 0.85);
  color: rgba(200, 255, 240, 0.92);
}

#game-container .planner-practice-banner {
  border-color: rgba(212, 175, 55, 0.35);
  color: rgba(255, 224, 130, 0.95);
}

#game-container .planner-guided-banner {
  border-color: rgba(34, 211, 238, 0.4);
  color: rgba(207, 250, 254, 0.96);
}

#game-container .planner-guided-coach {
  margin-bottom: 0.55rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: rgba(6, 22, 38, 0.92);
  max-width: 52rem;
}

#game-container .planner-guided-coach-inner {
  position: relative;
}

#game-container .planner-guided-coach-badge {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(34, 211, 238, 0.85);
  margin-bottom: 0.35rem;
}

#game-container .planner-guided-coach-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin: 0 0 0.4rem;
  line-height: 1.35;
}

#game-container .planner-guided-coach-body {
  font-size: 0.8rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
  margin: 0 0 0.5rem;
}

#game-container .planner-guided-coach-body strong {
  color: rgba(167, 243, 208, 0.98);
  font-weight: 600;
}

#game-container .planner-guided-coach-physical {
  font-size: 0.76rem;
  line-height: 1.55;
  color: rgba(220, 245, 255, 0.9);
  margin: 0 0 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  background: rgba(8, 45, 55, 0.45);
  border-left: 3px solid rgba(45, 212, 191, 0.5);
}

#game-container .planner-guided-coach-physical strong {
  color: rgba(153, 246, 224, 0.98);
}

#game-container .planner-guided-coach-why-wrap {
  margin: 0 0 0.45rem;
}

#game-container .planner-guided-coach-details {
  font-size: 0.74rem;
  line-height: 1.5;
  color: rgba(200, 230, 255, 0.88);
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  background: rgba(0, 40, 60, 0.35);
  border: 1px solid rgba(100, 200, 255, 0.22);
}

#game-container .planner-guided-coach-details-summary {
  cursor: pointer;
  font-weight: 600;
  color: rgba(165, 220, 255, 0.95);
  list-style: none;
}

#game-container .planner-guided-coach-details-summary::-webkit-details-marker {
  display: none;
}

#game-container .planner-guided-coach-details[open] .planner-guided-coach-details-summary {
  margin-bottom: 0.4rem;
}

#game-container .planner-guided-coach-details-body {
  padding-left: 0.15rem;
}

#game-container .planner-guided-coach-why-p {
  margin: 0 0 0.45rem;
}

#game-container .planner-guided-coach-why-p:last-child {
  margin-bottom: 0;
}

#game-container .planner-guided-coach-why-wrap strong {
  color: rgba(186, 230, 253, 0.95);
}

#game-container .planner-guided-glossary {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
}

#game-container .planner-guided-glossary-link {
  color: rgba(125, 211, 252, 0.95);
  text-decoration: underline;
  text-underline-offset: 2px;
}

#game-container .planner-guided-glossary-link:hover {
  color: rgba(186, 230, 253, 1);
}

#game-container .planner-guided-why-label {
  font-weight: 600;
  color: rgba(125, 211, 252, 0.95);
  margin-right: 0.25rem;
}

#game-container .planner-guided-link-btn {
  font-size: 0.72rem;
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: transparent;
  color: rgba(165, 243, 252, 0.98);
  cursor: pointer;
}

#game-container .planner-guided-link-btn:hover {
  background: rgba(34, 211, 238, 0.12);
}

#game-container .planner-guided-skip-btn {
  display: block;
  margin-top: 0.65rem;
  font-size: 0.72rem;
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: transparent;
  color: rgba(253, 224, 71, 0.92);
  cursor: pointer;
}

#game-container .planner-guided-skip-btn:hover {
  background: rgba(251, 191, 36, 0.1);
}

#game-container .planner-guided-submit-hint {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(226, 232, 240, 0.82);
}

#game-container .planner-guided-ghost-explain {
  margin-top: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  background: rgba(100, 255, 218, 0.06);
  border: 1px solid rgba(100, 255, 218, 0.2);
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(226, 232, 240, 0.88);
}

#game-container .modal-guided-next,
#game-container .modal-guided-finish {
  padding: 0.55rem 1.25rem;
  border-radius: 7px;
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#game-container .modal-guided-next {
  background: rgba(100, 255, 218, 0.12);
  border: 1.5px solid rgba(100, 255, 218, 0.5);
  color: #a7f3d0;
}

#game-container .modal-guided-next:hover {
  background: rgba(100, 255, 218, 0.2);
  border-color: #64ffda;
}

#game-container .modal-guided-finish {
  background: rgba(212, 175, 55, 0.1);
  border: 1.5px solid rgba(212, 175, 55, 0.45);
  color: #fde68a;
}

#game-container .modal-guided-finish:hover {
  background: rgba(212, 175, 55, 0.18);
  border-color: #d4af37;
}

#game-container .game-header-primary {
  background: linear-gradient(135deg, rgba(100, 255, 218, 0.15), rgba(100, 200, 255, 0.1));
  border: 1px solid rgba(100, 255, 218, 0.45);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#game-container .game-header-primary:hover {
  background: linear-gradient(135deg, rgba(100, 255, 218, 0.22), rgba(100, 200, 255, 0.16));
  border-color: rgba(100, 255, 218, 0.65);
  color: #ffffff;
}

#game-container .demand-bar-section {
  margin: 0.35rem 0 0.5rem;
}

#game-container .demand-bar-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.38);
  margin-bottom: 0.25rem;
}

#game-container .demand-bar-wrap {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

#game-container .demand-bar-flex {
  display: flex;
  width: 100%;
  height: 100%;
}

#game-container .demand-bar-met {
  flex: 0 0 0%;
  min-width: 0;
  background: linear-gradient(90deg, #15803d, #22c55e);
  transition: flex-basis 0.2s ease;
}

#game-container .demand-bar-gap-fill {
  flex: 1 1 auto;
  background: rgba(255, 255, 255, 0.1);
  min-width: 0;
}

#game-container .demand-bar-ghost {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: rgba(167, 243, 208, 0.55);
  pointer-events: none;
  transition: left 0.15s ease, width 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
  #game-container .demand-bar-met,
  #game-container .demand-bar-ghost {
    transition: none;
  }
}

#game-container .demand-ghost-hint {
  font-size: 0.65rem;
  color: rgba(167, 243, 208, 0.85);
  margin: 0.25rem 0 0;
  min-height: 1em;
}

#game-container .n1-weak-hint {
  font-size: 0.68rem;
  color: rgba(255, 193, 7, 0.9);
  margin: 0.35rem 0 0;
  min-height: 0;
}

#game-container .ppa-compare-wrap {
  position: relative;
  margin-top: 0.5rem;
}

#game-container .ppa-compare-btn {
  font-size: 0.72rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: transparent;
  color: #D4AF37;
  cursor: pointer;
}

#game-container .planner-ppa-popover {
  margin-top: 0.4rem;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(100, 255, 218, 0.2);
  background: rgba(8, 20, 35, 0.96);
  font-size: 0.76rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}

#game-container .planner-ppa-popover p {
  margin: 0 0 0.5rem;
}

#game-container .planner-ppa-popover p.ppa-popover-last {
  margin-bottom: 0;
}

#game-container #toolbar-panel .tool-btn-row.guided-hidden {
  display: none !important;
}
