/* ═══════════════════════════════════════════════════════════
   Terminal Building Management Challenge — Stylesheet
   Aligned with sister game (DT Map) green palette
   ═══════════════════════════════════════════════════════════ */

:root {
  --ocean:   #00664B;
  --daylight:#DAEFE8;
  --sundown: #FFC20E;
  --text:    #202322;
  --muted:   #64706C;
  --line:    rgba(0,0,0,.08);
  --glass:   rgba(255,255,255,.88);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  background: #EEF7F3;
  color: var(--text);
  min-height: 100vh;
}

/* ── Header removed — game identified by hero section ────── */

/* ── Page wrap ──────────────────────────────────────────── */
.wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 8px clamp(12px, 3vw, 40px) 12px;
}

/* ── Hero / progress banner ─────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 1.15rem;
  padding: 1.2rem 1.4rem 1.5rem;
  background:
    linear-gradient(135deg, rgba(0,102,75,0.96), rgba(0,60,44,0.96)),
    radial-gradient(circle at 82% 20%, rgba(255,255,255,0.24), transparent 26%);
  border: 1px solid rgba(0,102,75,0.35);
  box-shadow: 0 18px 45px rgba(0,0,0,0.18);
  margin-bottom: 16px;
}
.hero::before {
  content: "✈";
  position: absolute;
  right: 44px; top: 14px;
  font-size: 5.8rem;
  color: rgba(255,255,255,0.10);
  transform: rotate(-8deg);
}
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0; height: 14px;
  background: repeating-linear-gradient(90deg,
    rgba(255,255,255,0.13) 0px, rgba(255,255,255,0.13) 24px,
    transparent 24px, transparent 54px);
}
.hero-kicker {
  display: inline-block;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 850;
  color: #fff;
  margin-bottom: 0.55rem;
  letter-spacing: 0.04em;
}
.hero-title {
  font-size: clamp(1.45rem, 3.5vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 0.85rem;
}
.progress-shell {
  width: 100%;
  height: 13px;
  border-radius: 999px;
  background: rgba(255,255,255,0.25);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.20);
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #16A34A, var(--sundown));
  transition: width 0.35s ease;
  width: 0%;
}
#progress-text {
  margin-top: 0.3rem;
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
}

/* ── Hero top row (title + How to play button) ──────────── */
.hero-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.85rem;
}
.hero-top-row .hero-title { margin-bottom: 0; }
.hero-help-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.40);
  border-radius: 10px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.45rem 1rem;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: background 0.15s, border-color 0.15s;
  min-width: 120px;
  justify-content: center;
}
.hero-help-btn:hover { background: rgba(255,255,255,0.30); border-color: rgba(255,255,255,0.6); }

/* ── How to play modal body ──────────────────────────────── */
.how-to-play-body {
  padding: 4px 0;
  line-height: 1.65;
  color: var(--text);
  font-size: 0.92rem;
}
.how-to-play-body p { margin-bottom: 0.9rem; }
.how-to-play-body p:last-child { margin-bottom: 0; }

/* ── How to play expander (kept for reference, no longer in DOM) ── */
details.about {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  margin-bottom: 14px;
}
details.about summary {
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--ocean);
  cursor: pointer;
  user-select: none;
  list-style: none;
}
details.about summary::before { content: "▶ "; font-size: 0.7em; }
details[open].about summary::before { content: "▼ "; }
details.about .about-body {
  padding: 0 1rem 1rem;
  line-height: 1.6;
  color: var(--muted);
  font-size: 0.9rem;
}
details.about .about-body p { margin-top: 0.6rem; }

