/* Cross Stitch: the same warm paper as Paper Chain. Squares are paper tiles cut out of an ink board (the black squares
   are the board showing through), the word you're on is teal, and the square you're on is gold. */
@font-face { font-family: "Atkinson"; src: url("/fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #f6f0e4;
  --card: #fffdf8;
  --ink: #2b2620;
  --muted: #6d645a;
  --faint: #a59a8c;
  --line: #e2d8c6;
  --slot: #efe7d8;
  --hit: #2f8a85;
  --near: #c4860f;
  --accent: #d9483b;
  --board: #2b2620;
  --word: color-mix(in srgb, var(--hit) 20%, var(--card));
  --here: color-mix(in srgb, var(--near) 48%, var(--card));
  --solved: color-mix(in srgb, var(--hit) 12%, var(--card));
  --shown: #22706b;
  --key-h: 50px;
  --keys: calc(var(--key-h) * 3 + 30px + env(safe-area-inset-bottom));
  --cluebar: 58px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --body: "Atkinson", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Atkinson", system-ui, -apple-system, "Segoe UI", sans-serif;  /* clean, not rounded (Adam, 2026-11-21) */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1c1a17; --card: #2c2823; --ink: #f2ece2; --muted: #b5ab9d; --faint: #7c7366; --line: #3a352e; --slot: #3a352f;
    --board: #0d0c0a; --word: color-mix(in srgb, var(--hit) 34%, var(--card)); --here: color-mix(in srgb, var(--near) 55%, var(--card));
    --solved: color-mix(in srgb, var(--hit) 18%, var(--card)); --shown: #73c7c0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --paper: #1c1a17; --card: #2c2823; --ink: #f2ece2; --muted: #b5ab9d; --faint: #7c7366; --line: #3a352e; --slot: #3a352f;
    --board: #0d0c0a; --word: color-mix(in srgb, var(--hit) 34%, var(--card)); --here: color-mix(in srgb, var(--near) 55%, var(--card));
    --solved: color-mix(in srgb, var(--hit) 18%, var(--card)); --shown: #73c7c0;
    color-scheme: dark;
  }
html.big { --key-h: 58px; --cluebar: 66px; font-size: 19px; }
/* Short phones (an iPhone SE): a little less keyboard, so the grid keeps its room. */
@media (max-height: 620px) { :root { --key-h: 44px; --cluebar: 54px; } html.big { --key-h: 50px; --cluebar: 60px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--body);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
  background-image: radial-gradient(rgba(120, 100, 70, .045) 1px, transparent 1px); background-size: 6px 6px;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus { outline: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--hit) 60%, transparent); outline-offset: 2px; }
svg { display: block; }
[hidden] { display: none !important; }

