/* Unblur: a darkroom. Near-black paper, warm safelight red, film-strip guess slots. */
:root {
  --bg: #0d0b0b;
  --panel: #171313;
  --panel-2: #201a19;
  --line: #2e2625;
  --ink: #f3ece4;
  --muted: #9c8f86;
  --safe: #e8402f;       /* safelight red: accents */
  --safe-dim: #e8402f33;
  --close: #e9a23b;
  --good: #57c27a;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: radial-gradient(120% 60% at 50% -10%, #2a0f0c 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }

/* ---------- header ---------- */
.top {
  display: grid; grid-template-columns: 40px 1fr 40px; align-items: center;
  max-width: 640px; margin: 0 auto; padding: 14px 16px 6px;
}
.brand { text-align: center; }
.logo {
  margin: 0; font: italic 400 44px/1 var(--serif); letter-spacing: .01em;
}
.logo span { display: inline-block; }
.logo span:nth-child(1) { filter: blur(3px); opacity: .55; }
.logo span:nth-child(2) { filter: blur(2.2px); opacity: .65; }
.logo span:nth-child(3) { filter: blur(1.5px); opacity: .75; }
.logo span:nth-child(4) { filter: blur(.9px); opacity: .85; }
.logo span:nth-child(5) { filter: blur(.4px); }
.logo span:nth-child(6) { color: var(--safe); }
.meta { font: 12px var(--mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.icon {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); display: grid; place-items: center; cursor: pointer;
  font: 600 17px var(--sans); color: var(--muted); transition: color .15s, border-color .15s;
}
.icon:hover { color: var(--ink); border-color: var(--muted); }

main { max-width: 640px; margin: 0 auto; padding: 8px 16px 48px; }

/* ---------- photo ---------- */
.frame {
  position: relative; background: #000; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px -30px #e8402f40, 0 0 0 6px var(--panel);
  margin-top: 10px;
}
.photo { position: relative; aspect-ratio: 4 / 3; display: grid; }
.photo img {
  grid-area: 1 / 1; width: 100%; height: 100%; object-fit: cover; display: block;
  transition: opacity .9s ease;
  user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.photo img.in { opacity: 0; }
.photo.contain img { object-fit: contain; }
.loading { grid-area: 1 / 1; place-self: center; font: 13px var(--mono); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.focus {
  position: absolute; left: 12px; bottom: 12px; display: flex; gap: 4px; align-items: center;
  padding: 6px 9px; background: #0d0b0bcc; border-radius: 99px; backdrop-filter: blur(6px);
  font: 11px var(--mono); color: var(--muted); letter-spacing: .08em;
}
.focus i { width: 14px; height: 4px; border-radius: 2px; background: #ffffff22; }
.focus i.on { background: var(--safe); }
.focus.clear i { background: var(--good); }

/* ---------- hint ---------- */
.hint {
  margin: 18px 0 14px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--safe); border-radius: 6px; display: flex; gap: 14px; align-items: baseline;
}
.tag { font: 600 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--safe); flex: none; }
.hint p { margin: 0; font: 400 22px/1.25 var(--serif); }

/* ---------- guesses: a strip of film frames ---------- */
.slots {
  list-style: none; margin: 0 0 14px; padding: 8px 10px; display: grid; gap: 6px;
  background: #090707; border-radius: 6px; border: 1px solid var(--line);
  position: relative;
}
.slots li {
  display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 12px;
  background: var(--panel); border-radius: 3px; border: 1px solid transparent;
  font: 15px var(--sans); color: var(--muted);
}
.slots li .n { font: 11px var(--mono); color: #5a4f4a; width: 1.4em; }
.slots li .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slots li .r { font: 600 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.slots li.wrong { color: var(--ink); border-color: #e8402f44; }
.slots li.wrong .r { color: var(--safe); }
.slots li.close { color: var(--ink); border-color: #e9a23b55; background: #e9a23b14; }
.slots li.close .r { color: var(--close); }
.slots li.correct { color: var(--ink); border-color: #57c27a77; background: #57c27a1c; }
.slots li.correct .r { color: var(--good); }
.slots li.new { animation: drop .35s ease; }
@keyframes drop { from { transform: translateY(-6px); opacity: 0 } }

/* ---------- input ---------- */
.guess { display: flex; gap: 8px; }
.guess input, .namer input {
  flex: 1; min-width: 0; height: 50px; padding: 0 16px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line); outline: none; font-size: 17px;
}
.guess input:focus, .namer input:focus { border-color: var(--safe); box-shadow: 0 0 0 3px var(--safe-dim); }
.guess button, .namer button, .actions button, dialog .primary {
  height: 50px; padding: 0 22px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; font-weight: 600;
}
.guess button, .primary { background: var(--safe) !important; border-color: var(--safe) !important; color: #fff; }
.guess button:disabled { opacity: .5; cursor: default; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px) } 40%, 80% { transform: translateX(6px) } }
.toast { min-height: 24px; margin-top: 8px; text-align: center; font: 13px var(--mono); color: var(--muted); }
.toast.close { color: var(--close); }

/* ---------- result ---------- */
.result, .empty {
  margin-top: 6px; padding: 22px 20px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; text-align: center;
}
.verdict { font: 600 11px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.verdict.won { color: var(--good); }
.verdict.lost { color: var(--safe); }
.answer { font: italic 400 42px/1.1 var(--serif); margin: 6px 0 10px; }
.answer::first-letter, .recap .a::first-letter { text-transform: uppercase; }
.stats { display: flex; justify-content: center; gap: 26px; margin: 4px 0 8px; }
.stats div { display: grid; }
.stats b { font: 400 30px/1 var(--serif); }
.stats span { font: 10px var(--mono); color: var(--muted); letter-spacing: .12em; text-transform: uppercase; margin-top: 4px; }
.credit { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.credit:empty { display: none; }
.credit a { color: var(--muted); }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.namer { margin-top: 18px; text-align: left; }
.namer label { display: block; font: 11px var(--mono); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; }
.namer .row { display: flex; gap: 8px; }
.next { margin-top: 18px; font: 12px var(--mono); color: var(--muted); letter-spacing: .06em; }
.next span { color: var(--ink); }

/* ---------- dialogs ---------- */
dialog {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 22px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
}
dialog::backdrop { background: #000a; backdrop-filter: blur(4px); }
dialog h2 { margin: 0 0 10px; font: italic 400 32px/1 var(--serif); }
dialog ol { padding-left: 20px; margin: 0 0 12px; }
dialog li { margin-bottom: 6px; }
dialog .small { font-size: 13px; color: var(--muted); }
dialog .primary { width: 100%; margin-top: 6px; }
.board-head { display: flex; justify-content: space-between; align-items: center; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 8px; margin: 6px 0 10px; }
.tabs button { flex: 1; height: 34px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 14px; }
.tabs button[aria-selected="true"] { background: var(--panel-2); color: var(--ink); }
.board-sub { font: 11px var(--mono); color: var(--muted); letter-spacing: .06em; margin-bottom: 8px; }
.rows { list-style: none; padding: 0; margin: 0; max-height: 52vh; overflow: auto; }
.rows li {
  display: grid; grid-template-columns: 2.4em 1fr auto auto; gap: 10px; align-items: center;
  padding: 9px 6px; border-bottom: 1px solid var(--line); font-size: 15px;
}
.rows li.you { background: var(--safe-dim); border-radius: 4px; }
.rows li.gap { display: block; text-align: center; color: var(--muted); border: 0; padding: 2px; }
.rows .rk { font: 12px var(--mono); color: var(--muted); }
.rows li:nth-child(-n+3) .rk { color: var(--safe); font-weight: 600; }
.rows .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .sc { font: 600 13px var(--mono); }
.rows .tm { font: 12px var(--mono); color: var(--muted); min-width: 4.5em; text-align: right; }
.rows .none { display: block; color: var(--muted); text-align: center; padding: 24px 0; border: 0; }

@media (max-width: 420px) {
  .logo { font-size: 38px; }
  .hint p { font-size: 19px; }
  .answer { font-size: 34px; }
  .guess button { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- five photos a day ---------- */
.rounds {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 6px 0 4px;
  padding: 6px; background: #090707; border: 1px solid var(--line); border-radius: 6px;
}
.rd {
  height: 40px; border-radius: 3px; border: 1px solid var(--line); background: var(--panel);
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  font: 600 12px var(--mono); color: var(--muted); transition: border-color .15s, background .15s;
}
.rd .no { opacity: .7; }
.rd .st { font-size: 13px; }
.rd.locked { cursor: default; opacity: .45; }
.rd.live { color: var(--ink); border-color: var(--safe); }
.rd.live .st { color: var(--safe); }
.rd.won { background: #57c27a14; border-color: #57c27a55; color: var(--ink); }
.rd.won .st { color: var(--good); }
.rd.lost { background: #e8402f14; border-color: #e8402f55; color: var(--ink); }
.rd.lost .st { color: var(--safe); }
.rd[aria-current="true"] { box-shadow: 0 0 0 2px var(--ink) inset; }
.rd:not(:disabled):hover { border-color: var(--muted); }

.reveal {
  margin-top: 2px; padding: 18px 20px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; text-align: center;
}
.reveal .answer { margin: 4px 0 6px; }
.reveal .primary {
  height: 48px; padding: 0 22px; border-radius: 6px; border: 1px solid var(--safe); background: var(--safe);
  color: #fff; font-weight: 600; cursor: pointer;
}
.result { margin-top: 14px; }
.big { display: grid; justify-items: center; margin: 4px 0 10px; }
.big b { font: italic 400 72px/1 var(--serif); }
.big span { font: 10px var(--mono); color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.recap { list-style: none; padding: 0; margin: 14px 0 16px; display: grid; gap: 4px; text-align: left; }
.recap button {
  width: 100%; display: grid; grid-template-columns: 1.6em 1fr auto; gap: 10px; align-items: center;
  padding: 8px 12px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; text-align: left;
}
.recap .n { font: 11px var(--mono); color: var(--muted); }
.recap .a { font: italic 400 20px/1.1 var(--serif); display: block; }
.recap .m { font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.recap .won .m { color: var(--good); }
.recap .lost .m { color: var(--safe); }
