/*
 * pipes.games — colours, the frame, the game card, the board, the text pages. Taken from the prototype
 * (prototype/style.css, which follows minesweeper-online.games), with the parts of the site the prototype did
 * not have: the text under the game, the footer, How to play with its examples, the privacy page, the link
 * to a puzzle and the toast.
 * Themes: the system chooses (prefers-color-scheme) unless the visitor picks one (data-theme on <html>).
 * The board is styled by its class .pboard, so the examples of How to play look like the game (js/board.js).
 */
:root {
  --page: #f4f3ef;
  --card: #ffffff;
  --text: #1e2228;
  --muted: #646b78;
  --line: #e3e1db;
  --accent: #1f5fd6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(31, 95, 214, 0.09);
  --ok: #1f8a4c;
  --ok-soft: rgba(31, 138, 76, 0.1);
  --shadow: 0 1px 2px rgba(20, 30, 50, 0.06), 0 8px 24px rgba(20, 30, 50, 0.07);
  --side: #ebe9e3; --side-hl: #e0ddd5; --side-line: #dcd9d1;

  /* the board */
  --grid: #dde1e6;
  --tile: #ffffff;
  --tile-locked: #d9e4f2;
  --pipe: #3b4654;
  --pipe-empty: #cfd6df;
  --water: #2f8cf0;
  --water-won: #1a73dc;
  --lamp-off: #bcc4ce;
  --lamp-on: #ffc93c;
  --halo: #ffcf4d;
  --lamp-text: #a86f00;
  --pump: #1659c7;
  --cursor: #1f5fd6;
  --hl: rgba(31, 95, 214, 0.2); --bad: rgba(214, 48, 49, 0.2);
  /* colour mode: the networks (0 is the usual water blue) and two colours meeting */
  --c0: #2f8cf0; --c1: #f08424; --c2: #9b5de5; --mix: #9a8c80; --lamp-tint: 32%;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #121418; --card: #1b1e23; --text: #e6e8eb; --muted: #9aa3ad; --line: #2b3038;
    --accent: #8fb0ff; --accent-ink: #0f1420; --accent-soft: rgba(143, 176, 255, 0.13);
    --ok: #74cf95; --ok-soft: rgba(116, 207, 149, 0.13);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --side: #1a1d22; --side-hl: #252931; --side-line: #2a2e36;
    --grid: #2f343c; --tile: #242931; --tile-locked: #2d3b4f;
    --pipe: #6f7a89; --pipe-empty: #1a1d22; --water: #3b95ff; --water-won: #5aa8ff;
    --lamp-off: #4d5563; --lamp-on: #ffcf4a; --halo: #ffcf4a; --lamp-text: #ffcf4a; --pump: #3b7dff; --cursor: #8fb0ff;
    --c0: #3b95ff; --c1: #ff9a3d; --c2: #b383ff; --mix: #7d7268; --lamp-tint: 68%;
    --hl: rgba(143, 176, 255, 0.26); --bad: rgba(255, 107, 107, 0.24);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #121418; --card: #1b1e23; --text: #e6e8eb; --muted: #9aa3ad; --line: #2b3038;
  --accent: #8fb0ff; --accent-ink: #0f1420; --accent-soft: rgba(143, 176, 255, 0.13);
  --ok: #74cf95; --ok-soft: rgba(116, 207, 149, 0.13);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --side: #1a1d22; --side-hl: #252931; --side-line: #2a2e36;
  --grid: #2f343c; --tile: #242931; --tile-locked: #2d3b4f;
  --pipe: #6f7a89; --pipe-empty: #1a1d22; --water: #3b95ff; --water-won: #5aa8ff;
  --lamp-off: #4d5563; --lamp-on: #ffcf4a; --halo: #ffcf4a; --lamp-text: #ffcf4a; --pump: #3b7dff; --cursor: #8fb0ff;
  --c0: #3b95ff; --c1: #ff9a3d; --c2: #b383ff; --mix: #7d7268; --lamp-tint: 68%;
  --hl: rgba(143, 176, 255, 0.26); --bad: rgba(255, 107, 107, 0.24);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 16px/1.55 Rubik, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* Rubik has no Japanese: the system font there (docs/plan.md, section 8). Rubik looks heavier than system-ui,
   so the weights are a step lighter than on minesweeper-online.games (500 for labels, 600 for numbers). */
body:lang(ja) { font-family: system-ui, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; line-height: 1.75; line-break: strict; word-break: auto-phrase; }
a { color: var(--accent); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex: none; }
[hidden] { display: none !important; }

/* ===================================================================== frame */
.app { display: grid; grid-template-columns: 284px minmax(0, 1fr); min-height: 100vh; }
main { min-width: 0; padding: 0 24px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 19px; letter-spacing: -0.01em; color: var(--text); text-decoration: none; }
.logo { width: 30px; height: 30px; }
/* The logo keeps its own colours in both themes (same as favicon.svg): a pipe rising and turning to a lit lamp,
   the P of pipes.games; one sign for every language. */
.logo-bg { fill: #1f5fd6; }
.logo-pipe { fill: none; stroke: #fff; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.logo-lamp { fill: #ffc93c; stroke: #fff; stroke-width: 2; }

.side { position: sticky; top: 0; height: 100vh; background: var(--side); border-right: 1px solid var(--side-line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 24px; overflow-y: auto; }
.side .brand { padding: 0 8px; }
.side-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 500; padding: 0 10px; margin: 0 0 6px; }
.sizes { display: flex; flex-direction: column; gap: 2px; }
.sizes a { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 8px; padding: 8px 10px; border-radius: 10px; color: var(--text); text-decoration: none; line-height: 1.35; }
.sizes a b { font-weight: 500; }
.sizes a small { color: var(--muted); font-size: 12.5px; grid-column: 1; }
.sizes a em { font-style: normal; color: var(--muted); font-size: 13px; grid-row: 1 / span 2; grid-column: 2; align-self: center; font-variant-numeric: tabular-nums; }
.sizes a:hover { background: var(--side-hl); }
.sizes a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.sizes a[aria-current="page"] small, .sizes a[aria-current="page"] em { color: inherit; opacity: 0.75; }

/* segmented control: difficulty, theme */
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--side-hl); }
/* the text of a button not chosen: muted, but a quarter towards the text colour — plain --muted on --side-hl was
   about 4:1, under the 4.5:1 of WCAG AA (PageSpeed, 02.11.2026: the theme switch in the footer) */
.seg button { flex: 1; padding: 6px 8px; border-radius: 8px; font-weight: 400; font-size: 14.5px; color: color-mix(in srgb, var(--muted) 75%, var(--text)); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.seg-sm button { padding: 4px 10px; font-size: 13px; }

.switch { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 6px 10px; border-radius: 10px; cursor: pointer; }
.switch:hover { background: var(--side-hl); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 36px; height: 20px; flex: none; border-radius: 999px; background: var(--side-line); transition: background .15s; }
.switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch-text { display: flex; flex-direction: column; line-height: 1.3; }
.switch-text b { font-weight: 500; }
.switch-text small { color: var(--muted); font-size: 12.5px; }

.links { display: flex; flex-direction: column; gap: 2px; }
.links a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.links a:hover, .links a[aria-current] { background: var(--side-hl); }
.links svg { width: 20px; height: 20px; }

/* ☰ of the phone's top bar and ✕ of its drawer: only below 820 px */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; }
.icon-btn:hover { background: var(--side-hl); }
.icon-btn svg { width: 22px; height: 22px; }
.topbar, .drawer-close, .scrim { display: none; }

/* ===================================================================== the card */
.stage { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 0; }
.stage-in { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.card {
  --pad: 14px;
  position: relative;
  width: min(100%, 640px, max(340px, calc(100vh - 150px)));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: var(--pad);
}
.card-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 4px 10px; }
.counter { display: inline-flex; align-items: center; gap: 6px; font-size: 20px; min-width: 0; font-variant-numeric: tabular-nums; }
.counter b { font-weight: 600; }
.counter svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.timer-box { justify-self: end; }
.lamps.full, .lamps.full svg { color: var(--lamp-text); stroke: var(--lamp-text); }
.face { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); transition: transform .08s; }
.face:hover { filter: brightness(0.96); }
.face:active { transform: scale(0.93); }
.face svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.card-foot { display: flex; align-items: center; gap: 4px; padding: 10px 0 0; }
.foot-gap { flex: 1; }
.tool { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 10px; color: var(--muted); font-weight: 400; font-size: 15px; }
.tool:hover { background: var(--accent-soft); color: var(--text); }
.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool-sq { width: 36px; padding: 0; justify-content: center; }
.tool[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.tool:disabled { opacity: 0.4; pointer-events: none; }

/* After a win the result takes the place of the tools (as on minesweeper-online.games) */
.result { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--ok-soft); }
.result-text { margin: 0; }
.result-text b { color: var(--ok); font-weight: 600; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { padding: 7px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-weight: 500; }
.btn:hover { background: var(--accent-soft); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }

.toast { position: absolute; left: 50%; bottom: 16px; transform: translate(-50%, 8px); padding: 8px 14px; border-radius: 10px; background: var(--text); color: var(--page);
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* a puzzle from a link (#p=…): a tag above the card and the way back to new puzzles */
.link-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.link-tag { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 500; font-size: 14px; }
.link-btn { font-weight: 500; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }

/* ===================================================================== the board */
#board {
  display: block;
  width: 100%;
  height: auto;
  /* square until js/game.js draws the board (an empty SVG is 150 px high: the text under the card jumped down,
     PageSpeed 02.11.2026: layout shift 0.168), then the ratio of its viewBox */
  aspect-ratio: auto 1 / 1;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.pboard .bg { fill: var(--tile); stroke: var(--grid); stroke-width: 1.5; transition: fill .15s; }
.pboard .bg.locked { fill: var(--tile-locked); }
/* the examples of How to play: the tile a technique decides, and what a rule forbids */
.pboard .bg.hl { fill: var(--hl); }
.pboard .bg.bad { fill: var(--bad); }
.pboard .frame { fill: none; stroke: var(--grid); stroke-width: 3; }
/* Wrap: the rect's outline starts at the top-left corner and every side is a whole number of cells (60 units),
   so a 15-unit dash period shifted by half a dash puts a dash centred on every corner (the same L-shaped cap
   at all four) and on every grid line between them. */
.pboard .frame.wrap { stroke: var(--muted); stroke-dasharray: 9 6; stroke-dashoffset: 4.5; stroke-linejoin: miter; opacity: .6; }
.pboard .tile { transition: transform .14s ease-out; }
#board .tile { cursor: pointer; }
.pboard .tile path { fill: none !important; } /* the pump's drop is a filled path */
.pboard .o { stroke: var(--pipe); fill: var(--pipe); }
/* Water: newly joined pipes fill one after another (--s is set per tile in refresh). */
.pboard .f { stroke: var(--pipe-empty); fill: var(--pipe-empty); transition: stroke .1s, fill .1s; }
.pboard .tile.on .f { stroke: var(--water); fill: var(--water); transition: stroke .2s, fill .2s; transition-delay: var(--s, 0ms); }
.pboard:not(.colors).won .tile .f { stroke: var(--water-won); fill: var(--water-won); transition: stroke .25s, fill .25s; transition-delay: var(--d, 0ms); }

/* Colour mode: water takes the colour of its pump; lamps show their colour pale until their own water comes. */
.pboard .tile.on.w1 .f { stroke: var(--c1); fill: var(--c1); }
.pboard .tile.on.w2 .f { stroke: var(--c2); fill: var(--c2); }
.pboard .tile.mix .f { stroke: var(--mix); fill: var(--mix); }
.pboard .pump.c1 .pump-body { fill: var(--c1); }
.pboard .pump.c2 .pump-body { fill: var(--c2); }
.pboard .pump.c0 .pump-body { fill: var(--c0); }
.pboard .lamp.c0 { fill: color-mix(in srgb, var(--c0) var(--lamp-tint), var(--tile)); }
.pboard .lamp.c1 { fill: color-mix(in srgb, var(--c1) var(--lamp-tint), var(--tile)); }
.pboard .lamp.c2 { fill: color-mix(in srgb, var(--c2) var(--lamp-tint), var(--tile)); }
.pboard .lamp.c0.lit { fill: var(--c0); }
.pboard .lamp.c1.lit { fill: var(--c1); }
.pboard .lamp.c2.lit { fill: var(--c2); }
.pboard .glow-a.g0, .pboard .glow-b.g0 { stop-color: var(--c0); }
.pboard .glow-a.g1, .pboard .glow-b.g1 { stop-color: var(--c1); }
.pboard .glow-a.g2, .pboard .glow-b.g2 { stop-color: var(--c2); }
.pboard .halo { opacity: 0; transition: opacity .1s; pointer-events: none; }
.pboard .halo.lit { opacity: 1; transition: opacity .35s; transition-delay: var(--s, 0ms); }
.pboard .glow-a { stop-color: var(--halo); stop-opacity: .6; }
.pboard .glow-b { stop-color: var(--halo); stop-opacity: 0; }
.pboard.colors .glow-a { stop-opacity: .45; }
.pboard .lamp { fill: var(--lamp-off); stroke: var(--pipe); stroke-width: 2.5; transition: fill .1s; pointer-events: none; }
.pboard .lamp.lit { fill: var(--lamp-on); transition: fill .25s; transition-delay: var(--s, 0ms); }
.pboard.won .lamp { animation: pop .5s ease-out both; animation-delay: var(--d, 0ms); transform-box: fill-box; transform-origin: center; }
@keyframes pop { 45% { transform: scale(1.45); } }
.pboard .pump { pointer-events: none; }
.pboard .pump-body { fill: var(--pump); stroke: var(--pipe); stroke-width: 2.5; }
.pboard .pump-drop { fill: #fff; }
.pboard .cursor { fill: none; stroke: var(--cursor); stroke-width: 4; pointer-events: none; }
.pboard.solving { opacity: .35; }

/* ===================================================================== text */
.content { max-width: 720px; width: 100%; margin: 0 auto 48px; }
.content section { margin-bottom: 28px; }
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 14px; letter-spacing: -0.015em; font-weight: 600; }
h2 { font-size: 23px; line-height: 1.25; margin: 32px 0 10px; letter-spacing: -0.01em; font-weight: 600; }
h3 { font-size: 18px; margin: 22px 0 8px; font-weight: 600; }
.content h2:first-child { margin-top: 0; }
p, ul { margin: 0 0 12px; }
ul { padding-left: 22px; }
li { margin-bottom: 4px; }
kbd { font: inherit; font-size: 0.9em; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--card); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.lead { font-size: 18px; color: var(--muted); }
.more { margin-top: 8px; }
.more a, .next-link a { font-weight: 500; text-decoration: none; }
.more a:hover, .next-link a:hover { text-decoration: underline; }
.meta { color: var(--muted); font-size: 14px; margin-top: 24px; }

.page-text { max-width: 720px; width: 100%; margin: 0 auto; padding: 48px 0 32px; flex: 1; }

/* How to play: examples drawn by js/howto.js on the board of the game */
.ex { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 24px; margin: 16px 0 24px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.ex-board { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
svg.mini { display: block; max-width: 100%; height: auto; }
.ex figcaption { flex-basis: 100%; font-size: 15px; color: var(--muted); }

/* ===================================================================== Pipes of the day (as on minesweeper-online.games) */
.daily-head { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.daily-when { display: flex; align-items: center; gap: 10px; font-weight: 500; flex-wrap: wrap; justify-content: center; margin: 0; }
.daily-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--side); border: 1px solid var(--side-line); }
.daily-tabs button { display: grid; grid-template-columns: auto auto; column-gap: 6px; align-items: baseline; padding: 6px 14px; border-radius: 9px; line-height: 1.25; text-align: left; }
.daily-tabs button b { font-weight: 500; }
.daily-tabs button small { grid-column: 1; color: var(--muted); font-size: 12.5px; }
.daily-tabs button i { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-style: normal; width: 10px; height: 10px; border-radius: 50%; }
.daily-tabs button i.first { background: var(--lamp-on); box-shadow: 0 0 0 2px color-mix(in srgb, var(--lamp-on) 35%, transparent); }
.daily-tabs button i.solved { background: var(--ok); }
.daily-tabs button:hover { background: var(--side-hl); }
.daily-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.daily-tabs button[aria-selected="true"] small { color: inherit; opacity: 0.85; }
.content .note { color: var(--muted); margin-bottom: 12px; }

.daily-summary { margin-top: 12px; padding: 16px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.daily-summary h2 { font-size: 18px; margin: 0 0 6px; }
.daily-summary p { margin: 0 0 6px; }
.daily-summary .mine { margin-top: 8px; font-weight: 500; }

.hist { margin: 12px 0 0; }
.hist .bars { display: flex; align-items: flex-end; gap: 2px; height: 96px; border-bottom: 1px solid var(--line); }
.hist .bar { flex: 1; min-height: 2px; background: color-mix(in srgb, var(--accent) 45%, var(--card)); border-radius: 4px 4px 0 0; }
.hist .bar.own { background: var(--accent); }
.hist figcaption { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 13px; color: var(--muted); }

.calendar { border-collapse: separate; border-spacing: 4px; margin: 4px -4px 8px; }
.calendar caption { text-align: left; font-weight: 500; padding: 0 4px 4px; }
.calendar th { font-size: 12.5px; font-weight: 500; color: var(--muted); padding: 2px; text-transform: capitalize; }
.calendar td { text-align: center; width: 40px; height: 36px; padding: 0; }
.calendar td > * { display: grid; place-items: center; height: 100%; border-radius: 8px; }
.calendar a { color: var(--text); text-decoration: none; background: var(--card); border: 1px solid var(--line); }
.calendar a:hover { border-color: var(--accent); }
.calendar span { color: var(--muted); opacity: 0.6; }
.calendar .today a { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.calendar .current a { box-shadow: 0 0 0 2px var(--accent); }
.month-nav { display: flex; justify-content: space-between; gap: 16px; margin: 8px 0 24px; }

.table-wrap { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.stats-table th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stats-table td { padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stats-table th.group { text-align: center; border-bottom-color: transparent; padding-bottom: 0; }
.stats-table .pct { color: var(--muted); font-size: 13px; }

/* /stats/ (t/stats.php): the totals as cards, as on minesweeper-online.games */
.stat-totals { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 8px 0 4px; }
.stat-totals li { padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: var(--muted); }
.stat-totals b { display: block; font-size: 28px; line-height: 1.2; color: var(--text); }
.stats-page .stats-table { margin-bottom: 8px; }
.stats-page h3 { font-size: 17px; margin: 24px 0 8px; }
/* The days of Pipes of the day: bars of one width, so the first days of the site are not a few giant bars */
.stats-page .hist { width: max-content; min-width: min(280px, 100%); max-width: 100%; }
.stats-page .hist .bar { flex: 0 1 20px; }

/* The banner asking for GA4 cookies (layout.php consent_banner(), js/analytics.js): only for visitors from the
   EEA, UK and Switzerland who have not chosen yet; both buttons alike, as on minesweeper-online.games */
.consent {
  position: fixed; right: 24px; bottom: 24px; z-index: 90; width: min(420px, calc(100vw - 32px));
  padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); font-size: 14px; line-height: 1.45;
}
.consent[hidden] { display: none; }
.consent p { margin: 0 0 12px; }
.consent-buttons { display: flex; gap: 8px; }
.consent .consent-buttons .btn { flex: 1; }
.consent-open body { padding-bottom: 180px; }
@media (max-width: 820px) { .consent { right: 16px; bottom: 16px; } }

/* ===================================================================== the tutorial (t/tutorial.php, tutorial-lesson.php) */
.lx-ladder { list-style: none; display: grid; gap: 8px; margin: 16px 0 0; padding: 0; }
.lx-ladder li a { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 2px 10px; align-items: baseline; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); text-decoration: none; }
.lx-ladder li a:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.lx-ladder .num { grid-row: span 2; font-weight: 700; color: var(--muted); font-size: 18px; }
.lx-ladder b { font-weight: 600; }
.lx-ladder small { grid-column: 2; color: var(--muted); font-size: 14px; }
.lx-ladder em { grid-column: 3; grid-row: 1; font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.lx-ladder em.live { color: var(--accent); }
.lx-ladder em.done { color: var(--ok); }
.lx-crumbs { font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lx-crumbs a { text-decoration: none; font-weight: 500; }
.lx-crumbs a:hover { text-decoration: underline; }
.lx-crumbs + h1 { margin-top: 8px; }
.lx-figure { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 14px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.lx-board { display: block; max-width: 100%; height: auto; }
.page-text .lx-text { min-height: 4.6em; max-width: 560px; margin: 0; text-align: center; font-size: 15.5px; }
.lx-steps { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); font-weight: 600; }
.lx-steps button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 18px; color: var(--text); }
.lx-steps button:disabled { opacity: 0.35; cursor: default; }
.lx-ex .lx-card { margin: 0 auto; width: max-content; max-width: 100%; }
.lx-ex .lx-card .card-head { grid-template-columns: 1fr auto; }
.lx-ex .lx-board { margin: 0 auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#ex-board .tile { cursor: pointer; }
.lx-dots { display: inline-flex; gap: 6px; justify-self: end; }
.lx-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.lx-dots i.done { background: var(--ok); }
.lx-dots i.now { background: var(--accent); }
.lx-task { font-weight: 600; font-size: 15px; }
.page-text .lx-feedback { width: 0; min-width: 100%; min-height: 3.2em; display: flex; align-items: center; margin: 12px 0 0; padding: 10px 14px;
  border-radius: 12px; background: var(--accent-soft); font-size: 14.5px; line-height: 1.45; }
.page-text .lx-feedback.ok { background: var(--ok-soft); }
.lx-next { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.page-text .lx-next .btn { text-decoration: none; color: var(--text); }
.page-text .lx-next .btn-primary { color: var(--accent-ink); }
.page-text .lx-done { margin: 12px auto 0; max-width: 560px; text-align: center; font-weight: 600; }
@media (max-width: 520px) { .lx-figure { padding: 14px 8px 12px; } }

/* ===================================================================== the hard puzzles (t/hard.php, hard-puzzle.php) */
.hd-warning { padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 15px; }
.hd-progress { font-weight: 600; }
.hd-group h2 { margin-top: 28px; }
.hd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.hd-card { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  color: var(--text); text-decoration: none; }
.hd-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.hd-card svg { width: 100%; height: auto; display: block; margin-bottom: 4px; }
.hd-card b { font-weight: 600; }
.hd-tier { color: var(--muted); font-size: 13px; }
.hd-very-hard { color: var(--lamp-text); font-weight: 500; }
.hd-done { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--ok); }
.hd-card.solved { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.hd-head { text-align: center; }
.hd-head a { font-size: 14px; text-decoration: none; font-weight: 500; }
.hd-head h1 { margin: 2px 0 0; font-size: 26px; }
.hd-head p { margin: 2px 0 0; color: var(--muted); }
.hd-best { margin: 0; color: var(--muted); font-size: 14px; }
.hd-nav { display: flex; gap: 24px; justify-content: center; font-size: 15px; }
.hd-nav a { text-decoration: none; font-weight: 500; }

/* ===================================================================== footer */
.foot { margin-top: auto; padding: 20px 0 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; display: flex; flex-direction: column; gap: 12px; }
.foot p { margin: 0; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px; }
.langs { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.langs a { color: var(--accent); text-decoration: none; }
.langs a:hover { text-decoration: underline; }
.langs [aria-current] { color: var(--text); font-weight: 500; }
.made-in { display: inline-flex; align-items: center; gap: 8px; }
.ua-heart { flex: none; }

/* ===================================================================== narrow screens */
@media (max-width: 820px) {
  .app { display: block; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 100; width: min(300px, 86vw); height: auto;
    visibility: hidden; transform: translateX(-100%); transition: transform .2s ease, visibility 0s linear .2s; }
  .side.open { visibility: visible; transform: none; transition: transform .2s ease; box-shadow: 0 0 32px rgba(0, 0, 0, 0.25); }
  .side.open + .scrim { display: block; position: fixed; inset: 0; z-index: 99; background: rgba(0, 0, 0, 0.35); }
  .drawer-open, .drawer-open body { overflow: hidden; }
  .drawer-close { display: inline-flex; position: absolute; top: 14px; right: 8px; color: var(--muted); }
  .side .brand { padding-right: 48px; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; gap: 4px; padding: 6px 12px 6px 6px; background: var(--side); border-bottom: 1px solid var(--side-line); }
  .topbar .brand { font-size: 17px; }
  .topbar .logo { width: 26px; height: 26px; }
  html { scroll-padding-top: 60px; }
  main { padding: 0 8px; min-height: calc(100vh - 53px); min-height: calc(100dvh - 53px); }
  .stage { min-height: 0; padding: 8px 0; align-items: flex-start; }
  .card { --pad: 8px; width: 100%; border-radius: 14px; }
  .card-head { padding: 0 4px 8px; }
  .content { padding: 0 8px; margin-top: 24px; }
  .page-text { padding: 24px 8px; }
  .foot { padding-left: 8px; padding-right: 8px; }
  .cols { grid-template-columns: 1fr; }
  h1 { font-size: 25px; }
  h2 { font-size: 21px; }
  .daily-head, .daily-tabs { width: 100%; }
  .daily-tabs button { flex: 1 1 auto; min-width: 0; padding: 6px 6px; font-size: 14.5px; }
  .daily-tabs button b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .calendar td { width: 36px; }
}
@media (max-width: 360px) {
  .tool span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pboard .tile.on .f, .pboard .lamp.lit, .pboard .halo.lit { transition-delay: 0ms; }
  .pboard.won .lamp { animation: none; }
  .pboard .tile { transition: none; }
  .side, .side.open { transition: none; }
}
