/* Stateside. A road trip in the colours of an old park poster: cream paper, navy ink, a red
   for where you are and a gold for what you have. Phone first; one column everywhere. */
:root {
  --bg: #f5efe0;
  --card: #fffdf7;
  --ink: #1d2742;
  --muted: #5e6884;
  --line: #e2d9c3;
  --navy: #22366b;
  --red: #d2463c;
  --gold: #efb02f;
  --gold-ink: #4a3500;
  --sea: #cfe3f1;
  --land: #e9e2cf;
  --state: #fff7df;
  --good: #1c9257;
  --good-bg: #daf3e4;
  --bad: #cf3545;
  --bad-bg: #fde2e4;
  --shadow: 0 2px 0 rgba(29, 39, 66, .07), 0 12px 28px -16px rgba(29, 39, 66, .4);
  --f-display: "Fredoka", "Avenir Next Rounded", "Segoe UI", system-ui, sans-serif;
  --f-body: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 500 17px/1.5 var(--f-body);
  padding-top: env(safe-area-inset-top, 0px);
  -webkit-tap-highlight-color: transparent;
}
h1, h2 { font-family: var(--f-display); font-weight: 700; margin: 0; text-wrap: balance; line-height: 1.2; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
svg { display: block; }
img { display: block; max-width: 100%; }

.wrap {
  max-width: 560px; margin: 0 auto; display: grid; gap: 16px;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(150px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.wrap.home { padding-bottom: 40px; }

.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.fill { fill: currentColor; stroke-width: 1.2; }

/* ---------- top ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { font: 700 24px/1 var(--f-display); color: var(--navy); letter-spacing: .01em; }
.brand b { color: var(--red); }
.pills { display: flex; gap: 8px; }
.pills.center { justify-content: center; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; background: var(--card); border-radius: 99px;
  padding: 6px 12px; font-weight: 800; box-shadow: var(--shadow); font-variant-numeric: tabular-nums;
}
.pill .ic { width: 18px; height: 18px; color: var(--gold); }
.pill .ic-flame { color: var(--red); }
.icon-btn { border: 0; background: none; padding: 8px; min-width: 44px; min-height: 44px; border-radius: 12px; color: var(--muted); display: grid; place-items: center; }

/* ---------- maps ---------- */
.map { width: 100%; height: auto; overflow: visible; }
.map path, .map circle { vector-effect: non-scaling-stroke; }
.map .sea { fill: var(--sea); }
.map .land { fill: var(--land); stroke: #d3c9b1; stroke-width: 1; }
.map .st { fill: var(--state); stroke: var(--navy); stroke-width: 1.5; stroke-linejoin: round; transition: fill .15s; }
.map .st.dim { fill: var(--land); stroke: #b9b09a; stroke-width: 1; }
.map .st.hl { fill: var(--red); }
.map .st.good { fill: var(--good); }
.map .st.bad { fill: var(--bad); }
.map.tap-states .st { cursor: pointer; }
@media (hover: hover) { .map.tap-states .st:hover { fill: #ffe9a8; } .closed .map.tap-states .st:hover { fill: var(--state); } }
.closed .map .st { cursor: default; }
.closed .map.tap-states .st.good:hover { fill: var(--good); }
.closed .map.tap-states .st.bad:hover { fill: var(--bad); }
.map .st:focus-visible { outline: none; fill: #ffe08a; stroke-width: 3.500; }
.map .city:focus-visible { outline: none; }
.map .city:focus-visible .dot { stroke: var(--gold); stroke-width: 5; }
.st-label { font-family: var(--f-display); font-weight: 600; fill: var(--navy); text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: var(--state); stroke-width: 4px; stroke-linejoin: round; }
.st-label.on-hl { fill: #fff; stroke: var(--red); }

.map.tap-cities .st.hl { fill: var(--state); }
.city .hit { fill: transparent; }
.city .dot { fill: var(--navy); stroke: #fff; stroke-width: 2; }
.city .dot.capital { fill: var(--red); }
.names .st.hl { fill: var(--state); }
.city-label { font-family: var(--f-body); font-weight: 800; fill: var(--ink); paint-order: stroke; stroke: #fffdf7; stroke-width: 4px; stroke-linejoin: round; display: none; pointer-events: none; }
.city-label.capital { fill: var(--red); }
.names .city-label, .reveal .city-label { display: block; }
.tap-cities .city { cursor: pointer; }
.tap-cities .city .dot { fill: var(--navy); }
.city.good .dot { fill: var(--good); }
.city.bad .dot { fill: var(--bad); }

.map.usa .st { fill: #e4dcc6; stroke: #fffdf7; stroke-width: 1; }
.map.usa .st.done { fill: var(--gold); }
.map.usa .st.hl { fill: var(--red); }

/* ---------- home ---------- */
.hero { background: var(--card); border-radius: 22px; padding: 16px 14px 14px; box-shadow: var(--shadow); display: grid; gap: 8px; }
.count { text-align: center; color: var(--muted); font-weight: 700; }
.count b { color: var(--ink); font: 700 22px/1 var(--f-display); }
.review {
  display: flex; gap: 12px; align-items: center; text-align: left; width: 100%;
  background: var(--navy); color: #fff; border: 0; border-radius: 18px; padding: 14px 16px;
  box-shadow: 0 5px 0 #15234a;
}
.review:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 #15234a; }
.review:disabled { background: #c9c2b0; box-shadow: 0 5px 0 #b1aa98; color: #fffdf7; }
.review b { display: block; font: 600 18px/1.2 var(--f-display); }
.review small { display: block; opacity: .85; font-size: 14px; line-height: 1.35; }
.review .ic { width: 28px; height: 28px; }

.unit { background: var(--card); border-radius: 22px; padding: 16px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.unit > header { display: flex; gap: 12px; align-items: center; }
.unit .num { flex: none; width: 38px; height: 38px; border-radius: 12px; background: var(--navy); color: #fff; display: grid; place-items: center; font: 700 18px/1 var(--f-display); }
.unit h2 { font-size: 20px; }
.unit header p { color: var(--muted); font-size: 14px; line-height: 1.35; }
.unit header > div { flex: 1; min-width: 0; }
.unit .badge { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); display: grid; place-items: center; }
.unit.closed { background: transparent; box-shadow: none; border: 2px dashed var(--line); padding: 14px; }
.unit.closed .num { background: #c9c2b0; }
.unit.closed h2 { color: var(--muted); }
.unit.closed .route { display: none; }
.soon { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; font-weight: 700; }
.soon .ic { width: 16px; height: 16px; }

.route { list-style: none; margin: 0; padding: 4px 0 6px; display: grid; gap: 16px; }
.stop { display: flex; gap: 14px; align-items: center; }
.stop.s1, .stop.s3 { margin-left: 34px; }
.stop.s2 { margin-left: 68px; }
.node {
  flex: none; width: 68px; height: 62px; border-radius: 50%; border: 0;
  background: var(--navy); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 0 #15234a;
}
.node .ic { width: 28px; height: 28px; }
.node:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #15234a; }
.node.next { background: var(--red); box-shadow: 0 6px 0 #93261f, 0 0 0 6px rgba(210, 70, 60, .18); }
.node.done { background: var(--gold); color: var(--gold-ink); box-shadow: 0 6px 0 #b9831a; }
.node:disabled { background: #d9d2c0; color: #fffdf7; box-shadow: 0 6px 0 #beb7a4; }
.stop-text b { display: block; font: 600 17px/1.25 var(--f-display); }
.stop-text small { display: block; color: var(--muted); font-size: 14px; line-height: 1.3; }
.stars { display: inline-flex; gap: 1px; margin-top: 3px; }
.stars i { color: var(--line); }
.stars i.on { color: var(--gold); }
.stars .ic { width: 15px; height: 15px; }

.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; padding-top: 6px; }
.link { border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: 14px; padding: 13px 8px; }

/* ---------- lesson ---------- */
.bar { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.progress { height: 14px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; min-width: 14px; border-radius: 99px; background: var(--gold); transition: width .3s; }
.bar-title { font: 600 14px/1 var(--f-display); color: var(--muted); }

.card { background: var(--card); border-radius: 22px; padding: 18px 16px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.card h1 { font-size: 23px; }
.ask h1 { font-weight: 600; }
.ask h1 b { color: var(--red); font-weight: 700; }
.eyebrow { font: 600 13px/1 var(--f-display); letter-spacing: .08em; text-transform: uppercase; color: var(--red); min-height: 13px; }
.teach { gap: 10px; }
.teach h1 { font-size: 28px; color: var(--navy); }
.body { display: grid; gap: 10px; }
.body b { font-weight: 800; }
.visual { border-radius: 16px; overflow: hidden; background: var(--sea); }
.visual .map { max-height: min(50vh, 460px); }
.visual .map.usa { background: var(--card); }
.visual:has(.usa) { background: none; }
.small-visual .visual .map { max-height: 190px; }
.ask:has(.typed) .visual .map { max-height: min(36vh, 340px); }
.ask:has(.options) .visual .map { max-height: min(34vh, 300px); }
.ask .visual .map.tap-states, .ask .visual .map.tap-cities { max-height: min(62vh, 560px); }
.ask:has(.typed) .photo img { max-height: 26vh; }
.ask:has(.options) .photo img { max-height: 32vh; }
.photo img, .opt-photo img, .credits img { height: auto; }
.wrap.lesson { padding-bottom: calc(var(--dock, 126px) + 24px + env(safe-area-inset-bottom, 0px)); }
.opt, .opt-photo { scroll-margin-bottom: calc(var(--dock, 126px) + 16px + env(safe-area-inset-bottom, 0px)); }
/* Width in map units, set on the element: hit testing ignores a non-scaling stroke. */
.map .st-hit { fill: none; stroke: transparent; vector-effect: none; pointer-events: stroke; cursor: pointer; }
.closed .st-hit { pointer-events: none; }
.visual blockquote, .clue { margin: 0; padding: 16px 18px; background: #fbf3dc; border-left: 6px solid var(--gold); font: 700 19px/1.4 var(--f-body); }
.visual:has(.clue) { background: none; }
.photo { margin: 0; border-radius: 16px; overflow: hidden; background: var(--line); }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo figcaption { background: var(--card); padding: 8px 2px 4px; font-size: 15px; color: var(--muted); }
.teach .photo { background: none; border-radius: 0; }
.teach .photo img { border-radius: 16px; }
.visual:has(.photo) { background: none; }

.legend, .facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.legend { grid-template-columns: 1fr 1fr; }
.legend b { display: inline-block; min-width: 2.1em; font-family: var(--f-display); color: var(--red); }
.facts li { padding-left: 18px; position: relative; }
.facts li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }

.options { display: grid; gap: 10px; }
.options.two { grid-template-columns: 1fr 1fr; }
.opt {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 16px;
  padding: 12px 14px; font-weight: 800; font-size: 17px; min-height: 54px;
}
.opt kbd { font: 700 13px/1 var(--f-body); color: var(--muted); border: 2px solid var(--line); border-radius: 7px; padding: 4px 7px; }
@media (hover: none) { .opt kbd { display: none; } }
.options.two .opt { justify-content: center; }
.opt:active:not(:disabled) { transform: translateY(3px); border-bottom-width: 2px; margin-bottom: 3px; }
.opt.sel { border-color: var(--navy); background: #e6ebf8; }
.opt.good { border-color: var(--good); background: var(--good-bg); color: #0e5a34; opacity: 1; }
.opt.bad { border-color: var(--bad); background: var(--bad-bg); color: #8f1f2c; }
.opt:disabled:not(.good):not(.bad) { opacity: .55; }
.shake { animation: shake .4s; border-color: var(--bad) !important; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.typed { display: grid; gap: 10px; }
.typed input {
  width: 100%; font: 800 20px/1.2 var(--f-body); color: var(--ink); background: #fff;
  border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px;
}
.typed input::placeholder { color: #a9a290; font-weight: 500; font-size: 17px; }
.typed input:focus { outline: none; border-color: var(--navy); }
.typed input.good { border-color: var(--good); background: var(--good-bg); }
.typed input.bad { border-color: var(--bad); background: var(--bad-bg); text-decoration: line-through; }

.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt-photo { padding: 0; border: 4px solid transparent; border-radius: 18px; overflow: hidden; background: var(--line); }
.opt-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.opt-photo.good { border-color: var(--good); }
.opt-photo.bad { border-color: var(--bad); }
.opt-photo:disabled:not(.good):not(.bad) { opacity: .5; }

.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pairs .opt { justify-content: center; text-align: center; padding-inline: 8px; }
.sequence { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: seq; min-height: 8px; }
.sequence li { counter-increment: seq; display: flex; gap: 10px; align-items: center; background: var(--good-bg); border-radius: 14px; padding: 10px 14px; color: #0e5a34; }
.sequence li::before { content: counter(seq); font: 700 16px/1 var(--f-display); width: 26px; height: 26px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; }
.sequence span { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips .opt { width: auto; }
.chips .opt.used { visibility: hidden; }

/* ---------- dock ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 2px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.dock:empty { display: none; }
.dock.good { background: var(--good-bg); border-color: #b5e6cb; }
.dock.bad { background: var(--bad-bg); border-color: #f6c3c8; }
.dock-in { max-width: 560px; margin: 0 auto; padding: 14px 16px; display: grid; gap: 10px; max-height: 44vh; overflow-y: auto; }
.verdict { display: grid; gap: 2px; }
.verdict b { font: 700 20px/1.25 var(--f-display); display: flex; gap: 8px; align-items: center; }
.verdict .ic { width: 24px; height: 24px; stroke-width: 3.200; }
.dock.good .verdict { color: #0e5a34; }
.dock.bad .verdict { color: #8f1f2c; }
.verdict span { font-weight: 700; font-size: 16px; line-height: 1.4; }
.btn {
  border: 0; border-radius: 16px; padding: 14px 18px; width: 100%;
  font: 600 18px/1 var(--f-display); letter-spacing: .02em;
  background: #e6dfcb; color: var(--ink); box-shadow: 0 5px 0 #c9c1aa;
}
.btn.primary { background: var(--good); color: #fff; box-shadow: 0 5px 0 #136a3f; }
.btn.danger { background: var(--bad); color: #fff; box-shadow: 0 5px 0 #96222f; }
.typed .btn { background: var(--navy); color: #fff; box-shadow: 0 5px 0 #15234a; }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.btn:disabled { opacity: .5; }

/* ---------- result ---------- */
.done-card { text-align: center; padding: 34px 18px 26px; gap: 14px; margin-top: 8vh; }
.done-card h1 { font-size: 30px; color: var(--navy); }
.done-card p { color: var(--muted); font-weight: 700; }
.big-stars { display: flex; justify-content: center; gap: 8px; }
.big-stars i { color: var(--line); }
.big-stars i.on { color: var(--gold); animation: pop .5s var(--d) backwards cubic-bezier(.2, 1.6, .4, 1); }
.big-stars .ic { width: 58px; height: 58px; }
.big-stars i:nth-child(2) .ic { width: 74px; height: 74px; margin-top: -10px; }
@keyframes pop { from { transform: scale(0) rotate(-30deg); opacity: 0; } }

/* ---------- credits ---------- */
.panel { background: var(--card); border-radius: 22px; padding: 16px; box-shadow: var(--shadow); display: grid; gap: 10px; }
.panel h2 { font-size: 20px; color: var(--navy); }
.credits { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.credits li { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; font-size: 15px; line-height: 1.35; }
.credits img { border-radius: 10px; aspect-ratio: 4 / 3; object-fit: cover; }
.credits small { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.credits a { color: var(--navy); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* sound */
.pill-btn { border: 0; cursor: pointer; font: inherit; min-width: 44px; min-height: 36px; justify-content: center; }
.pill.pill-btn .ic { color: var(--navy, currentColor); }
.pill-btn[aria-pressed="false"] .ic { color: var(--muted); }
.say { border: 0; background: var(--sea); color: var(--navy, #1f2a4d); width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; vertical-align: middle; margin-left: 10px; cursor: pointer; flex: none; }
.say:active { transform: scale(0.94); }
.say .ic { width: 22px; height: 22px; }
.facts li:has(.say) { padding-left: 44px; min-height: 36px; padding-top: 3px; }
.facts li:has(.say)::before { display: none; }
.facts li .say { width: 34px; height: 34px; margin: 0; position: absolute; left: 0; top: 0; }
.facts li .say .ic { width: 18px; height: 18px; }

/* ---------- levels ---------- */
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.level {
  border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 16px;
  padding: 10px 8px; min-height: 64px; text-align: center; display: grid; gap: 2px; align-content: center; cursor: pointer;
}
.level b { font: 600 15px/1.2 var(--f-display); }
.level small { color: var(--muted); font-size: 12px; line-height: 1.25; }
.level.on { border-color: var(--navy); background: var(--navy); color: #fff; box-shadow: 0 4px 0 #15234a; }
.level.on small { color: #dfe5f4; }

.rows { background: var(--card); border-radius: 22px; padding: 10px 14px; box-shadow: var(--shadow); display: grid; }
.row { display: flex; gap: 14px; align-items: center; padding: 10px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row .node { width: 56px; height: 52px; }
.row .node .ic { width: 24px; height: 24px; }
.row-text { min-width: 0; }
.row-text b { display: block; font: 600 17px/1.25 var(--f-display); }
.row-text small { display: block; color: var(--muted); font-size: 13px; line-height: 1.3; }
.row.closed .row-text b { color: var(--muted); }
.row.final { padding-top: 14px; }

/* The map of the whole country in a lesson: the style of the region maps, without the sea. */
.map.usa-play .st-label { stroke-width: 3px; }
.map.usa-play .city .dot.capital { stroke-width: 1.5; }

.bar-title { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- the app around the game: update banner, version ---------- */
.banner {
  position: fixed; z-index: 50; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100% - 24px)); display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  background: var(--navy); color: #fff; border-radius: 18px; padding: 12px 14px 12px 18px; box-shadow: var(--shadow);
  animation: banner-in .25s ease-out;
}
.banner[hidden] { display: none; }
.banner p { margin: 0; flex: 1 1 180px; font-weight: 700; line-height: 1.35; }
.banner-btns { display: flex; gap: 8px; margin-left: auto; }
.banner button { min-height: 44px; border-radius: 12px; padding: 0 16px; font: 700 15px var(--f-body); border: 0; }
.banner-go { background: var(--gold); color: var(--gold-ink); }
.banner-later { background: rgba(255, 255, 255, .14); color: #fff; }
@keyframes banner-in { from { opacity: 0; transform: translate(-50%, -12px); } }
@media (prefers-reduced-motion: reduce) { .banner { animation: none; } }
.version { text-align: center; color: var(--muted); font-size: 12px; margin: 0; padding: 0 0 18px; opacity: .8; }

/* "Niet die in …" under a question about a city whose name occurs in more than one state */
.aside { display: block; margin-top: 4px; font: 700 15px var(--f-body); color: var(--muted); }
