:root {
  --primary: #ff7a1a;
  --accent: #a855f7;
  --bg: #1a1030;
  --on-primary: #ffffff;
  --text: #f7f3ff;
  --muted: rgba(247, 243, 255, 0.68);
  --surface: rgba(255, 255, 255, 0.07);
  --surface-2: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.14);
  --danger: #ff5a6e;
  --ok: #3ddc97;
  --radius: 20px;
  --font-display: 'Fredoka', ui-rounded, system-ui, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --tabbar-h: 68px;
  --content-w: 680px;
  /* Side padding that lines bars up with the centered content column on wide screens */
  --gutter: max(16px, calc((100% - var(--content-w)) / 2 + 16px));
  color-scheme: dark;
}
:root[data-mode='light'] {
  --text: #22192f;
  --muted: rgba(34, 25, 47, 0.66);
  --surface: rgba(0, 0, 0, 0.045);
  --surface-2: rgba(0, 0, 0, 0.08);
  --border: rgba(0, 0, 0, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 500px at 50% -200px, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.5 var(--font-body);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: 0.2px; }
button, input, textarea, select { font: inherit; color: inherit; }

/* ---------- chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font: 700 22px var(--font-display); }
.brand-emoji { font-size: 24px; }
.topbar-actions { display: flex; gap: 8px; }
.topbar-link { text-decoration: none; font-weight: 600; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 0; cursor: pointer; font-size: 15px; }
.share-preview { width: 100%; aspect-ratio: 1200 / 630; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); object-fit: cover; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 0 var(--gutter) env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 0 12px; text-decoration: none; font-size: 12px; font-weight: 600; color: var(--muted);
}
.tabbar a span { font-size: 22px; line-height: 1; }
.tabbar a[aria-current='page'] { color: var(--text); }
.tabbar .tab-post span {
  display: grid; place-items: center; width: 56px; height: 56px; margin-top: -26px; margin-bottom: 2px;
  border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: 26px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 45%, transparent), 0 0 0 5px var(--bg);
}
.tabbar .tab-post.disabled span { filter: grayscale(0.8); opacity: 0.6; }

.view { max-width: var(--content-w); margin: 0 auto; padding: 16px; }
.loading, .empty { text-align: center; color: var(--muted); padding: 48px 16px; }

/* ---------- game header ---------- */
.game-head { text-align: center; padding: 8px 0 18px; }
.game-head .emoji { font-size: 44px; line-height: 1; }
.game-head h1 { font-size: clamp(26px, 7vw, 36px); margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-size: 14px; font-weight: 600;
}
.chip.live { background: color-mix(in srgb, var(--primary) 22%, transparent); border-color: color-mix(in srgb, var(--primary) 55%, transparent); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 30%, transparent); }
.chip .dot.off { background: var(--muted); box-shadow: none; }
.countdown { font-variant-numeric: tabular-nums; }

.banner {
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 30%, transparent), color-mix(in srgb, var(--accent) 30%, transparent));
  border: 1px solid var(--border); text-align: center; font-weight: 600;
}
.banner strong { font-family: var(--font-display); font-size: 20px; display: block; }

