/* ---------------------------------------------------------------------
 * style.css — dark finance-terminal theme, matching risk-command-center /
 * valuation-command-center / market-simulator / company-deep-dive /
 * interview-command-center. Slightly more playful here (a "level-up"
 * feel to year transitions, badge-style progress pips, punchier
 * good/bad color coding) since this is explicitly a game — but still
 * built from the same dark, professional palette, not a toy skin.
 * ------------------------------------------------------------------- */

:root {
  color-scheme: dark;
  --page-bg: #05070b;
  --surface-1: #0b0e15;
  --surface-2: #0f131c;
  --surface-3: #131826;
  --border: rgba(0, 240, 255, 0.14);
  --border-soft: rgba(255, 255, 255, 0.08);
  --text-primary: #e6edf7;
  --text-secondary: #9fb0c3;
  --text-muted: #6b7a8f;
  --accent-cyan: #00f0ff;
  --accent-magenta: #ff2ec4;
  --accent-amber: #ffb020;
  --accent-purple: #a78bfa;
  --up: #0ca30c;
  --down: #e34948;
  --focus-ring: rgba(0, 240, 255, 0.55);
  --font: -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: "SFMono-Regular", "Consolas", "Cascadia Mono", "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: var(--font);
  min-height: 100%;
}

body {
  background-image:
    radial-gradient(circle at 12% 0%, rgba(0, 240, 255, 0.07), transparent 45%),
    radial-gradient(circle at 88% 8%, rgba(255, 46, 196, 0.06), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(167, 139, 250, 0.04), transparent 50%);
  background-attachment: fixed;
}

a { color: var(--accent-cyan); }
::selection { background: rgba(0, 240, 255, 0.25); }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--surface-2); color: var(--accent-cyan);
  padding: 8px 12px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

button, input, select { font-family: inherit; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ---------- Header ---------- */

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.05), transparent);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-cyan); box-shadow: 0 0 8px 2px rgba(0, 240, 255, 0.7);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(0.8); } }
.brand h1 { font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase; margin: 0; font-weight: 700; }
.brand .sub { font-size: 11px; color: var(--text-muted); letter-spacing: 0.02em; }
.header-links { display: flex; align-items: center; gap: 14px; font-size: 12px; }
.header-links a { color: var(--text-muted); text-decoration: none; }
.header-links a:hover { color: var(--accent-cyan); }

/* ---------- Shell / screens ---------- */

.shell { max-width: 960px; margin: 0 auto; padding: 28px 24px 60px; }
.screen { display: none; }
.screen.active { display: block; animation: fadeSlideIn 0.4s ease; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.card {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 20px 22px;
}
.card + .card { margin-top: 16px; }

.section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent-cyan); margin: 0 0 14px;
}
.section-label::before {
  content: ''; width: 6px; height: 6px;
  background: var(--accent-cyan); box-shadow: 0 0 6px 1px var(--accent-cyan);
  border-radius: 1px;
}

.btn {
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  padding: 11px 20px; border-radius: 8px;
  font-size: 13px; letter-spacing: 0.03em; cursor: pointer;
  transition: all 0.15s ease;
}
.btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.btn.primary {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.16), rgba(167, 139, 250, 0.12));
  border-color: var(--accent-cyan); color: var(--accent-cyan); font-weight: 700;
}
.btn.primary:hover { box-shadow: 0 0 18px rgba(0, 240, 255, 0.25); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.full { width: 100%; text-align: center; }
.btn.big { padding: 15px 20px; font-size: 14.5px; letter-spacing: 0.04em; margin-top: 18px; }

/* ---------- Setup screen ---------- */

.hero-card {
  background: linear-gradient(160deg, rgba(0, 240, 255, 0.06), rgba(167, 139, 250, 0.04));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 26px;
  margin-bottom: 24px;
}
.hero-text { font-size: 13.5px; line-height: 1.75; color: var(--text-secondary); margin: 0; }
.hero-text strong { color: var(--text-primary); }

.setup-section { margin-bottom: 26px; }

.industry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

.industry-card {
  background: var(--surface-2);
  border: 2px solid var(--border-soft);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex; flex-direction: column;
}
.industry-card:hover { border-color: rgba(0, 240, 255, 0.4); transform: translateY(-2px); }
.industry-card.selected {
  border-color: var(--accent-cyan);
  background: linear-gradient(160deg, rgba(0, 240, 255, 0.1), var(--surface-2));
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
}
.industry-card h3 { margin: 0 0 4px; font-size: 17px; }
.industry-card .tagline { font-size: 11.5px; color: var(--text-muted); margin: 0 0 12px; line-height: 1.5; min-height: 33px; }
.industry-card .trait-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.industry-trait {
  font-size: 9.5px; padding: 3px 7px; border-radius: 4px;
  background: var(--surface-3); border: 1px solid var(--border-soft); color: var(--text-secondary);
}

.years-row { display: flex; align-items: center; gap: 18px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 16px 18px; }
.years-row input[type="range"] { flex: 1; }
.years-display { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--accent-cyan); min-width: 80px; text-align: right; }

