/* One narrow centered column: header, square cover, six guess rows, one input.
   The album art is the only color on the page. */
:root {
  --bg: #F4F4F1; --fg: #151514; --muted: #83837D; --line: #D9D9D3; --soft: #E5E5E0; --raise: #FFFFFF;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121211; --fg: #ECECE7; --muted: #7E7E78; --line: #2C2C29; --soft: #222220; --raise: #1B1B19; color-scheme: dark; }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 14px;
  -webkit-font-smoothing: antialiased;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.app { max-width: 440px; margin: 0 auto; padding-block: 20px 28px; display: flex; flex-direction: column; gap: 22px; }
.app[hidden] { display: none; }
.loading { text-align: center; color: var(--muted); padding-top: 40vh; margin: 0; }

header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mark { display: flex; align-items: baseline; gap: 10px; }
/* Logo: a 3x3 cover, light to dark like the clue tiles (follows the theme) */
.logo { width: 18px; height: 18px; flex: none; align-self: center; }
.logo .g0 { fill: color-mix(in oklab, var(--fg) 18%, var(--soft)); }
.logo .g1 { fill: color-mix(in oklab, var(--fg) 38%, var(--soft)); }
.logo .g2 { fill: color-mix(in oklab, var(--fg) 58%, var(--soft)); }
.logo .g3 { fill: color-mix(in oklab, var(--fg) 79%, var(--soft)); }
.logo .g4 { fill: var(--fg); }
.word { font-weight: 600; font-size: 19px; letter-spacing: -0.035em; }
.num { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.hright { display: flex; align-items: center; gap: 16px; }
.dots { display: flex; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--line); }
.dot.used { background: var(--muted); border-color: var(--muted); }
.dot.now { border-color: var(--fg); }
.dot.win { background: var(--fg); border-color: var(--fg); }
/* Profile square: your latest solved cover as a 3x3, empty until your first solve */
.me { appearance: none; width: 20px; height: 20px; padding: 0; border: 1.5px solid var(--fg); background: transparent; cursor: pointer; display: grid; place-items: center; }
.me.has { border: 0; }
.me img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.dropback { position: fixed; inset: 0; z-index: 19; }
.drop { position: fixed; z-index: 20; top: calc(52px + env(safe-area-inset-top, 0px)); right: max(16px, calc((100vw - 440px) / 2)); width: min(360px, calc(100vw - 32px)); max-height: calc(100svh - 72px); overflow: auto; background: var(--bg); border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(0, 0, 0, .12); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.streak { display: flex; align-items: baseline; gap: 10px; }
.streak b { font-size: 44px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.streak span { color: var(--muted); }
.drop .nums { grid-template-columns: repeat(3, 1fr); }
.drop .nums b { font-size: 20px; }
.label { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.mwrap { max-height: 252px; overflow: auto; }
.mosaic { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.mt { appearance: none; padding: 0; border: 0; background: none; aspect-ratio: 1 / 1; cursor: pointer; display: block; }
.mt img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.mt.empty { border: 1px solid var(--line); }
.mt.today { border: 1px dashed var(--muted); }
.mt.on { outline: 2px solid var(--fg); outline-offset: 2px; }
.grad { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; height: 100%; }
.grad i { display: block; }
.minfo { font-size: 12px; color: var(--fg); min-height: 16px; }
.backup { display: flex; flex-direction: column; gap: 6px; }
.backup p.small { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.backup textarea { font-family: var(--mono); font-size: 11px; background: var(--soft); color: var(--fg); border: 1px solid var(--line); padding: 8px; resize: none; width: 100%; }
.backup .textbtn { align-self: flex-start; }
.iconbtn { appearance: none; border: 0; background: none; color: var(--fg); padding: 6px; margin: -6px; border-radius: 6px; cursor: pointer; display: grid; place-items: center; }
button:focus-visible, input:focus-visible, a:focus-visible, .tile:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

/* The cover never takes more than about half the screen height, so the clues and input stay close. */
figure { margin: 0 auto; width: min(100%, 52svh); min-width: min(100%, 260px); display: flex; flex-direction: column; gap: 10px; }
.frame { width: 100%; max-width: 100%; aspect-ratio: 1 / 1; background: var(--soft); }
#cover { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; transition: opacity .18s ease; }
#cover.fade { opacity: 0; }
.soon { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); }
.soon b { font-family: var(--mono); font-weight: 500; font-size: clamp(32px, 11vw, 52px); letter-spacing: -0.02em; color: var(--fg); font-variant-numeric: tabular-nums; }
.cap { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

.board { display: flex; flex-direction: column; gap: 6px; }
.heads, .row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, clamp(54px, 18vw, 68px)); gap: 6px; align-items: center; }
.heads { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.heads span { text-align: center; }
.heads span:first-child { text-align: left; }
.guess { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.gt { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ga { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idx { font-family: var(--mono); font-size: 11px; color: var(--line); }
.tile { height: 40px; display: grid; place-items: center; font-family: var(--mono); font-size: 10.5px; letter-spacing: -0.02em; border: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
.tile.skip { border-style: dashed; }
.tile.clue { cursor: pointer; }
.tile.l0 { background: color-mix(in oklab, var(--fg) 6%, var(--soft)); border-color: transparent; color: var(--fg); }
.tile.l1 { background: color-mix(in oklab, var(--fg) 38%, var(--soft)); border-color: transparent; color: var(--fg); }
.tile.l2 { background: color-mix(in oklab, var(--fg) 68%, var(--soft)); border-color: transparent; color: var(--bg); }
.tile.l3 { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.tile.dash { color: var(--muted); }
.tile.on { outline: 2px solid var(--fg); outline-offset: 2px; }
.tile.flip { animation: flip .46s cubic-bezier(.3, .7, .3, 1) both; }
@keyframes flip { from { transform: perspective(400px) rotateX(-90deg); } to { transform: none; } }
.detail { min-height: 16px; font-size: 12px; color: var(--fg); text-align: right; }

/* The guess input stays docked at the bottom of the screen while playing. */
#bottom.dock { position: sticky; bottom: 0; z-index: 4; background: var(--bg); margin-inline: -4px; padding: 10px 4px calc(8px + env(safe-area-inset-bottom, 0px)); }
.entry { position: relative; display: flex; flex-direction: column; gap: 8px; }
.field { display: flex; align-items: center; gap: 14px; border-bottom: 1.5px solid var(--fg); }
#q { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg); font: inherit; font-size: 16px; padding: 10px 0; outline: none; }
#q::placeholder { color: var(--muted); }
.chev { appearance: none; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 8px 4px; display: grid; place-items: center; }
.chev:hover { color: var(--fg); }
.textbtn { appearance: none; background: none; border: 0; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; padding: 6px 0; }
.textbtn:hover { color: var(--fg); }
.hint { font-size: 12px; color: var(--muted); }
.hint.warn { color: var(--fg); }
.list { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); background: var(--raise); border: 1px solid var(--line); list-style: none; margin: 0; padding: 4px; max-height: 300px; overflow: auto; box-shadow: 0 14px 34px rgba(0, 0, 0, .10); z-index: 5; }
.opt { padding: 9px 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; cursor: pointer; }
.opt span:first-child { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt span:last-child { font-size: 12px; color: var(--muted); white-space: nowrap; }
.opt[aria-selected="true"] { background: var(--soft); }

.result { display: flex; flex-direction: column; gap: 18px; }
.answer { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 16px; align-items: center; }
.answer img { width: 88px; height: 88px; display: block; }
.verdict { font-size: 24px; font-weight: 600; letter-spacing: -0.035em; }
.atitle { font-weight: 500; margin-top: 4px; }
.ameta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.listen { font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; }
.listen a { color: var(--fg); text-underline-offset: 3px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn { appearance: none; border: 1px solid var(--fg); background: var(--fg); color: var(--bg); font: inherit; font-weight: 500; padding: 9px 18px; border-radius: 999px; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--fg); }
.next { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .04em; }
pre.share { margin: 0; font-family: var(--mono); font-size: 12px; background: var(--soft); padding: 10px 12px; white-space: pre-wrap; user-select: all; }

footer { display: flex; justify-content: center; }

.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .28); display: grid; place-items: center; z-index: 20; padding: 16px; }
.panel { background: var(--bg); width: 100%; max-width: 380px; padding: 24px; display: flex; flex-direction: column; gap: 18px; border: 1px solid var(--line); max-height: 90vh; overflow: auto; }
.panel p { margin: 0; line-height: 1.5; color: var(--fg); }
.panel p.small { font-size: 12px; color: var(--muted); }
.ph { display: flex; justify-content: space-between; align-items: center; }
.ph h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.nums div { display: flex; flex-direction: column; gap: 2px; }
.nums b { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.nums span { font-size: 11px; color: var(--muted); }
.dist { display: flex; flex-direction: column; gap: 5px; }
.bar { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: center; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.bar div { height: 18px; background: var(--soft); display: flex; justify-content: flex-end; align-items: center; padding-right: 6px; color: var(--fg); min-width: 22px; font-variant-numeric: tabular-nums; }
.bar div.hi { background: var(--fg); color: var(--bg); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); font-size: 13px; padding: 8px 14px; border-radius: 999px; z-index: 30; }

@media (max-width: 480px) {
  .app { gap: 16px; padding-block: 14px 20px; }
  .tile { height: 36px; font-size: 10px; }
  .board { gap: 5px; }
  .guess .gt { font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .tile.flip { animation: none; }
  #cover { transition: none; }
}
