/* Neo-brutalist: pastel fills, black keylines, hard black shadows.
   Palette lifted from neo-brutalism-ui-library.vercel.app.
   Colour is structural — every fill means something, nothing is decoration. */

:root {
  --ground: #a6faff;   /* page */
  --paper: #ffffff;    /* panels */
  --ink: #000000;
  --grey: #6b6b6b;

  --lemon: #fff59f;
  --mint: #b8ff9f;
  --bubble: #ffa6f6;
  --peri: #a8a6ff;

  --key: 2px;          /* keyline weight */
  --drop: 6px;         /* hard shadow offset */
  --mono: ui-monospace, SFMono-Regular, Menlo, "DejaVu Sans Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 96px;
}

/* ---------- Masthead ---------- */

header { margin-bottom: 28px; }

h1 {
  margin: 0;
  font-size: clamp(38px, 11vw, 74px);
  line-height: 0.86;
  letter-spacing: -0.03em;
  font-weight: 700;
}

/* The wordmark is the way back to the menu. */
.home {
  font: inherit;
  color: inherit;
  line-height: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
}

.home:focus-visible { outline: 3px solid var(--ink); outline-offset: 6px; }

@media (prefers-reduced-motion: no-preference) {
  .glyph::before, .glyph::after { transition: transform .12s steps(2, end); }
}

.home:hover .glyph::before { transform: translate(8px, 7px); }
.home:hover .glyph::after { transform: translate(-7px, -6px); }

/* Mis-registered screen print: the plates don't quite line up. */
.glyph {
  position: relative;
  display: inline-block;
  color: var(--ink);
  isolation: isolate;   /* keeps the offset plates above the page, below the text */
}

.glyph::before,
.glyph::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
}

.glyph::before { color: var(--bubble); transform: translate(5px, 4px); }
.glyph::after  { color: var(--peri); transform: translate(-4px, -3px); }

.rule {
  height: 12px;
  margin: 18px 0 14px;
  border: var(--key) solid var(--ink);
  background: linear-gradient(
    90deg,
    var(--bubble) 0 46%,
    var(--lemon) 46% 74%,
    var(--peri) 74% 100%
  );
}

.sub { margin: 0; font-size: 14px; }

h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 26px 0 10px;
}

.panel > h2:first-child { margin-top: 0; }

/* ---------- Panels ---------- */

.panel {
  border: var(--key) solid var(--ink);
  background: var(--paper);
  padding: 24px;
  box-shadow: var(--drop) var(--drop) 0 var(--ink);
}

.hidden { display: none !important; }

/* ---------- Chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: var(--key) solid var(--ink);
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  background: var(--paper);
}

.chip:hover { background: var(--lemon); }
.chip:has(input:checked) { background: var(--peri); box-shadow: 3px 3px 0 var(--ink); }
.chip:has(input:checked):hover { background: var(--bubble); }
.chip:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.chip input { accent-color: var(--ink); margin: 0; }

/* ---------- Buttons ---------- */

.btn {
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: var(--key) solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 11px 16px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
}

.btn:hover { background: var(--lemon); }
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.btn:disabled {
  border-color: var(--grey);
  color: var(--grey);
  box-shadow: 3px 3px 0 var(--grey);
  cursor: not-allowed;
}
.btn:disabled:hover { background: var(--paper); }

/* Fill says what the button does: yellow goes on, purple defers, pink is the
   path that costs you the question. */
.primary { background: var(--lemon); }
.primary:hover { background: var(--mint); }

.skip { background: var(--peri); }
.giveup { background: var(--bubble); }
.nav .btn { background: var(--ground); }

.danger { background: var(--bubble); }
.danger:hover { background: var(--ink); color: var(--paper); }

.row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- Status strip ---------- */

.strip {
  display: flex;
  border: var(--key) solid var(--ink);
  margin: -4px -4px 18px;
}

.readout {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-right: var(--key) solid var(--ink);
  min-width: 0;
}

.readout.right { border-right: 0; text-align: right; align-items: flex-end; }

.readout b {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey);
  font-weight: 400;
}

.readout i {
  font-style: normal;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Streak segments double as the bonus meter — it caps at five, and so does
   the points bonus, so the bar shows exactly what the next answer is worth. */
.segs { display: flex; gap: 3px; align-items: center; height: 28px; }
.segs span { width: 11px; height: 17px; border: var(--key) solid var(--ink); }
.segs span.on { background: var(--peri); }
.segs span.max { background: var(--bubble); }

/* ---------- Tags ---------- */

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }

.tag {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: var(--key) solid var(--ink);
  background: var(--paper);
}

.cat { background: var(--ground); }
.diff.easy { background: var(--mint); }
.diff.medium { background: var(--lemon); }
.diff.hard { background: var(--bubble); }
.review { background: var(--peri); }

/* ---------- Replay banner ---------- */