/* ---------- Top ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 560px; margin: 0 auto; padding: calc(8px + env(safe-area-inset-top)) 12px 2px 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 1.45rem/1 var(--display); letter-spacing: .01em; white-space: nowrap; }
/* The same little crossword as the app's icon: cream squares on a dark board, a word stitched across the second row. */
.brand__mark { width: 30px; height: 30px; }
.brand__mark .board { fill: #2b2620; }
.brand__mark .sq { fill: #fffdf8; }
.brand__mark path { fill: none; stroke-width: 1.3; stroke-linecap: round; }
.brand__mark .x1 { stroke: #d9483b; }
.brand__mark .x2 { stroke: var(--near); }
.brand__mark .x3 { stroke: var(--hit); }
.brand__mark .x4 { stroke: #3f6fb5; }
.top__tools { display: flex; gap: 4px; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; transition: background-color .15s; }
.icon-btn:hover { background: var(--slot); }
.icon-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg .dot { fill: currentColor; }

.status { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  max-width: 560px; margin: 0 auto; padding: 0 16px 10px 18px; color: var(--muted); font-size: .95rem; }
.status__day b { color: var(--ink); }
.status__day { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status__right { display: flex; align-items: center; gap: 6px; flex: none; }
.pill { height: 36px; padding: 0 14px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 700; font-size: .92rem; color: var(--ink);
  transition: background-color .15s, opacity .2s; }
.pill:hover { background: var(--slot); }
.is-covered .pill, .is-done .pill { opacity: 0; pointer-events: none; }
.clock { display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 8px 0 12px; border-radius: 999px; background: var(--card);
  box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); font-weight: 700; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.clock svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; opacity: .75; }
.is-covered .clock svg, .is-done .clock svg { opacity: 0; width: 4px; }
.is-done .clock { background: var(--hit); color: #fff; box-shadow: none; padding-right: 12px; }

/* ---------- The board ---------- */
/* The grid is as big as the screen allows: never wider than the page, and short enough on a phone that the clue and
   the keyboard fit under it. */
.board { max-width: 560px; margin: 0 auto; padding: 0 16px calc(var(--keys) + var(--cluebar) + 8px); }
.puzzle { position: relative; width: min(100%, 440px, max(160px, 100svh - 114px - var(--keys) - var(--cluebar) - env(safe-area-inset-top)));
  margin: 0 auto; container-type: inline-size; }
.grid { display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); grid-template-rows: repeat(var(--n, 5), 1fr); gap: 3px; padding: 3px; aspect-ratio: 1; border-radius: 14px;
  background: var(--board); box-shadow: 0 1px 0 rgba(43, 38, 32, .08), 0 14px 30px -18px rgba(43, 38, 32, .55); transition: filter .3s; user-select: none; -webkit-user-select: none; }
.cell { position: relative; display: grid; place-items: center; border-radius: 6px; background: var(--card); cursor: pointer; transition: background-color .12s; touch-action: manipulation; }
.cell.is-block { background: transparent; cursor: default; }
.cell__n { position: absolute; left: 6%; top: 3%; font: 700 clamp(10px, 3.4cqi, 15px)/1.2 var(--body); color: var(--muted); pointer-events: none; }
.cell__l { font: 700 clamp(22px, 10.5cqi, 46px)/1 var(--body); text-transform: uppercase; color: var(--ink); pointer-events: none; transform: translateY(5%); }
html.big .cell__l { font-size: clamp(24px, 12cqi, 52px); }
html.big .cell__n { font-size: clamp(11px, 3.8cqi, 16px); }
.cell.is-word { background: var(--word); }
.cell.is-cur { background: var(--here); box-shadow: inset 0 0 0 2.5px var(--near); }
.cell.is-wrong .cell__l { color: var(--accent); }
.cell.is-wrong::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(to top right, transparent calc(50% - 1.5px), color-mix(in srgb, var(--accent) 75%, transparent) calc(50% - 1.5px), color-mix(in srgb, var(--accent) 75%, transparent) calc(50% + 1.5px), transparent calc(50% + 1.5px)); }
/* Shown for you: teal letters and a little corner. */
.cell.is-shown .cell__l { color: var(--shown); }
.cell.is-shown::before { content: ""; position: absolute; right: 0; bottom: 0; width: 22%; height: 22%; border-bottom-right-radius: 6px; pointer-events: none;
  background: linear-gradient(to top left, var(--hit) 50%, transparent 50%); opacity: .8; }
.is-done .cell:not(.is-block) { background: var(--solved); cursor: default; }
.grid.is-shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
/* Solved: the squares light up corner to corner. */
.grid.is-win .cell:not(.is-block) { animation: win .62s var(--ease) both; animation-delay: var(--d); }
@keyframes win { 45% { transform: scale(1.1); background: color-mix(in srgb, var(--hit) 55%, var(--card)); } }

/* The cover: Start, Paused, Welcome back. The grid and clues blur behind it, so the clock is fair. */
.is-covered .grid, .is-covered .lists { filter: blur(7px); pointer-events: none; }
.is-blank .grid { filter: none; opacity: .55; }
.cover { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 12px; }
.cover__card { width: min(100%, 340px); padding: 22px 20px 18px; border-radius: 20px; background: var(--card); text-align: center;
  box-shadow: 0 1px 0 rgba(43, 38, 32, .08), 0 20px 40px -18px rgba(43, 38, 32, .55); animation: rise .32s var(--ease); }
.cover__kicker { margin: 0; color: var(--muted); font-size: .9rem; }
.cover__title { margin: 4px 0 0; font: 700 1.5rem/1.2 var(--display); text-wrap: balance; }
.cover__text { margin: 6px 0 0; color: var(--muted); text-wrap: pretty; }
.cover__text:empty { display: none; }
.cover .btn { width: 100%; margin-top: 16px; background: var(--hit); color: #fff; }
.cover__how { margin-top: 10px; padding: 6px 10px; color: var(--muted); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }

/* The clue you're on: right above the keyboard on phones and tablets, under the grid on a computer. Tap it to switch
   between across and down; the arrows go to the next clue. */
.cluebar { position: fixed; left: 0; right: 0; bottom: var(--keys); z-index: 29; display: flex; align-items: stretch; min-height: var(--cluebar);
  background: var(--word); border-top: 1px solid color-mix(in srgb, var(--hit) 25%, transparent); transition: transform .35s var(--ease), opacity .25s; }
.cluebar__arrow { flex: none; display: grid; place-items: center; width: 52px; color: var(--ink); }
.cluebar__arrow svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cluebar__arrow:active { background: color-mix(in srgb, var(--hit) 15%, transparent); }
.cluebar__text { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 2px; text-align: left; font-size: 1.06rem; line-height: 1.3; }
.cluebar__text b { flex: none; color: var(--hit); font-size: .9rem; white-space: nowrap; }
.cluebar__text span { text-wrap: pretty; }
.is-covered .cluebar__text { visibility: hidden; }
.is-done .keys, .is-covered .keys { transform: translateY(110%); }
.is-done .cluebar, .is-covered .cluebar { transform: translateY(calc(100% + var(--keys))); }
@media (min-width: 600px) { .cluebar { padding: 0 max(0px, (100% - 560px) / 2); } }

/* All the clues: only beside the grid on a wide computer. On a phone the clue bar is enough (Adam, 2026-11-20: the list
   under the grid was redundant), so the screen is just the grid, the clue, and the keyboard, and it never scrolls. */
.lists { display: none; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 22px; transition: filter .3s; }
@media (hover: none), (pointer: coarse) {
  html:has(body:not(.is-done)) { overflow: hidden; }
  body:not(.is-done) { height: 100svh; overflow: hidden; }
}
.list h2 { margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font: 700 1.05rem/1.2 var(--display); }
.list ol { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 8px; margin: 0 -8px; padding: 6px 8px; border-radius: 10px; cursor: pointer; line-height: 1.35; font-size: .96rem;
  border-left: 3px solid transparent; transition: background-color .12s, color .12s; }
.list li b { flex: none; min-width: 1.2em; text-align: right; }
.list li.is-full:not(.is-cur) { color: var(--muted); }
.list li.is-cur { background: var(--word); }
.list li.is-cross { border-left-color: color-mix(in srgb, var(--hit) 55%, transparent); }
.is-done .list li { cursor: default; background: none; border-left-color: transparent; color: var(--ink); }

/* ---------- Keyboard ---------- */
.keys { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; gap: 7px; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: var(--paper); transition: transform .35s var(--ease); }
.keys__row { display: flex; gap: 6px; justify-content: center; max-width: 520px; width: 100%; margin: 0 auto; }
.keys button {
  flex: 1 1 0; min-width: 0; height: var(--key-h); border-radius: 8px; background: var(--card); box-shadow: 0 1px 0 rgba(0, 0, 0, .14), inset 0 0 0 1px var(--line);
  font: 700 1.12rem/1 var(--body); text-transform: uppercase; color: var(--ink); user-select: none; -webkit-user-select: none;
  transition: background-color .15s, transform .08s;
}
.keys button:active { transform: translateY(1px); background: var(--slot); }
.keys__wide { flex: 1.55 1 0 !important; }
.keys__wide svg { width: 24px; height: 24px; margin: 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
.keys__half { flex: .5 1 0; }

/* ---------- Toast ---------- */
/* Over the day and the clock, out of the grid's way; one line where it fits. */
.toast { position: fixed; left: 50%; top: calc(52px + env(safe-area-inset-top)); z-index: 40; transform: translate(-50%, -10px); opacity: 0; width: max-content;
  padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--paper); font-weight: 700; pointer-events: none;
  transition: opacity .2s, transform .25s var(--ease); max-width: calc(100% - 32px); text-align: center; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 24px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-weight: 700; font-size: 1.05rem; transition: transform .1s, opacity .15s; }
.btn:active { transform: translateY(1px); }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }

/* ---------- Sheets ---------- */
.sheet { width: min(100% - 24px, 460px); max-height: min(88vh, 760px); margin: auto; padding: 26px 22px 24px; border: 0; border-radius: 22px;
  background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); overflow: auto; overscroll-behavior: contain; }
html:has(dialog[open]) { overflow: hidden; }
.sheet::backdrop { background: rgba(28, 24, 18, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet[open] { animation: rise .32s var(--ease); }
.sheet[open]::backdrop { animation: fade-in .3s ease-out; }
.sheet.is-closing { animation: sink .2s ease-in forwards; }
.sheet.is-closing::backdrop { animation: fade-out .2s ease-in forwards; }
@keyframes sink { to { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.sheet h2 { margin: 0 0 14px; font: 700 1.45rem/1.2 var(--display); }
.sheet__close { position: absolute; right: 12px; top: 12px; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }
.sheet__close:hover { background: var(--slot); }
.sheet__close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sheet .btn { width: 100%; margin-top: 18px; }
.sheet--small { text-align: center; }
.sheet--small > p { margin: 0; color: var(--muted); }
.sheet__row { display: flex; gap: 10px; margin-top: 18px; }
.sheet__row .btn { margin-top: 0; }

/* How to play */
.how { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: step; }
.how__step { counter-increment: step; }
.how__step:nth-child(1) { --n: var(--hit); }
.how__step:nth-child(2) { --n: var(--near); }
.how__step:nth-child(3) { --n: var(--accent); }
.how__step h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 2px; font: 700 1.12rem/1.25 var(--display); }
.how__step h3::before { content: counter(step); display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--n); color: #fff; font: 700 .9rem/1 var(--body); }
.how__step p { margin: 0; padding-left: 36px; color: var(--muted); }
.how__body { overflow: hidden; }
.how__more { margin-top: 18px; border-top: 1px solid var(--line); }
.how__more summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 2px 0; color: var(--muted); font-weight: 700;
  cursor: pointer; list-style: none; }
.how__more summary::-webkit-details-marker { display: none; }
.how__more summary::after { content: ""; width: 8px; height: 8px; margin-right: 4px; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
.how__more[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.how__tips { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: .95rem; }
.how__note { margin: 10px 0 0; color: var(--muted); font-size: .9rem; }

/* Need a hand? */
.sheet--help-me { text-align: left; }
.sheet--help-me h2 { margin-bottom: 4px; }
.assist__label { margin: 18px 0 8px; font-weight: 700; }
.assist__row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sheet .assist__row .btn { width: auto; min-height: 46px; margin: 0; padding: 0 8px; font-size: .95rem; }
.assist__clear { display: block; margin: 20px auto 0; padding: 6px 10px; color: var(--muted); font-weight: 700; text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: var(--line); }

/* ---------- The finish and the stats ---------- */
.finish { text-align: center; }
.finish__day { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.finish__score { display: grid; justify-items: center; margin: 6px 0 0; }
.finish__score b { font: 700 3.8rem/1 var(--display); color: var(--hit); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.finish__score span { margin-top: 6px; color: var(--muted); font-size: .95rem; }
.finish__sub { margin: 12px 0 0; font-weight: 700; }
.finish__actions .btn { background: var(--hit); color: #fff; }
.stats__part { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
[data-finish][hidden] + .stats__part { margin-top: 4px; padding-top: 0; border-top: 0; }
.stats__title { margin: 0 0 16px !important; font-size: 1.15rem !important; }
[data-finish][hidden] + .stats__part .stats__title { font-size: 1.45rem !important; }
.nums { display: grid; grid-template-columns: repeat(4, 1fr); }
.nums--3 { grid-template-columns: repeat(3, 1fr); }
.nums div { padding: 0 4px; text-align: center; }
.nums div + div { border-left: 1px solid var(--line); }
.nums b { display: block; font: 700 1.55rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.nums span { display: block; margin-top: 4px; font-size: .8rem; line-height: 1.2; color: var(--muted); }
.line { margin-top: 26px; }
.line.has-you { margin-top: 48px; }
.line__track { position: relative; height: 10px; border-radius: 999px; background: var(--slot); }
.line__range { position: absolute; top: 0; bottom: 0; min-width: 10px; border-radius: 999px; background: color-mix(in srgb, var(--hit) 40%, var(--slot)); }
.line__avg { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--ink); }
.line__avg em { position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%); font-style: normal; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.line__you { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--card); }
.line__you em { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); font-style: normal; font-weight: 700; font-size: .85rem; color: var(--ink); white-space: nowrap; }
.line__ends { display: flex; justify-content: space-between; margin-top: 24px; color: var(--muted); font-size: .8rem; }
.stats__lead { margin: 14px 0 0; text-align: center; font-weight: 700; }
.stats__note { margin: 10px 0 0; color: var(--muted); font-size: .92rem; text-wrap: pretty; }
[data-global] .stats__note { text-align: center; }
.week { margin-top: 22px; }
.nums[hidden] + .week { margin-top: 0; }
.week__days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; list-style: none; margin: 0; padding: 0; }
.week__days li { display: grid; justify-items: center; gap: 4px; }
.week__days i { width: 100%; max-width: 30px; aspect-ratio: 1; border-radius: 7px; background: var(--slot); }
.week__days .is-clean i { background: var(--hit); }
.week__days .is-help i { background: var(--card); box-shadow: inset 0 0 0 3px var(--hit); }
.week__days .is-today i { outline: 2px solid var(--accent); outline-offset: 2px; }
.week__days b { font-size: .76rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.week__days .is-none b { color: var(--faint); }
.week__days small { font-size: .76rem; color: var(--muted); }
.week__days .is-today small { color: var(--ink); font-weight: 700; }
.week__key { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sw--clean { background: var(--hit); }
.sw--help { box-shadow: inset 0 0 0 2px var(--hit); margin-left: 10px; }
.stats__ever { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: .85rem; }
.next { margin: 16px 0 0; text-align: center; color: var(--muted); }
.next b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Done for the day (under the grid, once the times are closed). */
.is-done .board { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.done { max-width: 440px; margin: 22px auto 0; padding: 22px 20px 20px; border-radius: 22px; background: var(--card); box-shadow: 0 1px 0 rgba(0, 0, 0, .06), inset 0 0 0 1px var(--line); text-align: center; }
.done__title { margin: 0; font: 700 1.25rem/1.25 var(--display); }
.done__score { margin: 4px 0 0; color: var(--muted); }
.done__score b { font: 700 1.6rem/1.2 var(--display); color: var(--hit); font-variant-numeric: tabular-nums; }
.done__actions { display: grid; gap: 10px; margin-top: 16px; }
.done__actions .btn { width: 100%; }
.done__actions .btn:not(.btn--ghost) { background: var(--hit); color: #fff; }
.noscript { max-width: 520px; margin: 40px auto; padding: 0 16px; text-align: center; }

/* ---------- A test round's bar (from the portal) ---------- */
.testbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; max-width: 528px;
  margin: 0 auto 10px; padding: 8px 10px 8px 14px; border-radius: 14px; background: color-mix(in srgb, var(--near) 16%, var(--card));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--near) 55%, transparent); font-size: .92rem; }
.testbar > * { white-space: nowrap; }
.testbar__what { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.testbar__day { display: flex; align-items: center; gap: 2px; font-weight: 700; }
.testbar__day button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: 1.3rem; line-height: 1; }
.testbar__day button:hover, .testbar__reset:hover { background: var(--slot); }
.testbar__day button:disabled { opacity: .3; pointer-events: none; }
.testbar__reset { padding: 7px 12px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 700; }
/* The test bar takes some of the grid's room on a phone. */
body:has(.testbar) .puzzle { width: min(100%, 440px, max(160px, 100svh - 160px - var(--keys) - var(--cluebar) - env(safe-area-inset-top))); }
@media (max-width: 560px) {
  .testbar { margin: 0 16px 8px; flex-wrap: nowrap; gap: 6px; padding: 3px 4px 3px 12px; }
  .testbar__what span { display: none; }
  .testbar__day button { width: 30px; height: 30px; }
  .testbar__reset { padding: 6px 10px; }
}

/* ---------- Phones ---------- */
@media (max-width: 560px) {
  .sheet { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: 24px 24px 0 0;
    padding: 24px 20px calc(18px + env(safe-area-inset-bottom)); }
  .sheet[open] { animation: up .36s var(--ease); }
  .sheet.is-closing { animation: down .24s ease-in forwards; }
  .sheet .btn { margin-top: 16px; }
}
@keyframes up { from { transform: translateY(100%); } }
@keyframes down { to { transform: translateY(100%); } }
@media (max-width: 380px) {
  .brand { font-size: 1.25rem; gap: 8px; }
  .brand__mark { width: 26px; height: 26px; }
  .pill { padding: 0 11px; font-size: .86rem; }
  .status__day { font-size: .88rem; }
  .testbar__round { display: none; }
}
@media (max-width: 340px) {
  .top__tools .icon-btn { width: 40px; }
}

/* ---------- Computers: no keyboard on the screen, the clues beside the grid ---------- */
@media (hover: hover) and (pointer: fine) {
  :root { --keys: 0px; --cluebar: 0px; }
  .keys { display: none; }
  .board { padding-bottom: 40px; }
  .puzzle { width: min(100%, 440px, max(260px, 100dvh - 190px)); }
  .cluebar { position: static; z-index: auto; margin: 14px auto 0; width: 100%; max-width: 440px; min-height: 58px; padding: 0 !important; border: 0; border-radius: 14px; }
  .is-done .cluebar { display: none; }
  .is-covered .cluebar { transform: none; }
}
@media (hover: hover) and (pointer: fine) and (min-width: 880px) {
  .top, .status { max-width: 900px; }
  .board { max-width: 900px; }
  .play { display: grid; grid-template-columns: 440px 1fr; grid-template-rows: auto auto 1fr; column-gap: 36px; align-items: start; }
  .puzzle { grid-column: 1; width: 440px; }
  .cluebar, .done { grid-column: 1; }
  .lists { display: grid; grid-column: 2; grid-row: 1 / span 3; margin-top: 0; }
  .testbar { max-width: 868px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* Accessibility mode (public/settings.js): stronger secondary text, in light and dark. Bigger letters come with html.big. */
html.a11y { --muted: #4d463e; --faint: #7d7366; }
@media (prefers-color-scheme: dark) { :root.a11y:not([data-theme="light"]) { --muted: #d9d0c2; --faint: #a59a8c; } }
:root.a11y[data-theme="dark"] { --muted: #d9d0c2; --faint: #a59a8c; }
/* Bigger letters leave the top bar its usual size, so it still fits a phone. */
html.big .top .brand { font-size: 23px; }

/* ---------- Computers, tidied (Adam, 2026-11-25: "fix the desktop cross stitch screen") ----------
   A bigger grid that uses the window's height, the clue under it on one easy line, the clue lists with room to read,
   and the crossing clue marked with a soft tint instead of a curved edge. */
@media (hover: hover) and (pointer: fine) {
  .cluebar__text { padding: 10px 4px; font-size: 1.12rem; }
  .cluebar__text span { flex: 1; min-width: 0; }
}
@media (hover: hover) and (pointer: fine) and (min-width: 880px) {
  :root { --gw: min(540px, max(380px, 100dvh - 230px), 48vw); }
  .top, .status, .board { max-width: 1060px; }
  .testbar { max-width: 1028px; }
  .play { grid-template-columns: var(--gw) minmax(0, 1fr); column-gap: 44px; }
  .puzzle { width: var(--gw); }
  .cluebar { max-width: none; }
  .lists { gap: 28px; }
  .list h2 { font-size: 1.15rem; padding-bottom: 8px; margin-bottom: 8px; }
  .list li { font-size: 1.02rem; padding: 7px 10px; margin: 0 -10px 2px; border-left: 0; }
  .list li.is-cross:not(.is-cur) { background: color-mix(in srgb, var(--word) 45%, transparent); }
}
