/* The pencil-puzzle kit's interface: home, the puzzle on its desk, sheets, the
   win screen. Layout and drawing only; every color, face and size comes from
   the kit's look (puzzles.css) and the puzzle's accent. The puzzle's own
   board (its marks, its stars) is styled in its <slug>.css.
   Hashi's screens are the model for how things hold still: the bar and the
   dock keep their places and sizes, zoom has a strip of its own. */

/* A star in a label, drawn (kit/ui.js, withStars), in the ink of the words round it. */
.sg { width: .86em; height: .86em; fill: currentColor; vertical-align: -.08em; margin: 0 .06em 0 .1em; }
.sg + .sg { margin-left: 0; }
.starred { white-space: nowrap; }

/* Your move (house/cue.js, kit/play.js): what to press rings in the puzzle's
   accent, the paper having no turn color of its own. */
.house-beckon { --house-turn: var(--accent); }
.streak .sg { fill: var(--star, var(--accent)); stroke: var(--star-edge, none); stroke-width: .12; stroke-linejoin: round; margin-left: 0; }
/* A tick, drawn: two borders of a turned box. */
.tick { display: inline-block; width: .38em; height: .7em; margin: 0 .5em 0 .2em; border: solid currentColor; border-width: 0 .17em .17em 0; transform: translateY(-.1em) rotate(45deg); }

/* ── type, bars, footer ─────────────────────────────────────────────────── */
/* The page's skeleton is the house's (docs/design-language.md, "Layout and
   type"): the bar is --bar-h tall at --bar-top, its first and last things
   at the gutter; its tools and the way back are one size. */
.pk .bar { display: flex; align-items: center; gap: var(--s1) var(--s3); min-height: var(--bar-h); margin-top: max(calc(var(--frame) + var(--bar-top)), env(safe-area-inset-top)); padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left)); box-shadow: 0 1px 0 var(--paper-edge); }
.pk .bar .tools { margin-left: auto; display: flex; align-items: center; gap: var(--s1); }
.pk .bar .tools a.quiet { max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk .bar .quiet { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tool-h); padding: var(--s1) var(--tool-pad); font: var(--w-tool) var(--t-tool)/1.1 var(--ui); color: var(--soft); text-decoration: none; white-space: nowrap; }
/* the house kit's Feedback, last in the bar (docs/adr/0068), as quiet as the tools beside it */
.pk .bar > .house-fb-btn { color: var(--soft); }
/* (on the narrowest phones a play screen's bar draws its tools closer, so a timed puzzle's five fit beside the way up) */
@media (max-width: 360px) { .pk .play > .bar { gap: 4px; } .pk .play > .bar .tools { gap: 2px; } .pk .play > .bar .timer { margin-right: 2px; } }
/* (and Pause, the clock on a phone, keeps to its glyph and time: D36) */
@media (max-width: 360px) { .pk .play > .bar .pause { padding-inline: 6px; gap: 4px; min-width: 0; } .pk .bar .pause .narrow-time:not([hidden]) { min-width: 0; font-size: 14px; } .pk .bar .pause .glyph { width: 12px; height: 12px; } }
/* (and the narrowest phones, with the clock past ten minutes, give Pause half its sides again: docs/adr/0100) */
@media (max-width: 340px) { .pk .play > .bar .pause { padding-inline: 3px; } }
.pk .foot { display: flex; justify-content: flex-end; gap: var(--s3); flex-wrap: wrap; padding: var(--s4) max(var(--gutter), env(safe-area-inset-right)) max(var(--s4), env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left)); border-top: 1px solid var(--paper-edge); font-size: 13px; color: var(--soft); }
.pk .foot a { color: var(--accent); text-decoration: none; font-weight: 600; }
.pk .foot a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── home ───────────────────────────────────────────────────────────────── */
.pk .home { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.pk .home-bar { justify-content: flex-end; }
/* The column is --page-max wide inside the gutters; the footer lines up with it. */
.pk .home .foot { padding-inline: max(var(--gutter), env(safe-area-inset-left), calc((100% - var(--page-max)) / 2)); }
.pk .home .wrap { width: 100%; max-width: calc(var(--page-max) + 2 * var(--gutter)); margin: 0 auto; padding: var(--bar-gap) var(--gutter) var(--s4); flex: 1; }
.pk .waiting { padding: var(--s5) 0; text-align: center; animation: fade-in var(--m-glide, 250ms) ease .2s backwards; }
@keyframes fade-in { from { opacity: 0; } }
.pk .wordmark-h { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s2); }
.pk .wordmark-h .mark { width: .8em; height: .8em; transform: rotate(8deg); }
.pk .section { margin-top: var(--s4); }
.pk .section-head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.pk .streak { font: 700 var(--t-note)/1.4 var(--ui); color: var(--ink); }

/* What to play (kit/choose.js; docs/adr/0076, C2): two tabs, Today's daily
   and Infinite, a card under each with its one Play, and the links under
   it. The tabs are a choice, so the one shown wears the pick, never the
   fill; the card's Play is the view's one fill. */