.replay {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  background: var(--bubble);
  border: var(--key) solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 8px 12px;
  margin-bottom: 16px;
}

.replay b { letter-spacing: 0.1em; text-transform: uppercase; font-size: 12px; }
.replay span { font-size: 13px; }

/* The whole panel takes the replay colour so the screen reads as "the past". */
.game.replaying { box-shadow: var(--drop) var(--drop) 0 var(--bubble); }

/* ---------- Question ---------- */

.flagWrap { margin: 0 0 22px; }

.flagWrap img {
  display: block;
  width: 340px;
  max-width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: contain;      /* Nepal and Switzerland aren't 3:2 */
  border: var(--key) solid var(--ink);
  box-shadow: var(--drop) var(--drop) 0 var(--peri);
}

.question {
  font-size: clamp(20px, 3.4vw, 26px);
  line-height: 1.3;
  font-weight: 700;
  margin: 0 0 22px;
  max-width: 34ch;
}

/* ---------- Prompt ---------- */

.prompt {
  display: flex;
  align-items: stretch;
  border: var(--key) solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

.chevron {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  font-size: 20px;
}

.prompt:focus-within { box-shadow: 3px 3px 0 var(--peri); }

input[type="text"] {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 19px;
  padding: 13px 14px;
  background: var(--paper);
  border: 0;
  color: var(--ink);
  outline: none;
  caret-color: var(--ink);
}

input[type="text"]::placeholder { color: var(--grey); }

/* A locked answer is still the thing you wrote — keep it black on a pastel
   fill so it stays readable and the fill carries the verdict. */
input[type="text"]:disabled { opacity: 1; color: var(--ink); -webkit-text-fill-color: var(--ink); }

.prompt.locked { box-shadow: none; }
.prompt.locked .chevron { background: var(--grey); }
.prompt.locked.good input { background: var(--mint); }
.prompt.locked.bad input { background: var(--bubble); }

/* ---------- Feedback ---------- */

.feedback {
  margin-top: 18px;
  padding: 14px 16px;
  border: var(--key) solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 15px;
  display: none;
}

.feedback.show { display: block; }
.feedback.good { background: var(--mint); }
.feedback.bad { background: var(--bubble); }

@media (prefers-reduced-motion: no-preference) {
  .feedback.show { animation: stamp .16s steps(2, end); }
}

@keyframes stamp {
  from { transform: scale(1.04); }
  to { transform: scale(1); }
}

.feedback .label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border: var(--key) solid var(--ink);
  background: var(--paper);
}

.feedback .ans { font-size: 17px; }
.feedback .accept { font-size: 13px; margin-top: 6px; }

.feedback .explain {
  font-size: 14px;
  line-height: 1.6;
  margin-top: 12px;
  padding-top: 12px;
  border-top: var(--key) solid var(--ink);
  max-width: 62ch;
}

/* ---------- World map ---------- */

.mapWrap {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 12px;
  padding-top: 12px;
  border-top: var(--key) solid var(--ink);
}

.mapBox { flex: 1 1 260px; min-width: 0; max-width: 460px; }

.worldMap {
  display: block;
  width: 100%;
  border: var(--key) solid var(--ink);
  background: var(--ground);
}

.facts {
  flex: 0 0 148px;
  margin: 0;
  display: grid;
  gap: 8px;
}

.facts div {
  border: var(--key) solid var(--ink);
  background: var(--paper);
  padding: 6px 9px;
}

.facts dt {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grey);
}

.facts dd {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.facts dd span {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--grey);
  letter-spacing: 0.06em;
  margin-top: 3px;
}

.worldMap path {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
}

.worldMap path.here { fill: var(--peri); }

/* The ring, not the fill, is what finds a country two pixels wide. */
.worldMap .pin {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

/* ---------- Hints, finish ---------- */

.hint { color: var(--grey); font-size: 13px; margin: 16px 0 0; min-height: 18px; }
.hint.warn { color: var(--ink); font-weight: 700; background: var(--lemon); display: inline-block; padding: 2px 6px; }
.hint.stats { color: var(--ink); margin-top: 4px; }

.final { font-size: 17px; line-height: 1.7; }
.final strong { font-size: 26px; background: var(--lemon); padding: 0 6px; border: var(--key) solid var(--ink); }
.final .note { color: var(--grey); font-size: 14px; }

@media (max-width: 560px) {
  .wrap { padding: 26px 14px 72px; }
  .panel { padding: 18px; box-shadow: 4px 4px 0 var(--ink); }
  .strip { flex-wrap: wrap; }
  .readout.right { text-align: left; align-items: flex-start; }
  .flagWrap img { width: 100%; }
  .mapWrap { flex-direction: column; }
  .mapBox { max-width: none; width: 100%; }
  .facts { flex: none; width: 100%; grid-template-columns: 1fr 1fr; }
}
