:root {
  color-scheme: dark;
  --bg: #14161a;
  --surface: #1e2127;
  --raised: #282c34;
  --edge: #434850;
  --line: #333740;
  --ink: #f7f4ef;
  --muted: #b6b7c1;
  --accent: #ffc978;
  --on-accent: #272014;
  --accent-wash: #352b20;
  --good: #a4e1bf;
  --warn: #ffb6aa;
  --shadow: #0b0c10a8;
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  font-synthesis: none;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f7f6f3;
    --surface: #fffefa;
    --raised: #eeece7;
    --edge: #b8b5ae;
    --line: #d9d6d0;
    --ink: #232321;
    --muted: #575852;
    --accent: #ffc978;
    --on-accent: #272014;
    --accent-wash: #fff0d6;
    --good: #286649;
    --warn: #992c22;
    --shadow: #31291a24;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 1rem; }
.wrap { width: min(41rem, calc(100% - 2rem)); margin-inline: auto; }
button, input, textarea { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; }
:where(a,button,input,summary,textarea):focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
a { color: inherit; text-underline-offset: .22em; }
h1, h2, p { margin: 0; }
h2 { font-size: 1.05rem; }
strong { font-weight: 750; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.topbar { border-bottom: 1px solid var(--line); }
.nav-row { min-height: 4rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-size: 1.13rem; font-weight: 820; letter-spacing: -.045em; white-space: nowrap; }
.film-mark {
  width: 1.5rem;
  height: 1.12rem;
  position: relative;
  border: 1px solid var(--edge);
  border-radius: .23rem;
  background: var(--raised);
}
.film-mark::after {
  content: '';
  position: absolute;
  inset: .18rem .3rem;
  background: var(--accent);
  border-radius: .06rem;
}
.top-actions { display: flex; align-items: center; gap: .35rem; }
.mode-switch {
  display: flex;
  gap: .15rem;
  padding: .17rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: var(--surface);
}
.mode-switch button, #help, .quiet {
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: .4rem .7rem;
  border: 1px solid transparent;
  border-radius: 2rem;
  background: transparent;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 730;
  white-space: nowrap;
}
.mode-switch button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.mode-switch button:not([aria-pressed="true"]):hover, #help:hover, .quiet:hover { color: var(--ink); background: var(--raised); }
#help { font-size: 1rem; }

.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: .6rem; margin-block: clamp(1.5rem, 6vw, 3.3rem) 1rem; }
.puzzle-date { display: flex; flex-wrap: wrap; gap: .38rem; margin-bottom: .35rem; color: var(--muted); font-size: .875rem; font-weight: 650; }
#day-meta:not([hidden]) #puzzle-number::before { content: '·'; padding-right: .38rem; }
.intro h1 { font-size: clamp(1.85rem, 6.3vw, 2.75rem); line-height: 1.12; letter-spacing: -.065em; text-wrap: balance; }
.next { border-color: var(--edge); color: var(--ink); }

.clue-card {
  overflow: hidden;
  border: 1px solid var(--edge);
  padding: clamp(.95rem, 4vw, 1.55rem);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 .35rem 1.25rem var(--shadow);
}
.clue-head { display: flex; align-items: baseline; justify-content: space-between; gap: .65rem; }
#attempts { color: var(--muted); font-size: .88rem; font-weight: 700; text-align: right; }
.clue-steps { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: .32rem; margin-top: .85rem; }
.clue-step {
  position: relative;
  display: grid;
  grid-template-columns: 1fr .7rem 1fr;
  align-items: center;
  min-height: 2.85rem;
  padding: 0 .22rem;
  border: 1px solid var(--line);
  border-radius: .48rem;
  color: var(--ink);
  background: var(--raised);
  font-weight: 800;
  font-size: .9rem;
}
.clue-step > span:first-child { grid-column: 2; }
.step-mark { justify-self: center; width: .32rem; height: .32rem; border: 1px solid currentColor; border-radius: 50%; }
.step-mark:empty { visibility: hidden; }
.clue-step:is(.pass,.hit,.miss) .step-mark { visibility: visible; }
.clue-step.hit { color: var(--good); }
.clue-step.miss .step-mark { background: currentColor; opacity: .6; }
.clue-step.pass .step-mark { border-radius: .07rem; transform: rotate(45deg); }
.clue-step:not(:disabled):hover { border-color: var(--ink); }
.clue-step[aria-pressed="true"] { border-color: transparent; background: var(--accent); color: var(--on-accent); }
.clue-step:disabled { color: var(--muted); opacity: .62; background: transparent; }
.clue-content { padding-top: clamp(1.25rem, 4vw, 1.8rem); }
.clue-level { display: inline-block; border-radius: .32rem; padding: .22rem .46rem; background: var(--accent-wash); color: var(--ink); font-size: .875rem; font-weight: 730; }
.clue-text { min-height: 3.15em; margin-top: .6rem; font-size: clamp(1.14rem, 4.75vw, 1.57rem); font-weight: 680; line-height: 1.56; letter-spacing: -.032em; word-break: keep-all; overflow-wrap: anywhere; }

