/* Stamkwis - dark, high contrast, earthy. Outdoors at night, one hand, gloves. */
:root {
  --bg: #12110d; --bg2: #1c1a14; --card: #221f17; --line: #3b3526;
  --text: #f3ead6; --muted: #b9ad92; --moss: #8fb35a; --moss-d: #5f7d34;
  --ochre: #e0a63c; --rust: #c8582f; --sky: #8fc3d6; --danger: #e0583c;
  --radius: 14px; --tap: 56px;
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 18px/1.45 var(--font);
  background-image: radial-gradient(circle at 20% -10%, #2a2617 0, transparent 55%),
    repeating-linear-gradient(135deg, transparent 0 22px, rgba(255,255,255,.012) 22px 23px);
  min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
main { max-width: 720px; margin: 0 auto; padding: 12px 12px 96px; }
body.admin main { max-width: 1200px; }
a { color: var(--ochre); }
h1, h2 { font-weight: 800; letter-spacing: .02em; line-height: 1.15; margin: .2em 0 .5em; }
h1 { font-size: 1.6rem; text-transform: uppercase; }
h2 { font-size: 1.2rem; color: var(--moss); text-transform: uppercase; }
.small { font-size: .85rem; color: var(--muted); }
code, .code { font-family: var(--mono); font-size: 1.05rem; color: var(--ochre); word-break: break-all; }
p.code { font-size: 1.4rem; text-align: center; padding: .6em; border: 2px dashed var(--ochre); border-radius: 10px; }

/* header + trail blaze (the red-white-red marker painted on trees) */
.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px;
  background: var(--bg2); border-bottom: 3px solid var(--line); position: sticky; top: 0; z-index: 1000; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none;
  font-weight: 900; font-size: 1.25rem; letter-spacing: .08em; text-transform: uppercase; }
.blaze { width: 14px; height: 26px; border-radius: 2px;
  background: linear-gradient(var(--rust) 0 33%, #f3ead6 33% 66%, var(--rust) 66%); box-shadow: 0 0 0 2px #0006; }
nav.adm { display: flex; gap: 4px; flex-wrap: wrap; }
nav.adm a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
nav.adm a:hover { background: var(--card); color: var(--text); }

/* cards = badges: stitched edge */
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px 0; position: relative;
  box-shadow: inset 0 0 0 5px var(--card), inset 0 0 0 6px rgba(224,166,60,.18), 0 6px 18px #0007; }
.card.neutral { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row form { margin: 0; }

/* inputs: big, thumb-friendly */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: #15130e; border: 2px solid var(--line);
  border-radius: 10px; padding: 12px 14px; min-height: var(--tap); width: 100%; }
textarea { min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--ochre); outline-offset: 1px; border-color: var(--ochre); }
label.check { flex-direction: row; align-items: center; }
label.check input { width: auto; min-height: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap);
  padding: 10px 20px; border-radius: 12px; border: 2px solid #0008; background: var(--moss); color: #10140a;
  font: 800 1.05rem var(--font); text-transform: uppercase; letter-spacing: .04em; text-decoration: none;
  cursor: pointer; box-shadow: 0 3px 0 var(--moss-d); touch-action: manipulation; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--moss-d); }