.pk .pick-area { display: grid; gap: var(--s3); margin-top: var(--s4); }
.pk .pick-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: calc(var(--radius) + 2px); background: color-mix(in srgb, var(--paper-2) 60%, transparent); }
.pk .pick-tab { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 46px; padding: 0 var(--s3); border: 0; border-radius: var(--radius); background: none; color: var(--soft); font: var(--w-label) var(--t-label)/1.2 var(--ui); white-space: nowrap; cursor: pointer; }
/* (the narrowest phones: closer to its edges, so "Today’s daily" and its mark keep one line) */
@media (max-width: 360px) { .pk .pick-tab { gap: 6px; padding: 0 var(--s1); } }
.pk .pick-tab[aria-selected="true"] { color: var(--ink); background: var(--pick-tint); box-shadow: var(--pick-ring); font-weight: var(--pick-weight); }
.pk .pick-tab:focus-visible { outline: 2px solid currentColor; outline-offset: -4px; }
/* the daily's tab: a dot in the accent while today's is to do, a tick once it's solved */
.pk .tab-mark.due { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.pk .tab-mark.done { display: inline-flex; color: var(--good); }
.pk .tab-mark.done .tick { margin: 0 .1em; }
.pk .pick-panel { display: grid; gap: var(--s3); min-width: 0; }
.pk .pick-panel[hidden] { display: none; }
.pk .pick-card { min-width: 0; padding: var(--panel-pad); background: var(--paper-2); border: 1px solid var(--paper-edge); border-radius: var(--panel-radius); box-shadow: var(--card-shadow); }
.pk .pick-kicker { font: 700 var(--t-kicker)/1.3 var(--ui); letter-spacing: var(--kicker-spacing); text-transform: uppercase; color: var(--soft); }
/* A puzzle's picture, the board as it stands, in a square box that holds its place (shimmering) until it's drawn. */
.pk .pick-art { --gap: 12px; aspect-ratio: 1; border: 0; border-radius: var(--radius); background: var(--paper); }
.pk .pick-art.pick-thumb { --gap: 6px; }
.pk .pick-art:not(.ready) { background: linear-gradient(100deg, var(--paper) 30%, color-mix(in srgb, var(--paper-edge) 45%, var(--paper)) 50%, var(--paper) 70%) 0 0 / 220% 100%; animation: shimmer 1.4s linear infinite; }

/* Today's daily: its day, its picture, what it is, and Play. */
.pk .day-card { display: grid; justify-items: center; gap: var(--s2); text-align: center; }
.pk .day-card .pick-kicker { justify-self: start; }
.pk .day-card .pick-big { width: min(200px, 100%); margin: var(--s1) 0; }
.pk .pick-name { font: 700 var(--t-heading)/var(--lh-heading) var(--ui); }
.pk .pick-state .solved { color: var(--good); font-weight: 700; }
.pk .day-card .daily-go { justify-self: stretch; margin-top: var(--s2); }
.pk .pick-under { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s3); flex-wrap: wrap; margin: 0; padding: 0 var(--s1); font-size: var(--t-note); }
.pk .pick-under:not(:has(a)) .streak:empty { display: none; }
.pk .pick-under a, .pk .pick-links a { font: 600 var(--t-note)/1.4 var(--ui); color: var(--ink); text-underline-offset: 3px; }
.pk .pick-links { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin: 0; padding: 0 var(--s1); }
.pk .pick-links:empty { display: none; }
/* (a finger's reach: each link 44px tall, and rows of them, wrapped on a narrow phone, far enough apart that no reach covers another) */
@media (pointer: coarse) { .pk :is(.pick-under, .pick-links) a { display: inline-block; padding-block: 12px; margin-block: -12px; } .pk .pick-links { row-gap: var(--s4); } }

/* Infinite: your level, the ladder of every level, this puzzle and Play. On
   a phone, a row each and this puzzle's picture beside its words, a line
   over them; on a wide screen the picture at the left. */
.pk .inf-card {
  display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; gap: var(--s2) var(--s3);
  grid-template-areas: "head head" "ends ends" "ladder ladder" "you you" "line line" "art this" "play play";
}
.pk .inf-card::before { content: ''; grid-area: line; border-top: 1px solid var(--paper-edge); margin-top: var(--s1); }
.pk .inf-card > .pick-art { grid-area: art; width: 84px; }
.pk .lvl-head { grid-area: head; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s2) var(--s3); min-width: 0; }
.pk .lvl-which { display: grid; gap: 2px; min-width: 0; }
.pk .lvl-which .pick-kicker { white-space: nowrap; }
.pk .lvl-name { overflow-wrap: anywhere; }
/* (beside Your level, or under it where it can't keep a few words a line) */
.pk .lvl-rating { flex: 1 1 10em; max-width: 24em; margin-left: auto; text-align: right; }
.pk .lvl-rating a { color: var(--ink); font-weight: 600; text-underline-offset: 3px; }
.pk .lvl-ends { grid-area: ends; display: flex; justify-content: space-between; margin-top: var(--s1); font: 600 var(--t-note)/1.4 var(--ui); color: var(--soft); }
/* The ladder: one level a button, gentlest first, all one width. Yours has
   the accent's edge and "▲ You" under it; the one picked wears the pick.
   A long name gives way to a smaller face, then breaks at a syllable. */