input[type="range"] {
  -webkit-appearance: none; width: 100%; height: 4px; border-radius: 2px;
  background: var(--border-soft); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: var(--surface-1); border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 10px 1px rgba(0, 240, 255, 0.6); cursor: pointer; margin-top: -6.5px;
}
input[type="range"]::-moz-range-thumb {
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--surface-1); border: 2px solid var(--accent-cyan); cursor: pointer;
}
.range-scale { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--text-muted); margin-top: 5px; }

/* ---------- Game topbar / progress ---------- */

.game-topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.year-pip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.year-pip {
  width: 26px; height: 26px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  background: var(--surface-3); border: 1px solid var(--border-soft); color: var(--text-muted);
}
.year-pip.active { border-color: var(--accent-cyan); color: var(--accent-cyan); box-shadow: 0 0 8px 1px rgba(0,240,255,0.4); }
.year-pip.done { border-color: var(--up); color: var(--up); background: rgba(12,163,12,0.08); }

.industry-pill {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--accent-purple); color: var(--accent-purple);
}

.progress-track { height: 3px; background: var(--border-soft); border-radius: 2px; overflow: hidden; margin-bottom: 20px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple)); transition: width 0.4s ease; }

/* ---------- Dashboard (company state) ---------- */

.dashboard-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1px; background: var(--border-soft);
  border: 1px solid var(--border-soft); border-radius: 10px; overflow: hidden;
  margin-bottom: 18px;
}
.dashboard-tile { background: var(--surface-2); padding: 13px 14px; }
.dashboard-tile .dt-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 5px; }
.dashboard-tile .dt-value { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--text-primary); }
.dashboard-tile .dt-value.up { color: var(--up); }
.dashboard-tile .dt-value.down { color: var(--down); }
.dashboard-tile .dt-value.warn { color: var(--accent-amber); }

/* ---------- Decisions ---------- */

.decision-card { border-color: rgba(0, 240, 255, 0.2); }
.decision-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 28px; }
@media (max-width: 700px) { .decision-grid { grid-template-columns: 1fr; } }

.decision-item .control-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; gap: 8px; }
.decision-item .control-label .value { font-family: var(--mono); color: var(--accent-cyan); font-weight: 700; font-size: 13px; white-space: nowrap; }
.hint-text { font-size: 10px; color: var(--text-muted); font-weight: 400; }

.expand-toggle {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 22px; padding: 14px 16px;
  background: var(--surface-3); border: 1px solid var(--border-soft); border-radius: 8px;
  cursor: pointer; font-size: 12px; color: var(--text-secondary); line-height: 1.6;
}
.expand-toggle input { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; accent-color: var(--accent-purple); cursor: pointer; }
.expand-toggle strong { color: var(--accent-purple); }
.expand-toggle.disabled { opacity: 0.5; cursor: not-allowed; }

.decision-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.cash-check { font-size: 11.5px; color: var(--text-muted); font-family: var(--mono); }
.cash-check.warn { color: var(--accent-amber); }
.cash-check.danger { color: var(--down); font-weight: 700; }