.btn.big { width: 100%; min-height: 64px; font-size: 1.15rem; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); box-shadow: none; }
.btn.danger { background: var(--danger); color: #fff; box-shadow: 0 3px 0 #7b2a17; }
.btn.ghost.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: .85rem; }
.btn.disabled, .btn:disabled { opacity: .45; pointer-events: none; }
.msg { padding: 10px 14px; border-radius: 10px; background: #2b2718; border-left: 6px solid var(--ochre); }
.msg.err { border-color: var(--danger); background: #2e1a14; }
.msg.ok { border-color: var(--moss); background: #1c2614; }
.msg.warn { border-color: var(--ochre); }
.tip { background: #1d2a2f; border-left: 6px solid var(--sky); padding: 10px 14px; border-radius: 10px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--moss-d); color: var(--text);
  font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; vertical-align: middle; }
.badge.test { background: var(--rust); }

/* offline indicator */
.net { position: fixed; left: 50%; transform: translateX(-50%); top: 8px; z-index: 2000; background: var(--danger);
  color: #fff; font-weight: 900; padding: 8px 16px; border-radius: 999px; box-shadow: 0 4px 12px #000a;
  text-transform: uppercase; letter-spacing: .05em; font-size: .9rem; }

/* team: emoji picker */
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }
.emo input { position: absolute; opacity: 0; }
.emo span { display: grid; place-items: center; font-size: 2rem; min-height: 58px; border: 2px solid var(--line);
  border-radius: 12px; background: #15130e; }
.emo input:checked + span { border-color: var(--ochre); background: #3a2f12; box-shadow: 0 0 0 3px var(--ochre); }
.emo.taken span { opacity: .2; }

/* trail view */
.phase-title { font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin: 0; }
.coord-big { font: 900 1.7rem/1.2 var(--mono); color: var(--ochre); letter-spacing: .02em; margin: .2em 0;
  word-break: break-word; }
.compass { display: flex; align-items: center; gap: 16px; margin: 10px 0; }
.arrow { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--line); display: grid; place-items: center;
  background: radial-gradient(circle, #2a2618, #15130e); flex: none; }
.arrow svg { width: 56px; height: 56px; transition: transform .4s; }
.dist { font: 900 2.2rem var(--font); }
.map { height: 260px; border-radius: 12px; border: 2px solid var(--line); margin: 10px 0; background: #0e0d0a; }
.map.big { height: 420px; }
.countdown { font: 900 3.6rem/1 var(--mono); text-align: center; color: var(--ochre); margin: .3em 0; }
.paused { background: repeating-linear-gradient(45deg, #3a2f12 0 14px, #2a2410 14px 28px); }
.hint { border-left: 6px solid var(--sky); }
.media { max-width: 100%; height: auto; border-radius: 10px; display: block; margin: 10px 0; }
audio.media, video.media { width: 100%; }
.video { position: relative; padding-top: 56.25%; border-radius: 10px; overflow: hidden; margin: 10px 0; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.foot { opacity: .85; }
.foot form { margin-top: 8px; }

/* task inputs */
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; padding: 16px; min-height: var(--tap); border: 2px solid var(--line); border-radius: 12px;
  background: #15130e; color: var(--text); font-weight: 700; font-size: 1.1rem; }
.choice input:checked + span { border-color: var(--ochre); background: #3a2f12; box-shadow: 0 0 0 3px var(--ochre); }
.choice input:focus-visible + span { outline: 3px solid var(--sky); }
.legend { margin: 0; padding-left: 1.4em; color: var(--muted); }
.pairs { display: flex; flex-direction: column; gap: 10px; }
.pair { flex-direction: row; align-items: center; gap: 10px; }
.pair span { flex: 1; color: var(--text); }
.pair select { flex: 1.3; }
.cw-list { display: flex; flex-direction: column; gap: 12px; }
.cw-word span { color: var(--text); font-weight: 400; }
input.letters { font: 800 1.3rem var(--mono); letter-spacing: .5em; text-transform: uppercase;
  max-width: calc(var(--n) * 1.6em + 2em); }
.cw-grid { display: grid; gap: 2px; margin: 8px auto; max-width: 100%; overflow-x: auto; touch-action: manipulation; }
.cw-grid .cell { position: relative; width: 100%; aspect-ratio: 1; min-width: 30px; }
.cw-grid .cell input { width: 100%; height: 100%; min-height: 0; padding: 0; text-align: center; font: 800 1.2rem var(--mono);
  text-transform: uppercase; border-radius: 4px; border-width: 1px; background: #f3ead6; color: #12110d; caret-color: var(--rust); }
.cw-grid .cell input.on { background: #ffd98a; }
.cw-grid .cell sup { position: absolute; left: 2px; top: 0; font-size: .6rem; color: #5a4a2a; pointer-events: none; z-index: 1; }
.cw-preview { border-collapse: collapse; margin: 10px 0; }
.cw-preview td { width: 30px; height: 30px; text-align: center; font: 700 1rem var(--mono); position: relative; }
.cw-preview td.c { background: #f3ead6; color: #12110d; border: 1px solid #000; }
.cw-preview sup { position: absolute; left: 1px; top: -2px; font-size: .55rem; }

/* leaderboard */
.lb { width: 100%; border-collapse: collapse; }
.lb td, .lb th { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.lb .rank { font: 900 1.6rem var(--font); color: var(--ochre); width: 2em; }
.lb .tot { font: 900 1.4rem var(--font); text-align: right; }
.lb tr.first .rank::after { content: " 🏆"; font-size: 1rem; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: end; margin: 10px 0 18px; }
.podium div { text-align: center; background: var(--bg2); border: 2px solid var(--line); border-radius: 12px 12px 0 0; padding: 10px 4px; }
.podium .p1 { min-height: 150px; border-color: var(--ochre); } .podium .p2 { min-height: 115px; } .podium .p3 { min-height: 90px; }
.podium .e { font-size: 2.4rem; display: block; } .podium b { display: block; font-size: 1.3rem; color: var(--ochre); }
details.team-stats { margin: 6px 0; } details.team-stats summary { cursor: pointer; font-weight: 800; padding: 8px 0; }
.stats { width: 100%; font-size: .9rem; border-collapse: collapse; }
.stats td, .stats th { padding: 4px; border-bottom: 1px dashed var(--line); text-align: right; }
.stats td:first-child, .stats th:first-child { text-align: left; }

/* admin */
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list td, table.list th { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: left; }
table.list input, table.list select { min-height: 40px; padding: 6px 8px; width: auto; }
ul.list { padding-left: 1.2em; }
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin: 10px 0; }
.setting span { font-size: .85rem; }
.setting input, .setting select { min-height: 44px; padding: 8px; }
details summary { cursor: pointer; font-weight: 800; color: var(--moss); padding: 6px 0; }
.media-edit { border: 2px dashed var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.live { overflow-x: auto; }
.live table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.live td, .live th { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.att { display: inline-block; padding: 1px 6px; margin: 1px; border-radius: 6px; font-size: .8rem; background: #3a2018; }
.att.ok { background: #24361a; }
.flag { color: var(--danger); font-weight: 800; }
.emoji-marker { font-size: 26px; line-height: 1; text-shadow: 0 0 4px #000, 0 0 2px #000; }
.post-marker { background: var(--moss); color: #10140a; border-radius: 50%; width: 26px !important; height: 26px !important;
  display: grid; place-items: center; font: 900 13px var(--font); border: 2px solid #000; }
.decoy-marker { background: var(--rust); color: #fff; border-radius: 4px; width: 22px !important; height: 22px !important;
  display: grid; place-items: center; font: 900 12px var(--font); border: 2px solid #000; }
.decoy-marker.near { background: #ff2020; outline: 3px solid #fff; }
.timeline { display: flex; flex-direction: column; gap: 6px; }
.tl-row { display: grid; grid-template-columns: 110px 1fr 70px; gap: 8px; align-items: center; }
.tl { position: relative; height: 22px; background: #15130e; border-radius: 6px; overflow: hidden; }
.seg { position: absolute; top: 0; bottom: 0; display: inline-block; }
p.legend .seg { position: static; width: 16px; height: 12px; vertical-align: middle; margin: 0 4px 0 10px; }
.seg.walk { background: var(--moss-d); } .seg.search { background: var(--ochre); } .seg.answer { background: var(--sky); }
.seg.wait { background: #6b6250; } .seg.decoy { background: var(--rust); }

/* QR sheet: printable */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.qr-card { background: #fff; color: #000; padding: 12px; border-radius: 8px; text-align: center; break-inside: avoid; }
.qr-card .qr svg, .qr-card .qr img { width: 100%; height: auto; }
.qr-card .url { font: 9px var(--mono); word-break: break-all; }
@media print {
  body { background: #fff; color: #000; } .top, .noprint, .net { display: none !important; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); } main { max-width: none; padding: 0; }
}
.nice { text-align: center; }
@media (min-width: 700px) { body { font-size: 19px; } }