/* ── Event card ─────────────────────────────────────────── */
#event-card {
  border-radius: 1rem;
  padding: 1rem 1.2rem;
  margin-bottom: 0;
  background: linear-gradient(155deg, rgba(255,244,210,0.99) 0%, rgba(255,255,255,0.97) 100%);
  border: 1px solid rgba(255,194,14,0.45);
  border-left: 6px solid var(--sundown);
  border-top: 3px solid var(--sundown);
  color: #5E3A00;
  box-shadow: 0 12px 28px rgba(0,0,0,0.12);
  position: relative;
  overflow: hidden;
}
#event-card::after {
  content: "⚡";
  position: absolute;
  right: 10px; bottom: 6px;
  font-size: 3.8rem;
  opacity: 0.07;
  pointer-events: none;
  line-height: 1;
}

/* Pop-in animation triggered per new month */
@keyframes event-pop {
  0%   { transform: scale(0.94) translateY(-8px); opacity: 0.4; }
  60%  { transform: scale(1.025) translateY(2px); opacity: 1; }
  100% { transform: scale(1)    translateY(0);   opacity: 1; }
}
.event-card-animate {
  animation: event-pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.event-badge {
  display: inline-block;
  background: var(--sundown);
  color: #5E3A00;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
  margin-bottom: 0.55rem;
}
.event-label    { font-size: 0.77rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.3rem; opacity: 0.7; }
.event-name     { font-size: 1.15rem; font-weight: 900; margin-bottom: 0.45rem; line-height: 1.2; }
.event-desc     { font-size: 0.88rem; line-height: 1.5; margin-bottom: 0.6rem; }
.event-conditions { font-size: 0.85rem; display: flex; flex-direction: column; gap: 4px; }
.cond-item      { display: block; }
.occ-band       { font-weight: 900; color: var(--ocean); }

/* ── DT Insight card ────────────────────────────────────── */
#dt-insight {
  border-radius: 1rem;
  padding: 1rem 1.2rem;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #E8F5FF, #F0FFF4);
  border: 1px solid rgba(0,102,75,0.25);
  border-left: 7px solid var(--ocean);
  color: #0A2540;
  box-shadow: 0 10px 24px rgba(0,0,0,0.10);
}
.insight-title       { font-size: 1rem; font-weight: 800; margin-bottom: 0.55rem; }
.insight-explanation { font-size: 0.9rem; line-height: 1.55; margin-bottom: 0.85rem; }
.insight-grid        { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 0.75rem; }
.insight-col         { background: rgba(255,255,255,0.72); border-radius: 0.6rem; padding: 0.6rem 0.75rem; }
.insight-row         { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 2px 0; }
.insight-label       { font-size: 0.78rem; color: var(--muted); flex-shrink: 0; }
.insight-val         { font-size: 0.88rem; font-weight: 700; color: #0A2540; text-align: right; }
.highlight-blue      { color: var(--ocean); }
.highlight-green     { color: #16A34A; }
.insight-hint        { font-size: 0.88rem; color: #0A2540; }

/* ── Game section (block container) ─────────────────────── */
.game-section {
  display: block;
}

/* ── Chart row: event-card (col 1) | chart (col 2) | right panel (col 3) ── */
.game-row {
  display: grid;
  grid-template-columns: 210px 1fr 290px;
  gap: 14px;
  align-items: stretch;   /* equal height for all three columns */
  margin-bottom: 12px;
}
/* Explicit column placement so DOM order (chart first for mobile) works */
.game-row .chart-box  { grid-column: 2; grid-row: 1; }
.game-row #event-card { grid-column: 1; grid-row: 1; }
.game-row .game-right { grid-column: 3; grid-row: 1; }

/* ── Right panel: event card + strategy + buttons ────────── */
.game-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── YTD summary row (4 cards horizontal) ───────────────── */
.ytd-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

/* ── Chart ──────────────────────────────────────────────── */
.chart-box {
  position: relative;
  background: rgba(255,255,255,0.94);
  border-radius: 1rem;
  padding: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
  overflow: hidden;
}
#chart-combined { width: 100%; }
#chart-combined svg { width: 100%; height: auto; display: block; }
.chart-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: #0A2540;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

/* ── Controls (preset cards + sliders) ──────────────────── */
.controls-box {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
}
.controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.controls-label { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ocean); }

/* Mode toggle */
.mode-toggle { display: flex; gap: 6px; }
.mode-btn {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.3rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mode-btn.active {
  background: var(--ocean);
  color: #fff;
  border-color: var(--ocean);
}
.mode-btn:hover:not(.active) { background: var(--daylight); }

/* Preset cards */
#preset-cards { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.preset-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
}
.preset-card:hover:not(:disabled) { background: var(--daylight); border-color: rgba(0,102,75,0.4); }
.preset-card.active { background: var(--daylight); border-color: var(--ocean); }
.preset-card:disabled { opacity: 0.5; cursor: not-allowed; }
.preset-emoji { font-size: 1.3rem; flex-shrink: 0; }
.preset-info  { display: flex; flex-direction: column; }
.preset-name  { font-size: 0.9rem; font-weight: 800; }
.preset-desc  { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.preset-card.active .preset-name { color: var(--ocean); }
.preset-card.active .preset-desc { color: var(--muted); }

/* Sliders */
#sliders-container { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.slider-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.slider-header { display: flex; justify-content: space-between; align-items: baseline; }
.slider-label { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.slider-value { font-size: 0.88rem; font-weight: 800; color: var(--ocean); min-width: 3.5rem; text-align: right; }
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--daylight);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--ocean);
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--ocean);
  border: 2px solid white;
  cursor: pointer;
}

