/* Shared by Vorotool's two map games, Where is it? (play/) and Who is nearest? (play/nearest/). */
:root {
  --paper: #f3f5f2; --panel: #fbfcfa; --ink: #18222e; --muted: #5b6672; --rule: #d9ded7;
  --accent: #1f5fbf; --danger: #b3261e; --hover: #e9eee8; --good: #1d7a46; --shade: rgba(24,34,46,.08);
  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-body: "Familjen Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1318; --panel: #141a21; --ink: #e5eaee; --muted: #93a0ad; --rule: #28313b;
    --accent: #72a9ff; --danger: #ff8a80; --hover: #1c242d; --good: #6fd39b; --shade: rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1318; --panel: #141a21; --ink: #e5eaee; --muted: #93a0ad; --rule: #28313b;
  --accent: #72a9ff; --danger: #ff8a80; --hover: #1c242d; --good: #6fd39b; --shade: rgba(0,0,0,.35); color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.45 var(--font-body); overflow: hidden; }
#map { position: fixed; inset: 0; background: #a9c3dc; }   /* the physical map's sea, beyond the poles */
.leaflet-container { font: 12px var(--font-body); cursor: crosshair; }
.leaflet-container.locked { cursor: grab; }
/* the physical map has no dark version; dimmed, it sits with the dark panels */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .plain-tiles { filter: brightness(.72) saturate(.85); } }
:root[data-theme="dark"] .plain-tiles { filter: brightness(.72) saturate(.85); }
a { color: var(--accent); }
h1, h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
h2 { font-size: 22px; line-height: 1.15; }
.label { font: 600 11px/1.3 var(--font-body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
p { margin: 0; }

select, button, input[type=text] {
  font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--rule); border-radius: 8px; padding: 9px 12px; min-width: 0;
}
select, button { cursor: pointer; }
select:hover, button:hover { background: var(--hover); }
button.primary { background: var(--accent); color: var(--panel); border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); background: var(--accent); }
button:disabled { opacity: .5; cursor: default; filter: none; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; padding: 6px 12px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }

