:root {
  --sea: #0d1b24; --sea-line: #132632; --panel: #13222c; --panel-2: #182a35; --line: #2a3d49;
  --ink: #ece2c8; --muted: #97a29f; --gold: #d6ae5c; --gold-hi: #f2d283; --red: #d4594a;
  --land0: #b9954f; --land1: #9f7f42; --land2: #cba962; --land3: #ad8a48; --land4: #c29c55;
  --inert: #24343e; --border: #0d1b24;
  --fog: #16252e; --fog-dot: #223540; --mark: #f2d283; --answer: #f2d283;
  --btn-bg: var(--gold); --btn-ink: #1a1306;
  --serif: "DM Serif Display", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --logo-clue: var(--gold); --logo-untry: var(--gold-hi);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --sea: #d6dfdc; --sea-line: #c9d3d0; --panel: #f1f2ee; --panel-2: #e6e9e4; --line: #c3cbc7;
  --ink: #1d2a31; --muted: #4a575c; --gold: #9a7428; --gold-hi: #7a5a17; --red: #b23a2c;
  --land0: #c9a661; --land1: #b38f4c; --land2: #d8b977; --land3: #bf9b55; --land4: #cfae6b;
  --inert: #bcc6c3; --border: #d6dfdc;
  --fog: #aab6b5; --fog-dot: #9aa7a6; --mark: #5c4410; --answer: #7a5a17;
  --btn-bg: #7a5a17; --btn-ink: #ffffff;
  --logo-clue: #94702a; --logo-untry: #4f3a0c;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body { margin: 0; min-height: 100%; background: var(--sea); color: var(--ink); font-family: var(--sans);
  font-size: 15px; line-height: 1.45; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }

.app { display: grid; grid-template-columns: 1fr 360px; grid-template-rows: auto 1fr; height: 100vh; height: 100dvh; }
header { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px 10px; border-bottom: 1px solid var(--line); }
/* Logo follows the theme: "Clue" in gold, "untry" and the clue dot in the contrasting gold */
.brand { font-family: var(--serif); font-size: 26px; letter-spacing: .01em; text-decoration: none; display: inline-flex;
  align-items: center; color: var(--logo-clue); }
.brand:hover { color: var(--logo-clue); }
.brand span { color: var(--logo-untry); }
.brand .logo { display: block; width: 30px; height: 30px; margin-right: 10px; }
.brand .logo-dot { fill: var(--logo-untry); }
.header-right { display: flex; align-items: center; gap: 16px; }
.theme-btn { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 8px;
  padding: 5px 8px; font-size: 13px; cursor: pointer; }
.theme-btn:hover { color: var(--ink); border-color: var(--gold); }
.theme-btn svg { display: block; }
.theme-btn .icon-moon { display: none; }
:root[data-theme="light"] .theme-btn .icon-sun { display: none; }
:root[data-theme="light"] .theme-btn .icon-moon { display: block; }
.points { font-family: var(--serif); font-size: 30px; color: var(--gold); font-variant-numeric: tabular-nums;
  transition: color .3s; }
.points span { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-left: 6px; }
.points.hit { color: var(--red); }

/* Map */
.stage { position: relative; overflow: hidden; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--sea); }
.maplibregl-canvas { cursor: default; }
.maplibregl-canvas:active { cursor: grabbing; }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--panel) 80%, transparent) !important;
  color: var(--muted); font-size: 11px; }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.cont-label { font-family: var(--serif); font-style: italic; color: var(--ink); opacity: .32; font-size: 22px;
  pointer-events: none; white-space: nowrap; text-shadow: 0 0 6px var(--sea); }

.zoom { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.zoom button { min-width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
  cursor: pointer; font-size: 18px; }
.zoom button.small { font-size: 12px; padding: 0 6px; }
.zoom button:hover { border-color: var(--gold); }

.tip { position: fixed; pointer-events: none; background: var(--panel); border: 1px solid var(--line); padding: 4px 9px;
  border-radius: 6px; font-size: 13px; opacity: 0; transition: opacity .12s; z-index: 8; white-space: nowrap; }
.tip.on { opacity: 1; }
.tip small { color: var(--muted); margin-left: 6px; }

/* Toolbar */
.toolbar { position: absolute; left: 14px; right: 60px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; pointer-events: none; z-index: 2; }
.toolbar > * { pointer-events: auto; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 7px; cursor: pointer; line-height: 1.1; }
.seg button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); }
.status { flex-basis: 100%; margin-right: 60px; min-height: calc(2 * 1.45em + 14px); font-size: 13px; color: var(--muted); background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; width: max-content; max-width: 100%; }
.status strong { color: var(--ink); font-weight: 500; }

