/* PhotoPick: neutral dark surroundings so photos are judged on their own. */
:root {
  --bg: #121212;
  --surface: #1c1c1c;
  --surface2: #262626;
  --line: #333;
  --text: #ebe8e3;
  --muted: #9b968e;
  --accent: #f2b33d;
  --accent-ink: #1a1408;
  --ok: #6cc28a;
  --warn: #e7a33e;
  --danger: #e0614f;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
body.noscroll { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 650; margin: 8px 0 18px; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
code { background: var(--surface2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.err { color: var(--danger); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- layout */
.wrap { max-width: 1600px; margin: 0 auto; padding: 18px 20px 60px; }
.wrap.narrow { max-width: 760px; }
.bar {
  display: flex; align-items: center; gap: 14px; padding: 10px 20px; min-height: 56px;
  background: rgba(18, 18, 18, .94); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.bar.sticky { position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; letter-spacing: .02em; }
.who { margin-left: auto; color: var(--muted); }
.bar nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.bar nav a { color: var(--text); padding: 6px 10px; border-radius: 8px; }
.bar nav a.on { background: var(--surface2); }
.bar nav a:hover { text-decoration: none; background: var(--surface2); }
.bar .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.back { color: var(--text); white-space: nowrap; font-size: 15px; }
.head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; margin: 6px 0 12px; }
.head h1, .head h2 { margin: 0; }
.banner { padding: 10px 20px; }
.banner.warn { background: #4a3313; color: #ffd9a0; }

/* ---------------------------------------------------------------- controls */
.btn {
  font: inherit; font-weight: 600; color: var(--text); background: var(--surface2);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #555; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.done { color: var(--ok); border-color: #2f5a3e; background: #17261c; }
.btn.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn.small { padding: 3px 10px; font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.link:hover { text-decoration: underline; }
.seg { display: inline-flex; background: var(--surface2); border-radius: 999px; padding: 3px; }
.seg button { font: inherit; color: var(--muted); background: none; border: 0; border-radius: 999px; padding: 5px 12px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--bg); color: var(--text); }
.seg b { color: var(--accent); font-weight: 700; margin-left: 2px; }
.save { font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 0; }
.save.warn { color: var(--warn); }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 999px; background: var(--surface2); color: var(--muted); }
.chip.finished { background: #17261c; color: var(--ok); }
.chip.in_progress { background: #3a2c12; color: var(--accent); }
.chip.warn { background: #3a2c12; color: var(--warn); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%;
}
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); vertical-align: middle; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
label > input, label > select, label > textarea { margin-top: 4px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
label.inline select { width: auto; margin: 0; }
.formrow { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.formrow label { flex: 1 1 220px; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 20px; }
.card.danger { border-color: #4d2620; }
.card.login { margin-top: 12vh; }
.card.login form { margin-top: 18px; }
.progress { height: 8px; background: var(--surface2); border-radius: 99px; overflow: hidden; margin: 14px 0 6px; }
.uplist { margin: 8px 0 0; padding-left: 20px; }
.uplist li { margin: 2px 0; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------------------------------------------------------------- rater start page */
.empty { text-align: center; margin-top: 18vh; }
.empty .ro { color: var(--muted); }
.sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.set { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); }
.set:hover { text-decoration: none; border-color: #555; }
.set img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--surface2); }
.set-body { padding: 12px 14px 14px; }
.set-title { font-weight: 600; }
.set-meta { color: var(--muted); font-size: 13px; margin: 2px 0 8px; }

/* ---------------------------------------------------------------- picking grid */
.brief { max-width: 900px; margin: 4px 0 18px; }
.brief .instr { font-size: 17px; margin: 0 0 4px; }
.brief .help { color: var(--muted); margin: 0; font-size: 14px; }
.row, .agrid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 26px; }
.fill { flex-grow: 100000; }
.tile { position: relative; margin: 0; background: var(--surface2); border-radius: 4px; overflow: hidden; cursor: zoom-in; }
.tile i { display: block; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tile a { position: absolute; inset: 0; }
.tile::after { content: ""; position: absolute; inset: 0; border-radius: 4px; pointer-events: none; transition: box-shadow .12s; }
.tile.on::after { box-shadow: inset 0 0 0 4px var(--accent); }
.tpick {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .85); background: rgba(0, 0, 0, .35); color: transparent;
  font-size: 18px; font-weight: 800; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s, transform .08s;
}
.tile:hover .tpick, .tile.on .tpick, .tpick:focus-visible { opacity: 1; }
.tpick:hover { color: rgba(255, 255, 255, .8); }
.tpick:active { transform: scale(.9); }
.tile.on .tpick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (hover: none) { .tpick { opacity: 1; } }
.badge { position: absolute; top: 6px; right: 6px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 12px; padding: 1px 7px; border-radius: 99px; }
.badge.zero { background: rgba(0, 0, 0, .55); color: var(--muted); }
.fname { position: absolute; left: 6px; bottom: 5px; font-size: 11px; color: rgba(255, 255, 255, .75); text-shadow: 0 1px 2px #000; pointer-events: none; }
.agrid .tile { cursor: default; }
.empty-picks { margin: 30px 0; }

/* ---------------------------------------------------------------- full-size viewer */
.viewer { position: fixed; inset: 0; z-index: 50; background: #050505; display: grid; grid-template-rows: auto 1fr auto; }
.v-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.icon { background: none; border: 0; color: var(--text); font-size: 22px; cursor: pointer; padding: 4px 10px; }
.v-stage { min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 64px; }
.v-stage img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.v-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 96px; border: 0;
  background: none; color: rgba(255, 255, 255, .7); font-size: 54px; line-height: 1; cursor: pointer;
}
.v-nav:hover { color: #fff; }
.v-nav:disabled { opacity: .15; cursor: default; }
.v-nav.prev { left: 4px; }
.v-nav.next { right: 4px; }
.v-bottom { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
.pickbtn {
  font: inherit; font-size: 17px; font-weight: 700; color: var(--text); background: var(--surface2);
  border: 2px solid #555; border-radius: 999px; padding: 10px 28px; cursor: pointer; min-width: 170px;
}
.pickbtn .tick { display: inline-block; width: 1.2em; }
.pickbtn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.v-key { font-size: 12px; color: var(--muted); border: 1px solid #444; border-radius: 4px; padding: 0 6px; }

/* ---------------------------------------------------------------- dialogs */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 20px; }
.modal .box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; max-width: 440px; }
.modal p { margin: 0 0 18px; font-size: 16px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; background: var(--surface2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 999px; }

/* ---------------------------------------------------------------- admin tables */
table.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.list td { padding: 9px 10px; border-bottom: 1px solid #262626; vertical-align: middle; }
.list td.c { text-align: center; }
.nowrap { white-space: nowrap; }
.scrollx { overflow-x: auto; }
.matrix th.rot { height: 140px; vertical-align: bottom; padding: 0 4px 8px; text-align: center; white-space: nowrap; }
.matrix th.rot span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); }
.link-field { width: 260px; font-size: 12px; padding: 4px 8px; color: var(--muted); }
.tick-done { color: var(--ok); font-weight: 700; margin-left: 2px; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 700px) {
  .wrap { padding: 12px 10px 50px; }
  .bar { padding: 8px 10px; gap: 8px; flex-wrap: wrap; }
  .back span, .save { display: none; }
  .bar .title { order: -1; flex-basis: 100%; }
  .bar.sticky .seg { margin-right: auto; }
  .row, .agrid { gap: 4px; }
  .v-stage { padding: 0; }
  .v-nav { width: 44px; font-size: 40px; }
  .brief .instr { font-size: 15px; }
}