/* the bar along the top */
.bar {
  position: fixed; z-index: 1000; left: 0; right: 0; top: 0;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; display: flex; gap: 10px; align-items: center;
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.chip { background: var(--panel); border: 1px solid var(--rule); border-radius: 999px; padding: 5px 12px; box-shadow: 0 2px 8px var(--shade); white-space: nowrap; }
.brand { font: 400 15px var(--font-display); margin: 0; }
.brand a { text-decoration: none; color: var(--ink); }
.card h2.big { font-size: 30px; line-height: 1.1; }
.brand small { font: 12px var(--font-body); color: var(--muted); }
.bar .spacer { flex: 1; }
#timer.low { color: var(--danger); border-color: var(--danger); }

/* the clue */
.clue {
  position: fixed; z-index: 999; left: 50%; transform: translateX(-50%); top: calc(56px + env(safe-area-inset-top, 0px));
  width: min(460px, calc(100vw - 24px)); background: var(--panel); border: 1px solid var(--rule); border-radius: 12px;
  padding: 12px 16px 12px; box-shadow: 0 6px 20px var(--shade); display: grid; gap: 4px;
}
.clue .name { font: 400 24px/1.15 var(--font-display); text-wrap: balance; }
.clue .fact { font-size: 13.5px; color: var(--muted); }
.clue .hintline { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-top: 2px; }
.linkbtn { background: none; border: none; padding: 4px 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-size: 13.5px; }
.linkbtn:hover { background: none; }
.hinttext { font-size: 13.5px; font-weight: 600; }

/* the guess button */
.act {
  position: fixed; z-index: 999; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: grid; justify-items: center; gap: 6px; width: min(460px, calc(100vw - 24px));
}
.act button { width: 100%; font-size: 17px; padding: 13px 18px; border-radius: 10px; box-shadow: 0 6px 18px var(--shade); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; }
.choices button { background: var(--panel); box-shadow: 0 4px 12px var(--shade); padding: 10px 12px; font-size: 15px; text-align: left; border-radius: 10px; min-width: 0; overflow-wrap: anywhere; }
.choices button[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 4px 12px var(--shade); font-weight: 600; }
.choices button.out { text-decoration: line-through; }
.choices .note { grid-column: 1 / -1; justify-self: center; }
.act .note { background: var(--panel); border: 1px solid var(--rule); border-radius: 999px; padding: 3px 12px; font-size: 13px; color: var(--muted); }

/* cards: start, lobby, results */
.scrim { position: fixed; inset: 0; z-index: 1001; background: color-mix(in srgb, var(--paper) 55%, transparent); backdrop-filter: blur(2px); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.card {
  width: min(520px, 100%); background: var(--panel); border: 1px solid var(--rule); border-radius: 14px;
  box-shadow: 0 10px 30px var(--shade); padding: 22px 22px 18px; display: grid; gap: 14px; margin: auto;
}
.card .lede { color: var(--muted); }
.card section { display: grid; gap: 8px; border-top: 1px solid var(--rule); padding-top: 14px; }
.card .field { display: grid; gap: 4px; }
.card .field > span { font-size: 13px; font-weight: 600; }
.card .foot { font-size: 12.5px; color: var(--muted); display: grid; gap: 4px; }
.card .msg { font-size: 13.5px; }
.card .msg.err { color: var(--danger); }
.code { font: 500 28px/1 var(--font-data); letter-spacing: .12em; }
.vs { background: var(--hover); border-radius: 10px; padding: 10px 12px; }

/* results sheet along the bottom */
.sheet {
  position: fixed; z-index: 1000; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  width: min(520px, calc(100vw - 24px)); max-height: 58vh; overflow-y: auto; background: var(--panel);
  border: 1px solid var(--rule); border-radius: 14px; box-shadow: 0 10px 30px var(--shade); padding: 14px 16px; display: grid; gap: 10px;
}
.result-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pts { font: 500 26px/1 var(--font-data); font-variant-numeric: tabular-nums; }
.pts small { font: 13px var(--font-body); color: var(--muted); }
.bar-score { height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; }
.bar-score > i { display: block; height: 100%; background: var(--good); }
.region-note { font-size: 13.5px; }
.region-note .sw { display: inline-block; width: 11px; height: 11px; border-radius: 2px; background: color-mix(in srgb, var(--good) 35%, transparent); border: 1.5px solid var(--good); vertical-align: -1px; margin-right: 3px; }
.source-line { font-size: 12px; color: var(--muted); }

table.scores { width: 100%; border-collapse: collapse; font-size: 14px; }
table.scores th { text-align: left; font: 600 11px var(--font-body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--rule); }
table.scores td { padding: 6px; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
table.scores td.n, table.scores th.n { text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.scores tr.me td { font-weight: 600; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; border: 1.5px solid var(--panel); box-shadow: 0 0 0 1px var(--ink); }
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.players li { display: flex; align-items: center; gap: 4px; }
.players li.off { color: var(--muted); }
.roundlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 13.5px; }
.roundlist li { display: flex; justify-content: space-between; gap: 10px; }
.roundlist li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* pins on the map */
.pin { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.45); }
.target { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; background: #1d7a46; box-shadow: 0 0 0 2px #1d7a46, 0 2px 8px rgba(0,0,0,.5); display: grid; place-items: center; color: #fff; font: 700 13px var(--font-body); }
.leaflet-tooltip.pin-tip { background: var(--panel); color: var(--ink); border: 1px solid var(--rule); font: 600 12px var(--font-body); box-shadow: none; padding: 1px 6px; }
.leaflet-tooltip.pin-tip::before { display: none; }
.mapbtn { position: fixed; z-index: 998; left: 12px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
.leaflet-bottom.leaflet-right { margin-bottom: env(safe-area-inset-bottom, 0px); }
.leaflet-container { background: #a9c3dc; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #map { background: #56687a; } }
:root[data-theme="dark"] #map { background: #56687a; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 640px) {
  .card h2.big { font-size: 26px; }
  .clue { padding: 10px 14px; }
  .clue .name { font-size: 21px; }
  .card { padding: 18px 16px 14px; }
  .brand small { display: none; }
  .leaflet-control-zoom { display: none; }
  .bar { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .chip { padding: 4px 9px; font-size: 13px; }
  .wide { display: none; }
  /* --act-h: the guess area's height, set by the page, so the button and the map credit sit above it */
  .mapbtn { bottom: calc(var(--act-h, 82px) + 30px + env(safe-area-inset-bottom, 0px)); }
  .leaflet-bottom.leaflet-right { margin-bottom: calc(var(--act-h, 82px) + 22px + env(safe-area-inset-bottom, 0px)); }
  .leaflet-control-attribution { font-size: 9.5px; max-width: 60vw; }
}