.pk .ladder, .pk .ladder-you { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: var(--s2); container-type: inline-size; }
.pk .ladder { grid-area: ladder; }
/* (four levels or more on a phone: the buttons closer, to give their names the room) */
@media (max-width: 480px) { .pk :is(.ladder, .ladder-you).many { gap: var(--s1); } .pk .ladder.many .lv { padding-inline: 2px; } }
.pk .lv {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 52px; padding: var(--s1) 4px;
  border: 1px solid var(--line); border-radius: var(--radius); background: transparent; color: var(--ink); cursor: pointer;
  font: 600 var(--lv-size, var(--t-small))/1.15 var(--ui); text-align: center;
}
.pk .lv.mine { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pk .lv.on { background: var(--pick-tint); box-shadow: var(--pick-ring); font-weight: var(--pick-weight); }
.pk .lv.mine.on { box-shadow: var(--pick-ring), 0 0 0 1px var(--accent); }
.pk .lv:focus-visible { outline: 2px solid currentColor; outline-offset: -4px; }
/* (a long name takes a smaller face before it breaks: choose.js's fitLadder) */
.pk :is(.lv-name, .lv-hint) { display: block; align-self: stretch; min-width: 0; }
.pk .lv-name { white-space: nowrap; }
/* (a hint, chess's ratings, keeps its size and breaks after its dash) */
.pk .ladder.fitting .lv-name { font-weight: var(--pick-weight); }
.pk .ladder.wraps .lv-name { white-space: normal; hyphens: auto; overflow-wrap: anywhere; }
.pk .lv-hint { font-size: var(--t-kicker); font-weight: 500; line-height: 1.2; color: var(--soft); font-variant-numeric: tabular-nums; }
.pk .lv.on .lv-hint { color: var(--ink); }
.pk .ladder-you { grid-area: you; margin-top: calc(-1 * var(--s1)); }
.pk .ladder-you > span { justify-self: center; }
.pk .lv-you-mark { display: inline-flex; align-items: center; gap: 4px; font: 700 var(--t-kicker)/1.3 var(--ui); letter-spacing: var(--kicker-spacing); text-transform: uppercase; color: var(--accent); }
.pk .lv-you-mark svg { width: 10px; height: 8px; fill: currentColor; }
.pk .this-one { grid-area: this; display: grid; justify-items: start; gap: 2px; min-width: 0; }
.pk .this-title { font: var(--w-label) var(--t-label)/1.3 var(--ui); }
.pk .linkish { padding: 0; border: 0; background: none; color: var(--ink); font: 600 var(--t-note)/1.4 var(--ui); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pk .linkish[hidden] { display: none; }
.pk .this-play { grid-area: play; margin-top: var(--s1); }
@media (min-width: 761px) {
  .pk .pick-tabs { width: min(420px, 100%); }
  .pk .day-card { grid-template-columns: 240px minmax(0, 1fr); grid-template-rows: repeat(4, auto) 1fr; align-content: start; justify-items: start; gap: var(--s1) var(--s4); text-align: left; }
  .pk .day-card .pick-big { grid-row: 1 / -1; grid-column: 1; width: 240px; margin: 0; }
  .pk .day-card > :not(.pick-big) { grid-column: 2; }
  .pk .day-card .daily-go { justify-self: start; align-self: end; min-width: 180px; }
  .pk .inf-card {
    grid-template-columns: 240px minmax(0, 1fr) auto; grid-template-rows: repeat(4, auto) 1fr; align-items: start; gap: var(--s2) var(--s4);
    grid-template-areas: "art head head" "art ends ends" "art ladder ladder" "art you you" "art this play";
  }
  .pk .inf-card::before { display: none; }
  .pk .inf-card > .pick-art { width: 240px; }
  .pk .this-one, .pk .this-play { align-self: end; }
  .pk .this-play { min-width: 180px; margin: 0; }
}
.pk .dailies-off { padding: var(--s3) 0; }

/* The picture sits in its box as a printed puzzle. */
.pk .daily-art { --gap: var(--panel-pad); position: relative; min-height: 0; }
/* The picture fills the card's art box from its edges in, so the box is the same size whether or not it has loaded. */
.pk .daily-art svg { position: absolute; inset: var(--gap); width: calc(100% - 2 * var(--gap)); height: calc(100% - 2 * var(--gap)); opacity: 0; transition: opacity var(--m-glide, 250ms) ease; filter: drop-shadow(0 4px 6px rgba(var(--shade), .22)); }
.pk .daily-art.ready svg { opacity: 1; }
.pk .daily-art .no-art { position: absolute; inset: 0; display: grid; place-content: center; padding: var(--s1); text-align: center; font-size: var(--t-note, 14px); color: var(--soft); }
@keyframes shimmer { to { background-position: -120% 0; } }

.pk .settings { display: grid; gap: 0; max-width: 640px; }
/* Puzzles left part way: a row each under the Infinite card, Continue at its end. */
.pk .resume { padding: var(--s2) var(--panel-pad); background: var(--paper-2); border: 1px solid var(--paper-edge); border-radius: var(--panel-radius); }
.pk .pick-resume-head { font: var(--w-label) var(--t-label)/1.3 var(--ui); }
.pk .resume ul { list-style: none; margin: var(--s1) 0 0; padding: 0; display: grid; gap: var(--s1); }
.pk .resume li { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s1) var(--s2); min-height: 44px; }
.pk .resume-what { flex: 1 1 12em; min-width: 0; }
.pk .resume-what b { font-weight: 600; }

/* ── the archive: past dailies, a month at a time ───────────────────────── */
.pk .arc-head h2 { min-width: 9em; }
.pk .arc-nav { display: flex; gap: var(--s2); margin-left: auto; }
.pk .arc-days { display: grid; gap: var(--s2); }
.pk .arc-day { display: grid; grid-template-columns: 8em minmax(0, 1fr); align-items: center; gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--paper-edge); }
.pk .arc-day:first-child { border-top: 0; }
.pk .arc-date { font: var(--w-label) var(--t-label)/1.3 var(--ui); }
.pk .arc-cell {
  display: flex; flex-direction: column; justify-content: center; gap: 1px; min-height: 56px; padding: var(--s2) 12px;
  text-decoration: none; color: var(--ink); background: var(--paper-2); border: 1px solid var(--paper-edge); border-radius: 10px;
  transition: transform var(--m-lift, 150ms) ease, box-shadow var(--m-lift, 150ms) ease;
}
.pk .arc-cell b { font: var(--w-label) var(--t-label)/1.3 var(--ui); }
.pk .arc-cell > span { font-size: var(--t-note); color: var(--soft); }
.pk .arc-cell .solved { color: var(--good); font-weight: 700; }
.pk .arc-cell.is-solved { background: color-mix(in srgb, var(--good) 8%, var(--paper-2)); }
/* A picture puzzle's solved one shows its picture beside its name (kit/archive.js, game.gallery). */
.pk .arc-cell.has-pic { display: grid; grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; }
.pk .arc-pic { grid-row: 1 / 3; width: 40px; height: 40px; align-self: center; }
.pk .arc-pic svg { width: 100%; height: 100%; display: block; }
@media (hover: hover) { .pk a.arc-cell:hover { transform: translateY(-2px); box-shadow: 0 10px 18px -12px rgba(var(--shade), .55); } }
.pk a.arc-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.pk .arc-day.skeleton .arc-cell { min-height: 56px; background: linear-gradient(100deg, var(--paper) 30%, color-mix(in srgb, var(--paper-edge) 45%, var(--paper)) 50%, var(--paper) 70%) 0 0 / 220% 100%; animation: shimmer 1.4s linear infinite; border-color: transparent; }
.pk .arc-tally, .pk .arc-empty { margin-top: var(--s3); min-height: 1.45em; }

