:root {
  --bg: #1d2a24;
  --bg2: #26372f;
  --paper: #f4ead2;
  --paper-ink: #3b2f20;
  --ink: #f1efe6;
  --muted: #b8c2b9;
  --accent: #e8a33d;
  --accent-ink: #2a1c05;
  --good: #5fbf7a;
  --bad: #e2574c;
  --line: rgba(255,255,255,.12);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg) radial-gradient(circle at 20% -10%, #36503f 0, transparent 55%);
  color: var(--ink);
  font: 16px/1.5 Inter, system-ui, sans-serif;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); }
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: rgba(29,42,36,.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.seal {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: #9b2c22; color: #f7d9a8; font: 800 16px Inter; box-shadow: inset 0 0 0 3px #c2473b;
}
.clock { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; font-size: 14px; }
.clock small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.parchment {
  background: var(--paper) linear-gradient(135deg, rgba(255,255,255,.35), rgba(0,0,0,.04));
  color: var(--paper-ink); border: none; box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.parchment h1, .parchment h2, .story { font-family: "Special Elite", Georgia, serif; }
.parchment .small, .parchment label { color: #6b5a42; }
h1 { margin: 0 0 6px; font-size: 32px; }
h2 { margin: 0 0 10px; font-size: 22px; line-height: 1.25; }
.lead { font-size: 18px; margin-top: 0; }
.small { font-size: 13px; color: var(--muted); }
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 14px; }
input {
  width: 100%; font: 600 20px Inter; padding: 12px 14px; border-radius: 12px;
  border: 2px solid #c9b791; background: #fffaf0; color: #2b2116;
}
input:focus { outline: 3px solid var(--accent); }
.btn {
  display: block; width: 100%; text-align: center; margin-top: 12px; padding: 14px 16px;
  border-radius: 12px; border: none; font: 700 17px Inter; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: inherit; border: 2px solid currentColor; opacity: .85; }
.btn.small-btn { padding: 10px; font-size: 15px; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.story { white-space: normal; font-size: 17px; }
.story p { margin: 0 0 10px; }
.story h1 { font: 800 56px Inter; letter-spacing: 8px; text-align: center; margin: 10px 0; color: #9b2c22; }

.coords {
  background: #142019; border-radius: 12px; padding: 12px 14px; margin: 12px 0;
  font: 600 18px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.coords small { display: block; font: 400 12px Inter; color: var(--muted); }
.coords .dms { font-size: 15px; color: var(--muted); }
.nav {
  text-align: center; padding: 16px 8px; border-radius: 14px; background: #142019; margin: 12px 0;
}
.arrow-wrap { width: 170px; height: 170px; margin: 0 auto; position: relative; }
.rose { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--line); }
.rose span { position: absolute; font-size: 12px; color: var(--muted); }
.arrow { position: absolute; inset: 18px; transition: transform .3s ease-out; }
.dist { font: 800 40px Inter; margin-top: 6px; font-variant-numeric: tabular-nums; }
.temp { font-weight: 700; font-size: 18px; }
.nav .small { margin: 4px 0 0; }
.arrived { background: #1f4d30; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(95,191,122,.25); } }
.hiding { border-left: 4px solid var(--accent); padding: 8px 12px; background: rgba(232,163,61,.1); border-radius: 0 10px 10px 0; }
.codebox { margin-top: 16px; }
.codebox input { text-transform: uppercase; letter-spacing: 3px; text-align: center; }
.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.hint { background: #142019; border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-size: 15px; }
.fact { background: rgba(95,191,122,.12); border-radius: 10px; padding: 10px 12px; font-size: 15px; margin-top: 8px; }
summary { cursor: pointer; font-weight: 700; }
.fragments { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fragments label { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }
.fragments input { text-align: center; font-size: 26px; padding: 8px 0; text-transform: uppercase; }
.progress { height: 8px; background: var(--bg2); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
#progress-bar { height: 100%; background: var(--accent); width: 0; transition: width .6s; }
.hist-item { border-top: 1px solid var(--line); padding: 10px 0; }
.hist-item:first-of-type { border-top: none; }
.footer-links { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 0 4px 24px; }
.link { background: none; border: none; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px);
  background: #111; color: #fff; padding: 12px 18px; border-radius: 12px; transition: transform .3s;
  max-width: calc(100% - 32px); z-index: 20; text-align: center;
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--bad); }
#toast.good { background: #2d7a45; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; width: 100%; height: 100%; }

/* GPS help page */
.help h2 { margin-top: 28px; }
.help .demo { background: #142019; border-radius: 12px; padding: 14px; font-family: ui-monospace, monospace; }
.help table { border-collapse: collapse; width: 100%; font-size: 15px; }
.help td, .help th { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }
.help svg { max-width: 100%; height: auto; }
