:root {
  --bg: #f6f5f0; --card: #ffffff; --ink: #1c1c1a; --muted: #6b6b66; --line: #e3e1d8;
  --green: #14532d; --green-soft: #e4f2e8; --red: #a3261f; --red-soft: #fbe7e5; --amber: #8a5a00; --amber-soft: #fff1cc;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15161a; --card: #1f2127; --ink: #ecebe6; --muted: #a2a29a; --line: #33363f; --green: #7fcf9a; --green-soft: #1d3326; --red: #ff8a80; --red-soft: #3a1f1d; --amber: #ffcc66; --amber-soft: #3a3014; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 5; }
.brand { font-family: Georgia, serif; font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.brand span { color: var(--green); }
.nav button { background: none; border: 0; color: var(--muted); font: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.nav button.active { color: var(--ink); background: var(--bg); font-weight: 600; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
h1, h2, h3 { margin: 0 0 8px; font-family: Georgia, serif; }
.muted { color: var(--muted); } .small { font-size: 13px; } .hidden { display: none !important; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.seg { display: flex; margin-top: 4px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { flex: 1; margin: 0; padding: 10px 0; text-align: center; font-size: 15px; color: var(--muted); cursor: pointer; border-right: 1px solid var(--line); }
.seg label:last-child { border-right: 0; }
.seg input:checked + label { background: var(--card); color: var(--ink); font-weight: 600; }
.seg input[value=damaged]:checked + label { color: var(--red); }
.seg input[value=new]:checked + label { color: var(--green); }
.withbtn { display: flex; gap: 6px; } .withbtn input { flex: 1; }
.withbtn button { margin-top: 4px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; cursor: pointer; }
button.primary, .btn.primary { background: var(--green); color: #fff; border: 0; padding: 12px 18px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; }
button.primary:disabled { opacity: .5; cursor: default; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; font: inherit; cursor: pointer; text-decoration: none; }
.wide { width: 100%; margin-top: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: minmax(0, 1fr); } .nav button { padding: 8px 7px; font-size: 14px; } }
.msg { min-height: 1.2em; font-size: 14px; color: var(--red); }
.warn { background: var(--amber-soft); color: var(--amber); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.drop { position: relative; border: 2px dashed var(--line); border-radius: 14px; min-height: 180px; display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; overflow: hidden; background: var(--bg); }
.drop .big { font-size: 20px; font-weight: 600; }
.drop img { max-width: 100%; max-height: 360px; display: block; }
.thumbs-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumb { position: relative; width: 56px; height: 56px; }
.thumb img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.thumb.primary img { outline: 2px solid var(--green); }
.thumb button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--ink); color: var(--card); font-size: 12px; line-height: 20px; padding: 0; cursor: pointer; }
.small-btn { padding: 8px 12px; font-size: 14px; }
.photo-strip { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.photo-strip img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.nav-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--green); color: #fff; font-size: 11px; line-height: 18px; text-align: center; margin-left: 2px; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.badge.conf-high { background: var(--green-soft); color: var(--green); }
.badge.conf-medium { background: var(--amber-soft); color: var(--amber); }
.badge.conf-low { background: var(--red-soft); color: var(--red); }
.so-ok, .so-bad { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 8px 0; }
.so-ok { background: var(--green-soft); } .so-bad { background: var(--red-soft); }
.next-shot { background: var(--amber-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.err-text { color: var(--red); }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin 0.9s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
#queue-note { margin: -6px 0 10px; padding: 0 4px; }
.status { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: 14px; }
.status.err { background: var(--red-soft); color: var(--red); }
.result-head { display: flex; gap: 12px; align-items: flex-start; }
.result-head img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .2px; }
.badge.flag-good { background: var(--green-soft); color: var(--green); }
.badge.flag-bad { background: var(--red-soft); color: var(--red); }
.badge.flag-art { background: var(--amber-soft); color: var(--amber); }
.badge.neutral { background: var(--bg); color: var(--muted); }
.values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.values div { background: var(--bg); border-radius: 10px; padding: 10px; text-align: center; }
.values .k { font-size: 12px; color: var(--muted); } .values .v { font-size: 20px; font-weight: 700; font-family: Georgia, serif; }
.values .v.pos { color: var(--green); } .values .v.neg { color: var(--red); }
.kv { font-size: 14px; } .kv b { color: var(--muted); font-weight: 600; }
.comps { font-size: 13px; margin-top: 8px; }
.comps li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.comps li a { color: inherit; text-decoration: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; margin-top: 10px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 160px; margin: 0; }
.chk { display: flex; align-items: center; gap: 4px; margin: 0; }
.list { margin-top: 12px; }
.item { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.item img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; background: var(--bg); }
.item .t { font-weight: 600; } .item .m { font-size: 13px; color: var(--muted); }
.item .right { margin-left: auto; text-align: right; flex: none; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.modal-body { background: var(--card); width: 100%; max-width: 760px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px; }
@media (min-width: 600px) { .modal { align-items: center; } .modal-body { border-radius: 16px; } }
.modal-body img.full { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 10px; background: var(--bg); }
.art { background: var(--amber-soft); color: var(--ink); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
.flags li { color: var(--red); font-size: 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* invite codes */
.invite-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.invite-list li { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.invite-list code { font-size: 15px; font-weight: 600; letter-spacing: 0.05em; }
.invite-list button.small { padding: 4px 10px; font-size: 13px; }
#invite-form input { flex: 1 1 160px; min-width: 0; }