/* ---------- Year result screen ---------- */

.result-hero { text-align: center; padding: 10px 0 6px; }
.result-hero h2 { font-size: 24px; margin: 0; }
.result-hero.final { padding: 24px 0 10px; }
.result-hero.final h2 { font-size: 30px; background: linear-gradient(135deg, #ffffff 30%, var(--accent-cyan)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.event-card { border-color: rgba(255, 176, 32, 0.4); background: linear-gradient(160deg, rgba(255, 176, 32, 0.08), var(--surface-2)); }
.event-card p#event-description { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin: 0; }
.event-card.negative { border-color: rgba(227, 73, 72, 0.4); background: linear-gradient(160deg, rgba(227, 73, 72, 0.08), var(--surface-2)); }
.event-card.positive { border-color: rgba(12, 163, 12, 0.4); background: linear-gradient(160deg, rgba(12, 163, 12, 0.08), var(--surface-2)); }

table.statement-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-family: var(--mono); }
table.statement-table td, table.statement-table th { padding: 7px 4px; border-bottom: 1px solid var(--border-soft); }
table.statement-table td:first-child, table.statement-table th:first-child { text-align: left; color: var(--text-secondary); font-family: var(--font); }
table.statement-table td:not(:first-child), table.statement-table th:not(:first-child) { text-align: right; color: var(--text-primary); }
table.statement-table tr.subtotal td { font-weight: 700; color: var(--text-primary); border-top: 1px solid var(--border-soft); border-bottom: 2px solid var(--accent-cyan); }
table.statement-table tr.total td { font-weight: 700; color: var(--accent-cyan); border-top: 1px solid var(--border-soft); border-bottom: 2px solid var(--accent-cyan); }
table.statement-table td.neg { color: var(--down); }
table.statement-table td.pos { color: var(--up); }

.balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.balance-item { background: var(--surface-3); border: 1px solid var(--border-soft); border-radius: 8px; padding: 12px 14px; }
.balance-item .bi-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 5px; }
.balance-item .bi-value { font-family: var(--mono); font-size: 16px; font-weight: 700; }

.notes-list { margin: 16px 0; }
.notes-item {
  font-size: 12px; color: var(--text-secondary); line-height: 1.6;
  padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent-amber); border-radius: 6px; margin-bottom: 8px;
}

/* ---------- Final results ---------- */

.chart-wrap { position: relative; height: 300px; }
.chart-wrap.tall { height: 360px; }

.valuation-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .valuation-columns { grid-template-columns: 1fr; } }
.valuation-col { background: var(--surface-3); border: 1px solid var(--border-soft); border-radius: 10px; padding: 16px 18px; }
.valuation-col h4 { margin: 0 0 12px; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-cyan); }
.valuation-col .formula-line { font-family: var(--mono); font-size: 11.5px; color: var(--text-secondary); line-height: 1.9; }
.valuation-col .formula-line strong { color: var(--text-primary); }
.valuation-col .final-value { font-family: var(--mono); font-size: 24px; font-weight: 800; color: var(--accent-cyan); margin-top: 10px; }
.valuation-col .caveat { font-size: 11px; color: var(--accent-amber); margin-top: 8px; line-height: 1.5; }

.narrative-text { font-size: 13.5px; line-height: 1.85; color: var(--text-secondary); }
.narrative-text p { margin: 0 0 12px; }
.narrative-text strong { color: var(--text-primary); }

.table-scroll { overflow-x: auto; }
.table-scroll table.statement-table { min-width: 640px; }

/* ---------- Footer ---------- */

.footer-note {
  padding: 20px 24px 36px; color: var(--text-muted); font-size: 11px; line-height: 1.6;
  border-top: 1px solid var(--border-soft); margin-top: 12px;
  max-width: 960px; margin-left: auto; margin-right: auto;
}
.footer-links { display: block; margin-top: 6px; }
.footer-links a { margin-right: 14px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 640px) {
  .game-topbar { flex-direction: column; align-items: flex-start; }
  .decision-footer { flex-direction: column; align-items: stretch; }
}
