/* ---------- tokens: "Candy Pop+" building-block brights, high contrast ---------- */
:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #FAF7FD;
  --tray: #F3ECFA;
  --ink: #1E1033;
  --ink-2: #5A4A72;
  --line: #E6DDF0;
  --cell-w: #DCE9F8;
  --cell-m: #E8DEF7;
  --cell-d: #F1EAE2;
  --cell-ink: #2A1A40;
  --hole: #1E1033;
  --hole-ink: #FFFFFF;
  --draw: #CDBFDD;
  --accent: #FF2D6F;
  --p-flag: #FF2D6F;
  --p-crook: #2F7BFF;
  --p-plank: #FFC400;
  --p-boot: #FF5A3C;
  --p-hook: #00B8E0;
  --p-sprig: #18C77D;
  --p-bolt: #A24DFF;
  --p-cup: #FF8A00;
  --p-elbow: #00B8E0;
  --p-stairs: #6F45F5;
  --p-tee: #5CC93A;
  --radius: 10px;
  --gap: 5px;
  --shadow: 0 1px 0 rgb(30 16 51 / .04), 0 18px 40px -22px rgb(30 16 51 / .35);
  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
/* dark: true blacks and neutral greys, so the pieces carry all the colour */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A0A0B;
    --surface: #151517;
    --surface-2: #1C1C1F;
    --tray: #151517;
    --ink: #F7F7F8;
    --ink-2: #A9A9B2;
    --line: #2A2A2E;
    --cell-w: #1F2630;
    --cell-m: #29232F;
    --cell-d: #232326;
    --cell-ink: #EDEDF0;
    --hole: #F7F7F8;
    --hole-ink: #0A0A0B;
    --draw: #3D3D44;
    --accent: #FF5C8F;
    --p-flag: #FF5C8F;
    --p-crook: #5C97FF;
    --p-plank: #FFD43B;
    --p-boot: #FF7A5C;
    --p-hook: #33D1F0;
    --p-sprig: #3DE39A;
    --p-bolt: #BB78FF;
    --p-cup: #FFA033;
    --p-elbow: #33D1F0;
    --p-stairs: #8E6BFF;
    --p-tee: #86E05C;
    --shadow: 0 1px 0 rgb(0 0 0 / .4), 0 18px 40px -20px rgb(0 0 0 / .9);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
