:root {
  color-scheme: dark;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #2e2b28;
  color: #f4f2ec;
  --bg: #2e2b28;
  --sidebar: #252320;
  --panel: #34312d;
  --panel-2: #2c2a27;
  --card: #3a3632;
  --border: #45403a;
  --border-soft: #514a43;
  --muted: #b8b0a4;
  --text: #f4f2ec;
  --accent: #81b64c;
  --accent-strong: #6aa23d;
  --accent-soft: #3c4c2f;
  --gold: #e2bb62;
  --danger: #d46a5e;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(129, 182, 76, 0.1), transparent 24%),
    linear-gradient(180deg, #322f2c 0%, #2b2926 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 18px 16px;
  border-right: 1px solid var(--border);
  background: #262320;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 6px 18px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #1f231a;
  font-weight: 800;
  font-size: 1.2rem;
}

.brand-eyebrow,
.sidebar-label,
.tile-label,
.analysis-label,
.scene-kicker,
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: #c9c1b4;
}

.brand strong {
  display: block;
  font-size: 1.1rem;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 12px;
  border-radius: 12px;
  color: #ddd6cb;
  font-weight: 700;
}

.nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: #3a3632;
  color: #efe8db;
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
}

.nav-item.active,
.nav-item:hover {
  background: #312d29;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #1f231a;
}

.sidebar-card {
  margin-top: auto;
  padding: 16px 14px;
  border-radius: 16px;
  background: #302d2a;
  border: 1px solid var(--border);
}

.sidebar-card.muted {
  margin-top: 0;
}

.sidebar-card strong {
  display: block;
  margin-top: 6px;
  margin-bottom: 6px;
}

.sidebar-card p:last-child {
  margin-bottom: 0;
}

.page {
  width: min(100%, 1400px);
  margin: 0 auto;
  padding: 24px 24px 48px;
}

.panel,
.feature-tile,
.profile-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 26px;
}

.hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 320px;
  gap: 20px;
  align-items: start;
}

h1,
h2,
h3,
p,
ol {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.8rem, 6vw, 4.4rem);
  line-height: 0.94;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.intro,
.status,
.history li,
label span,
label output,
.tile-copy,
.profile-note,
.analysis-card p,
.sidebar-card p,
.chart-header p,
.legend,
.leaderboard-list li {
  color: var(--muted);
}

.profile-card {
  padding: 18px;
  background: linear-gradient(180deg, #3b3833 0%, #2f2c28 100%);
}

.profile-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.25rem;
  line-height: 1.2;
}

.profile-note {
  margin: 12px 0 0;
  min-height: 44px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 18px;
  margin-top: 22px;
}

.feature-tile {
  padding: 18px;
  min-height: 172px;
  background: linear-gradient(180deg, #383530 0%, #302d29 100%);
}

.feature-tile h2 {
  margin-top: 10px;
  margin-bottom: 12px;
  font-size: 1.55rem;
}

.play-tile {
  background: linear-gradient(180deg, #403a2d 0%, #343129 100%);
}

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

.setup-grid label,
label {
  display: grid;
  gap: 8px;
}

.toggle-card {
  align-content: start;
}

.toggle-button {
  width: 100%;
  justify-content: center;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 380px;
  gap: 20px;
  margin-top: 20px;
}

.main-column,
.side-column {
  display: grid;
  gap: 20px;
}

.leaderboard-layout-full {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 420px);
  gap: 20px;
  margin-top: 20px;
}

.leaderboard-hero {
  padding: 24px;
}

.leaderboard-teaser {
  min-height: 210px;
}

.leaderboard-side-rail {
  display: grid;
  gap: 20px;
}

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

.leaderboard-title {
  margin: 6px 0 0;
  font-size: 1.9rem;
}

.leaderboard-update {
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #2c2a27;
  color: #ddd6cb;
}

.leaderboard-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 999px;
  background: #403c38;
  border: 1px solid var(--border-soft);
  color: #e3ddd2;
  font-size: 0.88rem;
  font-weight: 700;
}

.leaderboard-table-wrap {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.leaderboard-table thead {
  background: #2c2a27;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
  color: #cfc7ba;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.leaderboard-table td {
  color: #f4f2ec;
  font-weight: 700;
}

.leaderboard-table tbody tr:hover {
  background: rgba(129, 182, 76, 0.08);
}

.rank-cell {
  width: 90px;
  color: #ddd6cb;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #1e2517;
  font-size: 0.88rem;
  font-weight: 800;
}

.rail-panel {
  min-height: 160px;
}

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

.highlight-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: #3a3733;
}

.highlight-item strong {
  color: var(--text);
}

.highlight-item span {
  color: var(--muted);
  font-weight: 700;
}

.panel {
  padding: 22px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.9rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: #3a3733;
  min-height: 86px;
}

