:root {
  --bg: #0e1712; --card: #16241c; --card2: #1d2f25; --line: #2a4034;
  --text: #eef3ee; --dim: #9fb3a6; --amber: #f5a524; --amber-d: #c9801a;
  --green: #4ade80; --red: #f87171; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--amber); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: 14px; color: var(--dim); margin: 12px 0 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; border: 0; border-radius: 12px;
  background: var(--amber); color: #1a1205; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .5; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.small { padding: 6px 10px; font-size: 14px; border-radius: 9px; }
.btn.danger { background: transparent; color: var(--red); border: 1px solid #5b2a2a; }
.btn.block { width: 100%; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 110px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px;
  position: sticky; top: 0; background: rgba(14, 23, 18, .92); backdrop-filter: blur(8px); z-index: 20; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: .5px; text-decoration: none; color: var(--text); }
.brand span { color: var(--amber); }
h1 { font-size: 26px; margin: 8px 0; } h2 { font-size: 20px; margin: 22px 0 10px; } h3 { font-size: 16px; margin: 16px 0 8px; }
.muted { color: var(--dim); } .small { font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.row { display: flex; gap: 10px; align-items: center; } .row > .grow { flex: 1; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--card2); color: var(--dim); }
.badge.during { background: #1f4d2f; color: var(--green); } .badge.after { background: #3a2c12; color: var(--amber); }
.error { color: var(--red); min-height: 1.2em; font-size: 14px; }

/* tabs */
.tabs { display: flex; gap: 4px; position: fixed; bottom: 0; left: 0; right: 0; background: #0b130f; border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 30; justify-content: center; }
.tabs button { flex: 1; max-width: 140px; background: none; border: 0; color: var(--dim); padding: 8px 0; border-radius: 10px; font-size: 12px; }
.tabs button b { display: block; font-size: 20px; }
.tabs button.on { color: var(--amber); background: var(--card); }
.fab { position: fixed; right: 18px; bottom: calc(84px + env(safe-area-inset-bottom)); width: 64px; height: 64px; border-radius: 50%;
  border: 0; background: var(--amber); font-size: 28px; box-shadow: 0 8px 24px rgba(0,0,0,.45); z-index: 31; cursor: pointer; }

/* feed */
.post { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 14px 0; }
.post img { width: 100%; max-height: 80vh; object-fit: cover; background: #000; cursor: zoom-in; }
.post .meta { padding: 10px 14px; }
.post .who { font-weight: 700; }
.claimtag { display: inline-block; margin-top: 6px; padding: 3px 9px; border-radius: 8px; background: #2d2410; color: var(--amber); font-size: 13px; font-weight: 700; }
.claimtag.vetoed { background: #3a1818; color: var(--red); text-decoration: line-through; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* bingo */
.bingo { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.sq { aspect-ratio: 1; border-radius: 9px; background: var(--card); border: 1px solid var(--line); padding: 5px; font-size: 11px; line-height: 1.2;
  display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; position: relative; overflow: hidden; text-align: left; color: var(--text); }
.sq.free { background: #1f4d2f; cursor: default; font-weight: 700; justify-content: center; text-align: center; }
.sq.claimed { background-size: cover; background-position: center; }
.sq.claimed::before { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(0,0,0,.85)); }
.sq > * { position: relative; }
.sq .by { font-weight: 800; color: var(--amber); font-size: 10px; }
.sq.mine { outline: 2px solid var(--amber); }
@media (min-width: 560px) { .sq { font-size: 13px; padding: 8px; } }

/* leaderboard */
.lb { width: 100%; border-collapse: collapse; }
.lb td, .lb th { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.lb td:nth-child(2), .lb th:nth-child(2) { text-align: left; }
.lb th { color: var(--dim); font-size: 12px; font-weight: 600; }
.lb .total { font-weight: 800; font-size: 18px; color: var(--amber); }
.winner { background: linear-gradient(135deg, #3a2c12, #1d2f25); border: 1px solid var(--amber-d); border-radius: var(--radius); padding: 16px; text-align: center; }
.winner .big { font-size: 40px; }
.shame { border-left: 3px solid var(--red); padding: 8px 12px; margin: 8px 0; background: var(--card); border-radius: 0 10px 10px 0; }

/* sheets, modals, toasts */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 560px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }
.sheet .preview { width: 100%; max-height: 40vh; object-fit: contain; border-radius: 10px; background: #000; }
.notice { background: #2d2410; color: #f8d9a0; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 12px 0; }
.toggle { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--text); font-size: 15px; }
.toggle input { width: 22px; height: 22px; }
.roast { text-align: center; }
.roast .fire { font-size: 56px; }
.roast p { font-size: 20px; font-weight: 700; line-height: 1.35; }
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: var(--card2); border: 1px solid var(--line); padding: 10px 16px;
  border-radius: 12px; z-index: 60; max-width: 90vw; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.bad { border-color: var(--red); }
.pending { background: #2d2410; color: #f8d9a0; padding: 8px 16px; font-size: 14px; text-align: center; }
.lightbox { position: fixed; inset: 0; background: #000; z-index: 70; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.grid img { aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: zoom-in; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; }
.stats b { display: block; font-size: 24px; color: var(--amber); }
#map { height: 320px; border-radius: var(--radius); border: 1px solid var(--line); }
.hero { text-align: center; padding: 40px 0 10px; }
.hero .logo { font-size: 54px; }
.sq > span:first-child { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.sq .pts { position: absolute; right: 5px; bottom: 3px; font-size: 10px; }
@media (max-width: 420px) { .sq { font-size: 10px; padding: 4px; } .sq > span:first-child { -webkit-line-clamp: 5; } }

/* in-app camera */
.cam { position: fixed; inset: 0; background: #000; z-index: 80; }
.cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-video.mirror { transform: scaleX(-1); }
.cam-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 14px 12px; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.cam-title { font-weight: 700; text-shadow: 0 1px 3px #000; }
.cam-bar { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around; align-items: center;
  padding: 20px 20px calc(28px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.cam-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 22px; cursor: pointer; }
.cam-shutter { width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: var(--amber); cursor: pointer; }
.cam-shutter:active { transform: scale(.92); }
.cam.flash::after { content: ""; position: absolute; inset: 0; background: #fff; animation: flash .25s ease-out forwards; }
@keyframes flash { from { opacity: .9; } to { opacity: 0; } }

/* map tab */
#tripmap { height: 58vh; border-radius: var(--radius); border: 1px solid var(--line); margin: 10px 0; }
.maptools { display: flex; gap: 8px; flex-wrap: wrap; }
.maphint { background: #1f4d2f; color: var(--green); border-radius: 10px; padding: 8px 12px; font-size: 14px; margin: 8px 0; }
.placerow { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.placerow .dist { color: var(--amber); font-weight: 700; font-size: 14px; white-space: nowrap; }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #3b82f6; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(59,130,246,.3); }
.leaflet-popup-content { color: #111; }
.leaflet-popup-content .btn { color: #1a1205; }
.bonus { background: #1e3a5f; color: #93c5fd; }
.sq.locked { background: repeating-linear-gradient(135deg, #16241c, #16241c 8px, #1a2a21 8px, #1a2a21 16px); color: var(--dim); }
.bar { height: 8px; background: var(--card2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > div { height: 100%; background: var(--amber); border-radius: 99px; }
details.card summary { cursor: pointer; list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
.tabs button { font-size: 11px; padding: 7px 0; }
.tabs button b { font-size: 19px; }
