:root {
  color-scheme: dark;
  --bg: #08101e;
  --panel: #101a2e;
  --panel-2: #15233d;
  --line: #263756;
  --text: #f5f7fb;
  --muted: #9aa9c4;
  --accent: #65d6c2;
  --accent-2: #8dc7ff;
  --good: #84e7a2;
  --bad: #ff9b9b;
  --warning: #f2d078;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(77, 119, 218, .18), transparent 30rem),
    radial-gradient(circle at 100% 20%, rgba(71, 196, 164, .10), transparent 24rem),
    var(--bg);
  color: var(--text);
}
button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-2); }

.shell { width: min(100%, 760px); margin: 0 auto; padding: 18px 16px calc(36px + env(safe-area-inset-bottom)); }
.topbar { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { color: var(--text); text-decoration: none; font-size: 19px; font-weight: 850; letter-spacing: -.03em; }
.brand span { color: var(--accent); }
.prototype { color: var(--muted); font-size: 11px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; text-transform: uppercase; letter-spacing: .08em; }

.screen { display: none; animation: fade .18s ease-out; }
.screen.active { display: block; }
@keyframes fade { from { opacity: .35; transform: translateY(4px); } }

.hero-copy { padding: 46px 2px 26px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-weight: 800; font-size: 11px; margin: 0 0 8px; }
h1 { margin: 0; font-size: clamp(34px, 10vw, 54px); line-height: .99; letter-spacing: -.055em; }
h2 { margin: 0; font-size: 25px; line-height: 1.08; letter-spacing: -.035em; }
.hero-copy > p:last-child, .results-hero + p { color: var(--muted); line-height: 1.55; font-size: 16px; }

.country-grid { display: grid; gap: 10px; }
.country-card {
  width: 100%; min-height: 76px; border: 1px solid var(--line); border-radius: 17px; padding: 13px 14px;
  color: var(--text); background: rgba(16, 26, 46, .92); display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; text-align: left; gap: 12px;
}
.country-card.live { cursor: pointer; box-shadow: var(--shadow); border-color: rgba(101, 214, 194, .45); }
.country-card.live:active { transform: scale(.99); }
.country-card:disabled { opacity: .48; }
.flag { font-size: 29px; }
.country-card strong { display: block; font-size: 16px; }
.country-card small { display: block; color: var(--muted); margin-top: 3px; }
.arrow { font-size: 23px; color: var(--accent); }
.quiet { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 14px 3px 0; }

.builder-head { padding-top: 10px; }
.text-button { background: none; border: 0; color: var(--muted); padding: 8px 0; cursor: pointer; font-weight: 700; }
.progress-wrap { margin: 13px 0 14px; }
.progress-label { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--muted); }
.progress-track { height: 6px; border-radius: 999px; background: #17243c; overflow: hidden; margin-top: 7px; }
.progress-bar { width: 10%; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s ease; }

.baseline-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 10px; }
.baseline-strip > div { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(13, 22, 39, .76); }
.baseline-strip small { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .05em; }
.baseline-strip strong { display: block; margin-top: 3px; font-size: 15px; white-space: nowrap; }

.lever-card { border: 1px solid var(--line); border-radius: 21px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); padding: 18px; box-shadow: var(--shadow); }
.lever-title-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.mini-button { color: var(--muted); background: #16243d; border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; cursor: pointer; font-size: 11px; font-weight: 800; }
.caveat { color: var(--muted); min-height: 40px; line-height: 1.4; font-size: 12px; margin: 10px 0 6px; }

.value-control { display: grid; grid-template-columns: 58px 1fr 58px; gap: 12px; align-items: center; margin: 18px 0 14px; }
.round-button { width: 58px; height: 58px; border-radius: 50%; border: 1px solid var(--line); background: #0c172a; color: var(--text); font-size: 30px; cursor: pointer; }
.value-display { text-align: center; }
.value-display strong { font-size: 46px; letter-spacing: -.05em; }
.value-display > span { color: var(--muted); font-weight: 800; margin-left: 5px; }
.value-display small { display: block; color: var(--muted); margin-top: 2px; font-size: 10px; }
.range { width: 100%; accent-color: var(--accent); }

.impact-box { background: #0b1528; border: 1px solid var(--line); border-radius: 14px; padding: 13px; margin: 16px 0; }
.impact-box small { color: var(--muted); display: block; }
.impact-box strong { display: block; font-size: 24px; margin: 3px 0; }
.impact-box span { font-size: 12px; color: var(--muted); }

.justify-label { display: block; font-weight: 800; font-size: 13px; margin-top: 14px; }
.justify-label span { color: var(--muted); font-weight: 500; }
textarea { width: 100%; min-height: 100px; margin-top: 7px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; resize: vertical; color: var(--text); background: #0a1426; outline: none; line-height: 1.45; }
textarea:focus { border-color: rgba(101, 214, 194, .65); box-shadow: 0 0 0 3px rgba(101, 214, 194, .08); }
.char-row { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; margin-top: 6px; }

.nav-row { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin: 12px 0; }
.primary-button, .secondary-button { min-height: 50px; border-radius: 13px; font-weight: 850; cursor: pointer; }
.primary-button { border: 0; background: var(--accent); color: #06201b; }
.secondary-button { border: 1px solid var(--line); background: #14223a; color: var(--text); }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }

.results-hero { padding: 22px 0 14px; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.result-tile { border: 1px solid var(--line); border-radius: 15px; background: var(--panel); padding: 14px; min-height: 112px; }
.result-tile.emphasis { background: linear-gradient(180deg, #152845, #101a2e); }
.result-tile small, .result-tile span { color: var(--muted); display: block; font-size: 10px; line-height: 1.35; }
.result-tile strong { display: block; font-size: 22px; margin: 5px 0; }

.choice-summary, .challenge-card, .community-card { margin-top: 13px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); padding: 16px; }
.section-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.choice-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 11px 0; border-bottom: 1px solid rgba(38, 55, 86, .75); }
.choice-item:last-child { border-bottom: 0; }
.choice-item small { color: var(--muted); display: block; margin-top: 3px; }
.choice-value { font-weight: 850; }
.challenge-card p, .community-card p { color: var(--muted); line-height: 1.45; font-size: 13px; }
.challenge-card .primary-button { width: 100%; margin-top: 4px; }
.community-card { display: grid; gap: 10px; }
.community-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.community-actions span { border: 1px solid var(--line); background: #14223a; border-radius: 999px; padding: 7px 9px; font-size: 11px; }
.source-note { color: var(--muted); font-size: 10px; line-height: 1.45; margin: 14px 3px; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; transition: .2s; background: #eafaf6; color: #09231d; border-radius: 999px; padding: 9px 13px; font-size: 12px; font-weight: 800; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 680px) {
  .shell { padding-top: 26px; }
  .country-grid { grid-template-columns: 1fr 1fr; }
  .community-card { grid-template-columns: 1.4fr .6fr; align-items: center; }
  .community-actions { justify-content: flex-end; }
}

@media (max-width: 410px) {
  .baseline-strip strong { font-size: 13px; }
  .value-control { grid-template-columns: 52px 1fr 52px; gap: 8px; }
  .round-button { width: 52px; height: 52px; }
  .value-display strong { font-size: 40px; }
  .char-row { display: block; }
  .char-row span:last-child { display: block; margin-top: 3px; }
}