/* ── a puzzle on its desk ───────────────────────────────────────────────── */
.pk .play { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); overflow: hidden; }
.pk .bar .narrow, .pk .narrow-label, .pk .narrow-time, .pk .opt-gear, .pk .help-q { display: none; }
/* Pause, Resume and (once solved) Share result share one slot of fixed width, so the clock never moves. */
.pk .bar .pause, .pk .bar .copy { min-width: 7.5em; }
.pk .where { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.pk .where h1 { margin: 0; font: 700 var(--t-bar)/1.2 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk .timer { font: var(--w-tool) var(--t-tool)/1 var(--ui); font-variant-numeric: tabular-nums; min-width: 4.6ch; text-align: right; margin-right: var(--s2); }
/* Beside it, what solving now would do to your rating (target.js, ADR 0085):
   a small pill in tabular figures, ink for a gain, soft for ±0, the mistake
   red for a loss (its true minus says so too). A change swells once and a
   ring fades from it; under reduced motion, a brief tint instead. */
.pk .pts { position: relative; font: 700 calc(var(--t-tool) - 2px)/1 var(--ui); font-variant-numeric: tabular-nums; min-width: 4.2ch; text-align: center; padding: 5px 7px; border-radius: 999px; border: 1px solid var(--paper-edge); background: var(--paper); color: var(--ink); margin-right: var(--s2); white-space: nowrap; }
.pk .pts.zero { color: var(--soft); }
.pk .pts.neg { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--paper-edge)); background: color-mix(in srgb, var(--bad) 7%, var(--paper)); }
.pk .pts:focus-visible { outline: 2px solid var(--focus, var(--ink)); outline-offset: 2px; }
.pk .pts-said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .pk .pts.pulse { animation: pk-pts-swell .5s ease-out; }
  .pk .pts.pulse::after { content: ""; position: absolute; inset: -2px; border-radius: 999px; border: 2px solid currentColor; pointer-events: none; animation: pk-pts-ring .6s ease-out forwards; }
  @keyframes pk-pts-swell { 0% { transform: scale(1); } 35% { transform: scale(1.12); } 100% { transform: scale(1); } }
  @keyframes pk-pts-ring { from { inset: -2px; opacity: .6; } to { inset: -9px; opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { .pk .pts.pulse { animation: pk-pts-tint 1.2s ease-out; } @keyframes pk-pts-tint { from { background: color-mix(in srgb, currentColor 16%, var(--paper)); } } }

.pk .water { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--desk); }
.pk .sea { flex: 1; display: flex; overflow: auto; padding: var(--s3); min-height: 0; overscroll-behavior: contain; }
/* Zoom: round buttons in a strip of their own under the desk, only for a
   board whose cells are small enough to need it, so they never cover a cell. */
.pk .zoom { display: flex; justify-content: flex-end; gap: var(--s2); padding: 0 max(var(--gutter), env(safe-area-inset-right), env(safe-area-inset-left)) var(--s2); }
.pk .zoom-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper-2); box-shadow: 0 2px 6px rgba(var(--shade), .25);
  color: var(--ink); font: 700 22px/1 var(--ui); cursor: pointer; display: grid; place-items: center;
}
.pk .zoom-btn:hover { background: var(--paper); }
.pk .zoom-btn:disabled { border-style: dashed; color: var(--soft); border-color: var(--soft); box-shadow: none; cursor: default; }
.pk .zoom-fit { width: auto; padding: 0 14px; border-radius: 22px; font-size: var(--t-note); }