/* Strategy summary line */
#strategy-line {
  font-size: 0.82rem;
  color: var(--muted);
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

/* ── Action buttons — inside right panel ────────────────── */
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.actions button {
  background: linear-gradient(135deg, #fff, #DCEEFF);
  color: #071A2F;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.75rem 0.6rem;
  font-size: 0.84rem;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0,0,0,0.10);
  transition: background 0.15s, color 0.15s;
  line-height: 1.3;
}
.actions button:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--daylight), #fff);
  color: var(--ocean);
}
.actions button:disabled {
  background: rgba(0,0,0,0.05);
  color: rgba(0,0,0,0.30);
  box-shadow: none;
  cursor: not-allowed;
}
#btn-dt.dt-used:disabled {
  background: rgba(0,102,75,0.08);
  color: rgba(0,0,0,0.35);
  border-left: 3px solid var(--ocean);
}

/* ── DT button pulse (when improvement available) ────────── */
@keyframes dt-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 8px 22px rgba(0,0,0,0.10); }
  50%       { transform: scale(1.04); box-shadow: 0 10px 28px rgba(0,102,75,0.30); border-color: var(--ocean); }
}
.dt-btn-pulse {
  animation: dt-pulse 1.6s ease-in-out infinite;
  border-color: var(--ocean) !important;
  color: var(--ocean) !important;
}

/* ── DT results modal ───────────────────────────────────── */
.dt-modal-screen {
  max-width: 620px;
  background: linear-gradient(160deg, #EEF7F3 0%, #fff 60%);
}
.dt-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.dt-modal-title {
  font-size: 1.1rem;
  font-weight: 900;
  color: #0A2540;
}
.dt-token-chip {
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(0,102,75,0.12);
  color: var(--ocean);
  border-radius: 999px;
  padding: 0.22rem 0.75rem;
  border: 1px solid rgba(0,102,75,0.22);
}
.dt-token-chip.dt-token-saved {
  background: rgba(22,163,74,0.10);
  color: #15803D;
  border-color: rgba(22,163,74,0.25);
}
.dt-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.dt-modal-apply-btn {
  background: var(--ocean);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s;
}
.dt-modal-apply-btn:hover { background: #004d38; }
.dt-modal-close-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.dt-modal-close-btn:hover { background: var(--daylight); }

/* ── DT chart nudge overlay ─────────────────────────────── */
.dt-chart-nudge {
  position: absolute;
  bottom: 52px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,194,14,0.92);
  border: 1px solid rgba(200,150,0,0.35);
  border-radius: 20px;
  padding: 0.38rem 1.05rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5E3A00;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,0.14);
  pointer-events: none;
  z-index: 5;
}
.dt-chart-nudge[hidden] { display: none; }
.dt-nudge-icon { font-size: 1rem; line-height: 1; }
.dt-nudge-text strong { font-weight: 900; }

