:root {
  --bg: #f6f5f1; --card: #ffffff; --ink: #1d1d1b; --muted: #6b6a66; --line: #e3e1da;
  --accent: #1f6f4a; --accent-ink: #ffffff; --warn: #a15c00; --bad: #b3261e; --good: #1f6f4a;
  --chip: #ecebe5; --rec: #c62828;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413; --card: #1e1e1c; --ink: #ecebe6; --muted: #a09f99; --line: #33322f;
    --accent: #4fae7f; --accent-ink: #0d1a13; --warn: #e0a043; --bad: #ef6b62; --good: #4fae7f;
    --chip: #2a2a27; --rec: #ef5350;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--accent); }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 20px; color: var(--ink); text-decoration: none; }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 24px 0 8px; }
h1 { font-size: 22px; margin: 4px 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 15px; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .5; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 140px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.list-item { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--chip); flex: none; }
.list-item .meta { min-width: 0; flex: 1; }
.list-item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; background: var(--chip); font-size: 13px; font-weight: 600; }
.chip.review, .chip.needs_info { background: var(--warn); color: #fff; }
.chip.live { background: var(--good); color: var(--accent-ink); }
.chip.failed { background: var(--bad); color: #fff; }
.price { font-weight: 700; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.photos .ph { position: relative; aspect-ratio: 1; }
.photos img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.photos .x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 99px; border: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 16px; }
.questions { margin: 0; padding-left: 20px; }
.questions li { margin: 4px 0; }
.rec { display: flex; align-items: center; gap: 14px; }
.recbtn { width: 76px; height: 76px; border-radius: 99px; border: 4px solid var(--rec); background: var(--card);
  display: grid; place-items: center; flex: none; cursor: pointer; }
.recbtn span { width: 30px; height: 30px; border-radius: 99px; background: var(--rec); transition: all .15s; }
.recbtn.on span { border-radius: 6px; width: 26px; height: 26px; }
.timer { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; }
audio { width: 100%; margin-top: 10px; }
textarea, input[type=text], input[type=number], input[inputmode] { width: 100%; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
textarea { min-height: 90px; resize: vertical; }
label.f { display: block; font-weight: 600; margin: 12px 0 4px; }
.progress { height: 6px; background: var(--chip); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.big-code { font-size: 64px; font-weight: 800; text-align: center; margin: 8px 0; }
.comp { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.comp:first-child { border-top: 0; }
.comp .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desc { white-space: pre-wrap; }
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 608px;
  margin: 0 auto; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 600; }
.pair-input { font-size: 32px !important; letter-spacing: .3em; text-align: center; }
.empty { text-align: center; padding: 40px 10px; }

main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs a { flex: 1; text-align: center; padding: 14px 0; color: var(--muted); text-decoration: none; font-weight: 600; }
.tabs a.on { color: var(--accent); }
.check { display: flex; gap: 10px; align-items: center; margin: 12px 0 0; }
.check input { width: 22px; height: 22px; }
.bubble { max-width: 80%; padding: 8px 12px; border-radius: 14px; margin: 6px 0; white-space: pre-wrap; background: var(--chip); }
.bubble.out { margin-left: auto; background: var(--accent); color: var(--accent-ink); }
.note { margin: 6px 0; padding: 6px 10px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); }
.chip.researching { background: var(--chip); }