/* no double-tap zoom (or its tap delay) on buttons that get tapped twice, like Clear board */
button, a { touch-action: manipulation; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
h1, h2 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; }
.app {
  max-width: 480px;
  margin: 0 auto;
  /* clear of the notch and home bar, including on a phone held sideways */
  padding:
    max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
/* Board, pieces, then the date and buttons. app.js sizes the board so all of it fits on one screen,
   and on short screens moves the pieces beside the board (the data-layout layouts below). */
main {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "board" "tray" "actions";
}

/* ---------- header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0 18px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; min-width: 0; }
/* the mark takes its colours from the palette, so it changes with light and dark */
.brand-mark { width: 42px; height: 42px; flex: none; }
.bm-flag { fill: var(--p-flag); }
.bm-crook { fill: var(--p-crook); }
.bm-plank { fill: var(--p-plank); }
.bm-hole { fill: var(--hole); }
.brand-name { display: grid; font-size: 1.32rem; line-height: .9; font-weight: 800; letter-spacing: -0.03em; font-variation-settings: "opsz" 96; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn {
  position: relative;
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink);
}
.icon-btn svg { width: 22px; height: 22px; }
/* the top bar's buttons and links answer taps a little beyond their edges (48px tall in all) */
.icon-btn::before, .board-switch a::before { content: ""; position: absolute; inset: -4px -2px; }
.board-switch a::before { inset: -8px 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.board-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); margin-right: 2px; }
.board-switch a { position: relative; text-decoration: none; color: var(--ink-2); font-weight: 700; font-size: .9rem; padding: 7px 14px; border-radius: 999px; }
.board-switch a[aria-current="page"] { background: var(--accent); color: #fff; }
/* phones: everything in the top bar tightens so the logo, Full/Quick and both buttons share one row */
@media (max-width: 420px) {
  .topbar { gap: 6px; padding-bottom: 14px; }
  .brand { gap: 7px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-name { font-size: 1.14rem; }
  .top-actions { gap: 4px; }
  .icon-btn svg { width: 21px; height: 21px; }
  .board-switch { margin-right: 0; }
  main { gap: 12px; }
  .board-switch a { font-size: .82rem; padding: 6px 9px; }
}
/* the narrowest phones (320px, or a bigger phone with its display zoomed) */
@media (max-width: 359px) {
  .brand-mark { width: 32px; height: 32px; }
  .brand-name { font-size: 1.02rem; }
  .board-switch a { padding: 6px 8px; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0 0 4px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- board ---------- */
.board {
  grid-area: board;
  justify-self: center;
  width: 100%; /* app.js sets the width that fits the screen */
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr));
  gap: var(--gap);
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.row { display: contents; }
.cell {
  --base: var(--cell-d);
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--fill, var(--base));
  color: var(--cell-ink);
  border-radius: var(--r-tl, var(--radius)) var(--r-tr, var(--radius)) var(--r-br, var(--radius)) var(--r-bl, var(--radius));
  cursor: crosshair;
  outline-offset: 1px;
}
.cell.k-weekday { --base: var(--cell-w); }
.cell.k-month { --base: var(--cell-m); }
/* label sizes follow the square size, so the 6-wide Mini and 10-wide full board both read well */
.label {
  font-weight: 700; font-size: clamp(9px, calc(100cqi / var(--cols, 6) * .25), 13px); letter-spacing: .04em; text-transform: uppercase;
  pointer-events: none; transition: opacity .12s;
}
.k-day .label { font-size: clamp(12px, calc(100cqi / var(--cols, 6) * .33), 19px); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; font-weight: 750; }
[data-board="full"] .app { max-width: 760px; }
[data-board="full"] .board { --gap: 4px; --radius: 9px; padding: 8px; border-radius: 20px; }
/* on its side (phones) the full board is 5 columns by 10 rows */
.board.tilted { --radius: 8px; border-radius: 18px; }
.cell.hole { --fill: var(--hole); color: var(--hole-ink); cursor: not-allowed; }
.cell.filled { cursor: pointer; }
.cell.filled .label, .cell.match .label { opacity: 0; }
.cell.drawing:not(.match) { --fill: var(--draw); }
.cell.drawing:not(.match) .label { opacity: .45; }
.cell[data-piece="flag"]  { --fill: var(--p-flag); }
.cell[data-piece="crook"] { --fill: var(--p-crook); }
.cell[data-piece="plank"] { --fill: var(--p-plank); }
.cell[data-piece="boot"]  { --fill: var(--p-boot); }
.cell[data-piece="hook"]  { --fill: var(--p-hook); }
.cell[data-piece="sprig"]  { --fill: var(--p-sprig); }
.cell[data-piece="bolt"]   { --fill: var(--p-bolt); }
.cell[data-piece="cup"]    { --fill: var(--p-cup); }
.cell[data-piece="elbow"]  { --fill: var(--p-elbow); }
.cell[data-piece="stairs"] { --fill: var(--p-stairs); }
.cell[data-piece="tee"]    { --fill: var(--p-tee); }
/* connectors fill the gaps between squares of the same piece so pieces read as one shape;
   they overlap each square by 1px so no hairline shows when the grid lands on fractional pixels */
.cell.jr::after, .cell.jb::before { content: ""; position: absolute; background: var(--fill); pointer-events: none; }
.cell.jr::after { top: 0; left: calc(100% - 1px); width: calc(var(--gap) + 2px); height: 100%; }
.cell.jr.jc::after { height: calc(100% + var(--gap) + 1px); }
.cell.jb::before { top: calc(100% - 1px); left: 0; width: 100%; height: calc(var(--gap) + 2px); }
.cell:focus-visible { outline: 3px solid var(--accent); z-index: 2; }

/* ---------- status + tray ---------- */
/* the puzzle's date, then its solution count and (for today's puzzle) how long is left of it */
.meta { flex: 1 1 120px; min-width: 0; margin: 0; display: grid; gap: 1px; font-size: .85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.meta .when { color: var(--ink); font-weight: 700; font-size: .95rem; }
/* "6 solutions" and "· 10h 27m left" each stay whole, so a narrow screen breaks the line between them */
#solutions, #time-left { display: inline-block; white-space: nowrap; }
#time-left:not(:empty)::before { content: "·"; margin: 0 .3em; }
/* the pieces sit together in one recessed toy tray */
.tray-box { grid-area: tray; background: var(--tray); border-radius: 22px; padding: 8px; }
.tray { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--tray-cols, 5), minmax(0, 1fr)); gap: 2px; }
@media (min-width: 600px) { .tray { grid-template-columns: repeat(var(--tray-cols-wide, 5), minmax(0, 1fr)); } }
.tray li { display: flex; min-width: 0; }
.tray-item {
  --pc: var(--ink);
  position: relative; width: 100%; min-height: 54px; /* room for a piece turned four squares tall */
  font: inherit; color: inherit; cursor: grab;
  background: transparent; border: 0; border-radius: 14px; padding: 6px 2px;
  display: grid; place-items: center;
  transition: transform .18s ease, opacity .2s, background-color .18s;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.tray-item:disabled { cursor: default; }
/* hover colours only where there's a mouse: on a phone they would stick after a tap */
@media (hover: hover) {
  .icon-btn:hover { border-color: var(--ink-2); }
  .tray-item:hover:not(:disabled) { background: color-mix(in srgb, var(--surface) 55%, transparent); }
  .btn.ghost:hover { border-color: var(--ink-2); }
}
.tray-item.dragging { opacity: .3; }
/* the floating copy of a piece while it's dragged */
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; opacity: .8; }
.drag-ghost i { position: absolute; border-radius: var(--radius); background: var(--pc); }
.drag-ghost.fits { opacity: .35; }
.drag-ghost[data-piece="flag"]  { --pc: var(--p-flag); }
.drag-ghost[data-piece="crook"] { --pc: var(--p-crook); }
.drag-ghost[data-piece="plank"] { --pc: var(--p-plank); }
.drag-ghost[data-piece="boot"]  { --pc: var(--p-boot); }
.drag-ghost[data-piece="hook"]  { --pc: var(--p-hook); }
.drag-ghost[data-piece="sprig"]  { --pc: var(--p-sprig); }
.drag-ghost[data-piece="bolt"]   { --pc: var(--p-bolt); }
.drag-ghost[data-piece="cup"]    { --pc: var(--p-cup); }
.drag-ghost[data-piece="elbow"]  { --pc: var(--p-elbow); }
.drag-ghost[data-piece="stairs"] { --pc: var(--p-stairs); }
.drag-ghost[data-piece="tee"]    { --pc: var(--p-tee); }
[data-board="full"] .drag-ghost i { border-radius: 9px; }
.tray-item[data-piece="flag"]  { --pc: var(--p-flag); }
.tray-item[data-piece="crook"] { --pc: var(--p-crook); }
.tray-item[data-piece="plank"] { --pc: var(--p-plank); }
.tray-item[data-piece="boot"]  { --pc: var(--p-boot); }
.tray-item[data-piece="hook"]  { --pc: var(--p-hook); }
.tray-item[data-piece="sprig"]  { --pc: var(--p-sprig); }
.tray-item[data-piece="bolt"]   { --pc: var(--p-bolt); }
.tray-item[data-piece="cup"]    { --pc: var(--p-cup); }
.tray-item[data-piece="elbow"]  { --pc: var(--p-elbow); }
.tray-item[data-piece="stairs"] { --pc: var(--p-stairs); }
.tray-item[data-piece="tee"]    { --pc: var(--p-tee); }
/* room for a piece turned four squares tall */
.mini { display: grid; gap: 2px; grid-template-columns: repeat(var(--w), 9px); grid-auto-rows: 9px; }
.mini i { border-radius: 3px; }
.mini i.on { background: var(--pc); }
.tray-item.used { opacity: .18; }
.tray-item.hot { transform: scale(1.15); }

/* ---------- buttons ---------- */
/* date and solution count on the left, the board's buttons on the right */
.actions { grid-area: actions; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 10px; }
.action-buttons { flex: none; display: flex; gap: 8px; margin-left: auto; }
/* Clear board keeps one width whatever it says, so arming it never reflows the row */
#btn-clear { display: inline-flex; flex-direction: column; align-items: center; }
#btn-clear::before, #btn-clear::after { content: "Clear board"; height: 0; overflow: hidden; visibility: hidden; }
#btn-clear::after { content: "Tap to clear"; }
.btn {
  appearance: none; cursor: pointer; font-weight: 700; font-size: .98rem;
  padding: 12px 22px; border-radius: 999px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--bg); min-height: 46px;
  transition: transform .1s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.armed { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn[disabled] { opacity: .4; cursor: default; }
.btn.wide { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 650; }

/* ---------- dialogs ---------- */
dialog {
  border: 0; padding: 0; border-radius: 22px;
  width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: hidden;
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .45);
}
dialog::backdrop { background: rgb(21 19 15 / .5); backdrop-filter: blur(3px); }
dialog[open] { display: flex; flex-direction: column; animation: rise .22s ease-out; }
/* a dialog taller than the screen scrolls inside itself; the archive's calendar is the part that gives */
.dlg { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 22px 20px; display: flex; flex-direction: column; gap: 16px; }
.dlg > * { flex: none; }
.dlg h2 { font-size: 1.6rem; font-weight: 780; }
.fine { margin: 0; font-size: .84rem; color: var(--ink-2); }
.stat-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin: 0; }
.stat-row div, .stat-grid div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.stat-row dt, .stat-grid dt { font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.stat-row dd, .stat-grid dd { margin: 2px 0 0; font-size: 1.45rem; font-weight: 780; font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; }
.solved-actions { display: grid; gap: 10px; }
.next { margin: 0; text-align: center; color: var(--ink-2); font-size: .9rem; }
.next strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* archive calendar */
.month { display: grid; gap: 8px; }
.month + .month { margin-top: 18px; }
.month h3 { margin: 0; font-size: 1rem; font-weight: 750; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { font-size: .7rem; font-weight: 700; color: var(--ink-2); text-align: center; padding-bottom: 2px; }
.cal .day {
  aspect-ratio: 1; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums;
  cursor: pointer; color: var(--ink); position: relative; padding: 0; text-decoration: none;
}
.cal .day.off { opacity: .3; cursor: default; background: transparent; }
.cal .day.started { border-color: var(--ink-2); }
.cal .day.solved { background: var(--p-boot); border-color: var(--p-boot); color: #fff; }
.cal .day.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal .day.current::after { content: ""; position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.dlg > #archive-body { flex: 0 1 auto; min-height: 8rem; max-height: 56dvh; overflow: auto; overscroll-behavior: contain; padding-right: 2px; }

/* toast: centred, and up to the screen's width less a margin before its text wraps */
.toast {
  position: fixed; left: 16px; right: 16px; margin-inline: auto; width: fit-content; max-width: 420px;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px)); transform: translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 20px; font-weight: 650; font-size: .9rem; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 10;
}
.toast.show { opacity: 1; transform: none; }
.noscript { text-align: center; padding: 40px 16px; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes pop { 0% { transform: scale(.82); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@keyframes reveal { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes settle { 0% { transform: translateY(0); } 40% { transform: translateY(-5px); } 100% { transform: translateY(0); } }
.cell.pop { animation: pop .28s ease-out; }
.cell.shake { animation: shake .32s ease-in-out; }
.board.solved .cell.hole { animation: reveal .7s ease-out forwards; animation-delay: .35s; z-index: 1; }
.board.solved .cell.filled { animation: settle .45s ease-out both; animation-delay: var(--delay, 0s); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (min-width: 520px) {
  .app { padding-top: 28px; }
  main { gap: 16px; }
}

/* ---------- pieces beside the board (app.js picks the layout that gives the biggest squares) ---------- */
/* "side": the sideways full board on a phone, pieces in two columns down its right, buttons below */
html[data-layout="side"] main {
  grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr);
  grid-template-areas: ". board tray ." "actions actions actions actions";
  column-gap: 0;
}
html[data-layout="side"] .tray-box { width: 116px; margin-left: 10px; display: flex; padding: 6px; }
html[data-layout="side"] .tray { flex: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; }
@media (max-width: 359px) {
  html[data-layout="side"] .tray-box { width: 100px; margin-left: 8px; padding: 4px; }
  html[data-layout="side"] .mini { grid-template-columns: repeat(var(--w), 8px); grid-auto-rows: 8px; }
}
/* "wide": a phone held sideways, with the pieces and buttons in a column right of the board: five
   pieces to a row, or four in a slimmer column ("wide-slim") when that leaves a bigger board */
html[data-layout^="wide"] .app { max-width: 1040px; }
html[data-layout^="wide"] main {
  grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: ". board tray ." ". board actions .";
  column-gap: 0;
  row-gap: 10px;
}
html[data-layout^="wide"] .board { align-self: start; }
html[data-layout^="wide"] .tray-box, html[data-layout^="wide"] .actions { width: 250px; margin-left: 16px; }
html[data-layout^="wide"] .tray-box { padding: 6px; }
html[data-layout^="wide"] .tray { grid-template-columns: repeat(5, minmax(0, 1fr)); }
html[data-layout^="wide"] .tray-item { min-height: 46px; padding-block: 4px; }
html[data-layout^="wide"] .mini { grid-template-columns: repeat(var(--w), 8px); grid-auto-rows: 8px; }
html[data-layout^="wide"] .actions { align-self: start; }
html[data-layout="wide-slim"] .tray-box, html[data-layout="wide-slim"] .actions { width: 214px; }
html[data-layout="wide-slim"] .tray { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- small screens ---------- */
/* the narrowest phones: the date fits on one line beside Clear board */
@media (max-width: 359px) {
  .meta { font-size: .8rem; }
  .meta .when { font-size: .84rem; }
  .btn { padding-inline: 16px; }
}
/* short screens: the dialogs tighten up */
@media (max-height: 560px) {
  .dlg { padding: 18px 18px 16px; gap: 12px; }
  .dlg h2 { font-size: 1.35rem; }
  .stat-row dd, .stat-grid dd { font-size: 1.25rem; }
}
/* a phone held sideways: a slimmer top bar leaves more height for the board */
@media (orientation: landscape) and (max-height: 500px) {
  .app { padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .topbar { padding: 0 0 10px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: 1.1rem; }
  .btn { min-height: 42px; padding-block: 9px; }
  /* dialogs go wider and shorter: the six statistics sit in two rows of three */
  dialog { width: min(560px, calc(100vw - 24px)); }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .cal .day { aspect-ratio: auto; height: 36px; }
}