.act { border: 1px solid var(--btn-bg); background: var(--btn-bg); color: var(--btn-ink); border-radius: 10px; padding: 9px 16px;
  font-weight: 700; cursor: pointer; }
.act:disabled { opacity: .4; cursor: default; }
.ghost { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 14px; cursor: pointer; }
.ghost:disabled { opacity: .4; cursor: default; }

/* Dossier */
aside { background: var(--panel); border-left: 1px solid var(--line); overflow: auto; padding: 20px 20px 28px; }
.passport { border: 1px solid var(--gold); border-radius: 6px; padding: 4px; }
.passport-in { border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); border-radius: 3px; padding: 16px 16px 18px; }
.passport h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 0 0 2px; }
.passport .sub { color: var(--muted); font-size: 13px; margin: 0; }

/* Guess mode */
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.toolbar[data-mode="guess"] .fog-only, .toolbar[data-mode="fog"] .guess-only { display: none; }
/* After the game only the result button stays; no control changes height, so nothing jumps */
.toolbar:not([data-over="true"]) .over-only,
.toolbar[data-over="true"] .seg, .toolbar[data-over="true"] .fog-only, .toolbar[data-over="true"] .guess-only {
  display: none; }
.toolbar .seg, .toolbar .act, .toolbar .ghost, .guess-slot { height: 40px; }
.seg button { height: 100%; }
.guess-slot { display: flex; }
.guess-slot > * { height: 100%; }
.guess-form input { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; width: 220px; }
.guess-form input:focus-visible { border-color: var(--gold); }
.confirm { display: inline-flex; gap: 6px; align-items: center; background: var(--panel); border: 1px solid var(--gold);
  border-radius: 10px; padding: 3px 3px 3px 12px; }
.confirm .act, .confirm .ghost { height: 32px; padding: 0 14px; }
.confirm strong { font-family: var(--serif); font-weight: 400; font-size: 18px; }

/* End screen */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; z-index: 10; padding: 20px;
  background: color-mix(in srgb, var(--sea) 70%, transparent); }
.card { background: var(--panel); border: 1px solid var(--gold); border-radius: 10px; padding: 26px 28px;
  max-width: 400px; text-align: center; }
.card h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; margin: 0 0 6px; }
.card .big { font-family: var(--serif); font-size: 56px; color: var(--gold); line-height: 1; }
.card p { color: var(--muted); margin: 8px 0 18px; }
.card p.small { font-size: 13px; margin: 14px 0 0; }
.card-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Banner with the newest clue */
.brief { position: absolute; left: 14px; top: 14px; z-index: 2; max-width: min(380px, calc(100% - 90px));
  background: var(--panel); border: 1.5px solid var(--gold); border-radius: 8px; padding: 10px 14px 12px;
  transform: rotate(-.6deg); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.brief:empty { display: none; }
.brief .kind { font-size: 12px; color: var(--gold); }
.brief .txt { font-family: var(--serif); font-size: 19px; line-height: 1.2; }
.brief .ask { font-size: 13.5px; margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--line); }
.brief.pop { animation: stamp-brief .45s cubic-bezier(.2, 1.6, .4, 1); }

@keyframes stamp { 0% { transform: scale(1.35) rotate(-6deg); opacity: 0; }
  100% { transform: rotate(var(--tilt, 0deg)); opacity: 1; } }
@keyframes stamp-brief { 0% { transform: scale(1.35) rotate(-6deg); opacity: 0; }
  100% { transform: rotate(-.6deg); opacity: 1; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 70%, transparent); }
  100% { box-shadow: 0 0 0 14px transparent; } }

