/* Kembara pages. Tokens in base.css; see docs/DESIGN.md. */
body { min-height: 100%; height: auto; }
.center { text-align: center; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; cursor: pointer; }

header.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.avatar {
  --c: var(--brand); display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: var(--c); color: #fff; font-weight: 700; font-size: 14px;
}
.avatar.big { width: 64px; height: 64px; font-size: 28px; border-radius: 16px; }

main.page { max-width: 1180px; margin: 0 auto; padding: 20px 16px 56px; display: grid; gap: 22px; }
main.narrow { max-width: 720px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.hero { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; }
.kpi b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.list { display: grid; }
.list > * { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: 0; }

/* Admin: the tab rail. */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .input { max-width: 280px; }

.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* Prayer times strip (public page). */
.prayers { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.prayer { padding: 10px; text-align: center; border-radius: 10px; background: var(--paper); }
.prayer b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.prayer.now { background: var(--brand); color: var(--brand-ink); }
@media (max-width: 640px) { .prayers { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.jenazah { border-left: 4px solid var(--ink); background: var(--paper); }
.notice { white-space: pre-line; }
.stack > .tag, .stack > .btn.small { justify-self: start; }
.loading { padding: 32px 16px; text-align: center; color: var(--ink-2); }
@media print {
  header.top, .no-print, .toast, .tabs { display: none !important; }
  body { background: #fff; }
  .card { border: 0; }
}

/* Maps (Leaflet + OpenStreetMap). */
.map { height: 320px; border-radius: var(--radius); border: 1px solid var(--line); z-index: 0; }
.map.tall { height: min(60vh, 520px); }
.mk-wrap { background: none; border: 0; }
.pin {
  --c: var(--brand); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--c); color: #fff; font-weight: 700; font-size: 13px; border: 2px solid #fff; box-shadow: 0 2px 6px rgb(0 0 0 / 35%);
}
.pin > span { transform: rotate(45deg); }
.pin.done { --c: #15803d; }
.pin.locked { --c: #9ca3af; }
.me-dot { position: relative; display: block; width: 18px; height: 18px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgb(37 99 235 / 25%); }
.me-dot i { display: none; position: absolute; left: 50%; top: 50%; width: 0; height: 0; margin: -26px 0 0 -8px; border: 8px solid transparent; border-bottom: 18px solid rgb(37 99 235 / 70%); transform-origin: 8px 26px; }
.pin.hidden { --c: #475569; outline: 2px dashed #94a3b8; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card); color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(0.82) contrast(1.1) saturate(0.85); } }

.qr-scan .btn { position: absolute; bottom: 32px; }

/* Organiser: event pieces. */
.cp { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; }
.cp-no { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.challenge { border-left: 3px solid var(--line-2); padding: 4px 0 4px 10px; }
.plan-card { padding: 16px; display: grid; gap: 6px; align-content: start; }
.plan-card.current { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.plan-card b.price { font-size: 22px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-grid figure { margin: 0; display: grid; gap: 6px; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--line); }
.big-code { font: 700 34px/1 var(--mono); letter-spacing: .12em; }
.winner { font-size: 28px; font-weight: 750; text-align: center; padding: 18px; border-radius: var(--radius); background: var(--brand-soft); }

/* QR sheet: printable, one card per checkpoint. */
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.qr-card { padding: 14px; text-align: center; display: grid; gap: 6px; break-inside: avoid; }
.qr-card svg { width: 100%; height: auto; background: #fff; }
.qr-card .code { font: 700 20px/1 var(--mono); letter-spacing: .1em; }
@media print { .qr-card { border: 1px dashed #999 !important; } }

/* Player (phone first). */
body.play main.page { max-width: 640px; padding-bottom: 96px; }
.score-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.score-bar > div { padding: 10px 6px; }
.score-bar b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: center; }
.dock .btn { flex: 1; max-width: 220px; }
.cp-item { display: flex; gap: 12px; align-items: flex-start; }
.cp-item.done { opacity: .85; }
.stamp { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 2px dashed var(--line-2); color: var(--ink-3); font-weight: 700; }
.stamp.on { border: 0; background: var(--good); color: #fff; }
.options { display: grid; gap: 8px; }
.options .btn { justify-content: flex-start; white-space: normal; text-align: left; min-height: 46px; }
.board li { display: flex; gap: 10px; align-items: center; }
.board .place { width: 30px; text-align: center; font-weight: 700; color: var(--ink-2); }
.board li.me { background: var(--brand-soft); }
.timer { font: 700 18px/1 var(--mono); }
.timer.low { color: var(--bad); }

/* ---------- Kembara ---------- */
.unit-dot { --c: var(--brand); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--c); color: #fff; font-size: 11px; font-weight: 800; border: 2px solid #fff; box-shadow: 0 2px 6px rgb(0 0 0 / 35%); }
.unit-dot.stale { filter: grayscale(1); opacity: .55; }
.unit-dot.alert { box-shadow: 0 0 0 4px #fff, 0 0 0 7px #dc2626; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px #fff, 0 0 0 12px rgb(220 38 38 / 30%); } }
.route-chip { --c: var(--brand); display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); font-weight: 650; font-size: 13px; }
.route-chip::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.route-chip.small { font-size: 12px; padding: 0 8px; }
.route-stops { margin: 0; padding-left: 22px; columns: 2; }
.stop-list { margin: 0; padding-left: 22px; } .stop-list li { padding: 2px 0; border-bottom: 1px dashed var(--line); }
.live-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 860px) { .live-grid { grid-template-columns: 1fr; } }
.alerts .row { padding: 6px 0; border-bottom: 1px solid var(--line); } .alerts .row:last-child { border: 0; }
.alert-sos b { color: #dc2626; } .alert-area b, .alert-speed b { color: #b45309; }
.sim-bar { gap: 8px; align-items: center; }
.sim-panel { border-style: dashed; }
.cp-item.locked { opacity: .65; }
.good-text { color: var(--good); }
.input.small { padding: 4px 6px; font-size: 13px; }

/* The camera clue view. */
body.cam-open { overflow: hidden; }
.cam { position: fixed; inset: 0; z-index: 200; background: #000; color: #fff; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam.nocam { background: radial-gradient(circle at 50% 35%, #115e59, #042f2e 70%); }
.cam.nocam video { display: none; }
.cam-hud { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); pointer-events: none; }
.cam-hud > * { pointer-events: auto; }
.cam-top { display: flex; gap: 8px; align-items: center; text-shadow: 0 1px 3px #000; }
.cam-guide { align-self: center; text-align: center; background: rgb(0 0 0 / 35%); border-radius: 20px; padding: 14px 20px; min-width: 220px; backdrop-filter: blur(4px); }
.cam-guide p { margin: 4px 0; }
.cam .arrow { font-size: 84px; line-height: 1; color: #5eead4; transition: transform .25s; text-shadow: 0 2px 8px #000; display: inline-block; }
.cam-big { font-size: 64px; margin: 0; }
.cam-dist { font-size: 32px; font-weight: 800; }
.warm { height: 10px; border-radius: 99px; background: linear-gradient(90deg, #38bdf8, #facc15, #ef4444); position: relative; margin: 8px 0 0; }
.warm span { position: absolute; top: -4px; bottom: -4px; left: 0; border-right: 4px solid #fff; border-radius: 2px; }
.cam-clue { align-self: center; max-width: 520px; text-align: center; background: rgb(15 118 110 / 85%); border: 2px dashed #99f6e4; border-radius: 16px; padding: 12px 16px; animation: pop .3s; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.cam-bottom { text-align: center; text-shadow: 0 1px 3px #000; }
.shutter { width: 72px; height: 72px; border-radius: 50%; border: 5px solid #fff; background: rgb(255 255 255 / 30%); cursor: pointer; }
.shutter:active { background: #fff; }
.cam-note { opacity: .85; }