/* ---------- last seen cards (the heart of the site) ---------- */
.last-seen-grid { display: grid; gap: 16px; margin-bottom: 20px; }
@media (min-width: 620px) { .last-seen-grid.two { grid-template-columns: 1fr 1fr; } }
.ls-card {
  position: relative; overflow: hidden; border-radius: 26px;
  background: var(--surface); border: 2px solid color-mix(in srgb, var(--primary) 60%, transparent);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.ls-photo { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; background: var(--surface-2); }
.ls-placeholder { aspect-ratio: 4 / 3; display: grid; place-items: center; font-size: 84px; background: var(--surface-2); }
.ls-tag {
  position: absolute; top: 14px; left: 14px;
  padding: 6px 12px; border-radius: 999px; background: var(--primary); color: var(--on-primary);
  font: 700 13px var(--font-display); letter-spacing: 1.2px; text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.ls-body { padding: 14px 18px 18px; }
.ls-body h2 { font-size: 26px; }
.ls-when { font-weight: 700; color: var(--primary); margin-top: 2px; }
.ls-caption { margin: 8px 0 0; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border-radius: 16px; border: 0; cursor: pointer;
  font-weight: 700; text-decoration: none; background: var(--surface-2); color: var(--text);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--border); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.cta { margin: 0 0 24px; font-size: 18px; min-height: 56px; }

/* ---------- feed ---------- */
.feed-head { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 0 12px; }
.feed-head h2 { font-size: 22px; }
.feed { display: grid; gap: 14px; }
.post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.post img { width: 100%; max-height: 70vh; object-fit: cover; background: var(--surface-2); }
.post-body { padding: 12px 14px 14px; }
.post-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.item-pill { padding: 3px 10px; border-radius: 999px; font-weight: 700; color: var(--text); background: color-mix(in srgb, var(--accent) 35%, transparent); }
.post-text { margin: 8px 0 0; overflow-wrap: anywhere; }
.post-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.post img { touch-action: manipulation; }
.like-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px 6px 10px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700;
}
.like-btn .heart { font-size: 20px; line-height: 1; }
.like-btn.on { border-color: color-mix(in srgb, #ff3b6b 60%, transparent); background: color-mix(in srgb, #ff3b6b 16%, transparent); }
.like-btn.pop .heart { animation: pop 0.35s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.45); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .like-btn.pop .heart { animation: none; } }
.link-btn { background: none; border: 0; padding: 8px 4px; color: var(--muted); font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:disabled { text-decoration: none; cursor: default; }

/* ---------- forms ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stack { display: grid; gap: 16px; }
.field label, .field .label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 14px; margin-top: 4px; }
input[type='text'], input[type='password'], input[type='number'], input[type='time'], input[type='datetime-local'], textarea, select {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); font-size: 16px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 70%, transparent); outline-offset: 2px;
}
.counter { text-align: right; font-size: 13px; color: var(--muted); }
.counter.over { color: var(--danger); }

.photo-pick {
  display: grid; place-items: center; gap: 6px; aspect-ratio: 4 / 3; border-radius: var(--radius);
  border: 2px dashed color-mix(in srgb, var(--primary) 60%, transparent); background: var(--surface);
  cursor: pointer; text-align: center; font-weight: 700; overflow: hidden; position: relative;
}
.photo-pick .big { font-size: 54px; line-height: 1; }
.photo-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-ok { color: var(--ok); font-size: 14px; font-weight: 600; margin-top: 6px; }

.item-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.item-choice { position: relative; }
.item-choice input { position: absolute; opacity: 0; }
.item-choice span {
  display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; border: 2px solid var(--border);
  background: var(--surface); font-weight: 700; cursor: pointer;
}
.item-choice img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.item-choice input:checked + span { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 18%, transparent); }
.item-choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 70%, transparent); }

.reminder {
  display: flex; gap: 12px; padding: 14px; border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 18%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.reminder .big { font-size: 26px; line-height: 1; }
.reminder p { margin: 0; }
.error { color: var(--danger); font-weight: 600; margin: 0; }
.closed { text-align: center; padding: 36px 20px; }
.closed .big { font-size: 56px; }
.closed h2 { margin: 10px 0 6px; }
.closed p { color: var(--muted); margin: 0 0 18px; }

/* ---------- rules ---------- */
.rules p { margin: 0 0 12px; }
.rules ol, .rules ul { padding-left: 22px; margin: 0 0 12px; }
.rules li { margin-bottom: 10px; }
.rules li::marker { color: var(--primary); font-weight: 700; }
.section-title { font-size: 24px; margin: 4px 0 14px; }
.prize { display: flex; gap: 10px; align-items: center; font-weight: 700; margin-top: 14px; }

/* ---------- past games ---------- */
.game-list { display: grid; gap: 12px; }
.game-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
}
.game-row .emoji { font-size: 32px; }
.game-row h3 { font-size: 18px; }
.game-row p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.game-row .swatch { width: 10px; align-self: stretch; border-radius: 6px; }
.back { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none; font-weight: 600; }

/* ---------- report sheet ---------- */
dialog.sheet {
  width: min(560px, 100% - 24px); max-height: 90dvh; margin: auto auto 12px; padding: 22px 20px;
  border: 1px solid var(--border); border-radius: 24px; color: var(--text);
  background: color-mix(in srgb, var(--bg) 92%, #fff 8%);
}
:root[data-mode='light'] dialog.sheet { background: #fff; }
@media (min-width: 620px) { dialog.sheet { margin: auto; } }
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog.sheet h2 { font-size: 24px; margin-bottom: 10px; }
dialog.sheet p { margin: 0 0 12px; }
dialog.sheet .fine { color: var(--muted); font-size: 14px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  transform: translate(-50%, 20px); opacity: 0; transition: 0.25s ease; z-index: 50;
  padding: 12px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); max-width: calc(100% - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- admin ---------- */
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 4px; }
.admin-tabs button { white-space: nowrap; }
.admin-tabs button[aria-pressed='true'] { background: var(--primary); color: var(--on-primary); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); }
.badge.active { background: var(--ok); color: #0b2b1d; }
.badge.flagged { background: var(--danger); color: #fff; }
.badge.draft { background: var(--accent); color: #fff; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
input[type='color'] { width: 100%; height: 48px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); padding: 4px; }
.item-edit { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--surface); }
.item-edit .thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-size: 28px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch input { width: 52px; height: 30px; accent-color: var(--primary); }
.muted { color: var(--muted); }
.mt { margin-top: 16px; }
.photo-pick-inner { display: grid; place-items: center; gap: 6px; position: relative; z-index: 1; padding: 16px; }

/* Turnstile spam check: same width as the buttons */
.turnstile { width: 100%; min-height: 65px; }
.turnstile iframe { width: 100% !important; }

.site-footer {
  max-width: var(--content-w); margin: 8px auto 0; padding: 8px 16px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 13px; color: var(--muted);
}
.site-footer a { color: var(--muted); text-underline-offset: 3px; }
.site-footer .link-btn { font-size: 13px; padding: 4px 2px; }

/* ---------- alerts banner + install guide ---------- */
.alert-banner { padding: 10px var(--gutter) 0; }
.alert-inner {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 30%, transparent), color-mix(in srgb, var(--primary) 22%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.alert-inner p { margin: 0; flex: 1; font-size: 14px; line-height: 1.35; }
.alert-icon { font-size: 22px; }
.alert-inner .btn.small { flex: none; }
.banner-close { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; }
.steps { padding-left: 22px; margin: 0 0 8px; }
.steps li { margin-bottom: 8px; }
.steps li::marker { color: var(--primary); font-weight: 700; }
.steps-title { font-size: 17px; margin: 14px 0 8px; }
.other-devices { margin-top: 10px; }
.other-devices summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.kbd { display: inline-block; padding: 0 4px; border-radius: 6px; background: var(--surface-2); }
.sheet-actions.single { grid-template-columns: 1fr; }

.ls-actions { margin-top: 12px; }
.ls-photo { touch-action: manipulation; }