/* Logbook */
.log { margin-top: 18px; }
.log h3 { font-family: var(--serif); font-weight: 400; font-size: 18px; margin: 0 0 8px; }
.log ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.log li { display: flex; gap: 8px; align-items: flex-start; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.log li.empty { color: var(--muted); border: 0; }
.log li .cost { margin-left: auto; color: var(--red); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log li .cost.zero { color: var(--muted); }
.log li .why { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; white-space: pre-line; }
.log li b { font-weight: 700; }
.howto { font-size: 13.5px; color: var(--muted); margin: 18px 0 0; }
.howto p { margin: 0 0 8px; max-width: 60ch; }
.game-footer { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 18px; padding-top: 12px;
  border-top: 1px solid var(--line); font-size: 13px; }
.game-footer a, .game-footer button { color: var(--muted); font: inherit; background: none; border: 0; padding: 0;
  text-decoration: underline; cursor: pointer; }
.game-footer a:hover, .game-footer button:hover { color: var(--ink); }

/* Tutorial (?oefenen): the coach card takes the place of the clue banner, the current target pulses */
.practice-tag { display: none; font-family: var(--sans); font-size: 12px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 9px; margin-left: 12px; }
.is-tutorial .practice-tag { display: inline-block; }
.is-tutorial .brief, .is-tutorial .help-btn, .is-tutorial #resultBtn { display: none; }
.help-btn { display: grid; place-items: center; width: 34px; height: 30px; padding: 0; font-size: 15px; font-weight: 700;
  text-decoration: none; }
a.act { display: inline-flex; align-items: center; text-decoration: none; }
.coach { position: absolute; left: 14px; top: 14px; z-index: 7; width: min(380px, calc(100% - 90px));
  background: var(--panel); border: 1.5px solid var(--gold); border-radius: 10px; padding: 12px 16px 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.coach-step { font-size: 12px; color: var(--gold); }
.coach h2 { font-family: var(--serif); font-weight: 400; font-size: 21px; margin: 2px 0 4px; }
.coach p { margin: 0; font-size: 14px; }
.coach-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.coach-actions .act { padding: 7px 14px; }
.coach-stop { margin-left: auto; color: var(--muted); font-size: 13px; }
.coach.waits .coach-actions::before { content: "Doe dit om verder te gaan"; font-size: 12.5px; color: var(--muted); }
.tut-target { outline: 2px solid var(--gold-hi); outline-offset: 3px; animation: tut-pulse 1.6s ease-in-out infinite; }
.tut-shade { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 6; pointer-events: none; }
.tut-shade.off { display: none; }
.tut-shade-fill { fill: rgba(4, 10, 14, .62); }
:root[data-theme="light"] .tut-shade-fill { fill: rgba(29, 42, 49, .5); }
@keyframes tut-pulse { 0%, 100% { outline-color: var(--gold-hi); } 50% { outline-color: transparent; } }

@media (max-width: 860px) {
  .brief { left: 10px; top: 10px; max-width: calc(100% - 86px); padding: 7px 10px 9px; }
  .brief .txt { font-size: 15px; }
  .brief .ask { font-size: 12.5px; margin-top: 5px; padding-top: 5px; }
}

@media (max-width: 860px) {
  .app { display: block; height: auto; }
  header { position: sticky; top: 0; background: var(--sea); z-index: 4; padding: 10px 14px 8px; }
  .brand { font-size: 22px; }
  .brand .logo { width: 26px; height: 26px; }
  .points { font-size: 24px; }
  .stage { overflow: visible; }
  #map { position: relative; height: 55vh; height: 55svh; }
  .toolbar { position: static; padding: 10px 12px; background: var(--panel); border-bottom: 1px solid var(--line);
    align-content: flex-start; min-height: 242px; }
  .toolbar .seg { flex: 1 1 100%; }
  .toolbar .seg button { flex: 1; text-align: center; }
  .toolbar .act { flex: 1; }
  .toolbar .guess-slot { flex: 1 1 100%; }
  .guess-form { flex: 1; }
  .guess-form input { width: 100%; }
  .confirm { flex: 1; }
  .confirm strong { margin-right: auto; }
  .status { margin-right: 0; min-height: calc(3 * 1.45em + 14px); }
  .toolbar .over-only { flex: 1; }
  .cont-label { font-size: 14px; }
  .zoom { right: 10px; top: 10px; }
  .coach { position: relative; left: auto; top: auto; width: auto; margin: 10px 12px 0; box-shadow: none; }
  .is-tutorial .practice-tag { display: none; }
  aside { border-left: 0; padding: 16px 14px 28px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

ol.clues { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
ol.clues li { position: relative; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 6px; }
ol.clues li.got { border: 1.5px solid var(--gold); transform: rotate(var(--tilt, 0deg));
  animation: stamp .45s cubic-bezier(.2, 1.6, .4, 1); }
ol.clues li.got[tabindex] { cursor: help; }
ol.clues li.unbought { border-style: dashed; animation: none; }
ol.clues li.unbought .kind { color: var(--muted); }
ol.clues li.pulse { animation: pulse 1s ease; }
ol.clues li.got .txt { font-family: var(--serif); font-size: 19px; line-height: 1.25; color: var(--ink); }
ol.clues li .kind { font-size: 12px; color: var(--muted); }
ol.clues li.got .kind { color: var(--gold); }
ol.clues li.locked { color: var(--muted); }
ol.clues li.next { border-style: solid; background: var(--panel-2); }
ol.clues li button { width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer; padding: 0;
  color: var(--ink); }
ol.clues li button:disabled { cursor: default; color: var(--muted); }
ol.clues li .tally { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