.play:not(:has(.next:not([hidden]),form:not([hidden]))) { display: none; }
.play { margin-top: 1rem; }
.search-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .48rem; }
.search-box { min-width: 0; position: relative; }
#query {
  width: 100%;
  min-height: 3.25rem;
  padding: .62rem .72rem;
  border: 1px solid var(--edge);
  border-radius: .64rem;
  color: var(--ink);
  background: var(--surface);
  outline-offset: 2px;
  font-size: 1rem;
}
#query::placeholder { color: var(--muted); }
.primary {
  min-height: 2.75rem;
  padding: .55rem .86rem;
  border: 1px solid transparent;
  border-radius: .64rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: .94rem;
  font-weight: 800;
  white-space: nowrap;
}
.primary:hover { filter: brightness(.93); }
#suggestions {
  position: absolute;
  z-index: 2;
  inset: calc(100% + .35rem) auto auto 0;
  width: 100%;
  min-width: min(15.5rem, 79vw);
  max-height: min(17rem, 40vh);
  margin: 0;
  padding: .25rem;
  border: 1px solid var(--edge);
  border-radius: .7rem;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  box-shadow: 0 .65rem 1.2rem var(--shadow);
}
#suggestions li { min-height: 2.75rem; padding: .4rem .55rem; border-radius: .4rem; display: grid; align-content: center; gap: .1rem; cursor: pointer; }
#suggestions li:hover, #suggestions li[aria-selected="true"] { background: var(--raised); }
.option-title { font-size: .9375rem; font-weight: 720; overflow-wrap: anywhere; }
.option-meta { color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }
.input-note { display: flex; min-height: 2.75rem; justify-content: space-between; gap: .25rem; }
.message { margin-top: .68rem; color: var(--muted); font-size: .875rem; line-height: 1.42; }
.message.warn { color: var(--warn); }
#skip { padding-inline: .35rem; color: var(--ink); }
.skip-cost { margin-left: .2rem; color: var(--muted); font-size: .8125rem; font-weight: 500; }

.answer { margin-top: 1rem; padding: 1rem 1.1rem 1.15rem; border: 1px solid var(--edge); border-radius: .85rem; background: var(--surface); }
#answer-outcome { color: var(--muted); font-size: .875rem; font-weight: 750; }
#answer-title { margin-top: .32rem; font-size: clamp(1.45rem, 5.6vw, 1.95rem); letter-spacing: -.045em; }
#answer-detail { margin-top: .3rem; color: var(--muted); font-size: .9375rem; line-height: 1.5; }
.answer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .42rem .8rem; margin-top: .75rem; }
.answer-actions a { font-size: .875rem; }
#share-status:not(:empty) { margin-top: .42rem; font-size: .875rem; }

.history { margin-top: .65rem; }
.history h2 { margin: 0 0 .35rem; color: var(--muted); font-size: .875rem; }
.report-list { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.guess-item { display: flex; align-items: baseline; gap: .6rem; min-width: 0; padding: .63rem .15rem; border-bottom: 1px solid var(--line); }
.guess-item > span { flex: none; color: var(--muted); font-size: .875rem; }
.guess-item strong { min-width: 0; font-size: .96rem; overflow-wrap: anywhere; }
.guess-result { margin-left: auto; }
.guess-item.correct .guess-result { color: var(--good); }

footer { display: flex; justify-content: space-between; align-items: start; gap: .55rem; padding: 1.15rem 0 max(1.6rem, env(safe-area-inset-bottom)); color: var(--muted); font-size: .8125rem; }
footer details { text-align: end; }
footer ul { display: grid; gap: .3rem; margin: .5rem 0 0; padding: 0; list-style: none; }
dialog { width: min(29rem,calc(100% - 2rem)); max-height: calc(100% - 2rem); overflow: auto; padding: 1.2rem; border: 1px solid var(--edge); border-radius: .9rem; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: #10131ca8; }
dialog h2 { margin: 0 0 .6rem; font-size: 1.22rem; }
dialog p { margin: 0 0 .8rem; line-height: 1.52; }
dialog textarea { display: block; width: 100%; margin: .5rem 0 .8rem; padding: .55rem; border: 1px solid var(--edge); border-radius: .4rem; background: var(--bg); color: var(--ink); }

@media (max-width: 26rem) {
  .wrap { width: calc(100% - 1.5rem); }
  .nav-row { min-height: 3.65rem; }
  .clue-text { min-height: 5.1em; }
  #skip { font-size: .875rem; }
}
@media (max-width: 22rem) {
  #skip { font-size: .8125rem; }
}