/* ── YTD cards (now in .ytd-row, not sidebar) ───────────── */

.glass-card {
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.6rem 0.8rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.10);
  color: #0A2540;
}
.glass-card.accent-blue   { border-left: 6px solid var(--ocean); }
.glass-card.accent-green  { border-left: 6px solid #16A34A; }
.glass-card.accent-amber  { border-left: 6px solid var(--sundown); }
.glass-card.accent-violet { border-left: 6px solid #8B5CF6; }

.metric-title { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; font-weight: 800; letter-spacing: 0.05em; margin-bottom: 0.28rem; }
.metric-value { font-size: 1.35rem; font-weight: 900; color: #0A2540; line-height: 1.05; }
.metric-sub   { font-size: 0.72rem; color: var(--muted); margin-top: 0.25rem; }

/* Budget alert variants */
.glass-card.overspent { border-color: #DC2626 !important; background: #FEF2F2; }
.glass-card.overspent .metric-value { color: #991B1B; }

/* Arrow indicators */
.arrow-up      { color: #16A34A; font-weight: 900; }
.arrow-down    { color: #DC2626; font-weight: 900; }
.arrow-neutral { color: #64748B; font-weight: 900; }

/* ── End-of-year panel ──────────────────────────────────── */
#end-of-year {
  margin-top: 0;
  background: rgba(255,255,255,0.94);
  border-radius: 1.2rem;
  padding: 1rem 1.2rem;
  box-shadow: 0 22px 50px rgba(0,0,0,0.14);
  color: #0A2540;
  border: 1px solid var(--line);
}
.eoy-title {
  font-size: 1.6rem;
  font-weight: 900;
  margin-bottom: 0.6rem;
  color: #0A2540;
}
.eoy-main {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  margin-bottom: 0.65rem;
}
.grade-badge {
  width: 110px; height: 110px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1.2rem;
  font-size: 3rem;
  font-weight: 1000;
  color: white;
  box-shadow: 0 16px 40px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.35);
  letter-spacing: -0.02em;
}
.eoy-head  { flex: 1; min-width: 0; }
.eoy-score   { font-size: 1.15rem; font-weight: 800; margin-bottom: 0.25rem; color: #0A2540; }
.eoy-tagline { font-size: 0.95rem; color: #475569; margin-bottom: 0; }

/* Status boxes */
.status-box {
  border-radius: 0.75rem;
  padding: 0.5rem 0.85rem;
  border-left: 6px solid;
  margin-bottom: 0.65rem;
  font-size: 0.83rem;
  line-height: 1.45;
  background: rgba(255,255,255,0.7);
}
.status-box.success { border-color: #16A34A; }
.status-box.warning { border-color: var(--sundown); }
.status-box.error   { border-color: #DC2626; }

/* EOY metric row */
.eoy-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.eoy-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #F8FAFC;
  border-radius: 0.6rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #E2E8F0;
}
.eoy-metric-label  { font-size: 0.72rem; color: #64748B; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; }
.eoy-metric-val    { font-size: 1.15rem; font-weight: 800; }
.eoy-metric-target { font-size: 0.72rem; color: #94A3B8; }
.good { color: #16A34A; }
.bad  { color: #DC2626; }

/* ── DT Impact (end-of-year) ─────────────────────────────── */
.dt-opportunity {
  margin-top: 0.4rem;
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border: 1px solid rgba(180,130,0,0.20);
  border-left: 6px solid #D97706;
  border-radius: 0.85rem;
  padding: 0.65rem 0.95rem;
}
.dt-opp-title { font-size: 0.88rem; font-weight: 800; color: #92400E; margin-bottom: 0.25rem; }
.dt-opp-desc  { font-size: 0.8rem; color: #1E293B; line-height: 1.5; margin-bottom: 0.35rem; }
.dt-opp-note  { font-size: 0.77rem; color: #92400E; line-height: 1.5; font-style: italic; }

.eoy-comparison-chart {
  margin-top: 1.2rem;
  background: rgba(255,255,255,0.94);
  border-radius: 0.85rem;
  padding: 1rem;
  border: 1px solid #E2E8F0;
}
.eoy-comparison-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0A2540;
  margin-bottom: 0.3rem;
}
.eoy-comparison-desc {
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.55;
  margin-bottom: 0.6rem;
}
.eoy-comparison-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.dt-impact {
  margin-top: 0.4rem;
  background: linear-gradient(135deg, var(--daylight), #F0FFF4);
  border: 1px solid rgba(0,102,75,0.20);
  border-left: 6px solid var(--ocean);
  border-radius: 0.85rem;
  padding: 0.65rem 0.95rem;
}
.dt-impact-title { font-size: 0.88rem; font-weight: 800; color: #0A2540; margin-bottom: 0.25rem; }
.dt-impact-desc  { font-size: 0.8rem; color: #475569; line-height: 1.5; margin-bottom: 0.5rem; }
.dt-impact-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 0.4rem;
}
.dt-impact-metric {
  background: rgba(255,255,255,0.75);
  border-radius: 0.55rem;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dt-impact-val   { font-size: 1.1rem; font-weight: 800; }
.dt-impact-label { font-size: 0.74rem; color: #64748B; font-weight: 600; }
.dt-impact-note  { font-size: 0.78rem; color: #475569; line-height: 1.45; font-style: italic; }
.dt-impact-score {
  font-size: 0.85rem; color: #1E293B; margin-bottom: 0.4rem;
  background: rgba(255,255,255,0.75); border-radius: 0.5rem; padding: 0.5rem 0.75rem;
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
}
.dt-score-delta { font-size: 0.8rem; font-weight: 700; }

/* ── Results screen wrapper & 2-column layout ───────────── */
#results-screen { padding-bottom: 6px; }
#results-screen[hidden] { display: none; }

.results-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  align-items: start;
}
.results-chart-col .eoy-comparison-chart { margin-top: 0; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  /* On mobile the nudge becomes a fixed bottom toast instead of a chart overlay */
  .dt-chart-nudge {
    position: fixed;
    bottom: 72px; left: 50%;
    transform: translateX(-50%);
    z-index: 7500;
    box-shadow: 0 6px 20px rgba(0,0,0,0.22);
    max-width: calc(100vw - 32px);
    white-space: normal;
    text-align: center;
  }

  /* Collapse 3-col grid to single column; reorder to: event-card → chart → right panel */
  .game-row {
    display: flex;
    flex-direction: column;
  }
  .game-row .chart-box,
  .game-row #event-card,
  .game-row .game-right { grid-column: unset; grid-row: unset; }
  .game-row #event-card { order: 1; }
  .game-row .chart-box  { order: 2; }
  .game-row .game-right { order: 3; }
  .actions      { flex-direction: row; flex-wrap: wrap; }
  .actions button { flex: 1 1 calc(50% - 5px); }
  .ytd-row      { grid-template-columns: repeat(2, 1fr); }
  .insight-grid { grid-template-columns: 1fr; }
  .eoy-metrics  { grid-template-columns: repeat(2, 1fr); }
  /* Collapse results 2-col to single column; hide chart (too small to read on tablet) */
  .results-2col { grid-template-columns: 1fr; }
  .results-chart-col { display: none; }
}

/* ── Mobile chart alt (hidden by default, shown at narrow widths) ─────────── */
#chart-mobile-alt { display: none; }
#chart-mobile-alt svg { width: 100%; height: auto; display: block; }

/* ── Chart accordion toggle (mobile only) ────────────────────────────────── */
.chart-toggle {
  display: none;
}

@media (max-width: 520px) {
  .hero-title   { font-size: 1.3rem; }
  .actions      { flex-direction: column; }
  .actions button { flex: none; width: 100%; }
  .ytd-row      { display: none; }
  .eoy-metrics  { grid-template-columns: 1fr; }
  .grade-badge  { width: 90px; height: 90px; font-size: 2.4rem; }
  .metric-value { font-size: 1.2rem; }
  #chart-combined { display: none; }

  /* Chart accordion */
  .chart-title  { display: none; }
  .chart-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 2px 0 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--ocean);
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  .chart-toggle-chevron {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
    display: inline-block;
  }
  .chart-box.chart-open .chart-toggle-chevron { transform: rotate(180deg); }
  .chart-box.chart-open #chart-mobile-alt { display: block; }
}
.chart-mobile-alt {
  font-size: 0.88rem;
  color: var(--text);
}
.chart-mobile-alt table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}
.chart-mobile-alt th {
  background: var(--daylight);
  color: var(--ocean);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 10px;
  text-align: left;
}
.chart-mobile-alt td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.chart-mobile-alt tr:last-child td { border-bottom: none; }
.chart-mobile-alt .cma-good { color: #16A34A; font-weight: 700; }
.chart-mobile-alt .cma-bad  { color: #DC2626; font-weight: 700; }
.chart-mobile-alt .cma-dim  { color: var(--muted); }

/* ── Mobile month results popup ─────────────────────────── */
.month-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0,0,0,0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.month-popup-overlay[hidden] { display: none; }
.month-popup {
  background: #fff;
  border-radius: 14px;
  padding: 22px 20px 18px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.22);
}
.month-popup-title {
  font-size: 1.1rem;
  font-weight: 900;
  color: #0A2540;
  margin-bottom: 14px;
}
.month-popup-body {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 16px;
}
.month-popup-body .popup-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr 1fr;
  gap: 0 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  align-items: baseline;
}
.month-popup-body .popup-row:last-child { border-bottom: none; }
.month-popup-body .popup-header  { font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.month-popup-body .popup-ytd     { background: var(--daylight); border-radius: 6px; padding: 6px 4px; margin-top: 4px; border-bottom: none; }
.month-popup-body .popup-label   { color: var(--muted); font-size: 0.85rem; }
.month-popup-body .popup-col-head { color: var(--ocean); }
.month-popup-body .popup-val     { font-weight: 800; }
.month-popup-body .popup-good    { color: #16A34A; font-weight: 700; }
.month-popup-body .popup-bad     { color: #DC2626; font-weight: 700; }
.month-popup-continue {
  width: 100%;
  background: var(--ocean);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}
.month-popup-continue:hover { background: #004d38; }

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background: rgba(255,255,255,0.86);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.footer a, .footer button {
  border: 0;
  background: transparent;
  color: var(--ocean);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  font-size: 13px;
}

/* ── About & Credits modal ──────────────────────────────── */
.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.about-overlay[hidden] { display: none; }
.about-screen {
  background: #fff;
  border-radius: 14px;
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
}
.about-close {
  position: absolute;
  top: 14px; right: 14px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
}
.about-close:hover { background: var(--daylight); }
.about-hero-sect {
  background: linear-gradient(135deg, rgba(0,102,75,0.96), rgba(0,60,44,0.96));
  border-radius: 10px;
  padding: 22px 28px;
  margin-bottom: 18px;
}
.about-hero-sect h1 {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 900;
  margin-top: 6px;
}
.eyebrow {
  color: var(--daylight);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 850;
  margin: 0 0 6px;
}
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.about-grid article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.about-grid h2 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--ocean);
}
.about-grid p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
}
.link-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--ocean);
  color: var(--ocean);
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
}
.link-btn:hover { background: var(--daylight); }
@media (max-width: 600px) {
  .about-grid { grid-template-columns: 1fr; }
  .footer { gap: 10px; font-size: 12px; }
}

/* ── Screen flip animations ─────────────────────────────── */
@keyframes screen-flip-out {
  0%   { transform: perspective(900px) rotateY(0deg);   opacity: 1; }
  100% { transform: perspective(900px) rotateY(-90deg); opacity: 0; }
}
@keyframes screen-flip-in {
  0%   { transform: perspective(900px) rotateY(90deg);  opacity: 0; }
  100% { transform: perspective(900px) rotateY(0deg);   opacity: 1; }
}
.screen-flip-out { animation: screen-flip-out 0.3s ease-in forwards; }
.screen-flip-in  { animation: screen-flip-in  0.35s ease-out forwards; }

/* ── Results-ready card (compact secondary, in .game-right) ─ */
.results-ready-card[hidden] { display: none; }
.results-ready-card {
  background: linear-gradient(135deg, var(--ocean), #004d38);
  border-radius: 0.85rem;
  padding: 0.75rem 1rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rr-title { font-size: 0.88rem; font-weight: 800; flex: 1; }
.rr-btn {
  flex-shrink: 0;
  background: #fff;
  color: var(--ocean);
  border: none;
  border-radius: 7px;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.rr-btn:hover { background: var(--daylight); }

/* ── Year-complete event card state ─────────────────────── */
.ec-complete-badge {
  background: linear-gradient(135deg, #FFC20E, #FF9500) !important;
  color: #5E2800 !important;
}
.ec-complete-trophy {
  font-size: 2.8rem;
  line-height: 1;
  margin: 0.6rem 0 0.4rem;
  text-align: center;
}
.ec-complete-title {
  text-align: center;
  font-size: 1.1rem !important;
  font-weight: 900 !important;
  margin-bottom: 0.4rem;
}
.ec-complete-desc {
  font-size: 0.82rem !important;
  text-align: center;
  line-height: 1.5;
  margin-bottom: 0.85rem;
}
.ec-see-results-btn {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, var(--ocean), #004d38);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 0.72rem 1rem;
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  transition: opacity 0.15s;
}
.ec-see-results-btn:hover { opacity: 0.88; }

/* ── Play again button (on results screen) ──────────────── */
.play-again-btn {
  display: block;
  margin: 14px auto 0;
  background: var(--ocean);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0.85rem 2.2rem;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s;
}
.play-again-btn:hover { background: #004d38; }

.learn-more-btn {
  display: block;
  margin: 8px auto 0;
  background: #FFC20E;
  color: #1a1a1a;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.8rem;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
  max-width: 480px;
}
.learn-more-btn:hover { background: #D97706; }

/* ── Occupancy colour coding ────────────────────────────── */
.occ-low    { color: #16A34A; font-weight: 700; }
.occ-medium { color: #D97706; font-weight: 700; }
.occ-high   { color: #DC2626; font-weight: 700; }

/* ── How to play redesign ───────────────────────────────── */
.htp-screen { max-width: 680px; }
.htp-hero { padding: 20px 22px; }
.htp-welcome {
  color: var(--daylight);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}
.htp-hero h1 {
  color: #fff;
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}
.htp-subtitle {
  color: rgba(255,255,255,0.80);
  font-size: 0.9rem;
  margin: 0;
}
.how-to-play-body { padding-top: 4px; }
.how-to-play-body p { font-size: 0.9rem; line-height: 1.6; color: var(--text); margin-bottom: 0.8rem; }
.htp-steps { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.htp-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #F8FAFC;
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid #E2E8F0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}
.htp-step-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--ocean);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.htp-step-dt {
  border-radius: 8px;
  width: 32px; height: 28px;
  font-size: 0.7rem;
  background: linear-gradient(135deg, var(--ocean), #004d38);
}
.htp-note {
  font-size: 0.8rem !important;
  color: var(--muted) !important;
  background: var(--daylight);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 18px !important;
}
.htp-start-btn {
  display: block;
  width: 100%;
  background: var(--ocean);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.82rem;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.15s;
}
.htp-start-btn:hover { background: #004d38; }