/* The sheet of the book the puzzle is printed on. */
.pk .paper {
  margin: auto; position: relative; padding: 10px 14px 14px; border-radius: 3px; color: var(--ink); background: var(--paper-2);
  box-shadow: 0 1px 0 #fff inset, 0 22px 44px -22px rgba(var(--shade), .6), 0 2px 8px rgba(var(--shade), .14);
}
.pk .folio {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: 0 0 10px;
  font: 700 12px/1 var(--ui); letter-spacing: .15em; text-transform: uppercase; color: var(--soft); white-space: nowrap;
}
/* The folio never widens the page: it takes the board's width, and a long name gives way. */
.pk .folio { width: 0; min-width: 100%; }
.pk .folio-left { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pk .folio-right { flex-shrink: 0; }
.pk .solved .folio-left { max-width: calc(100% - 190px); }
@media (max-width: 640px), (orientation: landscape) and (max-height: 500px) {
  .pk .folio .word { display: none; }
  .pk .solved .folio-left { max-width: calc(100% - 160px); }
}
/* A printed page keeps a hairline border a little way in from the board. */
.pk .neatline { position: relative; line-height: 0; margin: 8px; outline: 1px solid var(--line); outline-offset: 6px; }
.pk .grid { display: block; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.pk .grid:focus { outline: none; }
/* The board focused from the keyboard: the page's own hairline becomes the
   ring, in the pick color, rather than a second frame just outside it
   (ADR 0105). */
.pk .grid:focus-visible { outline: none; }
.pk .neatline:has(.grid:focus-visible) { outline: 3px solid var(--pick); }
.pk .grid.hidden { visibility: hidden; }
.pk .grid .cursor { fill: color-mix(in srgb, var(--pick) 14%, transparent); stroke: var(--pick); stroke-width: .07; pointer-events: none; }
.pk .grid .hov { fill: transparent; }
@media (hover: hover) and (pointer: fine) { .pk .play:not(.solved) .grid:not(.hidden) .hov:hover { fill: color-mix(in srgb, var(--ink) 7%, transparent); } }

.pk .cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s3); line-height: 1.5; background: var(--paper-2); }
.pk .cover-title { margin: 0; font: 400 34px/1 var(--display); color: var(--ink); }
.pk .cover-mark { width: 84px; height: 84px; opacity: .9; }
.pk .cover-mark svg, .pk .win-star svg { width: 100%; height: 100%; display: block; }

/* The stamp a solved puzzle gets: accent ink, pressed over the folio's size. */
.pk .stamp {
  position: absolute; right: 24px; top: -40px; display: none; align-items: baseline; gap: 10px;
  padding: 5px 14px; border: 3px double var(--accent); border-radius: 8px; color: var(--accent); line-height: 1;
  background: var(--paper-2); mix-blend-mode: multiply; opacity: .92; pointer-events: none; transform: rotate(-5deg);
}
.pk .solved .folio-size { visibility: hidden; }
.pk .stamp.on { display: flex; }
.pk .stamp.in { animation: stamp var(--m-glide, 250ms) cubic-bezier(.2, .9, .3, 1.2) both; }
.pk .stamp-word { font: 400 14px var(--display); letter-spacing: .2em; text-transform: uppercase; }
.pk .stamp-time { font: 400 22px var(--display); font-variant-numeric: lining-nums tabular-nums; }
@keyframes stamp { from { scale: 1.7; opacity: 0; } }

