:root {
  --green: #0f7f47;
  --green-2: #15a35c;
  --orange: #f47a20;
  --red: #e0262b;
  --ink: #0b0b0c;
  --glass: rgba(12, 12, 14, 0.58);
  --glass-2: rgba(12, 12, 14, 0.78);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f5f5f3;
  --muted: rgba(245, 245, 243, 0.72);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--text); font-family: -apple-system, "SF Pro Text", system-ui, "Segoe UI", Roboto, "PingFang HK", "Noto Sans CJK TC", sans-serif; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; }

#app { position: fixed; inset: 0; overflow: hidden; }

/* ---------- viewfinder ---------- */
#viewfinder { position: absolute; inset: 0; overflow: hidden; background: #111; touch-action: none; user-select: none; }
#video, #photo, #demo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#video.mirror { transform: scaleX(-1); }
#video[hidden], #photo[hidden] { display: none; }
#demo { display: none; }
#demo.on { display: block; }
.photo-credit { position: absolute; right: 10px; bottom: calc(var(--safe-bottom) + 232px); z-index: 4; font-size: 10px; color: rgba(255,255,255,0.75); background: rgba(0,0,0,0.45); padding: 3px 8px; border-radius: 999px; text-decoration: none; }
.photo-credit[hidden] { display: none; }
@media (max-height: 520px) { .photo-credit { bottom: calc(var(--safe-bottom) + 120px); } }

#sticker-layer { position: absolute; inset: 0; }
#viewfinder.gated #sticker-layer { display: none; }
#viewfinder.gated .chrome { display: none; }
#sticker { position: absolute; left: 0; top: 0; width: 260px; height: 306px; transform-origin: center center; will-change: transform; cursor: grab; }
#sticker:active { cursor: grabbing; }
#sticker svg, #sticker canvas { width: 100%; height: 100%; display: block; pointer-events: none; }

/* ---------- chrome ---------- */
.chrome { position: absolute; left: 0; right: 0; z-index: 5; pointer-events: none; }
.chrome > * { pointer-events: auto; }
.chrome.top { top: 0; padding: calc(var(--safe-top) + 12px) 14px 0; background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0)); padding-bottom: 28px; }
.chrome.bottom { bottom: 0; padding: 0 12px calc(var(--safe-bottom) + 12px); background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.72)); padding-top: 30px; display: flex; flex-direction: column; gap: 10px; }

.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: 0.02em; font-size: 15px; white-space: nowrap; background: var(--glass); border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(224, 38, 43, 0.28); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
.hint { margin: 8px 2px 0; font-size: 12px; color: var(--muted); text-shadow: 0 1px 2px rgba(0,0,0,0.6); }

.pill { border: 1px solid var(--line); background: var(--glass); color: var(--text); border-radius: 999px; padding: 8px 12px; font-size: 13px; white-space: nowrap; font-weight: 600; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); cursor: pointer; }
.pill.ghost { background: rgba(255,255,255,0.08); }
.top-actions { display: flex; gap: 6px; min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.top-actions::-webkit-scrollbar { display: none; }
@media (max-width: 420px) { .brand .live { display: none; } .brand { font-size: 14px; padding: 7px 9px; gap: 6px; } .top-row { gap: 6px; } .top-actions { gap: 3px; } .top-actions .pill { padding: 7px 8px; font-size: 12px; } }
.pill.toggle[aria-pressed="true"] { background: rgba(15, 127, 71, 0.7); border-color: var(--green-2); }

/* trays */
.tray { display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.tray::-webkit-scrollbar { display: none; }
.tray-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); min-width: 40px; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); cursor: pointer; font-size: 13px; font-weight: 600; transition: border-color .15s, background .15s, transform .1s; }
.chip img { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.9); object-fit: contain; padding: 2px; }
.chip[aria-pressed="true"] { border-color: var(--green-2); background: rgba(15, 127, 71, 0.55); }
.chip:active { transform: scale(0.96); }