.stat span,
.stat strong {
  display: block;
}

.stat span {
  font-size: 0.78rem;
  color: #c7c0b4;
}

.stat strong {
  margin-top: 10px;
  font-size: 1.1rem;
}

.status {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: #364231;
}

.inline-status {
  margin: 0;
}

.policy-form {
  display: grid;
  gap: 18px;
}

label span,
label output {
  font-size: 0.95rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  appearance: none;
  border: 1px solid #6a8d40;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(180deg, #85b84c 0%, #6ca33c 100%);
  color: #182010;
}

button.secondary {
  border-color: var(--border-soft);
  background: #3a3733;
  color: #f2ede4;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #6a8d40;
  border-radius: 999px;
  padding: 11px 18px;
  font-weight: 700;
  background: linear-gradient(180deg, #85b84c 0%, #6ca33c 100%);
  color: #182010;
}

.toggle-button.active {
  background: linear-gradient(180deg, #d0aa4f 0%, #bc9742 100%);
  border-color: #bc9742;
  color: #231c0f;
}

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

.chart-grid {
  margin-bottom: 22px;
}

.chart-panel,
.analysis-card {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: #3a3733;
}

.chart-header {
  margin-bottom: 10px;
}

.chart-header h3,
.chart-header p,
.analysis-card h3,
.analysis-card p {
  margin: 0;
}

.chart-header p,
.analysis-card p {
  margin-top: 6px;
}

.chart {
  width: 100%;
  height: auto;
  display: block;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 12px;
  font-size: 0.92rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend i {
  width: 18px;
  height: 3px;
  border-radius: 999px;
  display: inline-block;
}

.legend .gdp {
  background: #81b64c;
}

.legend .debt {
  background: #d46a5e;
}

.legend .inflation {
  background: #53a3e1;
}

.legend .unemployment {
  background: #c08ae6;
}

.history,
.leaderboard-list {
  display: grid;
  gap: 12px;
  padding-left: 20px;
  margin-bottom: 0;
}

.history li,
.leaderboard-list li {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: #3a3733;
}

.history strong,
.leaderboard-list strong,
.analysis-card h3 {
  color: var(--text);
}

.history .warning {
  color: var(--danger);
}

input[type="text"],
select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 48px;
  padding: 12px 42px 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  font: inherit;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  background:
    linear-gradient(45deg, transparent 50%, #c8c0b4 50%) calc(100% - 20px)
      calc(50% - 3px) / 8px 8px no-repeat,
    linear-gradient(135deg, #c8c0b4 50%, transparent 50%) calc(100% - 14px)
      calc(50% - 3px) / 8px 8px no-repeat,
    #403c38;
}

input[type="text"] {
  padding-right: 14px;
  background: #403c38;
}

select option {
  color: var(--text);
  background: #403c38;
}

.scene-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.scene-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.scene-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(129, 182, 76, 0.24), transparent 28%),
    radial-gradient(circle at bottom right, rgba(226, 187, 98, 0.18), transparent 22%),
    rgba(17, 18, 16, 0.8);
  backdrop-filter: blur(10px);
}

.scene-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
}

.scene-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(10px);
  animation: drift 6s ease-in-out infinite;
}

.orb-a {
  width: 220px;
  height: 220px;
  top: 12%;
  left: 16%;
  background: rgba(129, 182, 76, 0.3);
}

.orb-b {
  width: 180px;
  height: 180px;
  right: 12%;
  bottom: 16%;
  background: rgba(226, 187, 98, 0.22);
  animation-delay: -2.4s;
}

.scene-panel {
  position: relative;
  width: min(100%, 760px);
  padding: 34px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(28, 30, 27, 0.88);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.36);
  color: #f7f4ed;
}

.scene-panel.compact {
  width: min(100%, 640px);
  padding: 28px 30px;
}

.scene-panel h2 {
  margin: 14px 0 12px;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  line-height: 0.94;
  color: #fff9f1;
}

.scene-copy {
  margin: 0;
  max-width: 42rem;
  color: rgba(244, 241, 236, 0.88);
  font-size: 1.05rem;
  line-height: 1.55;
}

.scene-ticker,
.turn-flash {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.scene-ticker span,
.turn-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff9f1;
  font-size: 0.88rem;
}

.scene-button {
  margin-top: 24px;
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(20px, -18px, 0) scale(1.08);
  }
}

@media (max-width: 1200px) {
  .hero-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .leaderboard-layout-full {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .hero-top {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .page {
    padding: 16px;
  }

  .setup-grid,
  .stats,
  .chart-grid,
  .analysis-grid,
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .hero-card {
    padding: 18px;
  }

  .scene-panel,
  .scene-panel.compact {
    padding: 22px 20px;
  }
}