.pk .dock { display: flex; align-items: center; gap: var(--s3); min-height: 72px; padding: var(--s3) max(var(--gutter), env(safe-area-inset-right)) var(--s3) max(var(--gutter), env(safe-area-inset-left)); border-top: 1px solid var(--paper-edge); }
/* A board's own tools (a number pad) under the desk: it keeps its place
   once solved, out of use, so the board doesn't move. */
.pk .tray { flex-shrink: 0; display: flex; justify-content: center; padding: 0 var(--gutter) var(--s2); }
.pk .play.solved .tray { visibility: hidden; }
/* Room for two lines, so the dock (and the board above it) keep their size as messages change. */
.pk .status { flex: 1; min-width: 0; margin: 0; min-height: 3em; display: flex; align-items: center; }
.pk .status a { color: var(--accent); font-weight: 600; }
.pk .moves, .pk .result { display: flex; align-items: center; gap: var(--s2); flex-shrink: 0; }
.pk .quiet.inline { padding: 0; color: var(--accent); text-decoration: underline; font-weight: 700; }

/* ── a grid cut into regions (kit/regions.js): washes, thin lines, heavy lines ── */
.tint { stroke: none; }
.tint.t0 { fill: var(--tint-1); } .tint.t1 { fill: var(--tint-2); } .tint.t2 { fill: var(--tint-3); } .tint.t3 { fill: var(--tint-4); }
.tint.t4 { fill: var(--tint-5); } .tint.t5 { fill: var(--tint-6); } .tint.t6 { fill: var(--tint-7); }
.cell-lines { fill: none; stroke: color-mix(in srgb, var(--ink) 24%, transparent); stroke-width: .022; }
.region-lines { fill: none; stroke: var(--line-bold); stroke-width: .07; stroke-linecap: square; }
.frame { fill: none; stroke: var(--line-bold); stroke-width: .11; stroke-linejoin: miter; }

/* ── sheets and the result sheet: the house kit's (house/house.css), and what goes in them ── */
.house-body p { margin: 0; }
.house-body ul { margin: var(--s3) 0 0; padding-left: 20px; display: grid; gap: var(--s2); }
/* (a key named in How to play: its letters in the cap's middle in any face, trimmed to the cap height and baseline, padded evenly; house.css, "fine details") */
.house-body kbd:not(.house-key) { font: 700 12px/1 var(--ui); border: 1px solid currentColor; border-radius: 4px; padding: 3.5px 4px; margin-left: 2px; opacity: .8; text-box: trim-both cap alphabetic; }
:is(.house-sheet, .rb-page) .example { margin: 0 0 var(--s3); display: flex; flex-direction: column; align-items: center; gap: var(--s2); padding: var(--s3); background: var(--desk); border-radius: 10px; }
:is(.house-sheet, .rb-page) .example svg { width: min(100%, 220px); height: auto; filter: drop-shadow(0 6px 8px rgba(var(--shade), .25)); }
:is(.house-sheet, .rb-page) .example figcaption { max-width: 28em; text-align: center; }
/* On a wide screen, How to play opens out: the example beside the rules. */
@media (min-width: 900px) {
  .house-sheet.howto .house-body:not(:has(> .rulebook)) { display: grid; grid-template-columns: 300px 1fr; gap: 0 var(--s4); align-items: start; }
  .house-sheet.howto .house-body > .example { grid-column: 1; grid-row: 1 / span 10; align-self: start; position: sticky; top: 0; margin: 0; }
  .house-sheet.howto .house-body > :not(.example) { grid-column: 2; }
}

/* The result sheet is wide enough for a daily's "Next: 8×8 ★ Medium" beside Share result and Leaderboard. */
.house-scrim.house-scrim-result .house-sheet { --house-sheet-width: 640px; }
/* The result: the game's emblem, the time (in the house's facts), and where it went. */
.win-star { width: 76px; height: 76px; }
.win-best { font-weight: 700; color: var(--good); }
.house-result .house-fact b { font-size: 56px; }
.house-post a { color: var(--accent); font-weight: 600; }
.house-post .quiet.inline { padding: 0; color: var(--accent); text-decoration: underline; font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  .win-star { animation: win-pop calc(var(--m-celebrate, 1000ms) / 2) cubic-bezier(.2, .9, .3, 1.3) both; }
  .win-star svg { animation: win-spin var(--m-celebrate, 1000ms) ease-out both; }
}
@keyframes win-pop { from { scale: .3; opacity: 0; } }
@keyframes win-spin { from { rotate: -50deg; } }

/* ── a puzzle on a touch screen ───────────────────────────────────────── */
/* The page itself never bounces, refreshes, zooms on a double tap or selects
   text under a busy thumb; the board handles its own fingers. */