/* toolbar */
.toolbar { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 4px; }
.icon { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: grid; place-items: center; }
.icon:disabled { opacity: 0.35; cursor: default; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: rgba(255,255,255,0.12); display: grid; place-items: center; cursor: pointer; margin: 0 6px; }
.shutter span { width: 58px; height: 58px; border-radius: 50%; background: #fff; transition: transform .08s; box-shadow: inset 0 0 0 6px var(--green); }
.shutter:active span { transform: scale(0.88); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; padding: 14px 18px; border-radius: 14px; border: 1px solid transparent; font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, var(--green-2), var(--green)); color: #fff; box-shadow: 0 8px 20px rgba(15, 127, 71, 0.35); }
.btn.secondary { background: rgba(255,255,255,0.1); color: var(--text); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; }
.btn.danger { background: rgba(224, 38, 43, 0.18); color: #ff8a8e; border-color: rgba(224, 38, 43, 0.5); }
.btn.like { background: rgba(255,255,255,0.1); color: var(--text); border-color: var(--line); flex: 0 0 auto; min-width: 84px; }
.btn.like[aria-pressed="true"] { background: rgba(224, 38, 43, 0.22); color: #ff8a8e; border-color: rgba(224, 38, 43, 0.6); }
.tile-like { position: absolute; right: 6px; top: 6px; border: 0; padding: 4px 9px; border-radius: 999px; background: rgba(0,0,0,0.55); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.tile-like[aria-pressed="true"] { background: var(--red); }
.tile-like:active { transform: scale(0.92); }
.btn.danger.armed { background: var(--red); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: default; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--orange); color: #111; font-size: 11px; line-height: 18px; text-align: center; }
.count[hidden] { display: none; }

/* ---------- gate ---------- */
.gate { position: absolute; inset: 0; z-index: 8; display: grid; grid-template-rows: 1fr auto; place-items: center; padding: calc(var(--safe-top) + 100px) 20px 24px; overflow-y: auto; background: radial-gradient(120% 90% at 50% 0%, rgba(15,127,71,0.35), rgba(11,11,12,0.94) 60%); }
.gate[hidden] { display: none; }
.gate-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.gate-stage { position: relative; height: 236px; touch-action: none; user-select: none; -webkit-user-select: none; }
.gate-stage img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 150px; height: 176px; filter: drop-shadow(0 12px 24px rgba(0,0,0,0.5)); animation: float 3.4s ease-in-out infinite; }
.gate-stage img[hidden] { display: none; }
.gate-stage #sticker { cursor: grab; }
.stage-hint { position: absolute; left: 0; right: 0; bottom: -6px; text-align: center; font-size: 11px; color: var(--muted); opacity: 0.75; pointer-events: none; transition: opacity .4s; }
.stage-hint.fade { opacity: 0; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.gate h1 { margin: 4px 0 0; font-size: 26px; letter-spacing: -0.01em; }
.gate-sub { margin: 0 0 6px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.gate-note { margin: 4px 0 0; font-size: 12px; color: var(--muted); min-height: 1em; }
/* in the flow (last grid row), not fixed: a fixed footer slid over the text while a short phone scrolled */
.gate-credit { align-self: end; justify-self: center; margin: 22px 0 0; text-align: center; font-size: 11px; color: var(--muted); opacity: 0.75; letter-spacing: 0.02em; pointer-events: none; }
.gate { padding-bottom: calc(var(--safe-bottom) + 14px); }
button.brand { cursor: pointer; font-family: inherit; }
button.brand:active { transform: scale(0.97); }

/* ---------- toast ---------- */
.toast { position: absolute; left: 50%; top: calc(var(--safe-top) + 84px); transform: translateX(-50%); z-index: 9; background: var(--glass-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: min(90vw, 420px); text-align: center; }
.toast[hidden] { display: none; }

/* ---------- capture sheet ---------- */
.sheet { position: absolute; inset: 0; z-index: 10; background: rgba(0,0,0,0.9); display: grid; place-items: center; padding: 16px; }
.sheet[hidden] { display: none; }
.sheet-card { width: min(460px, 100%); display: flex; flex-direction: column; gap: 12px; }
.sheet-card img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 16px; background: #000; box-shadow: 0 16px 40px rgba(0,0,0,0.6); }
.sheet-actions { display: flex; gap: 8px; }
.sheet-actions .btn { width: auto; flex: 1 1 0; min-width: 0; padding: 14px 8px; font-size: 15px; white-space: nowrap; }
.sheet-actions .btn.like { flex: 0 0 auto; min-width: 72px; }

/* ---------- responsive: short screens (phone landscape) ---------- */
@media (max-height: 520px) {
  .gate { padding-top: calc(var(--safe-top) + 64px); }
  .chrome.top { padding-bottom: 14px; }
  .hint { display: none; }
  .chrome.bottom { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding-top: 14px; }
  .tray { flex: 1 1 40%; padding: 0; }
  .tray-label { display: none; }
  .chip { padding: 4px 10px 4px 4px; font-size: 12px; }
  .chip img { width: 28px; height: 28px; }
  .toolbar { flex: 1 1 100%; padding-top: 0; gap: 10px; }
  .icon { width: 38px; height: 38px; font-size: 17px; }
  .shutter { width: 56px; height: 56px; border-width: 3px; }
  .shutter span { width: 42px; height: 42px; box-shadow: inset 0 0 0 5px var(--green); }
  .gate-stage { height: 128px; }
  .gate-stage img { width: 96px; height: 113px; }
  .stage-hint { display: none; }
  .gate h1 { font-size: 20px; margin-top: 0; }
  .gate-sub { font-size: 13px; margin-bottom: 2px; }
  .gate-card { gap: 8px; }
  .btn { padding: 10px 16px; font-size: 15px; }
  .toast { top: calc(var(--safe-top) + 58px); }
}

/* ---------- responsive: tablets and wide screens ---------- */
@media (min-width: 700px) {
  .chrome.top > *, .chrome.bottom > * { width: 100%; max-width: 620px; margin-left: auto; margin-right: auto; }
  .chip { font-size: 14px; }
  .chip img { width: 38px; height: 38px; }
  .icon { width: 48px; height: 48px; }
  .sheet-card { width: min(560px, 100%); }
}

/* ---------- post form ---------- */
.post-form { display: flex; flex-direction: column; gap: 10px; }
.post-form[hidden] { display: none; }
.post-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.post-form .opt { font-weight: 400; opacity: 0.7; margin-left: 4px; }
.post-form input { font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,0.08); color: var(--text); outline: none; }
.post-form input:focus { border-color: var(--green-2); }
.sheet .sheet-card { max-height: 100%; overflow-y: auto; }

/* ---------- wall ---------- */
.wall { position: absolute; inset: 0; z-index: 11; background: var(--ink); display: flex; flex-direction: column; overflow: hidden; }
.wall[hidden] { display: none; }
.wall-head { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-top) + 12px) 14px 10px; }
.wall-empty { margin: 40px 24px; text-align: center; color: var(--muted); font-size: 15px; line-height: 1.5; }
.wall-empty[hidden] { display: none; }
/* masonry: JS deals tiles into columns (shortest first); each tile keeps its photo's own aspect
   (set inline from the post's w/h), so the full picture shows */
.wall-grid { flex: 1; overflow-y: auto; display: flex; gap: 6px; align-items: flex-start; padding: 0 8px calc(var(--safe-bottom) + 16px); }
.wall-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.wall-tile { position: relative; display: block; width: 100%; border: 0; padding: 0; background: #1a1a1c; border-radius: 12px; overflow: hidden; aspect-ratio: 3 / 4; cursor: pointer; }
.wall-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wall-tile .tile-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 8px 8px; background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.75)); color: #fff; font-size: 12px; text-align: left; line-height: 1.3; }
.wall-tile .tile-name { font-weight: 700; }
.wall-tile .tile-caption { opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall-view { position: absolute; inset: 0; background: rgba(0,0,0,0.96); display: flex; flex-direction: column; gap: 12px; padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 16px); }
.wall-view[hidden] { display: none; }
.wall-view img { flex: 1; min-height: 0; width: 100%; object-fit: contain; border-radius: 14px; background: #000; }
.wall-view-meta { text-align: center; }
.wall-view-name { font-weight: 800; font-size: 16px; }
.wall-view-caption { color: var(--text); font-size: 15px; margin-top: 2px; }
.wall-view-time { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- store line on the capture sheet ---------- */
.store-line { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.store-line[hidden] { display: none; }
.store-wait { color: var(--muted); font-size: 13px; }
.store-wait[hidden] { display: none; }
.store-ask, .store-set { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(255,255,255,0.08); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.store-ask[hidden], .store-set[hidden], .store-pick[hidden] { display: none; }
.store-ask-btns { display: flex; gap: 6px; }
.mini { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,0.1); color: var(--text); font-size: 16px; cursor: pointer; }
.mini.yes { background: var(--green); border-color: var(--green-2); color: #fff; }
.mini.no { color: var(--muted); }
.store-pick { display: flex; flex-direction: column; gap: 8px; }
.store-pick-label { color: var(--muted); font-size: 13px; }
.store-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 132px; overflow-y: auto; }
#store-pick-chips.picker { max-height: none; overflow: visible; flex-direction: column; align-items: stretch; }
#store-pick-chips.picker > .chip { align-self: flex-start; }
#store-pick-chips.picker .store-chips { max-height: 160px; }
#store-pick-district { width: 100%; max-width: none; margin-bottom: 6px; }
.store-chips .chip { padding: 8px 12px; font-size: 13px; }
.store-search { width: 100%; font: inherit; font-size: 16px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,0.08); color: var(--text); outline: none; margin-bottom: 6px; }
.store-search:focus { border-color: var(--green-2); }
.store-pick-none { font-size: 12.5px; color: var(--muted); }
.store-set .muted { color: var(--muted); font-size: 12px; margin-left: 4px; }
.linkish { align-self: flex-start; background: none; border: 0; color: var(--green-2); font-weight: 600; font-size: 13px; cursor: pointer; padding: 2px 0; }
.linkish[hidden] { display: none; }

/* ---------- wall filters / store lines ---------- */
.wall-filters { display: flex; gap: 8px; align-items: center; padding: 0 12px 10px; flex-wrap: wrap; }
.select { font: inherit; font-size: 13px; padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); color: var(--text); max-width: 60%; }
.wall-tile .tile-store { position: absolute; left: 6px; top: 6px; padding: 3px 8px; border-radius: 999px; background: rgba(15,127,71,0.85); color: #fff; font-size: 11px; font-weight: 700; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall-view-store { margin-top: 6px; font: inherit; font-size: 13px; font-weight: 700; color: #fff; background: rgba(15,127,71,0.85); border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.wall-view-claim { margin: 8px 0 0 8px; font: inherit; font-size: 13px; font-weight: 700; color: var(--text); background: rgba(255,255,255,0.1); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.wall-view-claim:disabled { opacity: 0.8; cursor: default; border-color: var(--green-2); }
.stat.mine { border-color: var(--green-2); background: rgba(15,127,71,0.22); }
.cards-stats .wall-empty small, #cards-empty small { display: block; margin-top: 6px; font-size: 12px; opacity: 0.8; line-height: 1.4; }
.wall-view-store[hidden] { display: none; }

/* ---------- store card ---------- */
.card-wrap { position: absolute; inset: 0; z-index: 12; background: rgba(0,0,0,0.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 16px); overflow-y: auto; }
@media (max-height: 640px) { .card-wrap { justify-content: flex-start; } .card-img { width: 110px; height: 129px; } .card-name { font-size: 19px; } }
.card-wrap[hidden] { display: none; }
.card { --card-a: #ffffff; --card-b: #eef2ee; --card-accent: #0f7f47; --card-deep: #0a5f35; width: min(340px, 100%); border-radius: 20px; background: linear-gradient(160deg, var(--card-a), var(--card-b)); color: #111; padding: 14px 16px 16px; box-shadow: 0 24px 60px rgba(0,0,0,0.6); position: relative; overflow: hidden; animation: cardin .5s cubic-bezier(.2,.9,.3,1.2); }
.card.rare { background: linear-gradient(160deg, #ffe9a8, #e9b93c); box-shadow: 0 24px 60px rgba(245,180,40,0.55), inset 0 0 0 3px #b8860b; }
.card.rare .card-head { color: #7a5200; }
.card.rare .card-stamp { border-top-color: #b8860b; }
.card-wrap.still .card { animation: none; }
@keyframes cardin { from { transform: translateY(30px) scale(.9) rotate(-3deg); opacity: 0; } to { transform: none; opacity: 1; } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--card-accent); position: relative; }
.card-serial { margin-left: auto; font-weight: 700; letter-spacing: .04em; color: var(--card-deep); opacity: .8; }
.card-motif { position: absolute; left: 0; right: 0; bottom: 0; height: 120px; pointer-events: none; }
.card-emblem { position: absolute; right: 12px; top: 40px; width: 56px; height: 56px; }
.card-earned { position: relative; text-align: center; font-weight: 800; font-size: 13px; color: #fff; background: var(--card-deep); border-radius: 999px; padding: 6px 12px; margin: -4px auto 8px; width: max-content; max-width: 100%; }
.card-earned[hidden] { display: none; }
.card-emblem svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15)); }
.card-motif svg { width: 100%; height: 100%; display: block; }
.card-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
.card-badges span { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,0.7); color: var(--card-deep); border: 1px solid rgba(0,0,0,0.08); }
.card-img, .card-name, .card-district, .card-stamp, .card-first, .card-look, .card-badges { position: relative; }
.card-rare { background: #b8860b; color: #fff; padding: 2px 8px; border-radius: 999px; }
.card-rare[hidden] { display: none; }
.card-img { width: 150px; height: 176px; display: block; margin: 6px auto 4px; object-fit: contain; }
.card-name { font-size: 22px; font-weight: 800; text-align: center; line-height: 1.15; }
.card-district { text-align: center; color: #556; font-size: 13px; margin-top: 2px; }
.card-stamp { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--card-accent); font-size: 12px; color: #334; font-weight: 700; }
.card-first { margin-top: 10px; text-align: center; background: var(--orange); color: #111; font-weight: 800; border-radius: 10px; padding: 8px; font-size: 13px; }
.card-first[hidden] { display: none; }
.card-look { margin-top: 10px; text-align: center; font-size: 13px; color: #223; }
.card-actions { width: min(340px, 100%); }

/* ---------- collection ---------- */
.cards-body { flex: 1; overflow-y: auto; padding: 0 14px calc(var(--safe-bottom) + 20px); }
.cards-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }
.cards-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 20px; }
.stat span { font-size: 11px; color: var(--muted); line-height: 1.3; }
.district-progress { display: flex; flex-direction: column; gap: 6px; }
.dp { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; align-items: center; }
.dp .bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; }
.dp .bar i { display: block; height: 100%; background: var(--green-2); }
.dp .n { color: var(--muted); font-size: 12px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.mini-card { --card-a: #ffffff; --card-b: #eef2ee; --card-deep: #0a5f35; position: relative; background: linear-gradient(160deg, var(--card-a), var(--card-b)); color: #111; border-radius: 14px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; cursor: pointer; text-align: center; }
.mini-card.rare { background: linear-gradient(160deg, #fff7d6, #f5d56a); }
.mini-card img { width: 70px; height: 82px; }
.mc-serial { position: absolute; top: 6px; right: 8px; font-size: 9px; font-style: normal; font-weight: 700; color: var(--card-deep); opacity: .7; }
.mini-card b { font-size: 13px; line-height: 1.15; }
.mini-card span { font-size: 11px; color: #556; }


/* ============================================================ field kit shell ============================================================ */
:root { --gold: #e0b23c; --gold-deep: #7a5200; }
.pill.green { background: rgba(15,127,71,0.78); border-color: rgba(21,163,92,0.6); color: #fff; }

/* quest strip + live store chip (top chrome) */
.quest { margin: 10px auto 0; max-width: 620px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: rgba(0,0,0,0.5); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.quest-bar { flex: 0 0 auto; width: 44px; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.18); overflow: hidden; }
.quest-bar b { display: block; height: 100%; width: 0; background: var(--orange); transition: width .5s; }
.quest.done .quest-bar b { background: var(--gold); }
.quest-text { display: flex; flex-direction: column; min-width: 0; }
.quest-text b { font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quest-text small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vf-store { display: block; margin: 8px auto 0; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.vf-store.dim { background: rgba(0,0,0,0.5); border-color: var(--line); color: var(--muted); }
.vf-store[hidden] { display: none; }

/* gate */
.gate { padding-top: calc(var(--safe-top) + 72px); }
.gate h1 { font-size: 28px; line-height: 1.1; }
.teasers { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.teaser { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 12px; background: rgba(255,255,255,0.08); border: 1px solid var(--line); }
.teaser i { width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto; background: linear-gradient(135deg, #d7f5e4, #8fd8b2); }
.teaser i.gold { background: linear-gradient(135deg, #ffe9a8, #e0b23c); }
.teaser b { display: block; font-size: 13px; }
.teaser span { font-size: 12px; color: var(--muted); }
.teaser.done { border-color: rgba(21,163,92,0.6); }
.teaser.done b::before { content: "✓ "; color: var(--green-2); }
.gate-links { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.gate-links .linkish { color: var(--muted); font-size: 13px; }
.gate-links .sep { color: var(--muted); opacity: .5; }
.gate-fine { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.gate .btn.secondary { font-size: 15px; }

/* one kit tray */
.kit { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.kit::-webkit-scrollbar { display: none; }
.kit .tray { flex: 0 0 auto; overflow: visible; padding: 0; gap: 6px; }
.kit-sep { flex: 0 0 auto; width: 1px; height: 26px; background: var(--line); margin: 0 2px; }
.kit-sep[hidden], .gold-chip[hidden] { display: none; }
.gold-chip { padding-left: 8px; border-color: rgba(224,178,60,0.55); }
.gold-chip i { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2c2, #e0b23c 55%, #a97a12); display: inline-block; }
.gold-chip[aria-pressed="true"] { background: rgba(224,178,60,0.35); border-color: var(--gold); }

/* tabs */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px 4px 0; }
.tabs button { border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; border-radius: 12px; cursor: pointer; position: relative; }
.tabs button i { width: 24px; height: 24px; border-radius: 8px; background: rgba(255,255,255,0.14); display: block; }
.tabs button[aria-selected="true"] { color: #fff; }
.tabs button[aria-selected="true"] i { background: var(--green); box-shadow: 0 0 0 2px rgba(21,163,92,0.35); }
.tabs .count { position: absolute; top: 2px; left: calc(50% + 8px); margin: 0; }
.wall > .tabs { flex: 0 0 auto; padding: 6px 8px calc(var(--safe-bottom) + 8px); background: rgba(0,0,0,0.6); border-top: 1px solid var(--line); }
/* the post viewer sits above the tab bar, never on top of it */
.wall-view { bottom: calc(var(--safe-bottom) + 70px); padding-bottom: 12px; }
@media (max-height: 520px) { .wall-view { bottom: calc(var(--safe-bottom) + 52px); } }

/* capture sheet: earn block, always-on form */
.store-set.earn[hidden] { display: none; }
.store-set.earn { display: flex; align-items: center; gap: 10px; background: linear-gradient(135deg, rgba(15,127,71,0.5), rgba(15,127,71,0.18)); border-color: rgba(21,163,92,0.55); }
.earn-card { width: 36px; height: 46px; border-radius: 6px; flex: 0 0 auto; border: 2px solid #fff; background: linear-gradient(160deg, #d9f3e5, #8fd8b2); }
.earn-card.gold { background: linear-gradient(160deg, #ffe9a8, #e0b23c); border-color: #b8860b; }
.earn-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.earn-text b { font-size: 13.5px; line-height: 1.2; }
.earn-text .muted { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.store-set.earn .linkish { flex: 0 0 auto; align-self: center; color: #8fd8b2; }
.sheet-card img#result { max-height: 46vh; }
.sheet-actions .btn.save { flex: 0 0 auto; min-width: 64px; }
.sheet-fine { margin: 0; text-align: center; font-size: 11.5px; color: var(--muted); }
@media (max-height: 640px) { .sheet-card img#result { max-height: 34vh; } }

/* card: earned moment */
.card-wrap { gap: 10px; }
.card-earned { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #8fd8b2; background: transparent; padding: 0; margin: 0; }
.card-next { margin: 0; text-align: center; font-size: 13px; color: var(--muted); max-width: 340px; line-height: 1.4; }
.card-next[hidden] { display: none; }
.card-actions { width: min(340px, 100%); display: flex; flex-direction: column; gap: 8px; }
.card-actions .btn.primary { width: 100%; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 7px; height: 12px; border-radius: 2px; opacity: .95; animation: confetti-fall 3s linear forwards; }
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(260deg); opacity: .7; } }
@media (prefers-reduced-motion: reduce) { .confetti i { animation: none; display: none; } }
/* ---------- legendary: the gold 18Bro of Hong Kong ---------- */
.card.gold { --gold-1: #f3d67c; --gold-2: #d9a93a; --gold-3: #8a6a1e; color: #f7e9c4; background: radial-gradient(120% 70% at 50% 0%, #4a3410 0%, #1c1408 42%, #0b0906 100%); box-shadow: 0 0 0 3px var(--gold-2), 0 0 0 6px #1a1206, 0 0 0 7px var(--gold-3), 0 30px 70px rgba(226,185,75,0.4), 0 0 60px rgba(226,185,75,0.25); }
.card.gold::before { content: ""; position: absolute; inset: -40% -60%; background: linear-gradient(115deg, transparent 42%, rgba(255,240,190,0.28) 50%, transparent 58%); transform: translateX(-60%); animation: foil 4.2s ease-in-out infinite; pointer-events: none; z-index: 3; mix-blend-mode: screen; }
@keyframes foil { 0%, 15% { transform: translateX(-60%); } 60%, 100% { transform: translateX(60%); } }
.card.gold .card-head { color: var(--gold-1); }
.card.gold .card-serial { color: var(--gold-2); opacity: 1; }
.card.gold .card-head { flex-wrap: nowrap; white-space: nowrap; }
.card.gold .card-stamp { position: relative; background: rgba(0,0,0,0.35); margin-left: -6px; margin-right: -6px; padding: 10px 6px 0; border-radius: 8px; }
.card.gold .card-name { color: #fff3cf; text-shadow: 0 2px 0 #6b4d0e, 0 0 24px rgba(243,214,124,0.55); font-size: 24px; }
.card.gold .card-district { color: var(--gold-1); letter-spacing: 0.04em; text-transform: uppercase; font-size: 11.5px; font-weight: 800; }
.card.gold .card-badges span { background: rgba(0,0,0,0.45); color: var(--gold-1); border-color: rgba(243,214,124,0.45); }
.card.gold .card-stamp { border-top-color: var(--gold-3); color: var(--gold-1); }
.card.gold .card-look { color: #e9d9ad; font-style: italic; }
.card.gold .card-img { width: 172px; height: 202px; filter: drop-shadow(0 0 22px rgba(255,214,102,0.55)) drop-shadow(0 14px 18px rgba(0,0,0,0.6)); }
.card.gold .card-emblem { filter: drop-shadow(0 0 10px rgba(243,214,124,0.5)); }
.card-burst { position: absolute; left: 50%; top: 150px; width: 340px; height: 340px; transform: translate(-50%, -50%); border-radius: 50%; background: repeating-conic-gradient(rgba(255,214,102,0.22) 0 8deg, transparent 8deg 20deg); -webkit-mask-image: radial-gradient(circle, #000 0%, rgba(0,0,0,0.55) 40%, transparent 68%); mask-image: radial-gradient(circle, #000 0%, rgba(0,0,0,0.55) 40%, transparent 68%); animation: burst 48s linear infinite; pointer-events: none; }
.card-burst[hidden] { display: none; }
@keyframes burst { to { transform: translate(-50%, -50%) rotate(360deg); } }
.card-legend { display: inline-block; margin-left: 6px; padding: 3px 10px; border-radius: 999px; background: linear-gradient(135deg, #f7e0a0, #d9a93a 55%, #a8801f); color: #2a1c05; font-size: 10px; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; box-shadow: 0 0 14px rgba(243,214,124,0.55); }
.card-legend[hidden] { display: none; }
.card-seals { position: relative; display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin-top: 10px; padding: 8px; border-radius: 12px; background: rgba(0,0,0,0.55); border: 1px solid rgba(243,214,124,0.3); }
.card-seals[hidden] { display: none; }
.card-seals svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.card-wrap.legend .card-earned { color: var(--gold-1); text-shadow: 0 0 16px rgba(243,214,124,0.6); }
@media (prefers-reduced-motion: reduce) { .card.gold::before, .card-burst { animation: none; } }
.mini-card.gold { background: radial-gradient(120% 80% at 50% 0%, #3d2b0d, #120d05 70%); color: #f7e9c4; box-shadow: 0 0 0 2px #d9a93a, 0 0 18px rgba(226,185,75,0.35); }
.mini-card.gold b { color: #fff3cf; }
.mini-card.gold span { color: #e9d9ad; }
.mini-card.gold .mc-serial { color: #f3d67c; opacity: 1; }
.goal.done { background: radial-gradient(120% 80% at 50% 0%, #3d2b0d, #120d05 70%); border-color: #d9a93a; box-shadow: 0 0 18px rgba(226,185,75,0.3); }
.goal.done b, .goal.done .goal-count { color: #f3d67c; }

/* wall: scope + district chips */
.wall-filters { flex-direction: column; align-items: stretch; gap: 8px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: rgba(255,255,255,0.08); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; padding: 8px 0; border-radius: 999px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--green); color: #fff; }
.wall-districts { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.wall-districts::-webkit-scrollbar { display: none; }
.wall-districts .chip { padding: 6px 11px; font-size: 12px; }
.wall-districts:empty { display: none; }
.wall-status { margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.wall-status[hidden] { display: none; }
.wall-status.warn { color: #ffb4a8; }

/* collection: goal + district grid */
.cards-line { font-size: 12px; color: var(--muted); }
.goal { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: linear-gradient(135deg, rgba(224,178,60,0.32), rgba(224,178,60,0.08)); border: 1px solid rgba(224,178,60,0.55); margin-top: 4px; }
.goal.clickable { cursor: pointer; }
.goal-card { width: 52px; height: 66px; border-radius: 8px; flex: 0 0 auto; background: linear-gradient(160deg, #ffe9a8, #e0b23c) center / 84% auto no-repeat; box-shadow: inset 0 0 0 1.5px #b8860b; }
.goal-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.goal-text b { font-size: 15px; }
.goal-text span { font-size: 12px; color: var(--muted); }
.goalbar { margin-top: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.15); overflow: hidden; }
.goalbar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .5s; }
.goal-count { font-size: 15px; white-space: nowrap; color: var(--gold); }
.goal.done .goal-count { color: #fff; }
.cards-body h3 span { font-weight: 600; text-transform: none; letter-spacing: 0; margin-left: 6px; color: var(--orange); }
.dgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.d { font-size: 10px; font-weight: 800; text-align: center; padding: 7px 2px; border-radius: 8px; border: 1px dashed var(--line); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d.on { border: 1px solid rgba(21,163,92,0.6); background: rgba(15,127,71,0.45); color: #fff; }
.cards-next { margin: 10px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.cards-next:empty { display: none; }
.mini-card.gold { background: linear-gradient(160deg, #ffe9a8, #e0b23c); box-shadow: inset 0 0 0 2px #b8860b; }
.mini-card.gold .mc-serial { color: #7a5200; }
@media (max-width: 479px) { .dgrid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 380px) { .dgrid { grid-template-columns: repeat(4, 1fr); } .d { font-size: 9.5px; } }

/* short screens */
@media (max-height: 520px) {
  .quest { display: none; }
  .vf-store { margin-top: 4px; }
  .chrome.bottom { padding-top: 10px; gap: 4px; }
  .kit { flex: 1 1 100%; }
  .chrome.bottom .toolbar { flex: 1 1 56%; padding-top: 0; }
  .chrome.bottom .tabs { flex: 1 1 40%; padding: 0; align-self: center; }
  .tabs { padding-top: 2px; }
  .tabs button { padding: 3px 4px; font-size: 10px; }
  .tabs button i { width: 18px; height: 18px; }
  .gate { padding-top: calc(var(--safe-top) + 40px); }
  .teasers { display: none; }
}
.store-chips[hidden] { display: none; }
.store-pick-sub { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* where-are-you line on the sheet + the store panel (2026-09-12: one question, best guess preselected) */
.where { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin: 10px 0 2px; font-size: 14px; }
.where .where-q { color: var(--muted); }
.where b { font-weight: 700; }
.where b.guess::before { content: "Best guess: "; font-weight: 500; color: var(--muted); }
.where[hidden] { display: none; }
.post-as { font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
.post-as[hidden], #post-name-label[hidden] { display: none; }
.store-panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 14; background: #141416; color: var(--text); border-radius: 18px 18px 0 0; padding: 12px 16px calc(var(--safe-bottom) + 16px); max-height: 78%; overflow-y: auto; box-shadow: 0 -12px 40px rgba(0,0,0,0.5); }
.store-panel[hidden] { display: none; }
.store-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 16px; }
.store-panel .store-line { margin: 0; }

/* permission priming (2026-09-12): explain camera + location once, before iOS asks */
.prime { position: absolute; inset: 0; z-index: 16; display: grid; place-items: center; padding: 24px; background: rgba(8,10,9,0.92); }
.prime[hidden] { display: none; }
.prime-card { width: min(100%, 360px); display: grid; gap: 12px; padding: 22px 20px calc(var(--safe-bottom) + 12px); border-radius: 18px; background: #161a17; text-align: center; }
.prime-card h2 { margin: 0; font-size: 20px; }
.prime-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.prime-card .btn { margin-top: 6px; }

/* prop ladder (2026-09-13): locked chips in the tray, the unlock moment, the kit row on the cards screen */
.chip { position: relative; }
.chip.locked { border-style: dashed; }
.chip.locked img { filter: brightness(0.12) contrast(1.3); opacity: 0.85; }
.chip.locked span { color: var(--muted); }
.lock-n { position: absolute; left: 24px; top: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,0.45); }
.chip.wobble { animation: wobble .42s ease; }
@keyframes wobble { 0%, 100% { transform: none; } 25% { transform: translateX(-4px) rotate(-3deg); } 75% { transform: translateX(4px) rotate(3deg); } }
.chip.goldish { border-color: rgba(224,178,60,0.7); }
.chip.goldish[aria-pressed="true"] { background: rgba(224,178,60,0.35); border-color: var(--gold); }
.unlock { position: absolute; inset: 0; z-index: 17; display: grid; place-items: center; padding: 24px; background: rgba(6,8,7,0.9); }
.unlock[hidden] { display: none; }
.unlock-card { position: relative; width: min(100%, 340px); display: grid; justify-items: center; gap: 8px; padding: 26px 20px calc(var(--safe-bottom) + 14px); border-radius: 22px; background: #161a17; text-align: center; overflow: hidden; }
.unlock-burst { position: absolute; left: 50%; top: 130px; width: 380px; height: 380px; transform: translate(-50%, -50%); border-radius: 50%; background: repeating-conic-gradient(rgba(47,179,110,0.2) 0 8deg, transparent 8deg 20deg); -webkit-mask-image: radial-gradient(circle, #000 0%, rgba(0,0,0,0.5) 40%, transparent 68%); mask-image: radial-gradient(circle, #000 0%, rgba(0,0,0,0.5) 40%, transparent 68%); animation: burst 48s linear infinite; pointer-events: none; }
.unlock.gold .unlock-burst { background: repeating-conic-gradient(rgba(255,214,102,0.3) 0 8deg, transparent 8deg 20deg); }
.unlock.gold .unlock-card { background: #1c1408; border: 1px solid rgba(224,178,60,0.5); }
#unlock-img { position: relative; width: 200px; height: 234px; object-fit: contain; animation: unlock-pop .55s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes unlock-pop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
#unlock-kicker { position: relative; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--green-2); }
.unlock.gold #unlock-kicker { color: var(--gold); }
.unlock-card h2 { position: relative; margin: 0; font-size: 22px; }
.unlock-card p { position: relative; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.4; }
.unlock-card .btn { position: relative; margin-top: 8px; width: 100%; }
.unlock-card .linkish { position: relative; }
.kit-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.kit-row::-webkit-scrollbar { display: none; }
.kit-chip { flex: 0 0 auto; width: 72px; display: grid; justify-items: center; gap: 3px; position: relative; font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; }
.kit-chip img { width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,0.9); object-fit: contain; padding: 3px; border: 1.5px solid var(--line); }
.kit-chip.have { color: var(--text); }
.kit-chip.have img { border-color: var(--green-2); }
.kit-chip.locked img { filter: brightness(0.12) contrast(1.3); opacity: 0.8; border-style: dashed; }
.kit-chip .lock-n { left: auto; right: 4px; top: -2px; }
.kit-chip.goldish img { border-color: var(--gold); }
@media (prefers-reduced-motion: reduce) { .unlock-burst, #unlock-img, .chip.wobble { animation: none; } }
@media (max-height: 520px) { .unlock { padding: 10px; overflow-y: auto; } .unlock-card { padding-top: 12px; gap: 5px; } #unlock-img { width: 120px; height: 140px; } .unlock-card h2 { font-size: 19px; } .unlock-card p { font-size: 13px; } .unlock-card .btn { margin-top: 4px; } }
.kit-chip span { white-space: normal; line-height: 1.15; }
.kit-hint { margin: -4px 0 8px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.kit-togo { display: block; font-size: 10px; font-weight: 700; color: var(--orange); line-height: 1.1; }
