:root {
  --bg: #0b0b0d; --panel: #16161a; --panel2: #1f1f25; --line: #2a2a31;
  --text: #f2f1ec; --dim: #9a98a0; --gold: #f5c518; --buy: #2fd27a; --pass: #ff5c5c;
  --r: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100dvh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: rgba(11,11,13,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 9px; align-items: center; font-weight: 800; letter-spacing: .02em; font-size: 17px; }
.brand img { width: 26px; height: 26px; }
.worth { color: var(--dim); font-size: 13px; text-align: right; }
.worth b { color: var(--gold); font-size: 15px; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: #111114; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.tabs button { background: none; border: 0; padding: 9px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; color: var(--dim); position: relative; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--gold); }
.tabs b { position: absolute; top: 4px; left: 55%; background: var(--gold); color: #000; font-size: 11px; border-radius: 9px; padding: 0 6px; min-width: 18px; }
.tabs b:empty { display: none; }
h2 { font-size: 20px; margin: 4px 0 12px; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.btn { background: var(--gold); color: #000; border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 800; font-size: 16px; }
.btn.ghost { background: var(--panel2); color: var(--text); font-weight: 600; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.search { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: var(--text); margin-bottom: 12px; }
.search:focus { outline: 2px solid var(--gold); border-color: transparent; }

/* scan */
.cam { position: relative; background: #000; border-radius: var(--r); overflow: hidden; aspect-ratio: 3/4; max-height: 62dvh; margin: 0 auto 14px; }
.cam video, .cam img.shot { width: 100%; height: 100%; object-fit: cover; display: block; }
.guide { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border: 3px solid var(--gold); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.45); }
.cam .msg { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: 14px; text-shadow: 0 1px 3px #000; }
.shutter { display: flex; gap: 10px; }
.shutter .btn { flex: 1; }
.progress { height: 4px; background: var(--panel2); border-radius: 2px; overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; background: var(--gold); width: 0; transition: width .2s; }

.picks { display: grid; gap: 10px; }
.pick { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); padding: 10px; text-align: left; width: 100%; }
.pick.best { border-color: var(--gold); }
.pick img { width: 64px; border-radius: 6px; flex: none; }
.pick .nm { font-weight: 700; }
.pick .px { color: var(--gold); font-weight: 800; font-size: 17px; }
.tag { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 8px; background: var(--panel2); color: var(--dim); margin-right: 4px; }
.tag.own { background: #193a27; color: var(--buy); }
.tag.come { background: #3a3219; color: var(--gold); }

.chosen { display: flex; gap: 14px; }
.chosen img { width: 42%; max-width: 220px; border-radius: 10px; }
.chosen .px { font-size: 28px; font-weight: 900; color: var(--gold); }
.qty { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.qty button { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--panel2); font-size: 22px; }
.qty span { font-size: 22px; font-weight: 800; min-width: 28px; text-align: center; }

/* collection */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.tile { background: none; border: 0; padding: 0; text-align: left; position: relative; }
.tile img { width: 100%; border-radius: 7px; display: block; aspect-ratio: 63/88; object-fit: cover; background: var(--panel2); }
.tile .n { position: absolute; top: 5px; right: 5px; background: var(--gold); color: #000; font-weight: 800; font-size: 12px; border-radius: 8px; padding: 1px 7px; }
.tile .p { font-size: 12px; color: var(--dim); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .p b { color: var(--text); }
.empty { text-align: center; padding: 40px 10px; color: var(--dim); }
.empty .btn { margin-top: 14px; }

/* coming */
.line { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line img { width: 54px; border-radius: 5px; }
.line:last-child { border-bottom: 0; }
.good { color: var(--buy); font-weight: 700; }

/* settings */
.slider { width: 100%; accent-color: var(--gold); height: 30px; }
.big { font-size: 40px; font-weight: 900; color: var(--gold); line-height: 1; }
.field { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--text); }
.qr { background: #fff; padding: 12px; border-radius: 12px; width: 212px; margin: 10px auto; }
.qr img { width: 100%; display: block; }
ol.steps { padding-left: 20px; margin: 8px 0; }
ol.steps li { margin: 6px 0; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* sheet */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet > div { background: var(--panel); border-radius: 18px 18px 0 0; width: 100%; max-width: 560px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 90dvh; overflow: auto; }
.toast { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(20px); background: var(--text); color: #000; padding: 10px 16px; border-radius: 12px; font-weight: 700; opacity: 0; pointer-events: none; transition: .2s; z-index: 30; max-width: 90vw; }
.toast.on { opacity: 1; transform: translateX(-50%); }
.warn { background: #3a1919; border: 1px solid #6b2a2a; color: #ffb3b3; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }

.hero { text-align: center; padding: 30px 8px; }
.hero img { width: 84px; }
.hero h1 { font-size: 30px; margin: 12px 0 6px; }
.hero p { color: var(--dim); max-width: 380px; margin: 0 auto 22px; }
.spent { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.spent div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.spent span { display: block; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }
.spent b { display: block; font-size: 20px; color: var(--gold); margin: 2px 0; }
.spent small { color: var(--dim); font-size: 11.5px; }
textarea.field { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 14px; line-height: 1.5; }
.brow { display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin-bottom: 8px; cursor: pointer; }
.brow.unsure { border-color: var(--gold); }
.brow.none { border-color: var(--pass); }
.brow img { width: 46px; border-radius: 5px; flex: none; }
.brow img.mine { width: 40px; opacity: .85; }
.brow .noimg { width: 46px; aspect-ratio: 63/88; border-radius: 5px; background: var(--panel2); display: grid; place-items: center; color: var(--dim); flex: none; }
.bq { display: flex; align-items: center; gap: 6px; flex: none; }
.bq button, .bx { width: 30px; height: 30px; border-radius: 8px; border: 0; background: var(--panel2); font-size: 16px; }
.bq span { min-width: 18px; text-align: center; font-weight: 800; }
.bx { color: var(--dim); flex: none; }
.toast button { pointer-events: auto; background: none; border: 0; font: inherit; font-weight: 900; text-decoration: underline; padding: 0 0 0 6px; color: #000; }
.conf { display: inline-block; font-size: 12.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.conf.yes { background: #193a27; color: var(--buy); }
.conf.no { background: #3a3219; color: var(--gold); }
.conf small { font-weight: 500; opacity: .85; }