html:has(.play), body:has(.play) { overscroll-behavior: none; }
.pk .play { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.pk .play a { -webkit-user-select: auto; user-select: auto; }
.pk .dock { padding-bottom: max(var(--s3), env(safe-area-inset-bottom)); }
.pk .moves .btn:last-child { margin-left: var(--s2); }
@media (pointer: coarse) {
  .pk .btn.small, .pk .bar .quiet:not(.wide) { min-width: 44px; }
  .pk .foot a { display: inline-block; padding: 12px 0; }
  .pk .seg > button, .pk .seg > a { min-height: 44px; }
  .pk kbd.house-key { display: none; }
}

/* ── phones ────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .pk .arc-day { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
  .pk .arc-cell.has-pic { grid-template-columns: minmax(0, 1fr); }
  .pk .arc-pic { grid-row: auto; width: 32px; height: 32px; margin-bottom: 4px; }
  .pk .arc-head h2 { min-width: 0; }
}
/* Options: the label above its control only when the row is too narrow for both (the house's own rule at 360px). */
/* Under 400px Options is a gear (its name stays for screen readers). */
@media (max-width: 400px) {
  .pk .bar .options { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .pk .opt-word, .pk .help-word { display: none; }
  .pk .opt-gear { display: inline-flex; }
  /* (a home's bar holds the arrow, How to play, the leaderboard and who you are: the first is a ?) */
  .pk .help-q { display: inline-block; min-width: 28px; text-align: center; font-size: 18px; }
}
@media (max-width: 640px) {
  :root { --t-display: 32px; }
  .pk .bar { gap: var(--s2); }
  .pk .bar .wide, .pk .wide-label { display: none; }
  .pk .narrow-label { display: inline-flex; }
  .pk .glyph { width: 14px; height: 14px; fill: currentColor; }
  .pk .bar .pause, .pk .bar .copy { min-width: 56px; }
  /* (the clock is the Pause button on a phone, D36: its bars and the time; the clock alone shows again once solved) */
  .pk .bar .tools:has(> .pause) > .timer { display: none; }
  /* (and the live number stays on the clock's right, as on a laptop: Pause, which holds the time here, goes just before it; David, 2026-11-21) */
  .pk .bar .tools:has(> .pause) > .counter { order: -2; }
  .pk .bar .tools:has(> .pause) > .pause { order: -1; }
  .pk .bar .pause { gap: 6px; }
  .pk .bar .pause .narrow-time:not([hidden]) { display: inline; font-variant-numeric: tabular-nums; min-width: 4ch; text-align: left; }
  .pk .bar .narrow { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; }
  /* The folio names the puzzle; the bar keeps its heading for screen readers. */
  .pk .where { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .pk .play > .bar .tools { margin-left: auto; }
  .pk .sea { padding: var(--s2) var(--gutter); }
  .pk .paper { padding: 8px 12px; }
  .pk .neatline { margin: 6px 4px; outline-offset: 4px; }
  .pk .folio { font-size: 12px; letter-spacing: .08em; }
  .pk .dock { flex-wrap: wrap; gap: var(--s2) var(--s3); min-height: 112px; align-content: center; }
  .pk .status { flex-basis: 100%; }
  .pk .moves, .pk .result { margin-left: auto; }
  /* Solved: Leaderboard and the next puzzle share the row the moves had, so the dock keeps its size. */
  .pk .result { justify-content: flex-end; width: 100%; }
  .pk .result .btn.primary { flex: 1 1 auto; }
  .pk .stamp { padding: 3px 10px; top: -30px; right: 20px; transform: rotate(-4deg); }
  .pk .stamp-word { font-size: 12px; }
  .pk .stamp-time { font-size: 18px; }
  .house-result .house-fact b { font-size: 48px; }
}

/* Phones on their side: the bar and the dock make a rail down the left, and
   the board gets the full height. */
@media (orientation: landscape) and (max-height: 500px) {
  .pk .play { grid-template-columns: minmax(200px, 240px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "bar water" "dock water"; }
  .pk .play > .bar { grid-area: bar; margin-top: 0; box-shadow: 1px 0 0 var(--paper-edge); align-items: flex-start; flex-direction: column; flex-wrap: nowrap; padding: max(var(--s2), env(safe-area-inset-top)) var(--s3) 0 max(var(--s3), env(safe-area-inset-left)); min-height: 0; }
  .pk .play > .bar .tools { margin-left: 0; flex-wrap: wrap; }
  .pk .play > .water { grid-area: water; flex-direction: row; }
  .pk .play > .dock { grid-area: dock; border-top: 0; border-right: 1px solid var(--paper-edge); padding-inline: var(--s3); flex-direction: column; align-items: stretch; justify-content: safe flex-end; min-height: 0; overflow: auto; }
  /* (the dock's words never give up their lines to the moves under them: a dock too short scrolls) */
  .pk .play > .dock .status { min-height: 0; flex-shrink: 0; }
  /* (Feedback keeps the far end of the bar, which on the rail is its top right, beside the way back,
     so it takes no row of its own from the dock: docs/adr/0068) */
  .pk .play > .bar { position: relative; }
  .pk .play > .bar > .house-fb-btn { position: absolute; top: max(var(--s2), env(safe-area-inset-top)); right: var(--s3); margin-block: calc((var(--bar-h) - var(--tool-h, 36px)) / 2); }
  @media (max-width: 640px) { .pk .play > .bar > .house-fb-btn { margin-block: calc((var(--bar-h) - 44px) / 2); } }
  /* (the rail is as narrow as a phone's bar, so the die and the arrow touch there too, and Feedback
     beside them keeps its word: docs/adr/0100) */
  .pk .play > .bar > .house-way { gap: 0; }
  .pk .zoom { flex-direction: column-reverse; justify-content: flex-start; padding: var(--s2) max(var(--s2), env(safe-area-inset-right)) var(--s2) 0; }
  .pk .tray { align-items: center; padding: var(--s2) max(var(--s2), env(safe-area-inset-right)) var(--s2) 0; }
  .pk .bar .narrow { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
  .pk .play > .dock .moves, .pk .play > .dock .result { margin-left: 0; flex-wrap: wrap; }
  .pk .play .result .btn.primary { flex: 1 1 100%; }
  /* The rail's tools on a fixed grid of two rows: the clock with the live number on its right, then
     Pause (or Copy) · ? · Options (a brainteaser's count goes in a row above: brainteasers.css) (David, 2026-11-21: on a phone on its
     side they fell into four rows, the number alone under Options). */
  /* (Pause's column gives a little when the rail is narrow, so ? stays a finger square inside the rail, off the board) */
  .pk .play > .bar .tools { display: grid; grid-template-columns: minmax(4.2em, auto) 44px minmax(0, 1fr); grid-template-areas: "time pts ." "pause help opts"; align-items: center; gap: var(--s1) var(--s2); }
  .pk .play > .bar .tools > .timer { grid-area: time; }
  .pk .play > .bar .tools > .pause, .pk .play > .bar .tools > .copy { grid-area: pause; }
  .pk .play > .bar .tools > .narrow { grid-area: help; }
  .pk .play > .bar .tools > .options { grid-area: opts; justify-self: start; }
  .pk .play > .bar .tools > .quiet, .pk .play > .bar .timer { margin: 0; padding-left: 0; padding-right: 0; min-width: 0; justify-content: flex-start; text-align: left; }
  .pk .play > .bar .tools > .narrow { justify-content: center; min-width: 44px; }
  /* (the live number sits right of the clock, as it does upright: ADR 0085) */
  .pk .play > .bar .tools > .pts { grid-area: pts; justify-self: start; margin: 0; }
  .pk .play > .bar .pause .narrow-label, .pk .play > .bar .copy .narrow-label, .pk .play > .bar .pause .narrow-time { display: none; }
  /* (the rail has room for the clock beside Pause) */
  .pk .play > .bar .tools:has(> .pause) > .timer { display: revert; }
  .pk .play > .bar .pause .wide-label, .pk .play > .bar .copy .wide-label { display: inline; }
  .pk .play > .dock .moves { flex-wrap: wrap; gap: var(--s2); }
  .pk .play > .dock kbd { display: none; }
  .pk .play > .dock .moves .btn:last-child { margin-left: 0; }
  .pk .stamp { padding: 3px 10px; top: -30px; right: 20px; transform: rotate(-4deg); }
  .pk .stamp-word { font-size: 12px; }
  .pk .stamp-time { font-size: 18px; }
  .pk .bar .wide { display: none; }
  .pk .play > .bar .tools > .quiet.wide { display: none; }
  .house-result .house-fact b { font-size: 30px; }
  .house-result .house-head { padding-bottom: 0; }
  .house-result .house-foot { padding-top: var(--s2); padding-bottom: var(--s3); }
  /* A short screen on its side keeps the time and the buttons in view; the emblem is on the stamp already. */
  .house-result .house-emblem { display: none; }
}

/* Reduced motion: nothing travels or celebrates; the house's short fades (sheets, toasts) stay. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  *:not([class*="house-"]), *::before, *::after { animation: none !important; }
}

/* ── Give up, asking in place (a brainteaser's: game.giveUp) ─────────────── */
/* The word and its question share one place, so the dock doesn't move as it asks. */
.pk .askbtn { display: inline-grid; place-items: center; }
.pk .askbtn > span { grid-area: 1 / 1; white-space: nowrap; }
.pk .askbtn:not(.ask) .q, .pk .askbtn.ask .lab { visibility: hidden; }
.pk .askbtn.ask {
  background: var(--bad); color: var(--paper-2); border-radius: var(--radius); text-decoration: none; font-weight: 700;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 35%, transparent);
}
.pk .askbtn.ask:hover { color: var(--paper-2); text-decoration: none; }
/* (on a narrow phone, Undo, Redo, Restart and Give up share two rows rather than run off the side) */
@media (max-width: 400px) { .pk .moves { flex-wrap: wrap; flex-shrink: 1; min-width: 0; max-width: 100%; justify-content: flex-end; row-gap: var(--s2); } }

/* No connection (docs/adr/0092): one quiet word on the folio, before the size. */
.pk .folio .offline { font-weight: 700; }
.pk .folio .offline::after { content: ' · '; font-weight: 400; }
