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

:root {
  --bg: #07111f;
  --bg-soft: #101b2b;
  --panel: rgba(13, 24, 41, 0.78);
  --panel-light: #ffffff;
  --text: #f5f7fb;
  --text-soft: #d6deea;
  --body: #435166;
  --border: rgba(255, 255, 255, 0.12);
  --line: rgba(10, 23, 38, 0.08);
  --gold: #ffd54f;
  --blue: #69b4ff;
  --shadow: 0 24px 60px rgba(4, 9, 18, 0.28);
  --radius: 24px;
}

html,
body {
  min-height: 100%;
  margin: 0;
  font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at top right, rgba(105, 180, 255, 0.18), transparent 24%),
    linear-gradient(180deg, #07111f 0%, #101b2b 28%, #eff4fb 28%, #eff4fb 100%);
  color: var(--text);
}

body {
  padding: 0;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.intro-screen,
.summary-screen {
  min-height: calc(100vh - 48px);
  display: none;
  align-items: center;
  justify-content: center;
}

.intro-screen.active,
.summary-screen.active {
  display: flex;
}

.intro-card,
.summary-card {
  width: min(1080px, 100%);
  padding: 36px;
  border-radius: 30px;
  background: rgba(9, 18, 33, 0.8);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.eyebrow,
.section-kicker,
.feedback-label {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9dd1ff;
}

.intro-card h1,
.summary-card h1,
.topbar h1 {
  margin: 0;
  font-family: 'Georgia', 'Times New Roman', serif;
  letter-spacing: -0.03em;
}

.intro-card h1,
.summary-card h1 {
  font-size: clamp(2.6rem, 6vw, 4rem);
}

.intro-text,
.summary-text,
.panel-copy,
.scenario-brief,
.feedback-panel p,
.decision-hint {
  font-family: 'Segoe UI', sans-serif;
}

.intro-text,
.summary-text {
  max-width: 64ch;
  margin: 16px 0 0;
  line-height: 1.8;
  color: var(--text-soft);
  font-size: 1.03rem;
}

.intro-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.intro-panel,
.summary-panel {
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.intro-panel h2,
.summary-panel h2,
.panel-header h2,
.feedback-panel h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  line-height: 1.35;
  color: #ffffff;
}

.intro-panel ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.72;
  color: var(--text-soft);
}

.intro-panel li + li {
  margin-top: 8px;
}

.primary-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  background: var(--gold);
  color: #0d2440;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
  box-shadow: 0 14px 26px rgba(255, 213, 79, 0.18);
}

.primary-btn:hover {
  transform: translateY(-2px);
  background: #ffe082;
}

.game-screen {
  display: none;
}

.game-screen.active {
  display: block;
}

.topbar,
.metric-card,
.district-panel,
.decision-panel,
.history-panel {
  border-radius: var(--radius);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 24px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.topbar-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.88rem;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  padding: 16px;
  background: rgba(9, 18, 33, 0.82);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.metric-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.metric-head span {
  color: var(--text-soft);
  font-size: 0.85rem;
}

.metric-head strong {
  font-size: 1.05rem;
}

.metric-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.metric-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #69b4ff 0%, #ffd54f 100%);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 16px;
}

.district-panel,
.decision-panel,
.history-panel {
  padding: 20px;
  background: var(--panel-light);
  border: 1px solid var(--line);
  box-shadow: 0 20px 44px rgba(10, 23, 38, 0.08);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-header h2,
.feedback-panel h3 {
  color: #161616;
}

.panel-copy,
.scenario-brief,
.feedback-panel p,
.decision-hint {
  margin: 0;
  color: var(--body);
  line-height: 1.7;
}

.scenario-brief {
  padding: 16px;
  border-radius: 18px;
  background: #f6f9ff;
  border: 1px solid rgba(0, 94, 162, 0.08);
}

.district-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.district-card,
.option-card,
.history-card {
  border-radius: 20px;
  border: 1px solid rgba(10, 23, 38, 0.08);
}

.district-card {
  padding: 16px;
  background: #f8fbff;
}

.district-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 10px;
}

.district-name {
  margin: 0;
  font-size: 1rem;
  color: #161616;
}

.district-score {
  font-size: 0.82rem;
  font-weight: 800;
  color: #005EA2;
}

.district-meta {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: #687586;
}

.district-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(10, 23, 38, 0.07);
  overflow: hidden;
  margin-bottom: 10px;
}

.district-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #69b4ff 0%, #7ed9b0 100%);
}

.district-note {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--body);
}

.options-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.option-card {
  width: 100%;
  padding: 18px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.option-card:hover:not([disabled]) {
  transform: translateY(-2px);
  border-color: rgba(0, 94, 162, 0.18);
  box-shadow: 0 16px 34px rgba(10, 23, 38, 0.08);
}

.option-card[disabled] {
  cursor: default;
  opacity: 0.72;
}

.option-card.selected {
  border-color: rgba(0, 94, 162, 0.28);
  box-shadow: 0 16px 34px rgba(0, 94, 162, 0.1);
  background: #f6faff;
}

.option-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.option-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
  color: #161616;
}

.option-tag {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: #edf4ff;
  color: #005EA2;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.option-summary {
  margin: 10px 0 0;
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--body);
}

.effect-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.effect-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: #f1f5fb;
  color: #4d5a6d;
}

.effect-chip.positive {
  background: #e8f8ef;
  color: #136f3c;
}

.effect-chip.negative {
  background: #fff0ed;
  color: #a63b1a;
}

.feedback-panel {
  margin-top: 16px;
  padding: 18px;
  border-radius: 20px;
  background: #f7f1e5;
  border: 1px solid rgba(122, 90, 35, 0.12);
}

.feedback-panel.hidden,
.hidden {
  display: none;
}

.feedback-meta {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(122, 90, 35, 0.08);
  color: #6c5428;
  font-size: 0.84rem;
  font-weight: 700;
}

.decision-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.history-panel {
  margin-top: 16px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-card {
  padding: 14px 16px;
  background: #f8fbff;
}

.history-card strong {
  display: block;
  margin-bottom: 4px;
  color: #161616;
}

.history-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--body);
}

.badge-list,
.final-metrics,
.summary-history {
  display: grid;
  gap: 10px;
}

.badge-item,
.final-metric-item,
.summary-entry {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.badge-item strong,
.summary-entry strong {
  display: block;
  margin-bottom: 4px;
}

.final-metric-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--text);
}

.final-metric-item span:last-child {
  font-weight: 800;
  color: var(--gold);
}

.full-width {
  grid-column: 1 / -1;
}

.summary-actions {
  margin-top: 24px;
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 16px 12px 28px;
  }

  .intro-card,
  .summary-card,
  .topbar,
  .district-panel,
  .decision-panel,
  .history-panel {
    padding: 16px;
  }

  .intro-grid,
  .summary-grid,
  .metric-grid,
  .district-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-header,
  .decision-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-pills {
    justify-content: flex-start;
  }
}
