:root {
  --bg: #0e1015; --panel: #161922; --line: #262b38; --text: #e8eaf0; --muted: #8b93a5;
  --amber: #ffb020; --pick: #3ddc97; --review: #ffb020; --alt: #8b93a5; --reject: #ff5d6c;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f3ec; --panel: #ffffff; --line: #ded9cc; --text: #1c1a14; --muted: #6a6657;
  --amber: #c77800; --pick: #148a5b; --review: #b97300; --alt: #6a6657; --reject: #d03449;
  --shadow: 0 8px 24px rgba(60, 50, 20, .18);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", "Noto Sans", "Noto Sans CJK TC", sans-serif;
  padding-bottom: 72px;
}
button, select, input { font: inherit; color: inherit; }
button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; min-height: 40px;
}
button:hover { border-color: var(--amber); }
button.primary { background: var(--amber); border-color: var(--amber); color: #1b1307; font-weight: 600; }
button.icon { padding: 0 10px; min-width: 40px; font-size: 18px; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: .2px; }
.counts { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; min-height: 34px;
  border-radius: 999px; font-size: 13px;
}
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip[aria-pressed="true"] { border-color: var(--c, var(--amber)); background: color-mix(in srgb, var(--c, var(--amber)) 16%, var(--panel)); }
.chip b { font-variant-numeric: tabular-nums; }
.tools { display: flex; gap: 8px; align-items: center; }
select { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-height: 40px; }

.banner { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; padding: 8px 16px; background: color-mix(in srgb, var(--amber) 16%, var(--bg)); font-size: 13px; text-align: center; }
.banner a { color: var(--amber); font-weight: 600; }
.panel { display: grid; gap: 4px 28px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.panel label { display: grid; gap: 6px; font-size: 13px; }
.panel small { color: var(--muted); }
input[type="range"] { width: 100%; accent-color: var(--amber); }

main { padding: 12px 16px; max-width: 1500px; margin: 0 auto; }
.progress { max-width: 460px; margin: 18vh auto; text-align: center; color: var(--muted); }
.progress h2 { color: var(--text); font-weight: 600; }
.meter { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 16px 0; }
.meter span { display: block; height: 100%; background: var(--amber); transition: width .25s; }
.group { margin: 0 0 22px; }
.group h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; gap: 10px; align-items: baseline; }
.group h3 b { color: var(--text); }
.group h3 .more { margin-left: auto; min-height: 30px; padding: 2px 12px; font-size: 12px; border-radius: 999px; }
.strip { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
.card {
  position: relative; padding: 0; overflow: hidden; border-radius: 10px; min-height: 0;
  border: 2px solid transparent; background: var(--panel); aspect-ratio: 3 / 2; text-align: left;
}
.card { scroll-margin: 76px 0 84px; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.card:hover img { transform: scale(1.04); }
.card.hero { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; min-height: 200px; }
.card.hero img { position: absolute; inset: 0; height: 100%; }
.card.hero .badge { font-size: 12px; padding: 3px 10px; }
.card.hero .why { font-size: 13px; padding: 24px 12px 10px; }
.card[data-state="pick"] { border-color: var(--pick); }
.card[data-state="review"] { border-color: var(--review); }
.card[data-state="reject"] img { opacity: .42; filter: grayscale(.7); }
.card[data-state="alt"] img { opacity: .78; }
.badge {
  position: absolute; left: 6px; top: 6px; padding: 2px 8px; border-radius: 6px; font-size: 11px;
  font-weight: 700; color: #08130e; background: var(--c); text-transform: uppercase; letter-spacing: .4px;
}
.card .why {
  position: absolute; inset: auto 0 0 0; padding: 14px 8px 6px; font-size: 11px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .78)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .own { position: absolute; right: 6px; top: 6px; font-size: 11px; background: #000a; color: #fff; padding: 2px 6px; border-radius: 6px; }
.empty { text-align: center; color: var(--muted); margin: 18vh 0; }

.bar {
  position: fixed; inset: auto 0 0 0; z-index: 5; display: flex; gap: 8px; padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); justify-content: center; flex-wrap: wrap;
}

.viewer { position: fixed; inset: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 96%, #000); display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; }
.viewer[hidden] { display: none; }
.v-head { display: flex; gap: 8px; padding: 10px 14px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.v-head .arrow { display: none; }
.v-head h2 { margin: 0; font-size: 15px; flex: 1; min-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-stage { display: flex; gap: 10px; justify-content: center; align-items: center; padding: 10px; min-height: 0; touch-action: pan-y pinch-zoom; }
.v-pane { position: relative; min-width: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.v-pane figcaption { font-size: 12px; color: var(--muted); }
.zoomer { position: relative; display: inline-block; overflow: hidden; border-radius: 8px; line-height: 0; }
.zoomer .inner { position: relative; transition: transform .3s; transform-origin: var(--ox, 50%) var(--oy, 50%); }
.zoomer.zoomed .inner { transform: scale(3); }
.zoomer img { max-width: 100%; max-height: calc(100vh - 290px); max-height: calc(100dvh - 290px); object-fit: contain; }
.faces .fbox { position: absolute; border: 2px solid var(--pick); border-radius: 4px; pointer-events: none; }
.faces .fbox.closed { border-color: var(--reject); }
.fbox em { position: absolute; left: -2px; top: -20px; font-size: 11px; font-style: normal; line-height: 16px; padding: 0 5px; background: var(--pick); color: #08130e; border-radius: 4px; white-space: nowrap; }
.fbox.closed em { background: var(--reject); color: #fff; }
.v-info { padding: 10px 14px; border-top: 1px solid var(--line); display: grid; gap: 6px 24px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); font-size: 13px; max-height: 22vh; overflow: auto; }
.v-info ul { margin: 0; padding-left: 18px; }
.v-info .bad { color: var(--reject); }
.v-info .good { color: var(--pick); }
.v-info dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; }
.v-info dt { color: var(--muted); }
.v-info dd { margin: 0; font-variant-numeric: tabular-nums; }
.v-act { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 14px 12px; border-top: 1px solid var(--line); }
.v-act .stars { display: flex; gap: 6px; flex-wrap: wrap; }
.v-act button[aria-pressed="true"], .v-head button[aria-pressed="true"] { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 18%, var(--panel)); }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 20px; max-width: min(560px, 92vw); box-shadow: var(--shadow); }
dialog::backdrop { background: #0009; }
dialog h2 { margin: 0 0 10px; font-size: 17px; }
dialog pre { background: var(--bg); padding: 10px; border-radius: 8px; overflow: auto; font-size: 12px; max-height: 40vh; }
dialog label { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
dialog input[type="text"] { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
dialog kbd { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 12px; }
dialog table td { padding: 3px 12px 3px 0; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 40; box-shadow: var(--shadow); max-width: 90vw; }

@media (max-width: 700px) {
  .top { padding: 8px 10px; gap: 8px; }
  .counts { order: 3; flex-basis: 100%; }
  main { padding: 10px; }
  .strip { grid-template-columns: repeat(2, 1fr); }
  .card.hero { grid-row: span 1; aspect-ratio: 3 / 2; min-height: 0; }
  .bar button { flex: 1; padding: 8px; font-size: 13px; }
  .bar .icon { flex: 0 0 40px; }
  .k { display: none; }
  .v-head { display: grid; grid-template-columns: 48px 48px repeat(3, 1fr); gap: 6px; padding: 8px 10px; }
  .v-head h2 { grid-column: 1 / 5; min-width: 0; align-self: center; }
  .v-head .arrow { display: inline; font-size: 18px; }
  .v-head .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .v-head button { padding: 4px 6px; min-height: 40px; font-size: 13px; }
  .v-head [data-close] { grid-column: 5; grid-row: 1; }
  .v-stage { flex-direction: column; padding: 6px 10px; gap: 6px; }
  .zoomer img { max-height: calc(100vh - 330px); max-height: calc(100dvh - 330px); }
  .v-stage.two .zoomer img { max-height: calc(50vh - 205px); max-height: calc(50dvh - 205px); }
  .v-stage.two .v-pane { gap: 2px; }
  .v-info { max-height: 15vh; padding: 6px 10px; gap: 4px; }
  .v-info dl { grid-template-columns: auto 1fr auto 1fr; gap: 2px 10px; }
  .v-act { padding: 6px 10px calc(8px + env(safe-area-inset-bottom)); }
  .v-act button { flex: 1; padding: 4px 6px; font-size: 13px; }
  .v-act .stars { flex: 1 1 100%; }
  .v-act .stars button { flex: 1; padding: 4px 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
