/* PaperGames – einfache, E‑Ink-freundliche Gestaltung */

:root {
  --bg: #f5f5f5;
  --bg-alt: #e3e3e3;
  --border: #111;
  --text: #111;
  --muted: #333;
  --accent: #111;
  --danger: var(--text);
  --square-light: #fdfdfd;
  --square-dark: #d5d5d5;
  --square-selected: #bbb;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --radius: 4px;
  --border-width: 2px;
  --shadow: 0 0 0 1px #000;
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-main);
  font-weight: 500;
}

/* Larger text sizes toggled by font-size-toggle.js. Tolino's own
   system-wide font size setting only affects the e-book reader, not
   this app's own web pages, so it needs its own independent control.
   Scaling the root font-size rather than adding a separate CSS variable
   works site-wide for free everywhere text is already sized in
   rem/em (nearly everywhere in this file), while leaving fixed-px board
   /card layouts (already sized to fit the viewport, board-a11y.js's
   float-grids, etc.) untouched, since those are unrelated to reading
   comfort and enlarging them would just waste screen space. */
html.text-size-large {
  font-size: 112.5%;
}

html.text-size-xlarge {
  font-size: 125%;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-1);
}

.app-header {
  display: flex;
  justify-content: space-between;
align-items: center;
  margin-bottom: var(--space-1);
  border-bottom: var(--border-width) solid var(--border);
  padding-bottom: var(--space-1);
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.app-header > * {
  margin: 0 var(--space-4) var(--space-4) 0;
}

.app-header > *:last-child {
  margin-right: 0;
}


.title-wrap h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
}

.app-title-link {
  color: inherit;
  text-decoration: none;
}

.app-title-link:visited {
  color: inherit;
}

.app-title-link:active,
.app-title-link:hover,
.app-title-link:focus {
  text-decoration: underline;
}

/* The PaperGames brand mark: a raised checkerboard tile. Pure flat fills
   and hard-edged shapes only (no gradients, no blur/filter) so it renders
   identically on 16-level-grayscale e-ink browsers, not just on phones -
   see the logo review in project history for why. */
.brand-icon {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  margin-right: 0.15em;
}

.app-title-author-link {
  color: inherit;
  text-decoration: none;
}

.app-title-author-link:visited {
  color: inherit;
}

.app-title-author-link:hover,
.app-title-author-link:active,
.app-title-author-link:focus {
  text-decoration: underline;
}


.subtitle {
  margin: var(--space-1) 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.user-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
font-size: 0.8rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.user-panel > * {
  margin: 0 var(--space-1) var(--space-1) 0;
}

.user-panel > *:last-child {
  margin-right: 0;
}


#user-status {
  white-space: nowrap;
  max-width: 100%;
  overflow-x: auto;
  font-weight: 600;
}

.user-panel-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.user-panel-buttons > * {
  margin: 0 var(--space-2) var(--space-2) 0;
}

.user-panel-buttons > *:last-child {
  margin-right: 0;
}


.user-status-row {
  justify-content: space-between;
}

#settings-panel {
  margin-bottom: var(--space-2);
}

/* Text links in the text colour instead of the browser's blue (and
   purple once visited); the underline stays as the sign of a link. Links
   styled as buttons or nav entries keep their own, more specific rules. */
a {
  color: var(--text);
}

button,
a.primary,
a.secondary {
  font-family: inherit;
  border-radius: var(--radius);
  border: var(--border-width) solid var(--border);
  background: #fff;
  padding: var(--space-2) var(--space-3);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  color: var(--text);
}

button.primary,
a.primary {
  background: var(--accent);
  color: #fff;
}

button.secondary,
a.secondary {
  background: var(--bg-alt);
}

button.small,
a.small {
  font-size: 0.7rem;
  padding: var(--space-1) var(--space-2);
}


button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* A greyed-out control button (Roll, Discard, ...) also gets its label
   struck through, so "not available now" doesn't rest on paleness alone.
   Only the labelled control buttons - board cells that are buttons keep
   their own markings. */
button.primary:disabled,
button.secondary:disabled {
  text-decoration: line-through;
}

.hidden {
  display: none !important;
}

/* Bis die Sprache der Seite angewendet ist, bleibt sie unsichtbar
   (gesetzt von einem kleinen Skript im <head>, entfernt von i18n.js,
   spätestens nach 4 Sekunden). Sonst zeichnet ein E-Ink-Display erst
   den englischen Grundtext und kurz danach alles noch einmal. */
html.i18n-pending body {
  visibility: hidden;
}

.mode-section {
  margin: var(--space-2) 0;
}

.mode-section h2 {
  font-size: 1rem;
  margin: 0 0 var(--space-1);
}

.mode-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
flex-wrap: wrap;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.mode-section-row > * {
  margin: 0 var(--space-2) var(--space-2) 0;
}

.mode-section-row > *:last-child {
  margin-right: 0;
}


.mode-buttons {
  display: flex;
  flex-wrap: wrap;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.mode-buttons > * {
  margin: 0 var(--space-2) var(--space-2) 0;
}

.mode-buttons > *:last-child {
  margin-right: 0;
}

.mode-buttons .mode-btn {
  border-radius: var(--radius);
}

.mode-buttons .mode-btn.active-mode {
  background: #ffffff;
  color: #000000;
  border-width: 3px;
  font-weight: 800;
}


.card {
  background: #fff;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  padding: var(--space-3) var(--space-3);
  margin-bottom: var(--space-2);
}

/* A quick way to skip past 25 games' worth of cards to the category
   you actually want - three plain anchor jumps, not JS, so they work
   the same with scripting on or off and cost nothing on E-Ink. */
.game-section-nav {
  display: flex;
  flex-wrap: wrap;
margin: 0 0 var(--space-2);
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
/* A quick way to skip past 25 games' worth of cards to the category
   you actually want - three plain anchor jumps > *, not JS > *, so they work
   the same with scripting on or off and cost nothing on E-Ink. */
.game-section-nav > * {
  margin: 0 var(--space-2) var(--space-2) 0;
}

/* A quick way to skip past 25 games' worth of cards to the category
   you actually want - three plain anchor jumps > *:last-child, not JS > *:last-child, so they work
   the same with scripting on or off and cost nothing on E-Ink. */
.game-section-nav > *:last-child {
  margin-right: 0;
}


.game-section-nav a {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.2;
  text-decoration: none;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.game-section-nav a > * {
  margin: 0 var(--space-1) var(--space-1) 0;
}

.game-section-nav a > *:last-child {
  margin-right: 0;
}


.field-row {
  margin-bottom: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.field-row > * {
  margin: 0 var(--space-2) var(--space-2) 0;
}

.field-row > *:last-child {
  margin-right: 0;
}


.field-row label {
  font-size: 0.9rem;
}

.field-row select {
  flex: 1;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  border: var(--border-width) solid var(--border);
  background: #fff;
  font-weight: 600;
}

.checkbox-label {
  display: flex;
  align-items: center;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.checkbox-label > * {
  margin: 0 var(--space-2) var(--space-2) 0;
}

.checkbox-label > *:last-child {
  margin-right: 0;
}


.status-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  min-height: 1.2em;
}

.game-clocks {
  font-size: 0.8rem;
}

/* Brett */

#board-section {
  display: flex;
  flex-direction: column;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
/* Brett */

#board-section > * {
  margin: 0 0.5rem 0.5rem 0;
}

/* Brett */

#board-section > *:last-child {
  margin-right: 0;
}


.board-header {
  display: flex;
  flex-direction: column;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.board-header > * {
  margin: 0 0.25rem 0.25rem 0;
}

.board-header > *:last-child {
  margin-right: 0;
}


.board-header-tools {
  display: flex;
  justify-content: flex-end;
margin-top: 0.15rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.board-header-tools > * {
  margin: 0 0.25rem 0.25rem 0;
}

.board-header-tools > *:last-child {
  margin-right: 0;
}



#game-label {
  font-weight: 600;
  font-size: 0.95rem;
}

#game-meta {
  font-size: 0.8rem;
  color: var(--muted);
}


#game-result {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

#game-result:empty {
  display: none;
}


#board-container {
  width: 100%;
  text-align: center;
}

#board {
  display: block;
  width: 100%;
  max-width: 760px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

/* Fallback, falls aspect-ratio nicht unterstützt wird, kümmert sich JS */

.square {
  position: relative;
  border-radius: 0;
  width: 12.5%;
  float: left;
  border: none;
  padding: 0;
  font-size: 1.8rem;
  line-height: 1;
  text-align: center;
  box-sizing: border-box;
}

.square.light {
  background: var(--square-light);
}

.square.dark {
  background: var(--square-dark);
}

/* Inline-SVG-Figuren zentriert im Feld, unabhängig von der tatsächlichen
   Feldgröße (die per JS dynamisch gesetzt wird). */
.square svg.piece-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 82%;
  height: 82%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Bolder outlines than the source artwork's default 1.5 - reads much
   more clearly on E‑Ink, where thin strokes tend to look faint/grey. */
.square svg.piece-svg [stroke-width] {
  stroke-width: 2.2;
}


/* Auswahl-Markierung für ein Feld */

/* Letzter Zug: nur ein dünner Rahmen, keine Tönung - eine halbdurchsichtige
   Fläche wird auf E-Ink-Displays mit wenigen Graustufen zu gerastertem Grau
   ohne zusätzliche Information. Dünner als der Auswahlrahmen (siehe
   .square.selected), damit beides nicht verwechselt wird. */
.square.last-move {
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* Letzter Zug in Spielen mit eigenen Feldern (Reversi, Mancala, Mühle,
   Backgammon ...): durchgezogen = Zielfeld, gestrichelt = Ausgangsfeld,
   gepunktet = mitbetroffen (umgedreht, geschlagen, entfernt). Nur
   Umrandungen, keine Graustufen, damit es auf E-Ink klar bleibt. Steht
   früh in der Datei, damit spielspezifische Auswahlrahmen weiter unten
   Vorrang haben. Gesperrte Felder sind sonst halbtransparent, der
   Rahmen soll aber schwarz bleiben. */
.lm-from {
  outline: 2px dashed var(--text);
  outline-offset: -4px;
}

.lm-changed {
  outline: 2px dotted var(--text);
  outline-offset: -4px;
}

.lm-to {
  outline: 3px solid var(--text);
  outline-offset: -3px;
}

.lm-from:disabled,
.lm-changed:disabled,
.lm-to:disabled {
  opacity: 1;
}

.square.selected {
  outline: 3px solid var(--border);
  outline-offset: -3px;
}

/* Züge unter dem Brett in einer Zeile, horizontal scrollend */
.moves-list {
  font-size: 0.7rem;
  line-height: 1.3;
  border-top: 1px solid var(--border);
  padding-top: 0.15rem;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
}

.moves-list.hidden {
  display: none;
}


/* Coordinate overlays inside squares.
   We only draw them on the "outer" ranks/files of the *visible* board:
   - left edge: rank number
   - bottom edge: file letter
   This works for both white and black orientation. */
.square[data-show-rank="1"]::before {
  content: attr(data-rank);
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 0.7rem;
  opacity: 0.9;
}

.square[data-show-file="1"]::after {
  content: attr(data-file);
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 0.7rem;
  opacity: 0.9;
}


.piece-black {
  color: #000;
}

.piece-white {
  color: #000;
}

/* Mobile tweaks */

@media (max-width: 600px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .user-panel {
    align-items: flex-start;
  }
}


/* Mode-Header mit About rechts */
.mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
/* Mode-Header mit About rechts */
.mode-header > * {
  margin: 0 var(--space-2) var(--space-2) 0;
}

/* Mode-Header mit About rechts */
.mode-header > *:last-child {
  margin-right: 0;
}


.mode-about-inline {
  font-size: 0.6rem;
  text-align: right;
  flex: 1;
}

.mode-about-inline a {
  text-decoration: underline;
}


.app-title-row {
  display: flex;
  align-items: baseline;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.app-title-row > * {
  margin: 0 var(--space-2) var(--space-2) 0;
}

.app-title-row > *:last-child {
  margin-right: 0;
}


.app-title-author {
  font-size: 0.7rem;
  color: var(--muted);
}


.inline-options {
  display: inline-flex;
margin-left: var(--space-2);
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.inline-options > * {
  margin: 0 var(--space-1) var(--space-1) 0;
}

.inline-options > *:last-child {
  margin-right: 0;
}


/* Compact selects for inline controls (offline level + online time) */
#offline-ai-controls #ai-level-inline,
#online-controls .online-inline-row > select#time-profile {
  flex: 0 0 auto;
  width: auto;
}
.ai-color-btn.active {
  background: var(--accent);
  color: #fff;
}

#online-controls .online-inline-row {
  flex-wrap: wrap;
  width: 100%;
}

#online-controls .online-inline-row > select#time-profile {
  flex: 0 0 auto;
  width: auto;
}

#online-controls .online-inline-row .online-action-right {
  margin-left: auto;
  display: inline-flex;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
#online-controls .online-inline-row .online-action-right > * {
  margin: 0 var(--space-2) var(--space-2) 0;
}

#online-controls .online-inline-row .online-action-right > *:last-child {
  margin-right: 0;
}


#online-controls .online-tabs-row {
  justify-content: space-between;
  width: 100%;
}

/* Flexbox `gap` fallback: margin-based spacing instead (see the .mode-buttons
   rule above) - this class is combined with .mode-buttons on the same
   element (see chess.html), it just overrides the gap value. */
.online-sub-tabs > * {
  margin: 0 var(--space-1) var(--space-1) 0;
}

.online-sub-tabs > *:last-child {
  margin-right: 0;
}

.board-actions {
  display: flex;
justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.board-actions > * {
  margin: 0 0.5rem 0.5rem 0;
}

.board-actions > *:last-child {
  margin-right: 0;
}


.board-actions .small {
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
}


/* color-choice labels for AI color selection (pawns instead of text) */
.inline-options .color-choice {
  display: inline-flex;
  align-items: center;
font-size: 1.2rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
/* color-choice labels for AI color selection (pawns instead of text) */
.inline-options .color-choice > * {
  margin: 0 4px 4px 0;
}

/* color-choice labels for AI color selection (pawns instead of text) */
.inline-options .color-choice > *:last-child {
  margin-right: 0;
}


/* Same cburnett pawn SVGs as on the board itself, sized as small inline
   icons here instead of the board's absolutely-positioned full-square use. */
.color-choice-icon {
  display: inline-flex;
  width: 1.2em;
  height: 1.2em;
}

.color-choice-icon svg {
  width: 100%;
  height: 100%;
}


#undo-btn {
  padding-left: var(--space-1);
  padding-right: var(--space-1);
}


.board-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10rem;
  padding: 1.5rem 0;
  color: var(--muted);
}





.board-placeholder-icon {
  font-size: 1em;
  line-height: 1;
}

/* Raw inline SVG (e.g. chess's knight) has no intrinsic width/height of its
   own, only a viewBox, so size it explicitly to match the other games'
   1em icon classes (.go-stone-icon, .checkers-icon-disc). */
.board-placeholder-icon-svg svg {
  display: block;
  width: 1em;
  height: 1em;
}

.board-placeholder-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-left: 0.4em;
  min-width: 0;
}

/* The title is a flex item of a column with align-items: flex-start, so
   without max-width it took the width of its text and pushed the page
   wider than the screen (Hashiwokakero, Minesweeper at 632px). Capped to
   the space left of the icon it wraps; clamp() also scales it down with
   the viewport so long single words fit whole - browsers without clamp()
   keep the 0.35em line and break such a word instead. */
.board-placeholder-title {
  max-width: 100%;
  font-size: 0.35em;
  font-size: clamp(1rem, calc(9vw - 1.6rem), 0.35em);
  line-height: 1;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* On narrow screens (phones) the 10rem placeholder pushed long game names
   past the right edge; step it down so the page never scrolls sideways. */
@media (max-width: 600px) {
  .board-placeholder {
    font-size: 6.5rem;
  }

  .board-placeholder-title {
    font-size: clamp(1rem, calc(13vw - 2rem), 0.35em);
  }
}

@media (max-width: 420px) {
  .board-placeholder {
    font-size: 5rem;
  }

  .board-placeholder-title {
    font-size: clamp(1rem, calc(13vw - 1.5rem), 0.35em);
  }
}

.board-placeholder-subtitle {
  max-width: 100%;
  font-size: 0.18em;
  line-height: 1.1;
  opacity: 0.8;
  overflow-wrap: break-word;
  word-wrap: break-word;
}


.score-line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  font-size: 0.7rem;
  line-height: 1.3;
  border-top: 1px solid var(--border);
  padding-top: var(--space-1);
  color: var(--muted);
  column-gap: var(--space-2);
}

.score-line.hidden {
  display: none;
}

.score-line-captures {
  justify-self: center;
  white-space: nowrap;
}

.score-line-diff {
  justify-self: end;
  white-space: nowrap;
}


/* About page */
.about-donate {
  margin-top: var(--space-4);
  font-size: 0.9rem;
}

.btn-donate {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  word-break: normal;
}

.btn-donate:visited {
  color: #fff;
}

.btn-donate:hover,
.btn-donate:active,
.btn-donate:focus {
  text-decoration: underline;
}

/* Keep long links in other contexts from breaking layouts */
.about-donate a {
  word-break: break-all;
}

.about-qr {
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.about-qr > * {
  margin: 0 var(--space-1) var(--space-1) 0;
}

.about-qr > *:last-child {
  margin-right: 0;
}


.about-qr img {
  max-width: 180px;
  height: auto;
  border: 1px solid var(--border);
  padding: var(--space-1);
  border-radius: 4px;
}

.about-credits {
  margin-top: var(--space-4);
  font-size: 0.75rem;
  color: var(--muted);
}

.about-back {
  margin-top: var(--space-4);
  font-size: 0.85rem;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-4);
}

.stats-table th,
.stats-table td {
  border: var(--border-width) solid var(--border);
  padding: var(--space-2) var(--space-2);
  text-align: left;
}

.stats-table th {
  background: var(--bg-alt);
}

.stats-table td:not(:first-child),
.stats-table th:not(:first-child) {
  text-align: center;
}

.stats-empty {
  margin-top: var(--space-4);
  color: var(--muted);
}

.stats-actions {
  margin-top: var(--space-4);
}

/* Site-wide nav bar and language switch (home/rules/guide/about pages) */

.lang-switch {
  display: flex;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
/* Site-wide nav bar and language switch (home/rules/guide/about pages) */

.lang-switch > * {
  margin: 0 var(--space-1) var(--space-1) 0;
}

/* Site-wide nav bar and language switch (home/rules/guide/about pages) */

.lang-switch > *:last-child {
  margin-right: 0;
}


/* A native <select>, built dynamically by i18n.js from however many
   languages exist - deliberately not a row of buttons, which stopped
   scaling once the app grew past a couple of languages. A native
   control also means the OS/browser draws the actual dropdown list,
   which behaves correctly and predictably on E-Ink browsers without
   any custom popover logic of our own. */
.lang-select,
.game-select {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.7rem;
  padding: var(--space-1) var(--space-5) var(--space-1) var(--space-2);
  border-radius: var(--radius);
  border: var(--border-width) solid var(--border);
  background: var(--bg-alt) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23111' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 0.5rem center;
  background-size: 0.6rem;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* Game switcher: same treatment as the language picker, built at
   runtime by game-switcher.js on every game/rules/history page (not on
   the home page, which has no "current game" to switch away from). */
.game-switch {
  display: flex;
  align-items: center;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
/* Game switcher: same treatment as the language picker > *, built at
   runtime by game-switcher.js on every game/rules/history page (not on
   the home page > *, which has no "current game" to switch away from). */
.game-switch > * {
  margin: 0 var(--space-1) var(--space-1) 0;
}

/* Game switcher: same treatment as the language picker > *:last-child, built at
   runtime by game-switcher.js on every game/rules/history page (not on
   the home page > *:last-child, which has no "current game" to switch away from). */
.game-switch > *:last-child {
  margin-right: 0;
}


.game-switch-icon {
  font-size: 0.8rem;
  line-height: 1;
}

.game-select {
  max-width: 11rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
margin: var(--space-2) 0;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.site-nav > * {
  margin: 0 var(--space-2) var(--space-2) 0;
}

.site-nav > *:last-child {
  margin-right: 0;
}


.site-nav-link {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  color: var(--text);
  background: #fff;
}

.site-nav-link.active-mode {
  background: var(--accent);
  color: #fff;
}

/* Narrow readers (Tolino Vision 6: 632 px, PocketBook Era, Tolino Vision
   Color): the header stacked its four controls (game switcher, Rules,
   Settings, Menu) on top of each other and took 171 px before the nav.
   Here they sit side by side and wrap only when they must, the title is
   smaller, the author line is left out, the spacing is tighter - and
   every control you tap in the header and the nav is at least 44 px
   high. Wider screens keep the layout above unchanged. */
@media (max-width: 800px) {
  .app-header {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .app-header > * {
    margin: 0 var(--space-1) var(--space-1) 0;
  }
  .app-title-row > * {
    margin: 0 var(--space-1) var(--space-1) 0;
  }
  .title-wrap h1 {
    font-size: 1.1rem;
  }
  .app-title-author {
    display: none;
  }
  .user-panel {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
  }
  .user-panel > * {
    margin: 0 var(--space-1) var(--space-1) 0;
  }
  .user-panel button,
  .user-panel a,
  .user-panel select {
    box-sizing: border-box;
    min-height: 44px;
  }
  .user-panel a {
    display: inline-flex;
    align-items: center;
  }
  .site-nav {
    margin: var(--space-1) 0;
  }
  .site-nav > * {
    margin: 0 var(--space-1) var(--space-1) 0;
  }
  .site-nav-link {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 44px;
    padding: var(--space-1) var(--space-2);
  }
}

/* History library page: a plain, image-free reading list of every game's
   origin story, roughly in the order each game first appeared. */

.history-intro-note {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  margin: 0 0 var(--space-4);
}

.history-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-timeline-item {
  padding: var(--space-4) 0;
  border-top: var(--border-width) solid var(--border);
}

.history-timeline-item:first-child {
  border-top: none;
  padding-top: 0;
}

.history-timeline-era {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-1);
}

.history-timeline-title {
  font-size: 1.05rem;
  margin: 0 0 var(--space-1);
}

.history-timeline-title a {
  color: var(--text);
  text-decoration: none;
}

.history-timeline-title a:hover {
  text-decoration: underline;
}

.history-timeline-desc {
  margin: 0 0 var(--space-2);
  color: var(--text);
}

.history-timeline-link {
  font-size: 0.85rem;
  font-weight: 700;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
margin: 2rem 0 var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.site-footer > * {
  margin: 0 var(--space-4) var(--space-1) 0;
}

.site-footer > *:last-child {
  margin-right: 0;
}


.site-footer a {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus {
  text-decoration: underline;
}

/* Home page */

.home-hero {
  text-align: center;
  padding: var(--space-4);
}

/* Icon and heading share one line, so the hero leaves room for the
   first row of game tiles on a 632x840 e-reader screen. */
.home-hero-icon {
  display: inline-block;
  width: 2.5rem;
  height: 2.5rem;
  margin-right: var(--space-2);
  vertical-align: middle;
}

.home-hero h1 {
  display: inline-block;
  margin: var(--space-1) 0;
  font-size: 2rem;
  font-weight: 800;
  vertical-align: middle;
}

.home-tagline {
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 var(--space-3);
}

.home-languages {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 0 var(--space-2);
}

/* What PaperGames doesn't do (home-app.js): plain sentences under the
   heading on the first visits. While it shows, it stands in for the
   general intro paragraph, which says much the same about offline play
   and e-ink - so the first row of game tiles still fits on the screen. */
.home-pitch {
  max-width: 34rem;
  margin: var(--space-1) auto var(--space-2);
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--text);
}

.home-hero.home-pitch-shown .home-intro {
  display: none;
}

/* Quick rules box above the board on a game page (quick-rules.js): up to
   three plain sentences and two buttons, in the normal page flow - it
   pushes the board down a little but never covers it. */
.quick-rules {
  padding: var(--space-3) var(--space-4);
}

.quick-rules-sentence {
  margin: 0 0 var(--space-2);
  line-height: 1.4;
}

.quick-rules-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--space-2);
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.quick-rules-actions > * {
  margin: 0 var(--space-2) 0 0;
}

.quick-rules-actions > *:last-child {
  margin-right: 0;
}

/* Offline status line under the home intro (home-app.js, offline-status.js):
   plain full-contrast text, a check mark or a dot as the only mark, no box.
   The reserved height keeps the buttons below from jumping when the text
   arrives. */
.offline-status {
  min-height: 1.5em;
  margin: var(--space-1) 0 0;
  font-weight: 700;
  color: var(--text);
}

.offline-status-icon svg {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  margin-right: 0.35em;
}

.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.home-hero-actions > * {
  margin: var(--space-3) var(--space-2) 0 var(--space-2);
}

.home-play-button {
  display: inline-block;
  text-decoration: none;
  font-size: 1.1rem;
  padding: var(--space-2) var(--space-5);
}

.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

.nav-card {
  display: block;
  text-decoration: none;
  color: var(--text);
}

.nav-card-title {
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: var(--space-1);
}

.nav-card-desc {
  font-size: 0.85rem;
  color: var(--muted);
}


/* Rules / Guide content pages */

.content-page h2 {
  font-size: 1.1rem;
  margin: var(--space-4) 0 var(--space-2);
}

.content-page h2:first-child {
  margin-top: 0;
}

.rule-list {
  margin: 0 0 var(--space-3);
}

.rule-list dt {
  font-weight: 800;
  margin-top: var(--space-2);
}

.rule-list dd {
  margin: var(--space-1) 0 0;
  color: var(--text);
}

/* Go board: intersections rather than squares, built as absolutely
   positioned lines/points inside a padded square (see go-app.js) rather
   than a CSS gradient grid, since that's more predictable across the
   older browsers found on E-Ink devices. */

.go-board {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
  padding: 6%;
}

.go-grid {
  position: relative;
  width: 100%;
  height: 100%;
}

.go-line {
  position: absolute;
  background: var(--border);
}

.go-line-h {
  left: 0;
  right: 0;
  height: 2px;
  transform: translateY(-1px);
}

.go-line-v {
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-1px);
}

.go-hoshi {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--border);
  pointer-events: none;
}

.go-point {
  position: absolute;
  transform: translate(-50%, -50%);
  background: transparent;
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
}

.go-stone {
  position: absolute;
  top: 4%;
  right: 4%;
  bottom: 4%;
  left: 4%;
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

/* A layered look (flat fill plus an inset rim) instead of a single flat
   disc - the same technique as the Ur pieces (.ur-piece::after): a ring
   set inside the stone reads as a lacquered highlight/shadow line without
   an actual gradient, so it stays safe on a 16-level grayscale E-Ink
   panel. Kept on ::before rather than ::after so ::after stays free for
   the last-move halo further down. */
.go-stone::before,
.go-stone-icon::before {
  content: "";
  position: absolute;
  top: 22%;
  left: 22%;
  width: 56%;
  height: 56%;
  border-radius: 50%;
  box-sizing: border-box;
}

.go-stone-black {
  background: #111;
  border: 1px solid #000;
}

.go-stone-black::before {
  border: 2px solid #555;
}

.go-stone-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

.go-stone-white::before {
  border: 2px solid #bbb;
}

/* Standalone stone icon for use outside the board (color-choice picker,
   home page card, placeholder) - same .go-stone-black/.go-stone-white
   coloring, including the inset rim above, so it reads as the same stone
   rather than a flatter stand-in, but sized/positioned inline rather than
   absolutely within a .go-point. Avoids relying on Unicode circle glyphs
   (●/○), whose look varies by device font. */
.go-stone-icon {
  position: relative;
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.go-point.last-move .go-stone::after {
  content: "";
  position: absolute;
  top: -22%;
  right: -22%;
  bottom: -22%;
  left: -22%;
  border: 2px solid var(--accent);
  border-radius: 50%;
}

/* Home page: game selection, Chess and Go shown with equal weight */

.game-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

/* Empty-state message for a section whose nav link always points
   somewhere real (e.g. My Favorites) - plain page text, not a muted
   gray, since faint tones are hard to read on E-Ink. */
.section-empty-state {
  color: var(--text);
  padding: var(--space-3) 0;
  margin: 0;
}

.game-select-item {
  position: relative;
  background: #fff;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
}

/* Favorite star toggle: filled vs. outline glyph (★/☆) rather
   than color, so it stays legible in grayscale on e-ink. Positioned over
   the card's own top-right corner rather than taking up layout space. */
.favorite-toggle {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  border: none;
  background: none;
  font-size: 1.2rem;
  line-height: 1.8rem;
  text-align: center;
  cursor: pointer;
  color: var(--text);
}

.favorite-toggle.is-favorite {
  color: var(--text);
}

/* Opt-in "suggest difficulty" toggle, on its own row below every AI
   opponent's level select rather than squeezed into that row (which is
   already tight with the New game button, color choice, and the level
   select's often-long option text, and .field-row doesn't wrap) - and
   the small note shown when it has just nudged the selection.
   See adaptive-difficulty.js. */
.adaptive-difficulty-row {
  flex-wrap: wrap;
}

.adaptive-difficulty-toggle {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  white-space: nowrap;
}

.adaptive-difficulty-toggle input {
  margin-right: var(--space-1);
}

.adaptive-difficulty-note {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Stats page: achievement badges, derived from GameStats rather than
   their own storage - locked ones stay visible (not hidden) so the
   player can see what's still ahead, just faded via opacity like every
   other "inactive" state in this app (:disabled buttons, etc.), since a
   color-only distinction wouldn't read on grayscale e-ink. */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

.achievement-badge {
  display: flex;
  align-items: flex-start;
  background: #fff;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
}

.achievement-badge.locked {
  opacity: 0.5;
}

.achievement-badge-icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-right: var(--space-2);
  flex-shrink: 0;
}

.achievement-badge-text {
  display: flex;
  flex-direction: column;
}

.achievement-badge-name {
  font-weight: 600;
}

.achievement-badge-desc {
  font-size: 0.8rem;
  color: var(--muted);
}

.games-group-title {
  margin: var(--space-4) 0 var(--space-2);
}

.games-group-title:first-child {
  margin-top: 0;
}

.games-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: var(--space-2) 0;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.games-toolbar > * {
  margin: 0 var(--space-2) var(--space-2) 0;
}

.games-toolbar > *:last-child {
  margin-right: 0;
}

.games-search-input {
  flex: 1 1 220px;
  padding: var(--space-2) var(--space-2);
  font-size: 0.95rem;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  box-sizing: border-box;
}

.games-sort-select {
  padding: var(--space-2) var(--space-2);
  font-size: 0.95rem;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}

.games-no-results {
  color: var(--muted);
  font-style: italic;
}

.game-select-title {
  font-weight: 800;
  font-size: 1.15rem;
  margin-bottom: var(--space-1);
}

/* Every game icon sits in the same square box: 1.5rem is 24 px at the
   normal text size, and rem (not px) so the icons grow with the A+/A++
   text size setting (font-size-toggle.js scales the root) - icon, line
   width and text stay in proportion. The catalog icons are drawn on one
   24-unit grid with 2-2.25 unit lines, i.e. 2-2.25 px at this size. */
.game-select-icon-svg {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  vertical-align: middle;
  flex-shrink: 0;
}

.game-select-icon-svg svg {
  display: block;
  width: 100%;
  height: 100%;
}

.game-select-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 var(--space-2);
}

/* "Family: Sudoku" under the description of a game that has relatives. */
.game-select-family {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 var(--space-2);
}

/* "Related games" at the end of a game page (game-switcher.js). */
.related-games h2 {
  margin-top: 0;
}

.related-games-family {
  margin: 0 0 var(--space-2);
}

.related-games-list {
  margin: 0;
  padding-inline-start: 1.4rem;
}

.related-games-list li {
  padding: 6px 0;
}

.related-games-list a,
.related-games-family a {
  display: inline-block;
  min-height: 32px;
  line-height: 32px;
}

.game-select-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: auto;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.game-select-actions > * {
  margin: 0 var(--space-2) var(--space-2) 0;
}

.game-select-actions > *:last-child {
  margin-right: 0;
}


/* End-of-game result popup, shared by every game via result-modal.js.
   Longhand top/right/bottom/left rather than the `inset` shorthand - a
   real device in this project's own test history silently ignores that
   shorthand entirely. */
.result-modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 1000;
}

.result-modal-overlay.hidden {
  display: none !important;
}

.result-modal {
  background: #fff;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  max-width: 320px;
  width: 100%;
  text-align: center;
}

/* Hidden by default; only .result-modal-win (a real win, not a loss or
   a draw - see classifyOutcome() in result-modal.js) shows it. A plain
   Unicode star rather than a drawn shape, matching how this project
   already uses a handful of Unicode symbols elsewhere (e.g. the resign
   button's flag) instead of an icon font. */
.result-modal-ornament {
  display: none;
  font-size: 2rem;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.result-modal-win .result-modal-ornament {
  display: block;
}

/* A real win also gets a slightly heavier frame - still just a border
   weight/style change, no color, so it reads the same on a monochrome
   E-Ink panel as anywhere else. */
.result-modal-win {
  border-width: calc(var(--border-width) * 2);
}

.result-modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: var(--space-2);
}

.result-modal-message {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: var(--space-4);
}

.result-modal .result-modal-close {
  min-width: 6rem;
}

/* Checkers board: reuses .square/.light/.dark/.selected/.last-move from
   the chess board (same float-grid technique, already proven on a real
   E-Ink device) rather than inventing a new layout mechanism. */

#checkers-board {
  display: block;
  width: 100%;
  max-width: 760px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.checkers-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 78%;
  height: 78%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

/* Same layered-rim technique as the Go stones (.go-stone::before) and the
   Ur pieces (.ur-piece::after): a ring inset from the edge rather than a
   single flat disc, flat shapes only so it stays grayscale-safe. Kept on
   ::before, not ::after, so ::after/the nested .checkers-king-mark below
   stay free for the king badge. */
.checkers-piece::before,
.checkers-icon-disc::before {
  content: "";
  position: absolute;
  top: 22%;
  left: 22%;
  width: 56%;
  height: 56%;
  border-radius: 50%;
  box-sizing: border-box;
}

.checkers-piece-black {
  background: #111;
  border: 2px solid #000;
}

.checkers-piece-black::before,
.checkers-icon-disc-black::before {
  border: 2px solid #555;
}

.checkers-piece-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

.checkers-piece-white::before,
.checkers-icon-disc-white::before {
  border: 2px solid #bbb;
}

/* King mark: a small layered rosette (a diamond behind a ring, the same
   idea as .ur-square-rosette) instead of a single plain ring, so a
   crowned piece reads as a deliberate badge rather than a dot dropped on
   top. This needs its own nested element (added/removed by checkers-
   app.js's updateCheckersBoard alongside the .checkers-piece-king class)
   rather than a second pseudo-element on .checkers-piece itself, since
   ::before is already the depth rim above and an element only has the
   two pseudo-elements to draw with. */
.checkers-king-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44%;
  height: 44%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.checkers-king-mark::before {
  content: "";
  position: absolute;
  top: 32%;
  left: 32%;
  width: 36%;
  height: 36%;
  transform: rotate(45deg);
  box-sizing: border-box;
}

.checkers-king-mark::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-sizing: border-box;
}

/* Contrast the badge against its own piece, same pairing the single-ring
   king mark used before: white on black, dark on white. */
.checkers-piece-black .checkers-king-mark::before {
  background: #fff;
}

.checkers-piece-black .checkers-king-mark::after {
  border: 2px solid #fff;
}

.checkers-piece-white .checkers-king-mark::before {
  background: var(--border);
}

.checkers-piece-white .checkers-king-mark::after {
  border: 2px solid var(--border);
}

/* Small disc icons for the color-choice picker and board placeholder,
   matching the board's own piece styling. */
.checkers-icon-disc {
  position: relative;
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.checkers-icon-disc-black {
  background: #111;
  border: 2px solid #000;
}

.checkers-icon-disc-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Royal Game of Ur board: a 3x8 float-grid (same technique as the chess
   and checkers boards) with the four corner squares at columns 4-5 of
   rows 0/2 left as invisible gaps, forming the traditional H-shape - a
   private 4-square lane per player top/bottom, connected by a shared
   8-square lane through the middle row.
   The board is clipped to that same H-shape (a 4-column block, a
   2-column bridge through the middle row only, then a 2-column tail
   block) instead of sitting inside a plain rectangle, so the outline
   reads as the real board's silhouette rather than a box with two blank
   corners top and bottom. Getting a border to trace that outline -
   including its two inward-facing notch corners, where a plain CSS
   `border` would just vanish since border stays rectangular under a
   clip-path - takes two nested elements rather than one: #ur-board is
   the frame (filled with the border color, clipped to the full
   H-shape) and #ur-grid, the actual clickable grid inside it, is
   clipped to the same H-shape inset by the border width on every edge.
   Since #ur-grid's squares otherwise tile it edge-to-edge, that inset
   clip trims a uniform border-width sliver off their outer-facing
   edges everywhere - all along the perimeter and both notches alike -
   letting the frame color show through as a continuous ring. */

#ur-board {
  display: block;
  width: 100%;
  max-width: 760px;
  background: var(--border);
  clip-path: polygon(
    0% 0%, 50% 0%, 50% calc(100%/3), 75% calc(100%/3), 75% 0%, 100% 0%,
    100% 100%, 75% 100%, 75% calc(200%/3), 50% calc(200%/3), 50% 100%, 0% 100%
  );
  box-sizing: border-box;
  margin: 0 auto;
}

#ur-grid {
  display: block;
  overflow: hidden;
  clip-path: polygon(
    calc(0% + 3px) calc(0% + 3px),
    calc(50% - 3px) calc(0% + 3px),
    calc(50% - 3px) calc(100%/3 + 3px),
    calc(75% + 3px) calc(100%/3 + 3px),
    calc(75% + 3px) calc(0% + 3px),
    calc(100% - 3px) calc(0% + 3px),
    calc(100% - 3px) calc(100% - 3px),
    calc(75% + 3px) calc(100% - 3px),
    calc(75% + 3px) calc(200%/3 - 3px),
    calc(50% - 3px) calc(200%/3 - 3px),
    calc(50% - 3px) calc(100% - 3px),
    calc(0% + 3px) calc(100% - 3px)
  );
}

.ur-square {
  background: var(--square-light);
  border: 1px solid var(--border);
}

/* The shared lane (middle row) is where captures can happen. It is set
   apart from each player's own safe squares by a second, inner frame
   line - shape, not a tint, which e-ink can't show. */
.ur-square-shared {
  box-shadow: inset 0 0 0 4px var(--square-light), inset 0 0 0 5px var(--border);
}

.ur-square-gap {
  background: transparent;
  border: none;
  pointer-events: none;
}

/* A small layered rosette mark (a diamond behind a ring) rather than a
   plain circle, closer to the flower motif on the real board, built
   from flat shapes only - no gradients or shadows to stay e-ink safe. */
.ur-square-rosette::before {
  content: "";
  position: absolute;
  top: 38%;
  left: 38%;
  width: 24%;
  height: 24%;
  background: var(--muted);
  transform: rotate(45deg);
  box-sizing: border-box;
  pointer-events: none;
}

.ur-square-rosette::after {
  content: "";
  position: absolute;
  top: 25%;
  left: 25%;
  width: 50%;
  height: 50%;
  border: 2px solid var(--muted);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

/* "Can move" (here and in Mancala, Mühle, Backgammon, Shogi, Hnefatafl,
   Konane): the grey tint plus a shape, so it never rests on grey alone -
   a small black triangle in the top-left corner of square cells, a ring
   with a white gap around round points. Neither looks like "last move"
   (thin frame/outline) or "selected" (3 px frame). */
.ur-square-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.ur-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 74%;
  height: 74%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.ur-piece::after {
  content: "";
  position: absolute;
  top: 22%;
  left: 22%;
  width: 56%;
  height: 56%;
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.ur-piece-black {
  background: #111;
  border: 2px solid #000;
}

.ur-piece-black::after {
  border: 2px solid #555;
}

.ur-piece-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

.ur-piece-white::after {
  border: 2px solid #bbb;
}

/* Small disc icons for the color-choice picker and board placeholder,
   matching the board's own piece styling. */
.ur-piece-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.ur-piece-icon-black {
  background: #111;
  border: 2px solid #000;
}

.ur-piece-icon-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Off-board "start" and finished "home" pieces have no board square of
   their own, so they're shown as simple labelled counters above/below
   the board instead. */
.ur-tray {
  display: flex;
max-width: 760px;
  margin: 0 auto 0.4rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
/* Off-board "start" and finished "home" pieces have no board square of
   their own > *, so they're shown as simple labelled counters above/below
   the board instead. */
.ur-tray > * {
  margin: 0 0.6rem 0.6rem 0;
}

/* Off-board "start" and finished "home" pieces have no board square of
   their own > *:last-child, so they're shown as simple labelled counters above/below
   the board instead. */
.ur-tray > *:last-child {
  margin-right: 0;
}


.ur-tray-slot {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.6rem;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 0.85rem;
  box-sizing: border-box;
}

button.ur-tray-slot {
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.ur-tray-slot-static {
  cursor: default;
}

.ur-tray-slot-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.ur-tray-slot-count {
  font-weight: 700;
}

.ur-dice-area {
  display: flex;
  align-items: center;
  justify-content: center;
margin-top: 0.5rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.ur-dice-area > * {
  margin: 0 0.6rem 0.6rem 0;
}

.ur-dice-area > *:last-child {
  margin-right: 0;
}


.ur-dice-display {
  display: flex;
  align-items: center;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.ur-dice-display > * {
  margin: 0 0.3rem 0.3rem 0;
}

.ur-dice-display > *:last-child {
  margin-right: 0;
}


.ur-die {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border: var(--border-width) solid var(--border);
  box-sizing: border-box;
}

.ur-die-marked {
  background: var(--accent);
}

.ur-die-blank {
  background: #fff;
}

.ur-die-total {
  font-weight: 700;
  margin-left: 0.3rem;
}

/* Nine Men's Morris board: a point-and-line grid (same technique as the
   Go board - a JS-enforced square container, since `aspect-ratio` alone
   is silently ignored on some E-Ink browsers) rather than a filled
   square grid, since the board is three nested squares of points
   connected by lines, not a checkerboard. */

.morris-board {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
  padding: 7%;
}

/* Points/lines are positioned inside this, not directly inside
   .morris-board - see the comment in morris-app.js's buildMorrisBoardDOM
   for why the padding above only acts as a margin for the outer ring of
   points' own radius when they're one level further in like this. */
.morris-grid {
  position: relative;
  width: 100%;
  height: 100%;
}

.morris-line {
  position: absolute;
  background: var(--border);
}

.morris-line-h {
  height: 2px;
  margin-top: -1px;
}

.morris-line-v {
  width: 2px;
  margin-left: -1px;
}

.morris-point {
  position: absolute;
  width: 11%;
  height: 11%;
  transform: translate(-50%, -50%);
  background: var(--square-light);
  border: 2px solid var(--border);
  border-radius: 50%;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
}

.morris-point-movable {
  background: var(--square-dark);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--text);
}

.morris-point-selected {
  border-color: var(--accent);
  border-width: 3px;
}

/* A piece that may be removed after a mill: a dashed ring (the reddish
   tint it used to have was invisible on e-ink). */
.morris-point-removable {
  border: 3px dashed var(--border);
}

.morris-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 82%;
  height: 82%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.morris-piece-black {
  background: #111;
  border: 2px solid #000;
}

.morris-piece-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Small disc icons for the color-choice picker and board placeholder,
   matching the board's own piece styling. */
.morris-icon-disc {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.morris-icon-disc-black {
  background: #111;
  border: 2px solid #000;
}

.morris-icon-disc-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Fanorona board: 45 points in a 5x9 grid (wider than tall, unlike most
   boards here), so it uses the same percentage-based absolute-positioning
   technique as WallMaze/Hex/Go rather than a plain float-grid, with a
   JS-enforced non-square aspect ratio (see ensureFanoronaBoardAspect in
   fanorona-app.js). Connections are drawn as one non-interactive SVG
   layer UNDER the point buttons - simpler and more reliable across an
   old E-Ink WebView than rotated divs, since roughly half the board's
   lines are diagonal (see fanorona-core.js for the "strong"/"weak"
   point pattern that decides which). Pieces are told apart structurally,
   not by color alone: Black is a filled disc, White an outlined disc,
   the same convention used everywhere else in this app. */

.fanorona-board {
  position: relative;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
}

.fanorona-lines {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.fanorona-lines line {
  stroke: var(--border);
  stroke-width: 2;
}

.fanorona-point {
  position: absolute;
  transform: translate(-50%, -50%);
  background: var(--square-light);
  border: 2px solid var(--border);
  border-radius: 50%;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
  z-index: 2;
}

.fanorona-point-movable {
  background: var(--square-dark);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--text);
}

.fanorona-point-selected {
  border-color: var(--accent);
  border-width: 3px;
}

.fanorona-point.last-move {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.fanorona-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 76%;
  height: 76%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.fanorona-piece-black {
  background: #111;
  border: 2px solid #000;
}

.fanorona-piece-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Small disc icons for the color-choice picker and board placeholder,
   matching the board's own piece styling. */
.fanorona-icon-disc {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.fanorona-icon-disc-black {
  background: #111;
  border: 2px solid #000;
}

.fanorona-icon-disc-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* The approach-vs-withdrawal choice and the "continue or stop" capture
   chain prompt: plain stacked buttons, margin-based spacing rather than
   flexbox `gap` (unsupported on the Tolino's Chrome 61 WebView). */
.fanorona-capture-choice,
.fanorona-chain-controls {
  margin-top: 0.6rem;
}

.fanorona-capture-choice button,
.fanorona-chain-controls button {
  margin: 0 0.5rem 0.5rem 0;
}

/* Worked-example diagrams on the rules page: two small SVG figures side
   by side on wide screens, stacked on narrow ones. Flexbox `gap`
   fallback (margin-based spacing) - same reason as above. */
.fanorona-example-row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 0 1rem -1.5rem;
}

.fanorona-example-figure {
  margin: 0 0 1rem 1.5rem;
  max-width: 260px;
}

.fanorona-example-figure svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.fanorona-example-figure figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

/* Backgammon board: a 13-column x 2-row CSS grid (12 point lanes per
   row plus a middle bar column spanning both rows), every cell placed
   explicitly by grid-column/grid-row rather than relying on auto-flow.
   Height is JS-enforced (see ensureBackgammonBoardSquare) rather than
   via `aspect-ratio`, which some E-Ink browsers silently ignore. */

.bg-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr) 0.7fr repeat(6, 1fr);
  grid-template-rows: 1fr 1fr;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  gap: 1px;
  padding: 1px;
}

.bg-bar {
  background: var(--square-dark);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.bg-point {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border: none;
  padding: 2px 0;
  box-sizing: border-box;
  cursor: pointer;
  overflow: hidden;
}

.bg-point-top {
  justify-content: flex-start;
}

.bg-point-bottom {
  justify-content: flex-end;
}

/* Every other point gets a line down each side instead of a beige tint,
   so neighbouring points stay apart on a grey screen. */
.bg-point-alt {
  box-shadow: inset 1px 0 0 var(--border), inset -1px 0 0 var(--border);
}

.bg-point-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.bg-point-selected {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.bg-point-label {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1;
}

.bg-point-top .bg-point-label {
  order: -1;
}

.bg-point-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.bg-point-stack > * {
  margin: 0 2px 2px 0;
}

.bg-point-stack > *:last-child {
  margin-right: 0;
}


.bg-point-top .bg-point-stack {
  order: 1;
}

.bg-checker {
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  box-sizing: border-box;
  flex-shrink: 0;
}

.bg-checker-black {
  background: #111;
  border: 2px solid #000;
}

.bg-checker-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

.bg-checker-overflow {
  font-size: 0.6rem;
  font-weight: 700;
}

.bg-tray {
  display: flex;
max-width: 760px;
  margin: 0 auto 0.4rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.bg-tray > * {
  margin: 0 0.6rem 0.6rem 0;
}

.bg-tray > *:last-child {
  margin-right: 0;
}


.bg-tray-slot {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.6rem;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 0.85rem;
  box-sizing: border-box;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.bg-tray-slot-static {
  cursor: default;
}

.bg-tray-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.bg-tray-slot-count {
  font-weight: 700;
}

.bg-dice-display {
  display: flex;
  align-items: center;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.bg-dice-display > * {
  margin: 0 0.4rem 0.4rem 0;
}

.bg-dice-display > *:last-child {
  margin-right: 0;
}


.bg-die {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  font-weight: 700;
  background: #fff;
}

/* Small disc icons for the color-choice picker and board placeholder,
   matching the board's own piece styling. */
.bg-icon-checker {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.bg-icon-checker-black {
  background: #111;
  border: 2px solid #000;
}

.bg-icon-checker-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Xiangqi board: a point-and-line grid, same technique as the Go board
   (a JS-enforced square-per-cell container, since `aspect-ratio` alone
   is silently ignored on some E-Ink browsers). */

.xq-board {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
  padding: 6%;
}

.xq-grid {
  position: relative;
  width: 100%;
  height: 100%;
}

.xq-line {
  position: absolute;
  background: var(--border);
}

.xq-line-h {
  left: 0;
  right: 0;
  height: 2px;
  transform: translateY(-1px);
}

.xq-line-v {
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-1px);
}

/* The river is a band without vertical lines (it covers them), the
   palaces are told apart by their diagonal cross - neither needs a tint. */
.xq-river {
  position: absolute;
  left: 0;
  right: 0;
  background: var(--square-light);
}

.xq-palace {
  position: absolute;
  background: transparent;
}

/* The palace's diagonal cross - same stroke color and thickness as
   the board's own grid lines (.xq-line), so it stays clearly visible
   in grayscale on E-Ink rather than reading as a faint decoration. */
.xq-palace-diag {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.xq-palace-diag line {
  stroke: var(--border);
  stroke-width: 2;
}

.xq-point {
  position: absolute;
  transform: translate(-50%, -50%);
  background: transparent;
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  width: 11%;
  height: 11%;
}

.xq-point-movable::before {
  content: "";
  position: absolute;
  top: 30%;
  left: 30%;
  width: 40%;
  height: 40%;
  border-radius: 50%;
  background: var(--square-dark);
}

.xq-point-last-move::before {
  content: "";
  position: absolute;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 80%;
  border: 2px dashed var(--muted);
  border-radius: 50%;
  box-sizing: border-box;
}

.xq-point-selected .xq-piece.xq-piece-filled {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.xq-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 88%;
  height: 88%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

.xq-piece-filled {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Red vs. Black is a color distinction, which doesn't exist at all on
   a monochrome E-Ink display - both used to render as similarly dark
   ink on the same light disc. Black pieces get their own solid dark
   disc instead (the same filled-vs-outlined trick already used for
   every other two-color game here), so which piece is whose reads
   from the disc itself, not from a hue. Classic-character text color
   and the symbol-style SVGs' own stroke color (in xiangqi-app.js) are
   flipped to match: dark ink on Red's light disc, light ink on
   Black's now-dark one. */
.xq-piece-black.xq-piece-filled {
  background: #111;
  border: 2px solid #000;
}

.xq-piece-red {
  color: #111;
}

.xq-piece-black {
  color: #fdfdfd;
}

.xq-piece svg {
  width: 68%;
  height: 68%;
}

/* Small disc icons for the color-choice picker and board placeholder,
   matching the board's own piece styling. */
.xq-icon-disc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3em;
  height: 1.3em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
  background: #fdfdfd;
  border: 2px solid var(--border);
  font-size: 0.7em;
  font-weight: 700;
  line-height: 1;
}

.xq-icon-disc-red {
  color: #111;
}

/* Same dark-filled-disc treatment as the board's own pieces - shown
   side by side with the red icon in the color-choice picker, so it
   needs the same monochrome-safe distinction, not just a text-color
   change. */
.xq-icon-disc-black {
  background: #111;
  border-color: #000;
  color: #fdfdfd;
}

/* Mancala board: a store well at each end of a 6x2 grid of pits,
   matching a physical Kalaha board's layout. The top row shows Player
   2's pits right-to-left and the bottom row shows Player 1's pits
   left-to-right, so sowing always reads as one continuous loop around
   the board rather than jumping between rows in raw array order. */

.mancala-board {
  display: flex;
  align-items: stretch;
max-width: 760px;
  margin: 0 auto;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
/* Mancala board: a store well at each end of a 6x2 grid of pits > *, matching a physical Kalaha board's layout. The top row shows Player
   2's pits right-to-left and the bottom row shows Player 1's pits
   left-to-right > *, so sowing always reads as one continuous loop around
   the board rather than jumping between rows in raw array order. */

.mancala-board > * {
  margin: 0 0.4rem 0.4rem 0;
}

/* Mancala board: a store well at each end of a 6x2 grid of pits > *:last-child, matching a physical Kalaha board's layout. The top row shows Player
   2's pits right-to-left and the bottom row shows Player 1's pits
   left-to-right > *:last-child, so sowing always reads as one continuous loop around
   the board rather than jumping between rows in raw array order. */

.mancala-board > *:last-child {
  margin-right: 0;
}


.mancala-store {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
flex: 0 0 15%;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: var(--square-light);
  box-sizing: border-box;
  padding: 0.4rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.mancala-store > * {
  margin: 0 0.3rem 0.3rem 0;
}

.mancala-store > *:last-child {
  margin-right: 0;
}


.mancala-store-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.mancala-store-count {
  font-size: 1.6rem;
  font-weight: bold;
}

.mancala-pits {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 1fr;
  gap: 0.3rem;
}

/* Pit height is set in JS to match its own measured width (see
   ensureMancalaPitAspectRatio in mancala-app.js) - `aspect-ratio` alone
   is silently ignored on some E-Ink browsers, the same issue noted in
   the other games' board-rendering code. */
.mancala-pit {
  position: relative;
  border-radius: 50%;
  border: var(--border-width) solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font: inherit;
}

.mancala-pit:disabled {
  opacity: 0.55;
}

.mancala-pit-movable {
  background: var(--square-dark);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--text);
}

.mancala-pit-count {
  font-size: 1.3rem;
  font-weight: bold;
  pointer-events: none;
}

/* Small disc icon for the color-choice picker and board placeholder,
   representing a single seed/counter. */
.mancala-seed-icon {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: middle;
}

/* Plain, non-interactive list of not-yet-built game ideas on the home
   page - deliberately undecorated (no icons, no action buttons) so it
   never looks like it could be tapped, unlike the playable games above. */
.coming-soon-list {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-4);
  color: var(--muted);
}

.coming-soon-list li {
  margin-bottom: var(--space-2);
}

.coming-soon-list strong {
  color: var(--text);
}

/* Reversi board: reuses .square from the chess board (same
   float-grid technique) but, unlike checkers, every square looks the
   same - a real Reversi board is a uniform grid, not a checkered one. */

#reversi-board {
  display: block;
  width: 100%;
  max-width: 760px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.reversi-square {
  background: var(--square-light);
  border: 1px solid var(--border);
}

.reversi-square-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

/* Gesperrt heißt hier nur "kein legaler Zug", nicht "inaktiv": ohne
   das würden fast alle Steine halbtransparent und Schwarz sähe grau aus. */
.reversi-square:disabled,
.c4-square:disabled {
  cursor: default;
  opacity: 1;
}

.reversi-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 78%;
  height: 78%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.reversi-piece-black {
  background: #111;
  border: 2px solid #000;
}

.reversi-piece-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Small disc icons for the color-choice picker and board placeholder,
   matching the board's own piece styling. */
.reversi-icon-disc {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.reversi-icon-disc-black {
  background: #111;
  border: 2px solid #000;
}

.reversi-icon-disc-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Connect Four board: same uniform-grid approach as Reversi (a real
   Connect Four board isn't checkered either) - 6 rows x 7 columns,
   with the whole column clickable, not just the empty landing cell. */

#fourinarow-board {
  display: block;
  width: 100%;
  max-width: 760px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.c4-square {
  /* Overrides .square's own 12.5% (built for an 8-column board): with
     7 columns, that width made floats wrap after 8 cells instead of 7,
     desyncing every row from its logical column past the first one. */
  width: calc(100% / 7);
  background: var(--square-light);
  border: 1px solid var(--border);
}

.c4-square-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.c4-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 78%;
  height: 78%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.c4-piece-black {
  background: #111;
  border: 2px solid #000;
}

.c4-piece-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Small disc icons for the color-choice picker and board placeholder,
   matching the board's own piece styling. */
.c4-icon-disc {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.c4-icon-disc-black {
  background: #111;
  border: 2px solid #000;
}

.c4-icon-disc-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Gomoku board: a fixed 15x15 intersection grid, identical technique
   to Go's own board (percentage-positioned lines/points rather than a
   float grid, since stones sit ON intersections, not inside squares) -
   just without Go's variable board size or hoshi star points. */

.gomoku-board {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
}

.gomoku-grid {
  position: relative;
  width: 100%;
  height: 100%;
}

.gomoku-line {
  position: absolute;
  background: var(--border);
}

.gomoku-line-h {
  left: 0;
  right: 0;
  height: 2px;
  transform: translateY(-1px);
}

.gomoku-line-v {
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-1px);
}

.gomoku-point {
  position: absolute;
  transform: translate(-50%, -50%);
  background: transparent;
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
}

.gomoku-stone {
  position: absolute;
  top: 4%;
  right: 4%;
  bottom: 4%;
  left: 4%;
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.gomoku-stone-black {
  background: #111;
  border: 1px solid #000;
}

.gomoku-stone-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

.gomoku-point.last-move .gomoku-stone::after {
  content: "";
  position: absolute;
  top: -22%;
  right: -22%;
  bottom: -22%;
  left: -22%;
  border: 2px solid var(--accent);
  border-radius: 50%;
}

/* Senet board: a 3x10 float-grid (same technique as the chess/checkers/
   Connect Four boards - a JS-enforced square size per cell, since CSS
   `aspect-ratio` is unreliable on E-Ink browsers), numbered in the
   traditional boustrophedon path across all three rows. The three named
   squares (House of Rebirth/Beauty/Water) get their own hatch patterns
   rather than a color, so they stay distinguishable on a monochrome
   E-Ink display. */

#senet-board {
  display: block;
  width: 100%;
  max-width: 820px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.senet-square {
  width: calc(100% / 10);
  background: var(--square-light);
  border: 1px solid var(--border);
}

.senet-square-number {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 0.6rem;
  line-height: 1;
  color: var(--muted);
  pointer-events: none;
}

.senet-square-rebirth {
  background: repeating-linear-gradient(45deg, var(--square-light), var(--square-light) 5px, #e6e6e6 5px, #e6e6e6 6px);
}

.senet-square-beauty {
  background: repeating-linear-gradient(-45deg, var(--square-light), var(--square-light) 5px, #e6e6e6 5px, #e6e6e6 6px);
}

.senet-square-water {
  background: repeating-linear-gradient(90deg, var(--square-light), var(--square-light) 4px, #d8d8d8 4px, #d8d8d8 6px);
}

/* Senet: the square numbers sit top left, so the triangle goes top right. */
.senet-square-movable {
  background: linear-gradient(225deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.senet-piece {
  position: absolute;
  top: 55%;
  left: 50%;
  width: 62%;
  height: 62%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.senet-piece-a {
  background: #111;
  border: 2px solid #000;
}

.senet-piece-b {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

.senet-piece-count {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

/* Small disc icons for the color-choice picker and board placeholder,
   matching the board's own piece styling. */
.senet-icon-disc {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.senet-icon-disc-a {
  background: #111;
  border: 2px solid #000;
}

.senet-icon-disc-b {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

.senet-borne-off {
  text-align: center;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  white-space: pre-wrap;
}

.senet-sticks-area {
  display: flex;
  align-items: center;
  justify-content: center;
margin-top: 0.5rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.senet-sticks-area > * {
  margin: 0 0.6rem 0.6rem 0;
}

.senet-sticks-area > *:last-child {
  margin-right: 0;
}


.senet-sticks-display {
  display: flex;
  align-items: center;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.senet-sticks-display > * {
  margin: 0 0.3rem 0.3rem 0;
}

.senet-sticks-display > *:last-child {
  margin-right: 0;
}


.senet-stick {
  display: inline-block;
  width: 0.5rem;
  height: 1.1rem;
  border: var(--border-width) solid var(--border);
  box-sizing: border-box;
}

.senet-stick-marked {
  background: var(--accent);
}

.senet-stick-blank {
  background: #fff;
}

.senet-stick-total {
  font-weight: 700;
  margin-left: 0.3rem;
}

/* Shogi board: a 9x9 float-grid (same technique as the chess/checkers/
   Connect Four boards - a JS-enforced square cell size, since CSS
   `aspect-ratio` is unreliable on E-Ink browsers). Pieces are plain
   pentagons carrying their kanji, rotated 180deg for White - so which
   side a piece belongs to is a shape fact, not a color fact, and
   promoted pieces get their own traditional single-kanji abbreviation
   instead of red ink. Both choices make this one of the more naturally
   E-Ink-friendly games here already, without needing a color fix. */

#shogi-board {
  display: block;
  width: 100%;
  max-width: 620px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.shogi-square {
  width: calc(100% / 9);
  background: var(--square-light);
  border: 1px solid var(--border);
}

.shogi-square-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.shogi-square-last-from,
.shogi-square-last-to {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.shogi-square-check {
  background: var(--square-dark);
}

.shogi-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 84%;
  transform: translate(-50%, -50%);
  clip-path: polygon(50% 0%, 92% 26%, 100% 100%, 0% 100%, 8% 26%);
  background: var(--square-light);
  border: 2px solid var(--border);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.shogi-piece svg {
  width: 80%;
  height: 80%;
  /* The pentagon is wider at the bottom, so the kanji sit a little low. */
  margin-top: 8%;
}

/* Etwas kräftigere Striche: feine Pinselstriche (z. B. 金 gegenüber 全)
   verschwimmen auf E-Ink sonst. !important, weil die Grafiken ihre
   Strichstärke als Inline-Stil mitbringen. */
.shogi-piece svg path {
  stroke: #000 !important;
  stroke-width: 0.45 !important;
  stroke-linejoin: round;
}

.shogi-piece-w {
  transform: translate(-50%, -50%) rotate(180deg);
}

/* Small pentagon icons for the color-choice picker and board
   placeholder, matching the board's own piece styling. */
.shogi-icon-piece {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
  clip-path: polygon(50% 0%, 92% 26%, 100% 100%, 0% 100%, 8% 26%);
  background: var(--square-light);
  border: 2px solid var(--border);
  box-sizing: border-box;
  vertical-align: middle;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
}

.shogi-icon-piece-w {
  transform: rotate(180deg);
}

/* Captured pieces switch sides and join the capturing player's hand -
   shown as a row of labelled buttons above/below the board, since they
   have no board square of their own until dropped. */
.shogi-hand {
  display: flex;
  flex-wrap: wrap;
justify-content: center;
  max-width: 620px;
  margin: 0 auto 0.4rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
/* Captured pieces switch sides and join the capturing player's hand -
   shown as a row of labelled buttons above/below the board > *, since they
   have no board square of their own until dropped. */
.shogi-hand > * {
  margin: 0 0.3rem 0.3rem 0;
}

/* Captured pieces switch sides and join the capturing player's hand -
   shown as a row of labelled buttons above/below the board > *:last-child, since they
   have no board square of their own until dropped. */
.shogi-hand > *:last-child {
  margin-right: 0;
}


.shogi-hand-piece {
  display: flex;
  align-items: center;
padding: 0.25rem 0.5rem;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font: inherit;
  cursor: pointer;
  box-sizing: border-box;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.shogi-hand-piece > * {
  margin: 0 0.25rem 0.25rem 0;
}

.shogi-hand-piece > *:last-child {
  margin-right: 0;
}


.shogi-hand-piece:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Selected hand piece: the grey plus the site's usual selection frame
   (3 px solid, like .square.selected) - neither the corner triangle of
   "can move" nor the thin inner frame of "last move". */
.shogi-hand-piece-selected {
  background: var(--square-dark);
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.shogi-hand-piece-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8em;
  height: 1.8em;
  clip-path: polygon(50% 0%, 92% 26%, 100% 100%, 0% 100%, 8% 26%);
  background: var(--square-light);
  border: 2px solid var(--border);
  box-sizing: border-box;
}

.shogi-hand-piece-label svg {
  /* The drawings carry generous empty margins of their own, so they are
     scaled past the label's box; the pentagon clip trims only blank space. */
  flex: none;
  width: 118%;
  height: 118%;
  margin-top: 12%;
}

/* Same slightly heavier strokes as on the board (see .shogi-piece svg path). */
.shogi-hand-piece-label svg path {
  stroke: #000 !important;
  stroke-width: 0.45 !important;
  stroke-linejoin: round;
}

.shogi-hand-piece.shogi-piece-w .shogi-hand-piece-label {
  transform: rotate(180deg);
}

.shogi-hand-piece-count {
  font-weight: 700;
  font-size: 0.85rem;
}

.shogi-promotion-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
margin-top: 0.5rem;
  flex-wrap: wrap;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.shogi-promotion-prompt > * {
  margin: 0 0.6rem 0.6rem 0;
}

.shogi-promotion-prompt > *:last-child {
  margin-right: 0;
}


/* Sudoku board: a 9x9 float-grid (same technique as the chess/checkers/
   Connect Four boards - a JS-enforced square cell size, since CSS
   `aspect-ratio` is unreliable on E-Ink browsers), with a thicker
   border marking each 3x3 box. Given cells are told apart from the
   player's own entries by weight (bold vs regular), and a conflicting
   entry gets a dashed outline - both structural, so nothing here
   depends on color to stay readable on a monochrome E-Ink display. */

#sudoku-board {
  display: block;
  width: 100%;
  max-width: 540px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.sudoku-cell {
  width: calc(100% / 9);
  background: var(--square-light);
  border: 1px solid var(--border);
}

.sudoku-box-left {
  border-left-width: 3px;
}

.sudoku-box-top {
  border-top-width: 3px;
}

.sudoku-cell-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  font-size: clamp(0.9rem, 3.5vw, 1.4rem);
  line-height: 1;
  pointer-events: none;
}

.sudoku-cell-given .sudoku-cell-value {
  font-weight: 700;
}

.sudoku-cell-conflict {
  outline: 2px dashed var(--border);
  outline-offset: -2px;
}

.sudoku-numpad {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
max-width: 540px;
  margin: 0.6rem auto 0;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.sudoku-numpad > * {
  margin: 0 0.4rem 0.4rem 0;
}

.sudoku-numpad > *:last-child {
  margin-right: 0;
}


.sudoku-numpad-btn {
  width: 2.4rem;
  height: 2.4rem;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-sizing: border-box;
}

.sudoku-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
  border: 2px solid var(--border);
  box-sizing: border-box;
  font-weight: 700;
}

/* Kakuro board: a float-grid (same JS-enforced-square-cell technique as
   the Sudoku/chess/checkers boards, since CSS `aspect-ratio` is
   unreliable on E-Ink browsers), sized 7x7/9x9/11x11 by difficulty
   rather than Sudoku's fixed 9x9, so cell width is set inline per
   puzzle instead of a fixed CSS percentage. A black "clue" cell is
   solid black with white sum numbers tucked in its corners - the
   across sum upper-right, the down sum lower-left, split by a thin
   diagonal line only when a cell carries both (see .kakuro-cell-split)
   - the standard Kakuro notation, kept legible in pure black/white with
   no reliance on color. */

#kakuro-board {
  display: block;
  width: 100%;
  max-width: 540px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.kakuro-cell {
  background: var(--square-light);
  border: 1px solid var(--border);
}

.kakuro-cell-white {
  cursor: pointer;
}

.kakuro-cell-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  font-size: clamp(0.8rem, 3.2vw, 1.3rem);
  line-height: 1;
  font-weight: 700;
  pointer-events: none;
}

.kakuro-cell-conflict {
  outline: 2px dashed var(--border);
  outline-offset: -2px;
}

.kakuro-cell-black {
  background: var(--border);
  box-sizing: border-box;
}

/* A thin white seam along the main diagonal (top-left to bottom-right),
   just wide enough to read as a dividing line, only drawn when a black
   cell carries both an across and a down clue at once - a cell with
   only one clue needs no divider. */
.kakuro-cell-split {
  background:
    linear-gradient(to top right,
      var(--border) 0%, var(--border) calc(50% - 0.75px),
      #fff calc(50% - 0.75px), #fff calc(50% + 0.75px),
      var(--border) calc(50% + 0.75px), var(--border) 100%);
}

.kakuro-clue {
  position: absolute;
  color: #fff;
  font-weight: 700;
  line-height: 1;
  font-size: 0.55rem;
  font-size: clamp(0.42rem, 1.7vw, 0.68rem);
  pointer-events: none;
}

.kakuro-clue-right {
  top: 2px;
  right: 2px;
}

.kakuro-clue-down {
  bottom: 2px;
  left: 2px;
}

.kakuro-numpad {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
max-width: 540px;
  margin: 0.6rem auto 0;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.kakuro-numpad > * {
  margin: 0 0.4rem 0.4rem 0;
}

.kakuro-numpad > *:last-child {
  margin-right: 0;
}


.kakuro-numpad-btn {
  width: 2.4rem;
  height: 2.4rem;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-sizing: border-box;
}

.kakuro-icon {
  display: inline-block;
  width: 1.4em;
  height: 1.4em;
  border: 2px solid var(--border);
  box-sizing: border-box;
  background: linear-gradient(to top right, var(--border) 0%, var(--border) 50%, transparent 50%, transparent 100%);
}

/* Peg Solitaire board: a 7x7 or 9x9 float-grid (same technique as the
   chess/checkers/Connect Four boards - a JS-enforced square cell size,
   since CSS `aspect-ratio` is unreliable on E-Ink browsers; the cell
   width is set inline from the board size), with the off-board corners
   left as invisible gaps - the same gap technique used for the Royal
   Game of Ur's board. */

/* --peg-cols is the board's grid size (5 to 9), set by
   pegsolitaire-app.js. Each hole is at most 66 px wide, so a small
   board stays small and the 9x9 one reaches 594 px - on a 632 px reader
   every hole is about 66 px. The first lines are the fallback for a
   browser without custom properties (the 7x7 boards). */
#pegsolitaire-board {
  display: block;
  width: 100%;
  max-width: 460px;
  max-width: calc(var(--peg-cols, 7) * 66px);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.peg-square {
  width: calc(100% / 7);
  width: calc(100% / var(--peg-cols, 7));
  background: var(--square-light);
  border: 1px solid var(--border);
}

.peg-square-gap {
  background: transparent;
  border: none;
  pointer-events: none;
}

.peg-square-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.peg-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40%;
  height: 40%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--border);
  box-sizing: border-box;
  pointer-events: none;
}

.peg-piece-filled {
  background: #111;
}

.peg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
}

.peg-icon::before {
  content: "";
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  background: #111;
  border: 2px solid var(--border);
  box-sizing: border-box;
}

/* Minesweeper board: a float-grid (same JS-enforced square cell size
   technique as the other games) at a fixed pixel width rather than a
   percentage one, wrapped in a horizontally scrolling container - so
   the 30-column Expert board keeps a legible ~32px cell size on a
   narrow e-reader screen instead of shrinking every cell down to
   illegibility. Numbers, flags and mines are told apart by the glyph
   itself, never by color, so this reads fine on a monochrome display
   without any special-casing. */

.minesweeper-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
/* Minesweeper board: a float-grid (same JS-enforced square cell size
   technique as the other games) at a fixed pixel width rather than a
   percentage one > *, wrapped in a horizontally scrolling container - so
   the 30-column Expert board keeps a legible ~32px cell size on a
   narrow e-reader screen instead of shrinking every cell down to
   illegibility. Numbers > *, flags and mines are told apart by the glyph
   itself > *, never by color > *, so this reads fine on a monochrome display
   without any special-casing. */

.minesweeper-toolbar > * {
  margin: 0 0.8rem 0.8rem 0;
}

/* Minesweeper board: a float-grid (same JS-enforced square cell size
   technique as the other games) at a fixed pixel width rather than a
   percentage one > *:last-child, wrapped in a horizontally scrolling container - so
   the 30-column Expert board keeps a legible ~32px cell size on a
   narrow e-reader screen instead of shrinking every cell down to
   illegibility. Numbers > *:last-child, flags and mines are told apart by the glyph
   itself > *:last-child, never by color > *:last-child, so this reads fine on a monochrome display
   without any special-casing. */

.minesweeper-toolbar > *:last-child {
  margin-right: 0;
}


.minesweeper-mine-counter,
.minesweeper-timer {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.minesweeper-board-wrap {
  overflow-x: auto;
  max-width: 100%;
}

#minesweeper-board {
  display: block;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.minesweeper-cell {
  background: var(--square-dark);
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.minesweeper-cell-revealed {
  background: var(--square-light);
}

.minesweeper-cell-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.9rem;
  font-size: clamp(0.7rem, 3vw, 1.1rem);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.minesweeper-cell-mine {
  background: var(--square-dark);
}

.minesweeper-cell-exploded {
  outline: 2px solid var(--border);
  outline-offset: -2px;
}

.mine-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
}

.mine-icon::before {
  content: "\25CF";
  font-size: 1em;
  line-height: 1;
}

/* Nonogram board: a CSS grid rather than the usual float-grid, since a
   Nonogram needs a row of column clues above the picture and a column
   of row clues to its left, in addition to the picture cells - a shape
   a simple square-per-cell float layout doesn't fit. A thicker border
   every 5th cell marks off easy 5-cell counting groups, the same idea
   as chess/checkers board coordinates but for line-counting instead. */

.nonogram-mode-toggle {
  display: flex;
  justify-content: center;
margin-bottom: 0.5rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
/* Nonogram board: a CSS grid rather than the usual float-grid > *, since a
   Nonogram needs a row of column clues above the picture and a column
   of row clues to its left > *, in addition to the picture cells - a shape
   a simple square-per-cell float layout doesn't fit. A thicker border
   every 5th cell marks off easy 5-cell counting groups > *, the same idea
   as chess/checkers board coordinates but for line-counting instead. */

.nonogram-mode-toggle > * {
  margin: 0 0.5rem 0.5rem 0;
}

/* Nonogram board: a CSS grid rather than the usual float-grid > *:last-child, since a
   Nonogram needs a row of column clues above the picture and a column
   of row clues to its left > *:last-child, in addition to the picture cells - a shape
   a simple square-per-cell float layout doesn't fit. A thicker border
   every 5th cell marks off easy 5-cell counting groups > *:last-child, the same idea
   as chess/checkers board coordinates but for line-counting instead. */

.nonogram-mode-toggle > *:last-child {
  margin-right: 0;
}


.nonogram-wrap {
  overflow: auto;
  max-width: 100%;
}

.nonogram-grid {
  display: grid;
  width: fit-content;
  margin: 0 auto;
  border: 3px solid var(--border);
  box-sizing: border-box;
  background: var(--square-light);
}

.nonogram-corner {
  background: var(--square-light);
  border-right: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
}

.nonogram-clue {
  display: flex;
  align-items: center;
  justify-content: center;
font-size: 0.75rem;
  font-weight: 700;
  background: var(--square-light);
  padding: 0.15em;
  box-sizing: border-box;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.nonogram-clue > * {
  margin: 0 0.15em 0.15em 0;
}

.nonogram-clue > *:last-child {
  margin-right: 0;
}


.nonogram-clue-col {
  flex-direction: column;
  border-bottom: 2px solid var(--border);
}

.nonogram-clue-row {
  flex-direction: row;
  justify-content: flex-end;
  border-right: 2px solid var(--border);
  white-space: nowrap;
}

/* Flexbox `gap` fallback: margin-based spacing instead (see the
   .mode-buttons rule earlier) - this class is combined with the
   display:flex .nonogram-clue on the same element. */
.nonogram-clue-row > * {
  margin: 0 0.5em 0.5em 0;
}

.nonogram-clue-row > *:last-child {
  margin-right: 0;
}

.nonogram-cell {
  width: 1.8em;
  height: 1.8em;
  min-width: 1.4em;
  min-height: 1.4em;
  background: var(--square-light);
  border: 1px solid var(--border);
  box-sizing: border-box;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.nonogram-cell-block-left {
  border-left-width: 2px;
}

.nonogram-cell-block-top {
  border-top-width: 2px;
}

.nonogram-cell-filled {
  background: #111;
}

.nonogram-cell-marked {
  color: var(--muted);
}

.nonogram-icon {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 1.4em;
  height: 1.4em;
  border: 2px solid var(--border);
  box-sizing: border-box;
  gap: 1px;
  padding: 1px;
}

.nonogram-icon::before,
.nonogram-icon::after {
  content: "";
  background: #111;
  grid-column: 2;
}

.nonogram-icon::before {
  grid-row: 1;
}

.nonogram-icon::after {
  grid-row: 3;
}

/* 2048 board: a 4x4 float-grid (same technique as the chess/checkers/
   Connect Four boards - a JS-enforced square cell size, since CSS
   `aspect-ratio` is unreliable on E-Ink browsers). Tiles are told apart
   purely by their printed number and a couple of border/weight steps
   as the value grows, never by color, unlike the classic game's usual
   color-per-value palette - so this reads fine on a monochrome E-Ink
   display without needing sixteen shades any reader could tell apart
   on some displays but not others. */

#twenty48-board {
  display: block;
  width: 100%;
  max-width: 420px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
  touch-action: none;
}

.twenty48-cell {
  width: 25%;
  background: var(--square-light);
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.twenty48-cell-filled {
  border-width: 2px;
}

.twenty48-cell-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.2rem;
  font-size: clamp(0.9rem, 5vw, 1.6rem);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.twenty48-cell-big .twenty48-cell-value {
  font-size: 1rem;
  font-size: clamp(0.7rem, 4vw, 1.3rem);
}

.twenty48-cell-huge {
  background: var(--square-dark);
}

.twenty48-cell-huge .twenty48-cell-value {
  font-size: 0.85rem;
  font-size: clamp(0.6rem, 3.2vw, 1.1rem);
}

.twenty48-controls-pad {
  display: flex;
  flex-direction: column;
  align-items: center;
margin-top: 0.6rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.twenty48-controls-pad > * {
  margin: 0 0.4rem 0.4rem 0;
}

.twenty48-controls-pad > *:last-child {
  margin-right: 0;
}


.twenty48-controls-row {
  display: flex;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.twenty48-controls-row > * {
  margin: 0 0.4rem 0.4rem 0;
}

.twenty48-controls-row > *:last-child {
  margin-right: 0;
}


.twenty48-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2em;
  height: 1.4em;
  border: 2px solid var(--border);
  box-sizing: border-box;
  font-size: 0.6rem;
  font-weight: 700;
}

/* Light Switch board: a fixed 5x5 float-grid (same JS-enforced square cell
   size technique as 2048/Minesweeper). A cell whose light is on shows a
   bold lamp (bulb with rays), an off cell is empty - a shape, not a fill
   or a color, so it reads at a glance on black-and-white E-Ink. Both stay
   light: a dark cell for "on" read as "light off" to players. */

#lightswitch-board {
  display: block;
  width: 100%;
  max-width: 360px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.lightswitch-cell {
  width: 20%;
  background: var(--square-light);
  border: 1px solid var(--border);
  box-sizing: border-box;
  padding: 0;
  cursor: pointer;
}

.lightswitch-cell-on {
  background: var(--square-light) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg stroke='%23141413' stroke-width='7' stroke-linecap='round'%3E%3Cpath d='M50 6V16M17 18L24 25M83 18L76 25M6 46H16M84 46H94M20 72L26 66M80 72L74 66'/%3E%3Cpath d='M40 80H60M42 90H58'/%3E%3C/g%3E%3Cpath d='M50 24C37 24 28 33 28 45C28 54 34 59 38 64V72H62V64C66 59 72 54 72 45C72 33 63 24 50 24Z' fill='%23141413'/%3E%3C/svg%3E") center / 78% no-repeat;
}

/* Light Switch rules page: the table of bottom-row patterns. Each pattern
   is a drawn row of five cells, lamps where a light is on. */
.lightswitch-solve-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
}

.lightswitch-solve-table th,
.lightswitch-solve-table td {
  border: 1px solid var(--border);
  padding: var(--space-1) var(--space-2);
  text-align: start;
  vertical-align: middle;
}

.lightswitch-solve-table td:last-child {
  font-weight: 700;
  font-size: 1.1rem;
}

.lightswitch-solve-row {
  display: block;
  width: 9rem;
  max-width: 100%;
  height: 1.8rem;
}

/* Mahjong Solitaire board: absolute positioning on a percentage grid
   (the same approach as Go/Xiangqi/Gomoku's point grids) rather than
   the usual float-grid, since tiles overlap across three layers
   instead of sitting in a simple rectangular arrangement. Each layer
   gets a small fixed pixel nudge (in mahjong-app.js) purely for the
   classic layered "mound" look. Tiles are matched by their printed
   glyph alone, so nothing here needs color to stay readable on a
   monochrome E-Ink display. */

.mahjong-wrap {
  overflow: auto;
  max-width: 100%;
}

#mahjong-board {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
}

.mahjong-tile {
  position: absolute;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 3px;
  box-sizing: border-box;
  box-shadow: 2px 2px 0 var(--border);
  padding: 0;
  cursor: pointer;
}

.mahjong-tile-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.9rem;
  font-size: clamp(0.6rem, 2.2vw, 1.2rem);
  line-height: 1;
  pointer-events: none;
}

.mahjong-tile-blocked {
  background: var(--square-dark);
}

.mahjong-tile-selected {
  outline: 3px solid var(--border);
  outline-offset: 1px;
}

.mahjong-actions-row {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
}

.mahjong-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
  font-size: 1.1rem;
}

/* FreeCell board: free cells and foundations in a row above eight
   cascading tableau columns. Cards overlap via a negative margin
   rather than the float-grid/percentage-grid techniques used
   elsewhere, since a solitaire cascade is a variable-height stack, not
   a fixed board shape - the page simply scrolls if a column grows
   tall. The overlap is set in JS together with the card height
   (CardFaces.layoutColumns in card-faces.js) so each card's label band
   stays fully visible at any screen width. The red/black colour the
   stacking rule depends on is shown by fill instead of colour: red
   suits are drawn hollow, black suits filled (.card-suit below). */

.freecell-top-row {
  display: flex;
  justify-content: space-between;
max-width: 900px;
  margin: 0 auto 0.6rem;
  flex-wrap: wrap;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.freecell-top-row > * {
  margin: 0 1rem 1rem 0;
}

.freecell-top-row > *:last-child {
  margin-right: 0;
}

.freecell-freecells,
.freecell-foundations {
  display: flex;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.freecell-freecells > *, .freecell-foundations > * {
  margin: 0 0.3rem 0.3rem 0;
}

.freecell-freecells > *:last-child, .freecell-foundations > *:last-child {
  margin-right: 0;
}


.freecell-cell {
  width: 2.6rem;
  height: 3.6rem;
  border: var(--border-width) solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-weight: 700;
  font-size: 1rem;
  box-sizing: border-box;
  cursor: pointer;
}

.freecell-foundation-empty {
  color: var(--muted);
  font-weight: 400;
}

.freecell-cell-selected {
  outline: 3px solid var(--border);
  outline-offset: 1px;
}

.freecell-columns {
  display: flex;
max-width: 900px;
  margin: 0 auto;
  align-items: flex-start;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.freecell-columns > * {
  margin: 0 0.4rem 0.4rem 0;
}

.freecell-columns > *:last-child {
  margin-right: 0;
}


.freecell-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Height and overlap (margin-top) are set in JS from the measured
   column width (CardFaces.layoutColumns in card-faces.js) rather than
   CSS `aspect-ratio`, which some E-Ink browsers (Tolino confirmed)
   don't support reliably. display:flex keeps the label at the top of
   the button - a button centres its content vertically, which pushed
   the label under the next card. */
.freecell-card {
  position: relative;
  width: 100%;
  border: var(--border-width) solid var(--border);
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  padding: 0.2rem 0 0 0.3rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.8rem;
  font-size: clamp(0.65rem, 2.4vw, 0.95rem);
  cursor: pointer;
}

.freecell-card:first-child {
  margin-top: 0;
}

/* An emptied column: its min-height (set in JS) keeps it tappable, and a
   dashed outline without fill marks it, like Ludo's empty home slots.
   Klondike and Spider draw their own .klondike-empty-slot /
   .spider-empty-slot inside the column instead, so this only ever
   matches FreeCell in practice. */
.freecell-column:empty,
.klondike-column:empty,
.spider-column:empty {
  border: 2px dashed var(--border);
  border-radius: 4px;
  box-sizing: border-box;
}

/* Card face from card-faces.js: rank text plus the suit as SVG. The
   line height matches the label band CardFaces.layoutColumns reserves. */
.card-face {
  display: block;
  line-height: 1.25;
  white-space: nowrap;
}

.card-suit {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 0.08em;
  vertical-align: -0.1em;
}

.freecell-card-selected {
  outline: 3px solid var(--border);
  outline-offset: -2px;
}

.freecell-actions-row {
  display: flex;
  justify-content: center;
  margin-top: 0.6rem;
}

.freecell-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8em;
  height: 1.4em;
  border: 2px solid var(--border);
  border-radius: 3px;
  box-sizing: border-box;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Klondike board: stock/waste and foundations in a row above seven
   cascading tableau columns - the same overlap-via-negative-margin
   layout as FreeCell's cascade, since a Klondike column is likewise a
   variable-height stack rather than a fixed board shape. Suits are
   drawn like FreeCell's: red suits hollow, black suits filled, so the
   red/black colour reads on a monochrome screen. Face-down cards get a
   hatched back instead of a plain color, the same structural, not
   color-based, convention used for player fills elsewhere in this
   app (e.g. Dots and Boxes). */

.klondike-top-row {
  display: flex;
  justify-content: space-between;
max-width: 900px;
  margin: 0 auto 0.6rem;
  flex-wrap: wrap;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.klondike-top-row > * {
  margin: 0 1rem 1rem 0;
}

.klondike-top-row > *:last-child {
  margin-right: 0;
}

.klondike-stockwaste,
.klondike-foundations {
  display: flex;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.klondike-stockwaste > *, .klondike-foundations > * {
  margin: 0 0.3rem 0.3rem 0;
}

.klondike-stockwaste > *:last-child, .klondike-foundations > *:last-child {
  margin-right: 0;
}

.klondike-cell {
  width: 2.6rem;
  height: 3.6rem;
  border: var(--border-width) solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-weight: 700;
  font-size: 1rem;
  box-sizing: border-box;
  cursor: pointer;
}

.klondike-foundation-empty {
  color: var(--muted);
  font-weight: 400;
}

.klondike-card-selected {
  outline: 3px solid var(--border);
  outline-offset: 1px;
}

.klondike-columns {
  display: flex;
max-width: 900px;
  margin: 0 auto;
  align-items: flex-start;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.klondike-columns > * {
  margin: 0 0.4rem 0.4rem 0;
}

.klondike-columns > *:last-child {
  margin-right: 0;
}

.klondike-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Height and overlap (margin-top) are set in JS, like FreeCell's
   cards (CardFaces.layoutColumns in card-faces.js). */
.klondike-card {
  position: relative;
  width: 100%;
  border: var(--border-width) solid var(--border);
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  padding: 0.2rem 0 0 0.3rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.8rem;
  font-size: clamp(0.65rem, 2.4vw, 0.95rem);
  cursor: pointer;
}

.klondike-card:first-child {
  margin-top: 0;
}

.klondike-card-back {
  background: repeating-linear-gradient(45deg, #fff, #fff 4px, var(--border) 4px, var(--border) 5px);
}

.klondike-empty-slot {
  display: block;
  width: 100%;
  border: var(--border-width) dashed var(--muted);
  border-radius: 4px;
  box-sizing: border-box;
}

.klondike-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8em;
  height: 1.4em;
  border: 2px solid var(--border);
  border-radius: 3px;
  box-sizing: border-box;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Card Tactics board: a 5x5 float-grid (same technique as chess/checkers -
   note the explicit width override below, since the shared .square
   base class hardcodes 12.5% for an 8-column board). Sides are told
   apart structurally, not by color alone: Blue is a filled disc, Red
   is an outlined disc, and either side's master gets its own ring
   marker on top - the same convention used for checkers kings. */

#cardtactics-board {
  display: block;
  width: 100%;
  max-width: 460px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.cardtactics-square {
  width: calc(100% / 5);
  background: var(--square-light);
  border: 1px solid var(--border);
}

.cardtactics-square-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.cardtactics-square-shrine::before {
  content: "";
  position: absolute;
  top: 8%;
  left: 8%;
  width: 84%;
  height: 84%;
  border: 2px dashed var(--muted);
  box-sizing: border-box;
  pointer-events: none;
}

.cardtactics-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 74%;
  height: 74%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.cardtactics-piece-blue {
  background: #111;
  border: 2px solid #000;
}

.cardtactics-piece-red {
  background: var(--square-light);
  border: 2px solid var(--border);
}

.cardtactics-piece-king::after {
  content: "";
  position: absolute;
  top: 25%;
  left: 25%;
  width: 50%;
  height: 50%;
  border-radius: 50%;
  box-sizing: border-box;
}

.cardtactics-piece-blue.cardtactics-piece-king::after {
  border: 2px solid #fff;
}

.cardtactics-piece-red.cardtactics-piece-king::after {
  border: 2px solid var(--border);
}

/* Small icons for the color-choice picker and board placeholder,
   matching the board's own piece styling. */
.cardtactics-icon-piece {
  display: inline-flex;
  width: 1.2em;
  height: 1.2em;
  border-radius: 50%;
  box-sizing: border-box;
  vertical-align: middle;
}

.cardtactics-icon-piece-blue {
  background: #111;
  border: 2px solid #000;
}

.cardtactics-icon-piece-red {
  background: var(--square-light);
  border: 2px solid var(--border);
}

/* Card rows above/below the board (each side's two cards) and the
   neutral-card display between them. Cards are plain buttons holding
   a name and a tiny 5x5 dot-diagram of that card's actual move
   offsets, so a player can read a card's moves without memorizing
   names. */
.cardtactics-cards-row {
  display: flex;
  justify-content: center;
margin: 0 auto 0.4rem;
  max-width: 460px;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
/* Card rows above/below the board (each side's two cards) and the
   neutral-card display between them. Cards are plain buttons holding
   a name and a tiny 5x5 dot-diagram of that card's actual move
   offsets > *, so a player can read a card's moves without memorizing
   names. */
.cardtactics-cards-row > * {
  margin: 0 0.6rem 0.6rem 0;
}

/* Card rows above/below the board (each side's two cards) and the
   neutral-card display between them. Cards are plain buttons holding
   a name and a tiny 5x5 dot-diagram of that card's actual move
   offsets > *:last-child, so a player can read a card's moves without memorizing
   names. */
.cardtactics-cards-row > *:last-child {
  margin-right: 0;
}


.cardtactics-neutral-row {
  display: flex;
  align-items: center;
  justify-content: center;
margin: 0.4rem auto 0;
  max-width: 460px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.cardtactics-neutral-row > * {
  margin: 0 0.5rem 0.5rem 0;
}

.cardtactics-neutral-row > *:last-child {
  margin-right: 0;
}


.cardtactics-card {
  display: flex;
  flex-direction: column;
  align-items: center;
padding: 0.3rem;
  border: var(--border-width) solid var(--border);
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
  cursor: pointer;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.cardtactics-card > * {
  margin: 0 0.2rem 0.2rem 0;
}

.cardtactics-card > *:last-child {
  margin-right: 0;
}


.cardtactics-card-selected {
  outline: 3px solid var(--border);
  outline-offset: -2px;
  background: var(--square-dark);
}

.cardtactics-card-name {
  font-weight: 700;
  font-size: 0.7rem;
  font-size: clamp(0.6rem, 2.2vw, 0.8rem);
}

.cardtactics-card-diagram {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 1px;
  width: 2.6rem;
  height: 2.6rem;
  background: var(--border);
}

.cardtactics-card-cell {
  background: var(--square-light);
}

.cardtactics-card-cell-center {
  background: var(--muted);
}

.cardtactics-card-cell-move {
  background: #111;
}

/* Hnefatafl board: a 7x7 float-grid (same technique as chess/checkers -
   note the explicit width override below, since the shared .square
   base class hardcodes 12.5% for an 8-column board). Sides are told
   apart structurally, not by color alone: attackers are a filled
   disc, defenders are an outlined disc, and the king gets his own
   crown marker on top of a defender disc - the same "own ring/shape
   marker" convention used for kings elsewhere in this app. */

#hnefatafl-board {
  display: block;
  width: 100%;
  max-width: 460px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.hnefatafl-square {
  width: calc(100% / 7);
  background: var(--square-light);
  border: 1px solid var(--border);
}

.hnefatafl-square-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.hnefatafl-square-last-from,
.hnefatafl-square.last-move {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.hnefatafl-square-throne,
.hnefatafl-square-corner {
  background: var(--square-dark);
}

.hnefatafl-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 74%;
  height: 74%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.hnefatafl-piece-attacker {
  background: #111;
  border: 2px solid #000;
}

.hnefatafl-piece-defender {
  background: var(--square-light);
  border: 2px solid var(--border);
}

.hnefatafl-piece-king::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48%;
  height: 48%;
  transform: translate(-50%, -50%);
  clip-path: polygon(0% 100%, 0% 40%, 25% 60%, 50% 30%, 75% 60%, 100% 40%, 100% 100%);
  background: var(--border);
  box-sizing: border-box;
}

/* Small icons for the side-choice picker and board placeholder,
   matching the board's own piece styling. */
.hnefatafl-icon-piece {
  display: inline-flex;
  width: 1.2em;
  height: 1.2em;
  border-radius: 50%;
  box-sizing: border-box;
  vertical-align: middle;
}

.hnefatafl-icon-piece-attacker {
  background: #111;
  border: 2px solid #000;
}

.hnefatafl-icon-piece-defender {
  background: var(--square-light);
  border: 2px solid var(--border);
}

/* WallMaze board: percentage-based absolute positioning (the same
   technique as Go's line-and-point board), since walls need clickable
   targets between cells, not just on them - a plain 9x9 float-grid
   has nowhere to put those. Pawns are told apart structurally, not by
   color alone: Player 1 is a filled disc, Player 2 an outlined disc,
   the same convention used everywhere else in this app. */

.wallmaze-board {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
}

.wallmaze-cell {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid var(--border);
  background: var(--square-light);
  padding: 0;
  margin: 0;
}

.wallmaze-cell-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.wallmaze-cell.last-move {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.wallmaze-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 62%;
  height: 62%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.wallmaze-piece-p1 {
  background: #111;
  border: 2px solid #000;
}

.wallmaze-piece-p2 {
  background: var(--square-light);
  border: 2px solid var(--border);
}

.wallmaze-wall-layer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  z-index: 2;
}

/* The whole-board tap target for "place a wall" mode: inert (and
   invisible) the rest of the time, so ordinary pawn-move clicks on
   the cells beneath it pass straight through. Turning the entire
   board into one forgiving target - rather than 64+ small, easily
   overlapping candidate buttons squeezed between cells - is what
   makes wall placement reliable to tap on a touchscreen; see
   wallmaze-app.js's onWallMazeBoardTap/selectNearestWallAtPoint. */
.wallmaze-wall-tap-catcher {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4;
  pointer-events: none;
}

.wallmaze-wall-tap-catcher.active {
  pointer-events: auto;
  cursor: crosshair;
  background: rgba(0, 0, 0, 0.03);
}

.wallmaze-wall-bar {
  position: absolute;
  box-sizing: border-box;
}

.wallmaze-wall-bar-placed {
  background: var(--border);
}

.wallmaze-wall-bar-preview {
  background: var(--accent);
  opacity: 0.55;
}

/* Small icons for the side-choice picker and board placeholder,
   matching the board's own piece styling. */
.wallmaze-icon-piece {
  display: inline-flex;
  width: 1.2em;
  height: 1.2em;
  border-radius: 50%;
  box-sizing: border-box;
  vertical-align: middle;
}

.wallmaze-icon-piece-p1 {
  background: #111;
  border: 2px solid #000;
}

.wallmaze-icon-piece-p2 {
  background: var(--square-light);
  border: 2px solid var(--border);
}

/* Hex board: a rhombus of hexagonal cells (percentage-based absolute
   positioning, the same technique as Go's board), with a JS-enforced
   non-square aspect ratio - the board is noticeably wider than tall,
   unlike every other board here. Stones are told apart structurally
   (filled vs. outlined), and each player's pair of target edges gets
   its own distinct thicker border so it's clear which side is trying
   to connect where without relying on color for that either. */

.hex-board-wrap {
  max-width: 620px;
  margin: 0 auto;
}

.hex-board {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

/* A clip-path polygon clips away a plain CSS border wherever the
   polygon's edge is diagonal (only the two vertical flat sides of
   this pointy-top hexagon would show a stroke), so each cell is built
   from two stacked, identically-clipped hexagons instead: a slightly
   larger one in the border color underneath, and a slightly inset one
   in the fill color on top - the same trick used to fake a uniform
   outline on any non-rectangular CSS shape. */
.hex-cell {
  position: absolute;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
}

.hex-cell-border,
.hex-cell-fill {
  position: absolute;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.hex-cell-border {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--border);
}

.hex-cell-fill {
  top: 6%;
  right: 6%;
  bottom: 6%;
  left: 6%;
  background: var(--square-light);
}

.hex-cell.last-move .hex-cell-fill {
  background: var(--square-dark);
}

.hex-legend {
  display: flex;
  justify-content: center;
margin: 0.5rem auto 0;
  max-width: 620px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.hex-legend > * {
  margin: 0 1.2rem 1.2rem 0;
}

.hex-legend > *:last-child {
  margin-right: 0;
}


.hex-legend-item {
  display: inline-flex;
  align-items: center;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.hex-legend-item > * {
  margin: 0 0.35rem 0.35rem 0;
}

.hex-legend-item > *:last-child {
  margin-right: 0;
}


.hex-stone {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56%;
  height: 56%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.hex-stone-r {
  background: #111;
  border: 2px solid #000;
}

.hex-stone-b {
  background: var(--square-light);
  border: 2px solid var(--border);
}

/* Small icons for the color-choice picker and board placeholder,
   matching the board's own stone styling. */
.hex-icon-piece {
  display: inline-flex;
  width: 1.2em;
  height: 1.2em;
  border-radius: 50%;
  box-sizing: border-box;
  vertical-align: middle;
}

.hex-icon-piece-r {
  background: #111;
  border: 2px solid #000;
}

.hex-icon-piece-b {
  background: var(--square-light);
  border: 2px solid var(--border);
}

/* Halma board: a 10x10 float-grid (same technique as chess/checkers -
   note the explicit width override below, since the shared .square
   base class hardcodes 12.5% for an 8-column board). Sides are told
   apart structurally, not by color alone (filled vs. outlined disc),
   and each side's home/goal camp is shaded so it's clear at a glance
   where pieces still need to travel to. */

#halma-board {
  display: block;
  width: 100%;
  max-width: 460px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.halma-square {
  width: calc(100% / 10);
  background: var(--square-light);
  border: 1px solid var(--border);
}

.halma-square-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.halma-square-camp-p1,
.halma-square-camp-p2 {
  background: repeating-linear-gradient(45deg, var(--square-light), var(--square-light) 4px, var(--square-dark) 4px, var(--square-dark) 5px);
}

.halma-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70%;
  height: 70%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.halma-piece-p1 {
  background: #111;
  border: 2px solid #000;
}

.halma-piece-p2 {
  background: var(--square-light);
  border: 2px solid var(--border);
}

/* Small icons for the side-choice picker and board placeholder,
   matching the board's own piece styling. */
.halma-icon-piece {
  display: inline-flex;
  width: 1.2em;
  height: 1.2em;
  border-radius: 50%;
  box-sizing: border-box;
  vertical-align: middle;
}

.halma-icon-piece-p1 {
  background: #111;
  border: 2px solid #000;
}

.halma-icon-piece-p2 {
  background: var(--square-light);
  border: 2px solid var(--border);
}

/* Chinese Checkers ("sternhalma" internally - see sternhalma-core.js
   for why) board: a six-pointed star of round holes on a triangular
   lattice, laid out via percentage-based absolute positioning (the
   same technique as Hex's board) with a JS-enforced aspect ratio,
   since - like Hex - this board isn't square. Each hole is itself a
   round button (rather than a square cell with a round piece drawn
   on top), and an occupied hole additionally shows a marble disc,
   told apart structurally like every other 2-player board here
   (filled vs. outlined disc) rather than by color alone. Each
   side's home/goal point gets the same shaded-diagonal-stripe
   treatment as Halma's camps above. */

.sternhalma-board {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  box-sizing: border-box;
}

.sternhalma-cell {
  position: absolute;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--square-light);
}

.sternhalma-cell-movable {
  background: var(--square-dark);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--text);
}

.sternhalma-cell-home-p1,
.sternhalma-cell-home-p2 {
  background: repeating-linear-gradient(45deg, var(--square-light), var(--square-light) 4px, var(--square-dark) 4px, var(--square-dark) 5px);
}

/* box-shadow (not outline) so the ring actually follows the circular
   border-radius instead of drawing a rectangle around it. */
.sternhalma-cell.selected {
  box-shadow: 0 0 0 3px var(--accent);
}

.sternhalma-cell.last-move {
  box-shadow: inset 0 0 0 3px var(--accent);
}

.sternhalma-marble {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70%;
  height: 70%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.sternhalma-marble-p1 {
  background: #111;
  border: 2px solid #000;
}

.sternhalma-marble-p2 {
  background: var(--square-light);
  border: 2px solid var(--border);
}

/* Small icons for the side-choice picker and board placeholder,
   matching the board's own marble styling. */
.sternhalma-icon-piece {
  display: inline-flex;
  width: 1.2em;
  height: 1.2em;
  border-radius: 50%;
  box-sizing: border-box;
  vertical-align: middle;
}

.sternhalma-icon-piece-p1 {
  background: #111;
  border: 2px solid #000;
}

.sternhalma-icon-piece-p2 {
  background: var(--square-light);
  border: 2px solid var(--border);
}

/* Yatzy: five pip-dot dice drawn as inline SVG (see yatzy-app.js) laid
   out in a row, plus a scoresheet built on the same .stats-table used
   by the Stats page. A held die is shown inverted (dark face, light
   pips) rather than picking it out with color, so it stays legible on
   e-ink. */
.yatzy-dice-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0.5rem 0;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.yatzy-dice-row > * {
  margin: 0 0.5rem 0.5rem 0;
}

.yatzy-dice-row > *:last-child {
  margin-right: 0;
}

.yatzy-die {
  display: block;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.yatzy-die:disabled {
  cursor: default;
}

.yatzy-die svg {
  display: block;
  width: 100%;
  height: 100%;
}

.yatzy-die-held {
  transform: scale(0.92);
}

.yatzy-scoresheet {
  margin-top: 0.75rem;
}

/* Yatzy vs. Kniffel/Yahtzee straights: plain text, no box or colour. */
.yatzy-rule-note {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
}

.yatzy-scoresheet .yatzy-cat-score,
.yatzy-scoresheet .yatzy-subtotal-value {
  width: 4.5rem;
}

.yatzy-score-btn {
  width: 100%;
  padding: 0.25rem 0.4rem;
  font-weight: 700;
  background: var(--bg);
  color: var(--text);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.yatzy-score-btn:disabled {
  cursor: default;
  /* A disabled score cell is a filled-in score, not an unavailable
     button: keep its number fully opaque. */
  opacity: 1;
}

.yatzy-score-filled {
  background: var(--bg-alt);
}

/* The score a category would get right now: a frame around the button
   (the Dots and Boxes "latest line" frame), not a tint - a pale blue was
   all but white on e-ink. */
.yatzy-score-preview {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

.yatzy-subtotal-row td {
  font-weight: 700;
  background: var(--bg-alt);
}

.yatzy-grand-total-row td {
  font-size: 1.05em;
}

/* Bulls and Cows: four guess slots, each a button that cycles through the
   six flat shapes (see bullsandcows-app.js) on tap - no color, no
   drag-and-drop, no hover state needed. Feedback pegs below each row of
   the history are plain filled/hollow circles rather than colored dots. */
.bullsandcows-guess-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0.5rem 0;
}

.bullsandcows-guess-row > * {
  margin: 0 0.5rem 0.5rem 0;
}

.bullsandcows-guess-row > *:last-child {
  margin-right: 0;
}

.bullsandcows-slot {
  display: block;
  width: 3.2rem;
  height: 3.2rem;
  padding: 0.3rem;
  background: var(--square-light);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.bullsandcows-slot:disabled {
  cursor: default;
  opacity: 0.6;
}

.bullsandcows-slot svg {
  display: block;
  width: 100%;
  height: 100%;
}

.bullsandcows-legend {
  font-size: 0.85em;
  color: var(--muted);
  margin: 0.3rem 0 0.6rem;
}

.bullsandcows-legend-row {
  display: flex;
  align-items: center;
  margin: 0.15rem 0;
}

.bullsandcows-legend-row .bullsandcows-peg {
  margin-right: 0.4em;
}

.bullsandcows-history {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
}

.bullsandcows-history-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid var(--bg-alt);
  padding: 0.4rem 0;
}

.bullsandcows-history-row:first-child {
  border-top: none;
}

.bullsandcows-history-number {
  width: 4.2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.bullsandcows-history-shapes {
  display: flex;
  margin-right: 0.6rem;
}

.bullsandcows-history-shape {
  display: block;
  width: 1.6rem;
  height: 1.6rem;
  margin-right: 0.25rem;
}

.bullsandcows-history-shape svg {
  display: block;
  width: 100%;
  height: 100%;
}

.bullsandcows-history-pegs {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 0.9rem;
  margin-left: auto;
}

.bullsandcows-peg {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid var(--text);
  box-sizing: border-box;
}

.bullsandcows-peg-black {
  background: var(--text);
}

.bullsandcows-peg-white {
  background: var(--bg);
}

.bullsandcows-score {
  display: inline-flex;
  align-items: center;
  min-width: 2.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Abstand per Rand statt "gap": Flexbox-gap kennen ältere
   E-Reader-Browser (WebView vor Chrome 84) nicht. */
.bullsandcows-score > * + * {
  margin-left: 0.35rem;
}

.bullsandcows-score-num {
  font-size: 1rem;
  line-height: 1;
}

.bullsandcows-score-zero {
  opacity: 0.45;
}

/* Dots and Boxes board: percentage-based absolute positioning (the same
   technique as WallMaze's board), since line segments need clickable
   targets BETWEEN dots, not just on them - a plain float-grid has
   nowhere to put those. The grid size (4x4 to 8x8 boxes) is chosen per
   game. Both players are told apart by shape, not by colour: Player 1
   draws solid lines and gets a cross in completed boxes, Player 2
   draws dotted lines and gets a circle. */

/* Up to 600 px wide, so on a 632 px reader the board fills its card
   (594 px): a line's tap area (0.6 of a box) then stays at least 44 px
   thick even on the 8x8 board. */
.dab-board {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
}

.dab-box {
  position: absolute;
  box-sizing: border-box;
  pointer-events: none;
}

.dab-box-p1,
.dab-box-p2 {
  background: none;
}

.dab-box-mark {
  position: absolute;
  top: 18%;
  left: 18%;
  width: 64%;
  height: 64%;
  display: block;
}

.dab-box-mark line,
.dab-box-mark circle {
  stroke: var(--text);
  stroke-width: 9;
  stroke-linecap: round;
  fill: none;
}

.dab-line {
  position: absolute;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 1;
}

.dab-line:disabled {
  cursor: default;
  /* A drawn line lets taps through to the undrawn line it overlaps. */
  pointer-events: none;
  /* Here disabled means "already drawn", not "unavailable": keep the
     line fully opaque instead of the global half-transparent
     button:disabled, which turns black lines mid-grey on e-ink. */
  opacity: 1;
}

.dab-line-bar {
  position: absolute;
  background: var(--square-dark);
  pointer-events: none;
}

.dab-line-bar-h {
  left: 4%;
  right: 4%;
  top: 50%;
  height: 22%;
  transform: translateY(-50%);
}

.dab-line-bar-v {
  top: 4%;
  bottom: 4%;
  left: 50%;
  width: 22%;
  transform: translateX(-50%);
}

.dab-line-drawn .dab-line-bar {
  background: var(--border);
}

/* Who drew a line is told apart by shape, not shade: Player 1 solid,
   Player 2 dotted - full squares of about 6 px with 6 px gaps (a
   dotted border on a bar this thin would be too fine for e-ink). */
.dab-line-p2 .dab-line-bar-h {
  background: repeating-linear-gradient(to right, var(--border) 0, var(--border) 6px, transparent 6px, transparent 12px);
}

.dab-line-p2 .dab-line-bar-v {
  background: repeating-linear-gradient(to bottom, var(--border) 0, var(--border) 6px, transparent 6px, transparent 12px);
}

.dab-line:not(:disabled):hover .dab-line-bar {
  opacity: 0.7;
}

/* All drawn lines are solid black now, so the latest one is marked by
   shape alone: a frame drawn around it. */
.dab-line-last .dab-line-bar {
  background: var(--text);
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

/* The latest line by Player 2 stays dotted inside the same frame. */
.dab-line-last.dab-line-p2 .dab-line-bar-h {
  background: repeating-linear-gradient(to right, var(--text) 0, var(--text) 6px, transparent 6px, transparent 12px);
}

.dab-line-last.dab-line-p2 .dab-line-bar-v {
  background: repeating-linear-gradient(to bottom, var(--text) 0, var(--text) 6px, transparent 6px, transparent 12px);
}

/* Legend under the board: line style and box mark per player. */
.dab-legend {
  max-width: 600px;
  margin: 0.5rem auto 0;
}

.dab-legend-item {
  margin: 0.25rem 0;
}

.dab-legend-line {
  display: inline-block;
  width: 2.4em;
  height: 6px;
  margin-right: 0.4em;
  vertical-align: middle;
  background: var(--text);
}

.dab-legend-line-p2 {
  background: repeating-linear-gradient(to right, var(--text) 0, var(--text) 6px, transparent 6px, transparent 12px);
}

[dir="rtl"] .dab-legend-line {
  margin-right: 0;
  margin-left: 0.4em;
}

.dab-dot {
  position: absolute;
  width: 3.5%;
  height: 3.5%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--border);
  pointer-events: none;
  z-index: 2;
}

/* Small icons for the player-choice picker and board placeholder,
   showing the same cross / circle marks as the board. */
.dab-icon-swatch {
  display: inline-flex;
  width: 1.1em;
  height: 1.1em;
  box-sizing: border-box;
  vertical-align: middle;
  border: 2px solid var(--border);
  position: relative;
}

.dab-icon-swatch .dab-box-mark {
  top: 8%;
  left: 8%;
  width: 84%;
  height: 84%;
}

/* Tic-Tac-Toe board: nine buttons placed by percentage in a square box
   (height set from the width by tictactoe-app.js). Marks are inline SVG:
   a cross for Player 1, a circle for Player 2. The winning line turns
   solid black with white marks - told apart by fill, not colour. */
.ttt-board {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: #fff;
  border: 3px solid var(--border);
  box-sizing: border-box;
}

.ttt-cell {
  position: absolute;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-height: 0;
  border: 2px solid var(--border);
  border-radius: 0;
  background: #fff;
  cursor: pointer;
}

.ttt-mark {
  display: block;
  width: 100%;
  height: 100%;
}

.ttt-mark line,
.ttt-mark circle {
  stroke: var(--text);
  stroke-width: 9;
  stroke-linecap: round;
  fill: none;
}

.ttt-cell.ttt-cell-win {
  background: var(--text);
}

.ttt-cell-win .ttt-mark line,
.ttt-cell-win .ttt-mark circle {
  stroke: #fff;
}

.ttt-icon-swatch {
  display: inline-flex;
  width: 1.1em;
  height: 1.1em;
  box-sizing: border-box;
  vertical-align: middle;
  border: 2px solid var(--border);
}

.ttt-term-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
}

/* Amazons board: percentage-based absolute positioning (the same
   technique as Wall Maze/Hex), a plain 10x10 grid of clickable cell
   buttons with a JS-enforced square aspect ratio. Amazons are told
   apart structurally, not by color alone: Player 1 is a filled disc,
   Player 2 an outlined disc, the same convention used everywhere else
   in this app. A burned square (wherever an arrow has landed) gets
   its own crosshatch fill - a criss-cross of both diagonals, visually
   distinct from every single-direction stripe pattern used elsewhere
   (Senet's rebirth/beauty squares, Halma's camps, Dots and Boxes'
   player-2 fill) - so it reads unmistakably as "different terrain",
   not as a movable-square highlight or another player's marker. */

.amazons-board {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
}

.amazons-cell {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid var(--border);
  background: var(--square-light);
  padding: 0;
  margin: 0;
}

.amazons-cell-burned {
  background-color: var(--square-dark);
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 3px, var(--border) 3px, var(--border) 4px),
    repeating-linear-gradient(-45deg, transparent, transparent 3px, var(--border) 3px, var(--border) 4px);
}

/* Step 2: legal move destinations for the amazon already selected. */
.amazons-cell-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

/* Step 3: legal arrow landings from the amazon's new square - a
   dashed accent ring rather than a plain fill, so it reads as a
   distinct "now aiming" mode instead of looking like another
   move-destination square. */
.amazons-cell-arrow-target {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.amazons-cell.selected {
  outline: 3px solid var(--border);
  outline-offset: -3px;
}

/* The destination already chosen in step 2, while step 3 (aiming the
   arrow) is in progress - kept visually marked so the board still
   shows where the moving amazon ended up. */
.amazons-cell-pending-to {
  box-shadow: inset 0 0 0 2px var(--border);
}

.amazons-cell.last-move {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.amazons-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 62%;
  height: 62%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.amazons-piece-p1 {
  background: #111;
  border: 2px solid #000;
}

.amazons-piece-p2 {
  background: var(--square-light);
  border: 2px solid var(--border);
}

/* Small icons for the side-choice picker, board placeholder, and
   rules page, matching the board's own piece/terrain styling. */
.amazons-icon-piece {
  display: inline-flex;
  width: 1.2em;
  height: 1.2em;
  border-radius: 50%;
  box-sizing: border-box;
  vertical-align: middle;
}

.amazons-icon-piece-p1 {
  background: #111;
  border: 2px solid #000;
}

.amazons-icon-piece-p2 {
  background: var(--square-light);
  border: 2px solid var(--border);
}

.amazons-icon-burned {
  display: inline-flex;
  width: 1.2em;
  height: 1.2em;
  box-sizing: border-box;
  vertical-align: middle;
  border: 1px solid var(--border);
  background-color: var(--square-dark);
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 3px, var(--border) 3px, var(--border) 4px),
    repeating-linear-gradient(-45deg, transparent, transparent 3px, var(--border) 3px, var(--border) 4px);
}

/* Bagh-Chal board: 25 points in a 5x5 grid (square, unlike Fanorona's
   wider-than-tall board), connected by horizontal, vertical, AND
   diagonal lines wherever the alquerque-style lattice allows (see
   baghchal-core.js's "strong"/"weak" point pattern). Uses the exact
   same percentage-based absolute-positioning + SVG-line-layer technique
   as .fanorona-board, just square: a JS-enforced pixel height (see
   ensureBaghChalBoardAspect in baghchal-app.js) rather than CSS
   `aspect-ratio`, which some E-Ink browsers silently ignore. Pieces are
   told apart structurally, not by color alone: tigers are a filled
   disc, goats an outlined disc, the same convention used everywhere
   else in this app. */

.baghchal-board {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
}

.baghchal-lines {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.baghchal-lines line {
  stroke: var(--border);
  stroke-width: 2;
}

.baghchal-point {
  position: absolute;
  transform: translate(-50%, -50%);
  background: var(--square-light);
  border: 2px solid var(--border);
  border-radius: 50%;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
  z-index: 2;
}

.baghchal-point-movable {
  background: var(--square-dark);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--text);
}

.baghchal-point-selectable {
  box-shadow: inset 0 0 0 2px var(--muted);
}

.baghchal-point-capture {
  box-shadow: inset 0 0 0 3px var(--accent);
}

.baghchal-point-selected {
  border-color: var(--accent);
  border-width: 3px;
}

.baghchal-point.last-move {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.baghchal-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 78%;
  height: 78%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

/* Tigers are filled black discs, goats outlined white ones - the
   filled-vs-outlined convention of the other games, instead of a brown
   that turned into a middling grey on e-ink. */
.baghchal-piece-tiger {
  background: #111;
  border: 2px solid #000;
}

.baghchal-piece-goat {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Small disc icons for the side-choice picker and board placeholder,
   matching the board's own piece styling. */
.baghchal-icon-disc {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.baghchal-icon-disc-tiger {
  background: #111;
  border: 2px solid #000;
}

.baghchal-icon-disc-goat {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Alquerque board (alquerque-app.js): the same point-and-line technique
   as Bagh-Chal - an SVG line layer under round point buttons - because it
   is the same 5x5 lattice. The lines are the rules here: only the drawn
   diagonals can be used. The two sides differ by shape, filled disc
   (Black) against a thick ring (White); points you can use right now get
   a dashed border, the piece being moved a heavy solid one - never grey
   alone. */
.alquerque-board {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
}

.alquerque-lines {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.alquerque-lines line {
  stroke: var(--border);
  stroke-width: 3;
}

.alquerque-point {
  position: absolute;
  transform: translate(-50%, -50%);
  background: var(--square-light);
  border: 2px solid var(--border);
  border-radius: 50%;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
  z-index: 2;
}

.alquerque-point-selectable,
.alquerque-point-movable {
  border: 3px dashed var(--border);
}

.alquerque-point-selected {
  border: 5px solid var(--accent);
}

.alquerque-point.last-move {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.alquerque-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 74%;
  height: 74%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.alquerque-piece-black {
  background: #111;
  border: 2px solid #000;
}

.alquerque-piece-white {
  background: #fff;
  border: 6px solid #111;
}

.alquerque-icon-disc {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.alquerque-icon-disc-black {
  background: #111;
  border: 2px solid #000;
}

.alquerque-icon-disc-white {
  background: #fff;
  border: 3px solid #111;
}

/* Pairs (pairs-app.js): cards as buttons placed by percentage in a box
   whose height JS sets from its width (square cards). Face down: a card
   with a diagonal hatch; face up: white with a heavy frame and a black
   SVG shape; a taken pair leaves an empty dashed slot. All three states
   differ in line and shape, none by a grey fill. */
.pairs-board {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
}

.pairs-card {
  position: absolute;
  box-sizing: border-box;
  border: 4px solid var(--square-light);
  border-radius: 10px;
  padding: 0;
  background-clip: padding-box;
  cursor: pointer;
}

.pairs-card-down {
  background-color: #fff;
  background-image: repeating-linear-gradient(45deg, #111 0, #111 2px, #fff 2px, #fff 10px);
  outline: 2px solid #111;
  outline-offset: -6px;
}

.pairs-card-open {
  background: #fff;
  outline: 5px solid #111;
  outline-offset: -9px;
}

.pairs-card-taken {
  background: transparent;
  outline: 2px dashed #111;
  outline-offset: -8px;
  cursor: default;
}

.pairs-symbol {
  display: block;
  width: 70%;
  height: 70%;
  margin: 15%;
}

/* Futoshiki (futoshiki-app.js): square cells with half a cell of space
   between them, placed by percentage in a square box (height set by JS).
   The "less than" signs sit in that space as filled SVG triangles, tip
   towards the smaller number - drawn, not typed, so they never depend
   on the device font. Given numbers are bold; a selected cell has a
   heavy frame, a hinted one a double frame, a conflict is shown
   inverted - shape and weight only, never grey. */
.futoshiki-board {
  position: relative;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
}

.fs-cell {
  position: absolute;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  background: var(--square-light);
  border: 2px solid var(--border);
  border-radius: 0;
  color: var(--text);
  cursor: pointer;
}

.fs-cell.selected {
  border-width: 5px;
}

.fs-cell.hint-cell {
  outline: 6px double var(--text);
  outline-offset: -9px;
}

.fs-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.3rem;
  font-size: clamp(1.1rem, 5vw, 1.8rem);
  line-height: 1;
  pointer-events: none;
}

.fs-given .fs-value {
  font-weight: 800;
}

.fs-conflict .fs-value {
  background: var(--text);
  color: var(--bg);
  border-radius: 3px;
  padding: 0.05em 0.2em;
}

.fs-sign {
  position: absolute;
  pointer-events: none;
}

.fs-sign svg {
  display: block;
  width: 94%;
  height: 94%;
  margin: 3%;
}

.fs-sign polygon {
  fill: var(--text);
}

/* Spider Solitaire board: a stock indicator and completed-sequences
   counter in a row above ten cascading tableau columns - the same
   overlap-via-negative-margin cascade layout as Klondike/FreeCell,
   just with more (narrower) columns since Spider deals 10 instead of
   7/8. Card faces match Klondike/FreeCell (red suits hollow, black
   suits filled). Like those two, `.spider-card` and `.spider-empty-slot`
   get their height and overlap in JS from the measured column width
   (CardFaces.layoutColumns in card-faces.js), since `aspect-ratio` is
   unreliable on E-Ink browsers. No CSS min-height on the cards:
   `min-height` always wins over a smaller explicit `height`, so on a
   narrow board it silently overrode the computed height and stretched
   every card. (The JS sets min-height on the columns only, so an empty
   column can still be tapped.) */

.spider-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
max-width: 900px;
  margin: 0 auto 0.6rem;
  flex-wrap: wrap;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.spider-top-row > * {
  margin: 0 1rem 1rem 0;
}

.spider-top-row > *:last-child {
  margin-right: 0;
}

.spider-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  height: 3.6rem;
  padding: 0 0.5rem;
  border: var(--border-width) solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-weight: 700;
  font-size: 1rem;
  box-sizing: border-box;
  cursor: pointer;
}

.spider-stock-blocked {
  color: var(--muted);
  cursor: not-allowed;
}

.spider-sequences {
  font-weight: 700;
  font-size: 1rem;
  cursor: default;
}

.spider-columns {
  display: flex;
max-width: 900px;
  margin: 0 auto;
  align-items: flex-start;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.spider-columns > * {
  margin: 0 0.25rem 0.4rem 0;
}

.spider-columns > *:last-child {
  margin-right: 0;
}

.spider-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.spider-card {
  position: relative;
  width: 100%;
  border: var(--border-width) solid var(--border);
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  padding: 0.15rem 0 0 0.25rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.7rem;
  font-size: clamp(0.55rem, 2vw, 0.85rem);
  cursor: pointer;
}

.spider-card:first-child {
  margin-top: 0;
}

.spider-card-back {
  background: repeating-linear-gradient(45deg, #fff, #fff 4px, var(--border) 4px, var(--border) 5px);
}

.spider-card-selected {
  outline: 3px solid var(--border);
  outline-offset: -2px;
}

.spider-empty-slot {
  display: block;
  width: 100%;
  border: var(--border-width) dashed var(--muted);
  border-radius: 4px;
  box-sizing: border-box;
}

.spider-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8em;
  height: 1.4em;
  border: 2px solid var(--border);
  border-radius: 3px;
  box-sizing: border-box;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Tablut board: a 9x9 float-grid (same technique as hnefatafl above -
   note the explicit width override below, since the shared .square
   base class hardcodes 12.5% for an 8-column board). Sides are told
   apart structurally, not by color alone: attackers are a filled
   disc, defenders an outlined disc, and the king gets his own crown
   marker on top of a defender disc - the same convention used for
   the smaller Brandub board. */

#tablut-board {
  display: block;
  width: 100%;
  max-width: 460px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.tablut-square {
  width: calc(100% / 9);
  background: var(--square-light);
  border: 1px solid var(--border);
}

.tablut-square-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

.tablut-square.last-move {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.tablut-square-throne,
.tablut-square-corner {
  background: var(--square-dark);
}

.tablut-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 74%;
  height: 74%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.tablut-piece-attacker {
  background: #111;
  border: 2px solid #000;
}

.tablut-piece-defender {
  background: var(--square-light);
  border: 2px solid var(--border);
}

.tablut-piece-king::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48%;
  height: 48%;
  transform: translate(-50%, -50%);
  clip-path: polygon(0% 100%, 0% 40%, 25% 60%, 50% 30%, 75% 60%, 100% 40%, 100% 100%);
  background: var(--border);
  box-sizing: border-box;
}

/* Small icons for the side-choice picker and board placeholder,
   matching the board's own piece styling. */
.tablut-icon-piece {
  display: inline-flex;
  width: 1.2em;
  height: 1.2em;
  border-radius: 50%;
  box-sizing: border-box;
  vertical-align: middle;
}

.tablut-icon-piece-attacker {
  background: #111;
  border: 2px solid #000;
}

.tablut-icon-piece-defender {
  background: var(--square-light);
  border: 2px solid var(--border);
}

/* Marble Push board: a 61-cell hexagon rendered as plain circular buttons
   at hex-grid positions (see marblepush-app.js's cube-coordinate pixel
   math) - round holes/marbles read just as clearly on e-ink as true
   hexagon cells and are far simpler to get pixel-perfect on an old
   WebView. Height is JS-enforced from the measured width (see
   ensureMarblePushBoardAspect) rather than via `aspect-ratio`, which some
   E-Ink browsers silently ignore. */
.marblepush-board-wrap {
  max-width: 640px;
  margin: 0 auto;
}

.marblepush-board {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.marblepush-cell {
  position: absolute;
  transform: translate(-50%, -50%);
  background: var(--square-light);
  border: 2px solid var(--border);
  border-radius: 50%;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
  z-index: 2;
}

.marblepush-cell-movable {
  background: var(--square-dark);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--text);
}

.marblepush-cell-selected {
  border-color: var(--accent);
  border-width: 3px;
}

/* A push destination: dashed border on top of the movable shading, so
   "this can capture" is conveyed structurally rather than by color
   alone. */
.marblepush-cell-sumito {
  border-style: dashed;
  border-width: 3px;
  border-color: var(--accent);
}

.marblepush-cell.last-move {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.marblepush-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 78%;
  height: 78%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.marblepush-piece-black {
  background: #111;
  border: 2px solid #000;
}

.marblepush-piece-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Small disc icons for the color-choice picker and board placeholder,
   matching the board's own marble styling. */
.marblepush-icon-disc {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.marblepush-icon-disc-black {
  background: #111;
  border: 2px solid #000;
}

.marblepush-icon-disc-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* The current-selection hint and its "Clear selection" button: plain
   stacked content, margin-based spacing rather than flexbox `gap`
   (unsupported on the Tolino's Chrome 61 WebView). */
.marblepush-selection-controls {
  margin-top: 0.6rem;
}

.marblepush-selection-controls button {
  margin: 0 0.5rem 0.5rem 0;
}

/* Worked-example diagram on the rules page. Flexbox `gap` fallback:
   margin-based spacing instead, since some E-Ink browsers (Tolino
   confirmed) don't support `gap` on a flex container and render items
   with zero space between them. */
.marblepush-example-row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 0 1rem -1.5rem;
}

.marblepush-example-figure {
  margin: 0 0 1rem 1.5rem;
  max-width: 300px;
}

.marblepush-example-figure svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.marblepush-example-figure figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
}


/* Pyramid Solitaire board: stock/waste/redeal row above a 7-row card
   triangle. The triangle itself uses absolute positioning sized in
   pixels by pyramidsolitaire-app.js's layoutPyramidBoard (measure the
   container's width, then set an explicit pixel height and per-card
   left/top/width/height) rather than CSS aspect-ratio, which isn't
   supported on the older E-Ink browsers this app targets. Lower rows
   get a higher z-index in that same JS so they visually sit in front,
   overlapping the row above - matching how a real card pyramid looks.
   Suits are told apart by glyph shape (spade/club vs. heart/diamond),
   never by red/black coloring, matching Klondike/FreeCell. All 28
   pyramid cards are dealt face-up (the standard rule for this game),
   so a covered card just gets a dimmed, non-interactive look instead
   of a hatched face-down back like the stock pile does. */

.pyramidsolitaire-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 640px;
  margin: 0 auto 0.6rem;
  flex-wrap: wrap;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.pyramidsolitaire-top-row > * {
  margin: 0 1rem 1rem 0;
}

.pyramidsolitaire-top-row > *:last-child {
  margin-right: 0;
}

.pyramidsolitaire-stockwaste {
  display: flex;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.pyramidsolitaire-stockwaste > * {
  margin: 0 0.3rem 0.3rem 0;
}

.pyramidsolitaire-stockwaste > *:last-child {
  margin-right: 0;
}

.pyramidsolitaire-cell {
  width: 2.6rem;
  height: 3.6rem;
  border: var(--border-width) solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-weight: 700;
  font-size: 1rem;
  box-sizing: border-box;
  cursor: pointer;
}

.pyramidsolitaire-cell:disabled {
  cursor: default;
}

.pyramidsolitaire-card-back {
  background: repeating-linear-gradient(45deg, #fff, #fff 4px, var(--border) 4px, var(--border) 5px);
}

.pyramidsolitaire-board {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  box-sizing: border-box;
}

.pyramidsolitaire-card {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--border-width) solid var(--border);
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
  font-weight: 700;
  font-size: 0.85rem;
  font-size: clamp(0.6rem, 2.3vw, 0.9rem);
  padding: 0;
  cursor: pointer;
}

/* Noch blockierte Karten: gestrichelter Rahmen statt Abblenden. Ihre
   Werte muss man zum Vorausplanen lesen können, und halbtransparente
   graue Schrift auf grauem Grund verschwimmt auf E-Ink. */
.pyramidsolitaire-card-covered,
.pyramidsolitaire-card-covered:disabled {
  border-style: dashed;
  color: var(--text);
  opacity: 1;
  cursor: default;
}

.pyramidsolitaire-card-selected {
  outline: 3px solid var(--border);
  outline-offset: 1px;
}

.pyramidsolitaire-card-gone {
  display: none;
}

.pyramidsolitaire-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8em;
  height: 1.4em;
  border: 2px solid var(--border);
  border-radius: 3px;
  box-sizing: border-box;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Surakarta board: a plain 6x6 grid of points, square (unlike Fanorona's
   wider-than-tall 5x9), so it reuses the same percentage-based
   absolute-positioning technique but with equal width/height totals.
   The board's namesake "loop tracks" - the 4 corner arcs that let a
   capturing slide curve off one edge and re-enter along a perpendicular
   line - are drawn as curved SVG paths in the same non-interactive
   layer as the ordinary grid lines, under the point buttons (see
   surakarta-app.js's buildSurakartaBoardDOM). Pieces use the same
   filled-disc-vs-outlined-disc convention as everywhere else in this
   app. */

.surakarta-board {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
}

.surakarta-lines {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.surakarta-lines line {
  stroke: var(--border);
  stroke-width: 2;
}

/* The 4 corner loop-track arcs, plus their short straight stub lines
   connecting the board's own edge points out to where each curve
   begins - drawn a little thicker/lighter than the plain grid lines so
   the loop tracks read as a visually distinct feature, per the task's
   emphasis that this is the game's defining (and least obvious)
   mechanic. */
.surakarta-loop-arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  opacity: 0.75;
}

.surakarta-loop-stub {
  stroke: var(--accent);
  stroke-width: 2;
  opacity: 0.55;
}

.surakarta-point {
  position: absolute;
  transform: translate(-50%, -50%);
  background: var(--square-light);
  border: 2px solid var(--border);
  border-radius: 50%;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
  z-index: 2;
}

.surakarta-point-movable {
  background: var(--square-dark);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--text);
}

.surakarta-point-capturable {
  box-shadow: inset 0 0 0 3px var(--accent);
}

.surakarta-point-selected {
  border-color: var(--accent);
  border-width: 3px;
}

.surakarta-point.last-move {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.surakarta-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 76%;
  height: 76%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.surakarta-piece-black {
  background: #111;
  border: 2px solid #000;
}

.surakarta-piece-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Small disc icons for the color-choice picker and board placeholder,
   matching the board's own piece styling. */
.surakarta-icon-disc {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.surakarta-icon-disc-black {
  background: #111;
  border: 2px solid #000;
}

.surakarta-icon-disc-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Worked-example loop-capture diagram on the rules page: a single
   wider figure (the loop makes for a wide diagram) rather than the
   side-by-side pair Fanorona uses for its two capture types. */
.surakarta-example-figure {
  max-width: 100%;
  margin: 0 0 1rem 0;
}

.surakarta-example-figure svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.surakarta-example-figure figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

/* Hashiwokakero (Bridges) board: islands scattered over a sparse grid
   rather than a filled one, so - like Fanorona/Hex/WallMaze/Go - it's
   rendered as absolutely-positioned circular island buttons over a
   single SVG line layer, with the container's height JS-enforced from
   its measured width each time it's built or the window resizes (CSS
   `aspect-ratio` is unreliable on E-Ink browsers; see hashi-app.js's
   ensureHashiBoardAspect). Every candidate bridge connection is drawn as
   an SVG line UNDER the islands, same as Fanorona's connection lines,
   but unlike Fanorona's purely decorative lines these ARE the primary
   clickable element: an invisible wide "hit" line sits under a thin
   visible one (or two, offset apart, for a double bridge) that's shown
   or hidden as bridges are placed/removed. */

#hashi-board {
  display: block;
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: var(--square-light);
  border: var(--border-width) solid var(--border);
  box-sizing: border-box;
  overflow: hidden;
}

.hashi-lines {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.hashi-edge-hit {
  stroke: rgba(0, 0, 0, 0.01);
  stroke-width: 22;
  cursor: pointer;
}

.hashi-edge-line {
  stroke: var(--text);
  stroke-width: 6;
  pointer-events: none;
}

.hashi-island {
  position: absolute;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: #fff;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.hashi-island-value {
  font-size: 1rem;
  font-size: clamp(0.7rem, 3.4vw, 1.3rem);
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.hashi-island-selected {
  border-color: var(--accent);
  border-width: 4px;
  box-shadow: 0 0 0 3px var(--accent) inset;
}

/* An island whose current bridge count already matches its required
   number - the positive counterpart to Kakuro's conflict highlighting
   (see .kakuro-cell-conflict): a filled disc instead of an error
   outline, since here reaching the target is progress, not a mistake. */
.hashi-island-satisfied {
  background: var(--border);
}

.hashi-island-satisfied .hashi-island-value {
  color: #fff;
}

/* An island with MORE bridges than its number allows - always a mistake
   to fix, flagged the same dashed-outline way KakuroCore flags an
   overshot run sum. */
.hashi-island-over {
  outline: 2px dashed var(--border);
  outline-offset: 2px;
}

.hashi-icon {
  display: inline-block;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  border: 2px solid var(--border);
  box-sizing: border-box;
  background: #fff;
}



/* Fleet Battle: two 10x10 grids (own fleet + enemy waters), each an 11-
   column CSS grid (a fixed-width row/column-label column plus the 10
   1fr board-cell columns). CSS grid `gap` is fine on this project's
   target E-Ink browsers (unlike flexbox `gap`, which several of this
   file's other rules work around with margin-based spacing instead), so
   no fallback is needed for the small gutters below. Cell WIDTH is left
   to the grid engine's own 1fr distribution; cell HEIGHT is set from JS
   (see ensureFbSquareCells in fleetbattle-app.js) once the grid has been
   measured, the same JS-enforced-square-cell approach checkers/kakuro
   use, since `aspect-ratio` isn't reliable on this project's target E-Ink
   browsers. */

.fb-boards {
  margin-top: 0.5rem;
}

.fb-board-block {
  margin-bottom: 1.25rem;
}

.fb-board-block:last-child {
  margin-bottom: 0;
}

.fb-board-block h2 {
  font-size: 1rem;
  margin: 0 0 0.4rem;
}

.fb-grid-wrap {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
}

.fb-grid {
  display: grid;
  grid-template-columns: 1.7em repeat(10, 1fr);
  gap: 1px;
  width: 100%;
  border: 2px solid var(--border);
  background: var(--border);
  box-sizing: border-box;
}

.fb-label,
.fb-corner {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--muted);
  background: var(--bg-alt);
}

.fb-cell {
  position: relative;
  display: block;
  width: 100%;
  background: var(--square-light);
  border: none;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  cursor: default;
}

.fb-cell.fb-clickable:not(:disabled) {
  cursor: pointer;
}

/* Own ship, not yet hit - a plain filled square (hull). */
.fb-cell.fb-ship::before {
  content: "";
  position: absolute;
  top: 14%;
  left: 14%;
  width: 72%;
  height: 72%;
  background: var(--square-dark);
  border: 1px solid var(--border);
  box-sizing: border-box;
}

/* Miss - a small hollow ring, distinct from a hit without relying on color. */
.fb-cell.fb-miss::before {
  content: "";
  position: absolute;
  top: 37%;
  left: 37%;
  width: 26%;
  height: 26%;
  border-radius: 50%;
  border: 2px solid var(--border);
  box-sizing: border-box;
}

/* Hit (ship not yet fully sunk) - a filled circle. */
.fb-cell.fb-hit::before {
  content: "";
  position: absolute;
  top: 18%;
  left: 18%;
  width: 64%;
  height: 64%;
  border-radius: 50%;
  background: #000;
  border: 2px solid #000;
  box-sizing: border-box;
}

/* Sunk ship - every cell gets a diagonal hatch fill plus an inverted
   ring marker, the same "distinct pattern, not just a color" technique
   as .amazons-icon-burned above, so a fully destroyed ship reads as
   clearly different from a plain in-progress hit. */
.fb-cell.fb-sunk {
  background-image: repeating-linear-gradient(45deg, #000 0, #000 2px, transparent 2px, transparent 6px);
}

.fb-cell.fb-sunk::after {
  content: "";
  position: absolute;
  top: 27%;
  left: 27%;
  width: 46%;
  height: 46%;
  border-radius: 50%;
  background: var(--square-light);
  border: 2px solid #000;
  box-sizing: border-box;
}

.fb-cell.fb-last {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.fb-legend {
  margin-top: 0.75rem;
}

.fb-legend-row {
  display: flex;
  align-items: center;
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
}

.fb-legend-mark {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 1.5em;
  height: 1.5em;
  margin-right: 0.5rem;
  border: 1px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
}

.fb-placement-status {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* Skyscrapers board: a real CSS grid (n+2) x (n+2), unlike the other
   puzzle boards' float-grid technique - a grid is a natural fit here
   since a row/column of edge-clue cells needs to sit flush around all
   four sides of the board, not just the fillable n x n interior. Grid
   `gap` is fine to use on E-Ink per this project's compatibility notes
   (only flexbox `gap` needs the margin-based fallback); the 1px gap on
   top of a solid background acts as the grid line between cells. Each
   cell's height is set inline by JS to match its computed square width,
   since CSS `aspect-ratio` is unreliable on E-Ink browsers. */

#skyscrapers-board {
  display: grid;
  gap: 1px;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  box-sizing: border-box;
  border: 3px solid var(--border);
  background: var(--border);
  overflow: hidden;
}

.skyscrapers-cell {
  background: var(--square-light);
  box-sizing: border-box;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.skyscrapers-corner {
  background: transparent;
}

.skyscrapers-clue-cell {
  background: transparent;
}

.skyscrapers-clue-value {
  font-weight: 700;
  line-height: 1;
  font-size: 0.9rem;
  font-size: clamp(0.7rem, 3vw, 1.1rem);
}

.skyscrapers-clue-ok .skyscrapers-clue-value {
  text-decoration: underline;
}

.skyscrapers-clue-violated .skyscrapers-clue-value {
  outline: 2px dashed var(--border);
  outline-offset: 2px;
  padding: 0 0.15em;
}

.skyscrapers-cell-board {
  cursor: pointer;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
}

.skyscrapers-cell-board.selected {
  outline: 3px solid var(--border);
  outline-offset: -3px;
}

.skyscrapers-cell-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  font-size: clamp(0.9rem, 3.5vw, 1.4rem);
  line-height: 1;
  pointer-events: none;
}

.skyscrapers-cell-conflict {
  outline: 2px dashed var(--border);
  outline-offset: -2px;
}

.skyscrapers-numpad {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 540px;
  margin: 0.6rem auto 0;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.skyscrapers-numpad > * {
  margin: 0 0.4rem 0.4rem 0;
}

.skyscrapers-numpad > *:last-child {
  margin-right: 0;
}

.skyscrapers-numpad-btn {
  width: 2.4rem;
  height: 2.4rem;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-sizing: border-box;
}

/* A tiny ascending skyline drawn with stacked background rectangles,
   anchored to the bottom of the icon box - no raw SVG needed, the same
   "one element, layered backgrounds" trick as .kakuro-icon's diagonal
   split, just with four bars instead of two triangles. */
.skyscrapers-icon {
  display: inline-block;
  width: 1.4em;
  height: 1.4em;
  border: 2px solid var(--border);
  box-sizing: border-box;
  background-repeat: no-repeat;
  background-image:
    linear-gradient(var(--border), var(--border)),
    linear-gradient(var(--border), var(--border)),
    linear-gradient(var(--border), var(--border)),
    linear-gradient(var(--border), var(--border));
  background-size: 16% 32%, 16% 52%, 16% 42%, 16% 78%;
  background-position: 8% 100%, 34% 100%, 60% 100%, 84% 100%;
}


/* Konane board: reuses .square's float-grid layout from the chess/
   checkers boards (see ensureKonaneSquareAspectRatio in konane-app.js for
   the JS-enforced row height), but unlike checkers every one of the 64
   squares is playable - Konane fills the whole board with alternating
   stones at the start, not just the dark squares - so both .light and
   .dark squares get a piece span and a click handler here. */

#konane-board {
  display: block;
  width: 100%;
  max-width: 760px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.konane-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 78%;
  height: 78%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.konane-piece-black {
  background: #111;
  border: 2px solid #000;
}

.konane-piece-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* Opening-ritual removal targets: a heavy inner frame (a reddish tint
   before, invisible on e-ink), so the two-stone opening ritual reads as
   different from an ordinary jump destination (grey) and from the last
   move's thin frame. */
.konane-square.konane-square-removable {
  box-shadow: inset 0 0 0 5px var(--text);
}

.konane-square.konane-square-movable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 12px, transparent 12px) var(--square-dark);
}

/* Small disc icons for the color-choice picker and board placeholder,
   matching the board's own piece styling. */
.konane-icon-disc {
  position: relative;
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.konane-icon-disc-black {
  background: #111;
  border: 2px solid #000;
}

.konane-icon-disc-white {
  background: #fdfdfd;
  border: 2px solid var(--border);
}

/* The "continue or stop" jump-chain prompt: a plain stacked button,
   margin-based spacing rather than flexbox `gap` (unsupported on the
   Tolino's Chrome 61 WebView) - same pattern as Fanorona's own chain
   controls (.fanorona-chain-controls) just above. */
.konane-chain-controls {
  margin-top: 0.6rem;
}

.konane-chain-controls button {
  margin: 0 0.5rem 0.5rem 0;
}



/* Slitherlink board: a dot grid where every potential edge between two
   neighboring dots is a real, invisible-until-drawn <button> - one tap
   cycles it empty -> line -> marked-off -> empty. The dots, clue
   numbers and the loop lines themselves are a purely decorative SVG
   layer underneath those buttons (re-styled in place as state changes,
   never rebuilt), the mirror image of fanorona-app.js's board, which
   draws its fixed lines as decorative SVG *under* real button points -
   here it's the lines that are clickable and the dots that are just
   markers. Sized with a JS-enforced pixel height (see
   ensureSlitherlinkAspectRatio in slitherlink-app.js) rather than CSS
   `aspect-ratio`, which is unreliable on E-Ink browsers. */

#slitherlink-board {
  position: relative;
  display: block;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  touch-action: manipulation;
}

.slitherlink-svg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.slitherlink-dot {
  fill: var(--border);
}

.slitherlink-dot.slitherlink-conflict {
  fill: var(--square-light);
  stroke: var(--danger);
  stroke-width: 3;
}

.slitherlink-edge-line {
  stroke: var(--muted);
  stroke-opacity: 0.28;
  stroke-width: 3;
  stroke-linecap: round;
}

.slitherlink-edge-line.slitherlink-edge-on {
  stroke: var(--border);
  stroke-opacity: 1;
  stroke-width: 9;
}

.slitherlink-edge-line.slitherlink-edge-marked {
  stroke: var(--danger);
  stroke-opacity: 0.85;
  stroke-width: 4;
  stroke-dasharray: 6 8;
}

.slitherlink-clue-ring {
  fill: none;
  stroke: none;
}

.slitherlink-clue-ring.slitherlink-conflict {
  stroke: var(--danger);
  stroke-width: 2.5;
  stroke-dasharray: 5 4;
}

.slitherlink-clue-text {
  font-weight: 700;
  fill: var(--text);
  font-size: 34px;
  pointer-events: none;
  user-select: none;
}

.slitherlink-clue-text.slitherlink-conflict {
  fill: var(--danger);
}

.slitherlink-edge-btn {
  position: absolute;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.slitherlink-edge-btn:focus {
  outline: 2px dashed var(--border);
  outline-offset: 1px;
}

.slitherlink-icon {
  display: inline-block;
  width: 1.4em;
  height: 1.4em;
  box-sizing: border-box;
  border: 2px solid var(--border);
  border-radius: 2px;
  position: relative;
}

.slitherlink-icon::before {
  content: "";
  position: absolute;
  top: 25%;
  right: 25%;
  bottom: 25%;
  left: 25%;
  border: 2px solid var(--border);
  border-right: none;
  border-bottom: none;
}

/* Ludo board: a single 15x15 CSS grid (CSS grid `gap` is fine on E-Ink
   browsers - only flexbox `gap` isn't - though this board doesn't use
   even that, every cell is simply placed at its own grid-area). Built
   from a JS-measured square container (no `aspect-ratio`), holding the
   52 shared track cells, each color's 5-cell home stretch, four 6x6
   home bases and a purely decorative center hub - see ludo-app.js for
   the coordinate tables. */

#ludo-board {
  display: grid;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  border: var(--border-width) solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  position: relative;
}

.ludo-filler {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.ludo-cell {
  position: relative;
  background: var(--square-light);
  border: 1px solid var(--border);
  box-sizing: border-box;
  padding: 0;
  overflow: hidden;
}

.ludo-cell-safe::before {
  content: "";
  position: absolute;
  top: 30%;
  left: 30%;
  width: 40%;
  height: 40%;
  border: 2px solid var(--muted);
  transform: rotate(45deg);
  box-sizing: border-box;
  pointer-events: none;
}

/* Whose home column and home base it is: a small copy of the colour's
   shape in the corner (the same shapes as the tokens), instead of the
   pale tints these used to have, which no e-ink screen can tell apart. */
.ludo-cell-home-column::before,
.ludo-home-base::before {
  content: "";
  position: absolute;
  top: 6%;
  left: 6%;
  width: 24%;
  height: 24%;
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
}

.ludo-home-base::before {
  width: 12%;
  height: 12%;
}

.ludo-cell-home-column-red::before,
.ludo-home-base-red::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='44' fill='%23111'/%3E%3C/svg%3E"); }
.ludo-cell-home-column-green::before,
.ludo-home-base-green::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='37' fill='%23fff' stroke='%23111' stroke-width='16'/%3E%3C/svg%3E"); }
.ludo-cell-home-column-yellow::before,
.ludo-home-base-yellow::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpolygon points='50,4 97,92 3,92' fill='%23111'/%3E%3C/svg%3E"); }
.ludo-cell-home-column-blue::before,
.ludo-home-base-blue::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Crect x='11' y='11' width='78' height='78' fill='%23fff' stroke='%23111' stroke-width='16'/%3E%3C/svg%3E"); }

/* A token that may move: a solid black wedge in the cell's bottom-right
   corner. A light grey fill was invisible on e-ink (213 vs 253 grey), and
   the wedge can't be mistaken for a token (shape), the last move's origin
   (dashed square) or its target (thin frame). Drawn as a background
   gradient so it leaves ::before (safe-square star) and ::after (origin
   mark) free; it stays clear of the centred token. */
.ludo-cell-movable,
.ludo-cell-home-column.ludo-cell-movable {
  background: var(--square-light) linear-gradient(135deg, transparent 72%, var(--text) 72%) no-repeat;
}

/* Width/height 100% here is load-bearing, not decorative: .ludo-token
   below sizes itself as a PERCENTAGE of this element, and a percentage
   only resolves against a definite parent size. Without an explicit
   size here this box has none (absolute positioning alone doesn't give
   it one), so every on-board token was silently collapsing to its
   `min-width`/`min-height` floor - tiny and the same size regardless of
   the board's actual size - instead of scaling with the cell like every
   other board element. */
.ludo-cell-last-from::after {
  content: "";
  position: absolute;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 80%;
  border: 2px dashed var(--text);
  border-radius: 10%;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 0;
}

.ludo-cell-last-to,
.ludo-home-slot-last {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

.ludo-cell-tokens {
  z-index: 1;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.ludo-cell-tokens > * {
  margin: 0 1px 0 0;
}

.ludo-cell-tokens > *:last-child {
  margin-right: 0;
}

.ludo-token {
  display: inline-block;
  width: 62%;
  height: 62%;
  min-width: 8px;
  min-height: 8px;
  box-sizing: border-box;
  color: var(--text);
}

/* The color's shape (ludoShapeSvg in ludo-app.js) fills its box. */
.ludo-shape {
  display: block;
  width: 100%;
  height: 100%;
}

.ludo-token-stacked {
  margin-left: -4px;
}

/* Four colors are indistinguishable on a grayscale E-Ink panel, so each
   color has its own shape wherever it appears - token, home slot, finish
   count, hub wedge, color picker: red a filled circle, green an open
   circle, yellow a filled triangle, blue an open square. Home columns
   and bases carry the same shape in a corner. */

.ludo-home-base {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 10%;
  padding: 18%;
  box-sizing: border-box;
  border: 1px solid var(--border);
}


/* An empty slot is a faint dashed circle; an occupied one shows the
   color's shape at full strength, so the tokens still waiting can be
   counted for every color. */
.ludo-home-slot {
  border-radius: 50%;
  border: 1px dashed var(--muted);
  background: transparent;
  box-sizing: border-box;
  padding: 0;
  cursor: pointer;
  color: var(--text);
}

.ludo-home-slot-filled {
  border: 0;
}


/* A waiting token that may enter: a thick double frame around it (the
   last move's mark is a thin single line). */
.ludo-home-slot-movable {
  outline: 5px double var(--text);
  outline-offset: 2px;
}

/* The center hub's decorative cells: a closed 3x3 block the track runs
   around (see ludo-app.js). None of them take clicks. */
.ludo-hub-corner {
  background: var(--square-light);
  border: 1px solid var(--border);
  box-sizing: border-box;
  pointer-events: none;
}

.ludo-hub-wedge {
  border: 1px solid var(--border);
  box-sizing: border-box;
  pointer-events: none;
  padding: 25%;
  color: var(--text);
  background: var(--square-light);
}


.ludo-hub-center {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--square-light);
  border: 1px solid var(--border);
  box-sizing: border-box;
  pointer-events: none;
}

/* Turn indicator: one chip per active color, the current player's chip
   highlighted - see the board header in ludo.html. */
.ludo-turn-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.3rem 0;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.ludo-turn-indicator > * {
  margin: 0 0.3rem 0.3rem 0;
}

.ludo-turn-indicator > *:last-child {
  margin-right: 0;
}

.ludo-turn-label {
  font-size: 0.9rem;
  font-weight: 700;
}

/* One chip per color: its shape and the number of its tokens in the
   finish. The player to move gets a thick frame. */
.ludo-turn-chip {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--square-light);
  color: var(--text);
  white-space: nowrap;
}

.ludo-turn-chip .ludo-shape {
  display: inline-block;
  vertical-align: middle;
  width: 1.1rem;
  height: 1.1rem;
}

.ludo-turn-count {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.3rem;
  font-weight: 700;
  font-size: 1rem;
}

.ludo-turn-chip-active {
  border-width: 3px;
  padding: 0.05rem 0.3rem;
}

.ludo-dice-area {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.5rem;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.ludo-dice-area > * {
  margin: 0 0.6rem 0.6rem 0;
}

.ludo-dice-area > *:last-child {
  margin-right: 0;
}

.ludo-dice-display {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ludo-die {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  font-weight: 700;
  background: #fff;
}

/* Small shape icons for the color picker, board placeholder and game
   card - the same shapes as the tokens. */
.ludo-icon-shape {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: middle;
  color: var(--text);
}

/* Print view for the paper puzzles (Sudoku, Kakuro, Nonogram, Slitherlink,
   Killer Sudoku, Calcudoku, Number Blocks, Hashi, Skyscrapers - every
   page with body.printable-puzzle, see print-puzzle.js): one A4 portrait
   sheet with a title line and the EMPTY puzzle, black on white. Only the
   board survives - not the site chrome around it, not the number pad,
   and none of the player's own entries, selection or conflict marks, so
   the sheet can be solved with a pen. The title line is filled in by
   print-puzzle.js and never shown on screen. */
.print-puzzle-title {
  display: none;
}

@page puzzle {
  size: A4 portrait;
  margin: 12mm;
}

@media print {
  html:has(body.printable-puzzle) {
    background: #fff !important;
  }

  body.printable-puzzle {
    page: puzzle;
    --bg: #fff;
    --bg-alt: #fff;
    --text: #000;
    --border: #000;
    --muted: #000;
    --accent: #000;
    --danger: #000;
    --square-light: #fff;
    --square-selected: #fff;
    background: #fff !important;
    color: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.printable-puzzle > *:not(#app),
  body.printable-puzzle #app > *:not(main),
  body.printable-puzzle main > *:not(#board-section),
  body.printable-puzzle #board-section > *:not(#board-container):not(.print-puzzle-title),
  body.printable-puzzle #board-container > [id$="-numpad"],
  body.printable-puzzle #nonogram-mode-toggle {
    display: none !important;
  }

  body.printable-puzzle #app,
  body.printable-puzzle main,
  body.printable-puzzle #board-section {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  body.printable-puzzle .print-puzzle-title {
    display: block;
    margin: 0 0 6mm;
    font-size: 14pt;
    font-weight: 700;
    text-align: center;
    color: #000;
  }

  body.printable-puzzle #board-container {
    width: var(--print-board-width, auto);
    max-width: none;
    margin: 0 auto;
    zoom: var(--print-zoom, 1);
    break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.printable-puzzle #board-container * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    outline: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
  }

  body.printable-puzzle .nonogram-wrap {
    overflow: visible !important;
  }

  /* The player's own entries: digits, bridges, loop lines, filled and
     crossed-out nonogram cells. Givens stay. */
  body.printable-puzzle .sudoku-cell:not(.sudoku-cell-given) .sudoku-cell-value,
  body.printable-puzzle .fs-cell:not(.fs-given) .fs-value,
  body.printable-puzzle .rp-cell:not(.rp-given) .rp-value,
  body.printable-puzzle .kakuro-cell-value,
  body.printable-puzzle .skyscrapers-cell-value,
  body.printable-puzzle .hashi-edge-line,
  body.printable-puzzle .hashi-edge-hit,
  body.printable-puzzle .slitherlink-edge-line,
  body.printable-puzzle .slitherlink-edge-btn {
    display: none !important;
  }

  body.printable-puzzle .nonogram-cell {
    background: #fff !important;
    color: transparent !important;
    border-radius: 0 !important;
  }

  /* Skyscrapers draws its grid lines as a black board showing through
     1px gaps, which would print the whole clue frame black. On paper:
     white everywhere, each fillable cell outlined instead (the outlines
     of two neighbours share the same 1px gap, so lines stay 1px). */
  body.printable-puzzle #skyscrapers-board {
    background: #fff !important;
    border: none !important;
  }

  body.printable-puzzle .skyscrapers-cell {
    background: #fff !important;
    border-radius: 0 !important;
  }

  body.printable-puzzle #skyscrapers-board .skyscrapers-cell-board {
    outline: 1px solid #000 !important;
    outline-offset: 0 !important;
  }

  /* Kakuro's blocked cells: a diagonal on white instead of a solid
     black block - same shape as the on-screen split clue cell, a
     fraction of the ink. */
  body.printable-puzzle .kakuro-cell-black {
    background:
      linear-gradient(to top right,
        #fff 0%, #fff calc(50% - 0.75px),
        #000 calc(50% - 0.75px), #000 calc(50% + 0.75px),
        #fff calc(50% + 0.75px), #fff 100%) !important;
  }

  body.printable-puzzle .kakuro-clue {
    color: #000 !important;
  }

  /* Status decorations that would give away progress. */
  body.printable-puzzle .rp-conflict .rp-value,
  body.printable-puzzle .fs-conflict .fs-value {
    background: none !important;
    color: #000 !important;
    padding: 0 !important;
  }

  body.printable-puzzle .fs-cell {
    border-width: 2px !important;
  }

  body.printable-puzzle .hashi-island {
    background: #fff !important;
    border: 3px solid #000 !important;
  }

  body.printable-puzzle .hashi-island-value {
    color: #000 !important;
  }

  body.printable-puzzle .slitherlink-dot {
    fill: #000 !important;
    stroke: none !important;
  }

  body.printable-puzzle .slitherlink-clue-ring {
    stroke: none !important;
  }

  body.printable-puzzle .slitherlink-clue-text {
    fill: #000 !important;
  }
}

/* "New version available" banner - see update-banner.js. A normal,
   in-flow element at the very top of <body> rather than position:fixed,
   so it never overlaps the header underneath it and needs no dynamic
   height bookkeeping - it just pushes the rest of the page down while
   it's shown. */
.update-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: #fff;
  border-bottom: var(--border-width) solid var(--border);
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.update-banner > * {
  margin: 0 var(--space-2) 0 0;
}

.update-banner > *:last-child {
  margin-right: 0;
}

/* Also used directly (not inside .update-banner-lines) by
   error-banner.js's single-line message - keep its own flex sizing so
   that usage keeps working unchanged. */
.update-banner-text {
  flex: 1 1 auto;
  font-size: 0.85rem;
}

/* Wraps the main message and the optional "what's new" line as two
   stacked lines inside the same flex slot the plain text span used to
   occupy - see update-banner.js. */
.update-banner-lines {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.update-banner-whats-new {
  font-size: 0.75rem;
  color: var(--muted);
}

.update-banner-close {
  padding: 0 var(--space-2);
  line-height: 1.4;
}

/* Tested devices (devices.html, devices-list.js): a plain bordered table
   that wraps its text instead of scrolling sideways on a narrow reader. */
.devices-table-wrap {
  max-width: 100%;
}

.devices-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.9rem;
}

.devices-table th,
.devices-table td {
  border: 1px solid var(--border);
  padding: var(--space-1) var(--space-2);
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
}

.devices-table th {
  font-weight: 700;
}

/* Display density (density.js): the spacing scale times 0.75 (compact)
   or 1.5 (spacious). Only the scale changes; boards don't use it. */
:root[data-density="compact"] {
  --space-1: 0.1875rem;
  --space-2: 0.375rem;
  --space-3: 0.5625rem;
  --space-4: 0.75rem;
  --space-5: 1.125rem;
}

:root[data-density="spacious"] {
  --space-1: 0.375rem;
  --space-2: 0.75rem;
  --space-3: 1.125rem;
  --space-4: 1.5rem;
  --space-5: 2.25rem;
}

/* The board fills the width of its card, so the side spacing on its way
   to the screen edge (#app's --space-1 plus the card's --space-3, 1rem
   at normal) must stay 1rem in every density, or the squares would grow
   or shrink. Only the board card's left/right padding makes up for it;
   the space above and below still follows the density. */
:root[data-density="compact"] #board-section {
  padding-left: 0.8125rem;
  padding-right: 0.8125rem;
}

:root[data-density="spacious"] #board-section {
  padding-left: 0.625rem;
  padding-right: 0.625rem;
}

/* Opt-in high-contrast mode for low-light e-ink reading conditions -
   see high-contrast.js. Overrides the same shared CSS custom
   properties every card, button and board grid line across all 46
   games already draws from, so this needs no per-component styling. */
:root.high-contrast {
  --bg: #ffffff;
  --bg-alt: #ffffff;
  --muted: #000000;
  --border-width: 3px;
  --square-dark: #bdbdbd;
  --square-selected: #999999;
}

/* Settings menu - see settings-menu.js. Same fixed-overlay technique as
   .result-modal-overlay (already proven on a real Tolino: longhand
   top/right/bottom/left rather than the `inset` shorthand, which that
   device silently ignores), and the same card look as .result-modal,
   just taller and scrollable since this holds several sections instead
   of one message. */
.settings-modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 1000;
}

.settings-modal-overlay.hidden {
  display: none !important;
}

.settings-modal {
  background: #fff;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: left;
}

.settings-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 var(--space-4) 0;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.settings-modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.settings-modal-close {
  min-width: 2rem;
  padding: var(--space-1) var(--space-2);
}

.settings-section {
  margin-bottom: var(--space-4);
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section h3 {
  margin: 0 0 var(--space-2) 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.settings-section .settings-subheading {
  margin-top: var(--space-4);
}

.settings-section .lang-switch select {
  width: 100%;
}

/* Flexbox `gap` fallback: margin-based spacing instead, since some E-Ink browsers (Tolino confirmed) don't support `gap` on a flex container and render items with zero space between them. */
.settings-segmented {
  display: flex;
}

.settings-segmented > * {
  margin: 0 var(--space-1) 0 0;
}

.settings-segmented > *:last-child {
  margin-right: 0;
}

.settings-segmented button {
  flex: 1;
}

.settings-segmented button.active {
  border-width: calc(var(--border-width) * 2);
  font-weight: 800;
}

.settings-checkbox-row {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.settings-checkbox-row input {
  margin-right: var(--space-2);
}

.settings-hint {
  color: var(--muted);
  margin: 0 0 var(--space-3) 0;
}

/* ---------- Categories (Stadt, Land, Fluss) ---------- */

.categories-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  border: 2px solid var(--border);
  border-radius: 3px;
  box-sizing: border-box;
  font-size: 1em;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.categories-player-names {
  display: flex;
  flex-wrap: wrap;
  margin: 0.25rem 0 0.5rem;
}

/* Margins instead of flexbox gap (older e-reader browsers). */
.categories-name-input {
  width: 9rem;
  margin: 0 0.4rem 0.4rem 0;
  font: inherit;
  padding: 0.3rem 0.4rem;
  border: var(--border-width) solid var(--border);
  box-sizing: border-box;
}

.categories-presets {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.categories-preset {
  display: inline-flex;
  align-items: center;
  width: 50%;
  min-height: 2.4rem;
  box-sizing: border-box;
  padding-right: 0.4rem;
}

.categories-preset input {
  width: 1.3rem;
  height: 1.3rem;
  margin: 0 0.4rem 0 0;
  flex: none;
}

.categories-custom-row input {
  flex: 1 1 12rem;
  font: inherit;
  padding: 0.3rem 0.4rem;
  border: var(--border-width) solid var(--border);
}

.categories-letter-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5rem 0;
}

.categories-letter {
  min-width: 6rem;
  height: 6rem;
  border: 4px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.2rem;
  font-weight: 700;
  line-height: 1;
  background: #fff;
}

.categories-timer {
  margin-left: 1rem;
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 6rem;
}

.categories-used {
  text-align: center;
  font-size: 0.9rem;
  margin: 0.25rem 0 0.5rem;
  word-spacing: 0.15em;
}

/* Up to 8 player columns: the table scrolls inside its own box instead
   of widening the page. */
.categories-board-wrap {
  overflow-x: auto;
  max-width: 100%;
}

.categories-board {
  width: 100%;
  border-collapse: collapse;
}

.categories-board th,
.categories-board td {
  text-align: center;
  padding: 0.2rem;
}

.categories-board tbody th,
.categories-board tfoot th {
  text-align: left;
  font-weight: 600;
}

.categories-board thead th {
  max-width: 6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.categories-cell {
  min-width: 2.8rem;
  min-height: 2.6rem;
  padding: 0.2rem 0.4rem;
  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: #fff;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

/* Scored cells invert, so given points stand out in plain black and white. */
.categories-cell-scored {
  background: var(--text);
  color: #fff;
}

.categories-cell:disabled {
  opacity: 1;
  cursor: default;
  border-style: dashed;
}

.categories-total-row th,
.categories-total-row td {
  font-weight: 700;
  border-top: 2px solid var(--border);
}

.categories-score-hint {
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

/* ---------- Right-to-left languages (Arabic) ----------
   The page layout mirrors with dir="rtl" (set by i18n.js), but the game
   boards keep their left-to-right geometry: board coordinates, dice rows
   and card tableaus are positions, not text. Grid and flex rows would
   otherwise flip. Text tables (scoresheets) are left to mirror. */
[dir="rtl"] [id$="-board"]:not(table) {
  direction: ltr;
}

[dir="rtl"] .rule-list dd,
[dir="rtl"] .content-page {
  text-align: start;
}

/* ---- Domino and Mau Mau: shared pieces ----
   Players with their tile/card counts, the cover that hides a hand while
   the device is passed on, and a row of action buttons. No flexbox `gap`
   (Tolino drops it) - spacing comes from margins. */
.game-players {
  display: flex;
  flex-wrap: wrap;
  margin: 0 0 var(--space-2);
}

.game-player {
  display: inline-block;
  margin: 0 var(--space-2) var(--space-1) 0;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--square-light);
}

.game-player-active {
  border-width: 3px;
  font-weight: 700;
}

.game-player-active .game-player-name::before {
  content: "\25B6\00A0";
}

.game-player-count {
  margin-left: var(--space-2);
}

.game-player-stock {
  border-style: dashed;
}

.hand-cover {
  margin: 0.6rem 0;
  padding: 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  background: var(--square-light);
}

.hand-cover p {
  margin: 0 0 0.6rem;
  font-weight: 700;
}

.game-actions-row {
  margin-top: var(--space-2);
  text-align: center;
}

.game-actions-row button {
  margin: 0 var(--space-1) var(--space-1);
}

/* ---- Domino ---- */
.domino-board {
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  background: var(--bg-alt);
}

.domino-ends {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.domino-ends-label {
  font-size: 0.85rem;
  text-align: center;
  margin: 0 0.4rem;
}

.domino-end {
  width: 4.2rem;
  height: 4.2rem;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: var(--square-light);
  color: var(--text);
  padding: 0;
}

.domino-end:disabled {
  opacity: 1;
  color: var(--text);
}

/* A selected tile fits here: thick double border. */
.domino-end-fits {
  border: 6px double var(--border);
}

/* The end where the last tile went: underlined number. */
.domino-end-last {
  text-decoration: underline;
  text-decoration-thickness: 3px;
}

.domino-line {
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.3rem 0;
  min-height: 3.2rem;
  -webkit-overflow-scrolling: touch;
}

.domino-tile {
  display: inline-block;
  vertical-align: middle;
  color: var(--text);
}

.domino-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.domino-face {
  fill: var(--square-light);
  stroke: currentColor;
  stroke-width: 3;
}

.domino-divider {
  stroke: currentColor;
  stroke-width: 2.5;
}

.domino-pip {
  fill: currentColor;
}

.domino-line-tile {
  width: 3.4rem;
  height: 1.7rem;
  margin-right: 2px;
}

.domino-line-tile.domino-tile-double {
  width: 1.7rem;
  height: 3.4rem;
}

/* The tile placed last: a solid bar underneath it. */
.domino-tile-last {
  border-bottom: 4px solid var(--border);
  padding-bottom: 2px;
}

.domino-hand {
  margin-top: 0.6rem;
  text-align: center;
}

.domino-hand-tile {
  width: 5rem;
  height: 2.5rem;
  margin: 0 0.3rem 0.6rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

/* Tiles that don't fit sit lower and get a dashed outline - never shown
   by grey alone. */
.domino-tile-unplayable {
  position: relative;
  top: 0.4rem;
  outline: 2px dashed var(--border);
  outline-offset: 2px;
}

.domino-tile-selected {
  position: relative;
  top: -0.4rem;
  outline: 4px solid var(--border);
  outline-offset: 3px;
}

/* Triangles variant: the board of triangles, scaled to the width (a very
   wide board scrolls inside its frame), and the places a picked tile fits
   on as dashed triangles with a numbered button in the middle. */
.domino-grid {
  overflow-x: auto;
  overflow-y: hidden;
  color: var(--text);
}

.domino-grid-inner {
  position: relative;
  width: 100%;
  margin: 0 auto;
}

.domino-grid-svg {
  display: block;
  width: 100%;
  height: auto;
}

.domino-tri-num {
  font-size: 28px;
  font-weight: 700;
  text-anchor: middle;
  fill: currentColor;
}

.domino-tri-num-board {
  font-size: 13px;
}

.domino-tri-last {
  stroke-width: 6;
}

.domino-tri-place {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-dasharray: 6 4;
}

.domino-grid-places {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}

.domino-place-btn {
  position: absolute;
  transform: translate(-50%, -40%);
  min-width: 32px;
  min-height: 32px;
  padding: 0 4px;
  border: 3px solid var(--border);
  border-radius: 50%;
  background: var(--square-light);
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
}

.domino-hand-tile.domino-hand-tri {
  width: 3.6rem;
  height: 3.2rem;
}

/* Icons follow the other games' 1em icon size (game cards, placeholder). */
.domino-icon {
  display: inline-block;
  vertical-align: middle;
  width: 2em;
  height: 1em;
  color: var(--text);
}

.domino-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---- Mau Mau ---- */
.maumau-board {
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem;
  background: var(--bg-alt);
}

.maumau-pile {
  width: 4.6rem;
  height: 6.4rem;
  margin: 0 0.5rem;
  border: var(--border-width) solid var(--border);
  border-radius: 6px;
  background: var(--square-light);
  box-sizing: border-box;
  color: var(--text);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.1;
  text-align: center;
  padding: 0.4rem 0 0;
}

.maumau-stock {
  background: repeating-linear-gradient(45deg, #fff, #fff 4px, var(--border) 4px, var(--border) 5px);
  font-size: 1rem;
  padding: 0;
}

.maumau-stock-count {
  display: inline-block;
  background: var(--square-light);
  border: 1px solid var(--border);
  padding: 0.1rem 0.35rem;
}

.maumau-stock:disabled {
  opacity: 1;
}

.maumau-discard-last {
  border-width: 4px;
}

.maumau-card-rank,
.maumau-card-suit {
  display: block;
}

.maumau-card-suit {
  font-size: 2rem;
}

.maumau-wish {
  margin-left: 0.5rem;
  padding: 0.3rem 0.5rem;
  border: 3px double var(--border);
  border-radius: var(--radius);
  background: var(--square-light);
  text-align: center;
  font-size: 0.85rem;
}

.maumau-wish-suit {
  display: block;
  font-size: 2rem;
  line-height: 1.1;
}

.maumau-wish-picker {
  margin: 0.6rem 0;
  text-align: center;
}

.maumau-wish-picker p {
  margin: 0 0 0.4rem;
  font-weight: 700;
}

.maumau-wish-btn {
  width: 4rem;
  height: 4rem;
  margin: 0 0.3rem 0.3rem;
  font-size: 2.4rem;
  line-height: 1;
  padding: 0;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: var(--square-light);
  color: var(--text);
}

.maumau-hand {
  margin-top: 0.6rem;
  text-align: center;
}

.maumau-card {
  display: inline-block;
  vertical-align: top;
  width: 3.4rem;
  height: 4.8rem;
  margin: 0 0.25rem 0.8rem;
  border: var(--border-width) solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  box-sizing: border-box;
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.1;
  padding: 0.3rem 0 0;
  cursor: pointer;
}

.maumau-card .maumau-card-suit {
  font-size: 1.6rem;
}

/* Cards that can't be played now sit lower with a dashed border. */
.maumau-card-unplayable {
  position: relative;
  top: 0.5rem;
  border-style: dashed;
}

.maumau-card-drawn {
  outline: 4px double var(--border);
  outline-offset: 2px;
}

.maumau-icon {
  display: inline-block;
  vertical-align: middle;
  width: 0.75em;
  height: 1em;
  border: 2px solid var(--border);
  border-radius: 3px;
  box-sizing: border-box;
  background: #fff;
  text-align: center;
  font-size: 1em;
  line-height: 0.9;
  color: var(--text);
}

[dir="rtl"] .game-player-count {
  margin-left: 0;
  margin-right: var(--space-2);
}

/* Children's version: bigger cards - number as digit and die pips in
   the top row, the animal large below. Shapes only, no grey. */
.maumau-card.maumau-kid,
.maumau-pile.maumau-kid {
  width: 4.4rem;
  height: 6.2rem;
  padding: 0.25rem 0.25rem 0;
}

.maumau-pile.maumau-kid {
  width: 4.8rem;
  height: 6.6rem;
}

.maumau-kid-top {
  display: block;
  height: 1.6rem;
  text-align: start;
}

.maumau-kid-num {
  display: inline-block;
  vertical-align: top;
  font-size: 1.3rem;
  line-height: 1.5rem;
  padding: 0 0.15rem;
}

.maumau-kid-pips {
  float: right;
  width: 1.5rem;
  height: 1.5rem;
}

[dir="rtl"] .maumau-kid-pips {
  float: left;
}

.maumau-kid-animal {
  display: block;
  width: 3.4rem;
  height: 3.4rem;
  margin: 0.3rem auto 0;
}

.maumau-pile.maumau-kid .maumau-kid-animal {
  width: 3.6rem;
  height: 3.6rem;
}

/* Children's version: nothing fits - the stock gets a heavy frame. */
.maumau-stock.maumau-stock-draw {
  outline: 5px double var(--border);
  outline-offset: 3px;
}

.maumau-discard-by {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.7rem;
  font-weight: 400;
  text-decoration: underline;
}

/* Settings dialog: running version and "force update", kept low-key. */
.settings-version-section {
  border-top: 1px dashed var(--border);
  padding-top: var(--space-2);
  font-size: 0.85rem;
}

.settings-version-line {
  margin: 0 0 var(--space-2);
}

.settings-version-hint {
  margin: var(--space-1) 0 0;
  font-size: 0.8rem;
}

/* Long compound words ("Datenschutzerklärung", long URLs) must not push a
   text page wider than a phone screen: hyphenate where the browser can,
   otherwise break inside the word. */
.content-page h1,
.content-page h2,
.content-page p,
.content-page dd,
.content-page li {
  overflow-wrap: break-word;
  word-wrap: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

/* The example rows use a negative start margin as a gutter; in right-to-
   left pages that gutter belongs on the right, not past the left edge. */
[dir="rtl"] .marblepush-example-row,
[dir="rtl"] .fanorona-example-row {
  margin: 0 -1.5rem 1rem 0;
}

[dir="rtl"] .marblepush-example-figure,
[dir="rtl"] .fanorona-example-figure {
  margin: 0 1.5rem 1rem 0;
}

/* Region puzzles (Calcudoku, Number Blocks, Killer Sudoku - see
   region-puzzle.js): a float-grid of square cells like Sudoku's board.
   Every cell draws only its left and top border; the board's own frame
   closes the right and bottom edge. Region borders differ from cell
   borders by line weight (thick 3px vs thin 1px), and Killer Sudoku's
   cages by line shape (dashed, just inside the cells) - never by grey,
   so all of it reads on a monochrome E-Ink screen. A conflicting digit
   is shown inverted (white on black) so it can't be mistaken for a
   cage line or the selection frame. */

#rp-board {
  display: block;
  width: 100%;
  max-width: 540px;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  margin: 0 auto;
}

.rp-cell {
  background: var(--square-light);
  border: 0 solid var(--border);
  border-left-width: 1px;
  border-top-width: 1px;
  color: var(--text);
}

.rp-cell.rp-edge-l {
  border-left-width: 0;
}

.rp-cell.rp-edge-t {
  border-top-width: 0;
}

.rp-cell.rp-thick-l {
  border-left-width: 3px;
}

.rp-cell.rp-thick-t {
  border-top-width: 3px;
}

.rp-value {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  font-size: clamp(0.95rem, 4vw, 1.5rem);
  line-height: 1;
  pointer-events: none;
}

.rp-board-dashed .rp-value {
  font-size: clamp(0.85rem, 3.4vw, 1.3rem);
}

.rp-given .rp-value {
  font-weight: 700;
}

.rp-conflict .rp-value {
  background: var(--text);
  color: var(--bg);
  border-radius: 3px;
  padding: 0.05em 0.2em;
}

.rp-label {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 0.7rem;
  font-size: clamp(0.55rem, 2.2vw, 0.8rem);
  font-weight: 700;
  line-height: 1;
  background: var(--square-light);
  padding: 0 1px;
  pointer-events: none;
  z-index: 1;
}

.rp-cage {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  right: 3px;
  border: 0 dashed var(--text);
  pointer-events: none;
}

.rp-cage-top { border-top-width: 1px; }
.rp-cage-bottom { border-bottom-width: 1px; }
.rp-cage-left { border-left-width: 1px; }
.rp-cage-right { border-right-width: 1px; }

/* Small puzzle icon in front of a rules-page term (inline SVG). */
.rule-term-icon {
  display: inline-block;
  width: 1.4em;
  height: 1.4em;
  vertical-align: middle;
}

.rule-term-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rp-board-dashed .rp-label {
  top: 2px;
  left: 2px;
}

/* ---- Card games with separate card tiles (Schwimmen, Durak, Concan) ----
   Faces come from CardFaces.renderTall (card-faces.js): rank on top, the
   suit below as SVG - hollow for red suits, filled for black - so the
   colour reads on E-Ink. A selected card is raised with a double outline;
   a card that can't be used now sits lower with a dashed border. */
.pc-row {
  margin: 0.4rem 0;
  text-align: center;
}

.pc-row-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.7rem; /* room for a raised, selected card */
}

.pc-card {
  display: inline-block;
  vertical-align: top;
  position: relative;
  width: 3.4rem;
  height: 4.8rem;
  margin: 0 0.2rem 0.6rem;
  border: var(--border-width) solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  box-sizing: border-box;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.1;
  padding: 0.3rem 0 0;
  cursor: pointer;
  text-align: center;
}

.pc-card .pc-rank {
  display: block;
}

.pc-card .pc-suit {
  display: block;
  width: 1.7rem;
  height: 1.7rem;
  margin: 0.2rem auto 0;
}

.pc-card-small {
  width: 2.7rem;
  height: 3.8rem;
  font-size: 0.95rem;
  padding-top: 0.2rem;
  margin: 0 0.1rem 0.3rem;
}

.pc-card-small .pc-suit {
  width: 1.3rem;
  height: 1.3rem;
}

.pc-card-selected {
  top: -0.4rem;
  outline: 4px double var(--border);
  outline-offset: 2px;
}

/* A card (or domino tile) just drawn from the stock, in any card game: a
   bold ring in its bottom right corner - a shape, not grey, so it shows on
   black-and-white e-ink. Removed with the player's next action. */
.card-new {
  position: relative;
}

.card-new::after {
  content: "";
  position: absolute;
  bottom: 0.15rem;
  right: 0.15rem;
  width: 0.95rem;
  height: 0.95rem;
  box-sizing: border-box;
  border: 0.27rem solid var(--text);
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
}

/* On a domino tile a ring in a half reads like a pip: put it at the bottom,
   centred on the dividing line, where no pip ever sits. */
.domino-tile.card-new::after {
  right: auto;
  left: 50%;
  margin-left: -0.475rem;
}

.pc-card-dim {
  top: 0.4rem;
  border-style: dashed;
}

.pc-card:disabled {
  opacity: 1;
  cursor: default;
}

.pc-card-back {
  background: repeating-linear-gradient(45deg, #fff, #fff 4px, var(--border) 4px, var(--border) 5px);
}

.pc-count {
  display: inline-block;
  background: var(--square-light);
  border: 1px solid var(--border);
  padding: 0.1rem 0.35rem;
  font-size: 0.95rem;
}

.pc-score {
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0.2rem 0 0.4rem;
}

.pc-life {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  vertical-align: -0.05em;
  margin-left: 0.15em;
}

.pc-player-extra {
  margin-left: 0.3rem;
}

[dir="rtl"] .pc-player-extra {
  margin-left: 0;
  margin-right: 0.3rem;
}

/* Durak: the trump suit stays visible at the top as symbol, word and
   the face-up trump card; each beating card lies lower and to the right
   over its attack card so both ranks stay readable. */
.durak-trump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin: 0 0 0.5rem;
  padding: 0.3rem;
  border: 3px double var(--border);
  border-radius: var(--radius);
  background: var(--square-light);
}

.durak-trump > * {
  margin: 0 0.35rem;
}

.durak-trump-label {
  font-weight: 700;
  font-size: 1.05rem;
}

.durak-trump-symbol .card-suit {
  width: 1.6rem;
  height: 1.6rem;
  display: block;
}

.durak-trump .durak-trump-card {
  margin-bottom: 0;
  cursor: default;
}

.durak-table {
  min-height: 5.8rem;
}

.durak-pair {
  display: inline-block;
  position: relative;
  vertical-align: top;
  width: 4.7rem;
  height: 5.3rem;
  margin: 0 0.15rem 0.3rem;
}

.durak-pair .pc-card {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  cursor: default;
}

.durak-pair .durak-defense {
  left: 1.95rem;
  top: 1.4rem;
  border-width: 3px;
}

.durak-rule-option {
  display: inline-block;
  margin: 0.3rem 0 0;
}

/* Concan: melds as small grouped cards; the discard pile gets a thick
   double frame while it must be taken. */
.concan-melds {
  min-height: 1rem;
}

.concan-meld {
  display: inline-block;
  vertical-align: top;
  margin: 0 0.3rem 0.3rem;
  padding: 0.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--square-light);
  color: var(--text);
}

button.concan-meld {
  border-width: 2px;
  cursor: pointer;
}

.concan-meld .pc-card {
  cursor: inherit;
  margin-bottom: 0;
}

.concan-piles {
  text-align: center;
  margin: 0.4rem 0;
}

.concan-stock {
  padding-top: 1.6rem;
}

.concan-discard-offer {
  outline: 4px double var(--border);
  outline-offset: 3px;
}

/* Doppelkopf: game type and trick number on top, the trump order list
   behind a button, the trick as four fixed seats (the winning card gets
   a double frame and "wins" underneath while the trick is still shown),
   the hand split into a trump row and a plain-suit row. */
.dk-top {
  text-align: center;
  margin: 0 0 0.4rem;
}

.dk-top > * {
  display: inline-block;
  vertical-align: middle;
  margin: 0.15rem 0.3rem;
}

.dk-game-type {
  font-weight: 700;
}

.dk-trump-order {
  border: 3px double var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
  margin: 0 0 0.5rem;
  text-align: center;
}

.dk-trump-order-note {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
}

.dk-order-card {
  cursor: default;
}

.dk-party {
  display: inline-block;
  min-width: 3.6rem;
  margin: 0 0.4rem;
  padding: 0 0.3rem;
  border: 1px solid var(--border);
  text-align: center;
  font-weight: 700;
}

.dk-total {
  font-weight: 700;
}

.dk-trick {
  text-align: center;
  margin: 0.5rem 0;
}

.dk-slot {
  display: inline-block;
  vertical-align: top;
  width: 4.6rem;
  margin: 0 0.1rem;
  padding: 0.2rem 0 0.1rem;
  border: 2px solid transparent;
  border-radius: 5px;
  text-align: center;
}

.dk-slot-name {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
}

.dk-slot .pc-card {
  cursor: default;
  margin-bottom: 0.1rem;
}

.dk-slot-empty {
  border-style: dotted;
}

.dk-slot-win {
  border: 4px double var(--border);
}

.dk-slot-mark {
  display: block;
  min-height: 1.2em;
  font-size: 0.85rem;
  font-weight: 700;
}

.dk-score {
  text-align: center;
  border: 3px double var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  margin: 0.5rem 0;
}

.dk-score p {
  margin: 0.2rem 0;
}

.dk-score-head {
  font-weight: 700;
  font-size: 1.1rem;
}

.dk-score-items {
  list-style: none;
  margin: 0.3rem auto;
  padding: 0;
  display: table;
}

.dk-score-items li {
  margin: 0.1rem 0;
  text-align: left;
}

[dir="rtl"] .dk-score-items li {
  text-align: right;
}

.dk-score-party {
  display: inline-block;
  min-width: 4.5rem;
  margin-right: 0.4rem;
  font-weight: 700;
}

[dir="rtl"] .dk-score-party {
  margin-right: 0;
  margin-left: 0.4rem;
}

.dk-score-table {
  border-collapse: collapse;
  margin: 0.4rem auto 0;
}

.dk-score-table th,
.dk-score-table td {
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  text-align: center;
}

/* Trix: the running contract in large type on top with the kingdom and
   its five contracts (tick = done, arrow = now); a score board that is
   always visible, with each player's penalty cards of this deal as mini
   cards; the four Trix rows as mini cards from low to high (the Jack
   framed double). Hand cards that fit a row carry a black corner. */
.tx-top {
  text-align: center;
  margin: 0 0 0.4rem;
}

.tx-contract {
  font-size: 1.35rem;
  font-weight: 700;
}

.tx-kingdom {
  font-size: 0.95rem;
  margin: 0.1rem 0;
}

.tx-contract-item {
  display: inline-block;
  margin: 0.1rem 0.3rem;
  padding: 0 0.3rem;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.tx-contract-done {
  border-style: dashed;
}

.tx-contract-now {
  border-width: 3px;
  font-weight: 700;
}

.tx-contract-mark {
  margin-right: 0.25rem;
}

[dir="rtl"] .tx-contract-mark {
  margin-right: 0;
  margin-left: 0.25rem;
}

.tx-players {
  margin: 0.3rem 0;
}

.tx-player {
  display: inline-block;
  vertical-align: top;
  box-sizing: border-box;
  width: 48%;
  margin: 0 1% 0.3rem;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  min-height: 2.2rem;
}

.tx-player-active {
  border-width: 3px;
}

.tx-player-head > span {
  display: inline-block;
  margin-right: 0.35rem;
}

[dir="rtl"] .tx-player-head > span {
  margin-right: 0;
  margin-left: 0.35rem;
}

.tx-player-name {
  font-size: 0.9rem;
}

.tx-total {
  font-weight: 700;
}

.tx-deal-score {
  border: 1px solid var(--border);
  padding: 0 0.25rem;
  font-size: 0.9rem;
}

.tx-player-info {
  font-size: 0.85rem;
  min-height: 1rem;
}

.pc-card-mini {
  width: 1.75rem;
  height: 2.5rem;
  margin: 0.1rem 0.05rem 0;
  padding-top: 0.1rem;
  font-size: 0.8rem;
  border-width: 1px;
  border-radius: 3px;
  cursor: default;
}

.pc-card-mini .pc-suit {
  width: 0.95rem;
  height: 0.95rem;
  margin-top: 0.05rem;
}

.tx-choose {
  text-align: center;
  margin: 0.4rem 0;
}

.tx-rows {
  margin: 0.4rem 0;
}

.tx-row {
  min-height: 2.9rem;
  margin: 0.15rem 0;
  padding: 0.1rem 0.2rem;
  border-bottom: 1px dotted var(--border);
  text-align: center;
}

.tx-row-suit {
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.3rem;
}

[dir="rtl"] .tx-row-suit {
  margin-right: 0;
  margin-left: 0.3rem;
}

.tx-row-suit .card-suit {
  display: block;
  width: 1.3rem;
  height: 1.3rem;
}

.tx-row .pc-card-mini {
  vertical-align: middle;
}

.tx-row-jack {
  border: 3px double var(--border);
}

.tx-row-empty {
  display: inline-block;
  vertical-align: middle;
  font-size: 0.85rem;
}

.pc-card.tx-playable::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 1rem 1rem 0;
  border-color: transparent var(--text) transparent transparent;
}

/* Crate Pusher: the board is one button per cell, sized in px by
   cratepusher-app.js from the available width (32 px at least). Every
   cell shows its content as an inline SVG - wall solid black, target a
   small hollow square, crate a framed square with a cross, crate on a
   target a solid square, the pusher a filled circle - so nothing depends
   on colour or grey. Thin cell lines keep the floor readable. */
.cp-counters {
  text-align: center;
  margin: 0 0 0.3rem;
}

.cp-counters > span {
  display: inline-block;
  margin: 0.15rem 0.25rem;
}

.cp-best {
  text-align: center;
  font-size: 0.9rem;
  margin: 0 0 0.4rem;
}

.cp-board {
  margin: 0 auto;
  line-height: 0;
  border: 2px solid var(--border);
}

.cp-row {
  white-space: nowrap;
}

.cp-cell {
  display: inline-block;
  vertical-align: top;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-height: 0;
  min-width: 0;
  border: 1px solid #c8c8c4;
  border-radius: 0;
  background: #fff;
  cursor: pointer;
}

.cp-cell svg {
  display: block;
  width: 100%;
  height: 100%;
}

.cp-cell.cp-wall {
  border-color: #141413;
  background: #141413;
  cursor: default;
}

.cp-cell:focus-visible {
  outline: 3px double var(--border);
  outline-offset: -4px;
}

/* Tipp-Knopf der Zahlenrätsel und Hashi (hint-engine.js): mindestens
   44 CSS-Pixel hoch, damit er auf dem Touchscreen sicher zu treffen ist. */
.board-actions .hint-btn {
  min-height: 44px;
}

/* Vom Tipp markiertes Feld bzw. markierte Insel: ein doppelter Rahmen -
   eine andere Form als die einfache Auswahl (.selected) und der
   gestrichelte Konfliktrahmen, also auch ohne Farbe oder Grau zu
   erkennen. */
.sudoku-cell.hint-cell,
.rp-cell.hint-cell,
.lightswitch-cell.hint-cell,
.kakuro-cell-white.hint-cell,
.skyscrapers-cell-board.hint-cell,
.nonogram-cell.hint-cell,
.mc-cell.hint-cell {
  outline: 6px double var(--text);
  outline-offset: -7px;
}

.hashi-island.hint-cell {
  outline: 6px double var(--text);
  outline-offset: 2px;
}

/* On a filled (black) Nonogram cell the same double frame is drawn in
   the light colour, so it still shows. */
.nonogram-cell-filled.hint-cell {
  outline-color: var(--square-light);
}

/* A Slitherlink hint marks an edge: the double frame goes round the
   edge's (otherwise invisible) tap area between the two dots. */
.slitherlink-edge-btn.hint-cell {
  outline: 5px double var(--text);
  outline-offset: 0;
}

/* Fox and Geese board (foxandgeese-app.js): the 33-point cross, drawn
   with the point-and-line technique of Alquerque - an SVG line layer
   under round point buttons. The sides differ by shape: a goose is a
   filled disc, the fox a triangle; points you can use right now get a
   dashed border, the piece being moved a heavy solid one - never grey
   alone. */
.foxandgeese-board {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  background: var(--square-light);
  border: 3px solid var(--border);
  box-sizing: border-box;
}

.foxandgeese-lines {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.foxandgeese-lines line {
  stroke: var(--border);
  stroke-width: 3;
}

.foxandgeese-point {
  position: absolute;
  transform: translate(-50%, -50%);
  background: var(--square-light);
  border: 2px solid var(--border);
  border-radius: 50%;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
  z-index: 2;
}

.foxandgeese-point-selectable,
.foxandgeese-point-movable {
  border: 3px dashed var(--border);
}

.foxandgeese-point-selected {
  border: 5px solid var(--accent);
}

.foxandgeese-point.last-move {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.foxandgeese-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 72%;
  height: 72%;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  pointer-events: none;
}

.foxandgeese-piece svg {
  display: block;
  width: 100%;
  height: 100%;
}

.foxandgeese-piece-goose {
  border-radius: 50%;
  background: #111;
  border: 2px solid #000;
}

.foxandgeese-icon-goose,
.foxandgeese-icon-fox {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: middle;
  box-sizing: border-box;
}

.foxandgeese-icon-goose {
  border-radius: 50%;
  background: #111;
  border: 2px solid #000;
}

/* The fox icon: a triangle outline drawn with borders (no SVG needed). */
.foxandgeese-icon-fox {
  width: 0;
  height: 0;
  border-left: 0.55em solid transparent;
  border-right: 0.55em solid transparent;
  border-bottom: 1em solid #111;
}

/* Seega board (seega-app.js): 5x5 square cells in a CSS grid, the row
   height set from the width in JS. Black stones are filled discs, White
   stones thick rings; the centre square is marked by a diagonal cross so
   it reads without grey. Squares you can use now get a dashed border,
   the stone being moved a heavy solid one. */
.seega-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
}

.seega-cell {
  position: relative;
  border: 1px solid var(--border);
  background: var(--square-light);
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  cursor: pointer;
  border-radius: 0;
}

.seega-cell-center {
  background-image: linear-gradient(45deg, transparent 48.5%, var(--border) 48.5%, var(--border) 51.5%, transparent 51.5%),
    linear-gradient(-45deg, transparent 48.5%, var(--border) 48.5%, var(--border) 51.5%, transparent 51.5%);
}

.seega-cell-selectable,
.seega-cell-target {
  outline: 3px dashed var(--border);
  outline-offset: -6px;
}

.seega-cell-selected {
  outline: 5px solid var(--accent);
  outline-offset: -6px;
}

.seega-cell.last-move {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.seega-stone {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 66%;
  height: 66%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

.seega-stone-black {
  background: #111;
  border: 2px solid #000;
}

.seega-stone-white {
  background: #fff;
  border: 7px solid #111;
}

.seega-icon-stone {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}

.seega-icon-stone-black {
  background: #111;
  border: 2px solid #000;
}

.seega-icon-stone-white {
  background: #fff;
  border: 3px solid #111;
}

.seega-phase-line {
  font-weight: 700;
}

/* Rommé: melds on the table carry the name of whoever laid them out; the
   hand wraps into two rows so every card stays whole and readable; a
   joker shows a star and a double frame. */
.romme-table {
  text-align: center;
}

/* One area per player on the table: the name above, the melds below,
   wrapping inside the card so four players never need sideways scrolling. */
.romme-owner-area {
  margin: 0 0 0.4rem;
  padding-top: 0.3rem;
  border-top: 1px solid var(--border);
}

.romme-owner-area:first-child {
  border-top: none;
  padding-top: 0;
}

.romme-owner-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

/* House rule: a card that may be taken from a meld - a button with the
   corner triangle used for "can move" elsewhere. */
.pc-card.romme-takeable {
  background: linear-gradient(135deg, var(--text) 0, var(--text) 9px, transparent 9px) #fff;
  border-width: 2px;
  cursor: pointer;
}

.romme-empty {
  display: block;
  font-style: italic;
  margin: 0.3rem 0;
}

.romme-hand {
  max-width: 34rem;
  margin-left: auto;
  margin-right: auto;
}

.pc-card.romme-joker {
  border-style: double;
  border-width: 4px;
}

.romme-round-end {
  margin: 0.6rem 0;
  padding: 0.5rem;
  border: var(--border-width) solid var(--border);
  text-align: center;
}

.romme-round-end ul {
  text-align: left;
  margin: 0.4rem 0;
}

.romme-player-status {
  display: block;
  margin: 0;
  font-size: 0.85rem;
}

[dir="rtl"] .romme-player-status {
  margin: 0;
}

/* Last move and "can move" on the same round point: keep both shapes
   (after the games' own .last-move rules, which would win otherwise). */
.fanorona-point-movable.last-move {
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 3px #fff, 0 0 0 6px var(--text);
}

.sternhalma-cell-movable.last-move {
  box-shadow: inset 0 0 0 3px var(--accent), 0 0 0 3px #fff, 0 0 0 6px var(--text);
}

.baghchal-point-movable.last-move {
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 3px #fff, 0 0 0 6px var(--text);
}

.marblepush-cell-movable.last-move {
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 3px #fff, 0 0 0 6px var(--text);
}

.surakarta-point-movable.last-move {
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 3px #fff, 0 0 0 6px var(--text);
}

/* Rommé: switch the hand order (suit / rank) - a full-size touch target. */
.romme-sort-row {
  text-align: center;
  margin: 0 0 0.4rem;
}

.romme-sort-button {
  min-height: 44px;
}

/* Who Took the Cake? (cake-app.js): a floor plan of square cells
   (float-grid, height set from JS like the other boards). Rooms are told
   apart by wall thickness - thick lines between rooms, thin ones inside -
   never by grey. The room's name sits on one line in the top strip of a
   run of its cells wide enough for it (else a number, spelled out in the
   legend under the board); furniture is drawn small in the bottom left
   corner, a placed thing large on the right below that strip, so neither
   ever covers the name. The window hangs
   outside the board on the left or right wall of its row. */
.cake-board-wrap {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 22px;
  box-sizing: border-box;
}

.cake-board {
  position: relative;
  width: 100%;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
}

.cake-cell {
  float: left;
  position: relative;
  box-sizing: border-box;
  border: 1px solid var(--border);
  background: var(--square-light);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}

.cake-cell.cake-wall-t { border-top-width: 3px; }
.cake-cell.cake-wall-b { border-bottom-width: 3px; }
.cake-cell.cake-wall-l { border-left-width: 3px; }
.cake-cell.cake-wall-r { border-right-width: 3px; }

.cake-labels {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cake-room-label {
  position: absolute;
  box-sizing: border-box;
  padding: 3px 3px 0 5px;
  font-size: 0.7rem;
  line-height: 1.1;
  font-weight: 700;
  text-align: start;
  white-space: nowrap;
  overflow: hidden;
}

/* A room whose name fits nowhere in its cells shows a number; the legend
   under the board spells it out. */
.cake-legend {
  margin: 0.4rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.6;
}

.cake-legend-item {
  display: inline-block;
  margin: 0 0.6rem;
  white-space: nowrap;
}

.cake-furn,
.cake-thing {
  position: absolute;
  display: block;
  pointer-events: none;
}

.cake-furn {
  left: 3%;
  bottom: 3%;
  width: 40%;
  height: 40%;
}

/* Table, cupboard, plant: no animal stands there, so the drawing fills
   the cell, below the room name where one is written in this cell. */
.cake-furn.cake-furn-big {
  left: 6%;
  right: 6%;
  top: 6%;
  bottom: 5%;
  width: auto;
  height: auto;
}

.cake-cell-labelled .cake-furn.cake-furn-big {
  top: calc(0.77rem + 5px);
}

/* Chair, rug: small in the bottom-left corner, the animal large beside it. */
.cake-furn.cake-furn-small {
  left: 3%;
  bottom: 3%;
  width: 36%;
  height: 36%;
}

.cake-thing {
  right: 4%;
  bottom: 5%;
  width: 56%;
  height: 56%;
}

.cake-furn svg,
.cake-thing svg {
  display: block;
  width: 100%;
  height: 100%;
}

.cake-window {
  position: absolute;
  width: 22px;
}

.cake-window-left { left: 0; }
.cake-window-right { right: 0; }

.cake-window svg {
  position: absolute;
  top: 50%;
  left: 0;
  width: 22px;
  height: 22px;
  margin-top: -11px;
}

.cake-palette {
  text-align: center;
  margin: 0.75rem 0 0.25rem;
}

/* Each button is at least as wide as an eighth of the 560px board
   column and grows with its name, so a name is never cut off; the row
   wraps onto a second line on narrow screens. */
.cake-pick {
  display: inline-block;
  vertical-align: top;
  width: auto;
  min-width: 4.4rem;
  margin: 2px;
  padding: 4px 4px;
  border: 2px solid var(--border);
  box-sizing: border-box;
}

.cake-pick-icon {
  display: block;
  width: 34px;
  height: 34px;
  margin: 0 auto;
}

.cake-pick-name {
  display: block;
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: nowrap;
}

/* The chosen thing: a heavy frame plus a double outline - a shape, not a
   shade. */
.cake-pick.cake-pick-selected {
  border-width: 4px;
  outline: 3px double var(--text);
  outline-offset: 1px;
  font-weight: 700;
}

.cake-clues-title {
  font-size: 1.1rem;
  margin: 0.75rem 0 0.25rem;
}

.cake-clues {
  margin: 0;
  padding-inline-start: 1.6rem;
}

/* The hint button right under the things to place, where the hand
   already is. */
.board-actions.cake-actions {
  justify-content: center;
  margin-top: 0.25rem;
}

/* Two columns of clues where there is room, so board, buttons and clues
   fit on one e-reader screen. */
@media (min-width: 560px) {
  .cake-clues {
    -webkit-column-count: 2;
    column-count: 2;
    -webkit-column-gap: 2rem;
    column-gap: 2rem;
  }

  .cake-clues li {
    -webkit-column-break-inside: avoid;
    break-inside: avoid;
  }
}

.cake-clue {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 6px 4px;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

/* The clue the hint's reason uses: bold until the next move. */
.cake-clue.cake-clue-used {
  font-weight: 700;
}

/* "Always true": the four fixed rules, numbered, same size as the clues,
   not tickable; a plain frame sets them apart from the clues. */
.cake-always {
  margin: 0.5rem 0 0;
  padding: 0 0.5rem 0.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
}

.cake-always-list {
  margin: 0;
  padding-inline-start: 1.6rem;
}

.cake-always-list li {
  padding: 4px 4px;
  text-align: start;
}

/* Ticked off: struck through and marked with a tick in front. */
.cake-clue.cake-clue-done {
  text-decoration: line-through;
}

.cake-clue.cake-clue-done::before {
  content: "\2713\00a0";
  font-weight: 700;
}

.cake-cell.hint-cell {
  outline: 6px double var(--text);
  outline-offset: -7px;
}

/* Animal Sudoku (animalsudoku-app.js): square cells (float grid, height
   set from JS), thick lines between the boxes. An animal that belongs to
   the puzzle has a heavy inner frame; an animal that repeats gets a
   dashed inner frame, a hinted cell a double one - shapes, never grey. */
.animalsudoku-board-wrap {
  max-width: 480px;
  margin: 0 auto;
}

.animalsudoku-board {
  position: relative;
  width: 100%;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
}

.animalsudoku-cell {
  float: left;
  position: relative;
  box-sizing: border-box;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0;
  cursor: pointer;
}

.animalsudoku-cell.animalsudoku-box-t { border-top-width: 3px; }
.animalsudoku-cell.animalsudoku-box-l { border-left-width: 3px; }

.animalsudoku-animal {
  display: block;
  width: 64%;
  height: 64%;
  margin: 18%;
  pointer-events: none;
}

/* A white gap keeps the frame of a given animal apart from the box lines. */
.animalsudoku-cell.animalsudoku-given {
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 7px var(--text);
  cursor: default;
}

.animalsudoku-cell.animalsudoku-conflict {
  outline: 3px dashed var(--text);
  outline-offset: -11px;
}

.animalsudoku-cell.hint-cell {
  outline: 6px double var(--text);
  outline-offset: -12px;
}

.animalsudoku-example {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  margin: 0 auto;
}

/* Shape Sort (shapesort-app.js): tubes of four slots side by side
   (inline-blocks, JS evens out the rows). Marked stones get a dashed
   frame, the chosen tube a heavy double frame, a finished tube a double
   border, hinted tubes a double outline - shapes, never grey. */
.shapesort-area {
  text-align: center;
}

.shapesort-tubes {
  margin: 0 auto;
  text-align: center;
}

.shapesort-tube-wrap {
  display: inline-block;
  vertical-align: top;
  margin: 0 5px 12px;
  text-align: center;
}

.shapesort-tube {
  display: block;
  width: 54px;
  padding: 3px;
  border: 3px solid var(--border);
  border-radius: 6px 6px 18px 18px;
  background: #fff;
  box-sizing: border-box;
  cursor: pointer;
}

.shapesort-slot {
  display: block;
  height: 44px;
  margin: 2px 0;
  border-radius: 4px;
  box-sizing: border-box;
}

.shapesort-stone-icon {
  display: block;
  width: 38px;
  height: 38px;
  margin: 3px auto;
  pointer-events: none;
}

.shapesort-slot.shapesort-stone-marked {
  outline: 3px dashed var(--text);
  outline-offset: -1px;
}

.shapesort-tube.shapesort-tube-selected {
  border-width: 5px;
  outline: 3px double var(--text);
  outline-offset: 2px;
}

.shapesort-tube.shapesort-tube-done {
  border-style: double;
  border-width: 6px;
}

.shapesort-tube.hint-cell {
  outline: 5px double var(--text);
  outline-offset: 3px;
}

.shapesort-tube-num {
  display: block;
  margin-top: 3px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* "Stones per tube": more stones, smaller shapes, taller tubes. The tube
   stays at least 44px wide to tap; JS puts the tubes in several rows. */
.shapesort-cap-6 .shapesort-tube { width: 50px; }
.shapesort-cap-6 .shapesort-slot { height: 37px; }
.shapesort-cap-6 .shapesort-stone-icon { width: 32px; height: 32px; margin: 2px auto; }
.shapesort-cap-8 .shapesort-tube { width: 46px; }
.shapesort-cap-8 .shapesort-slot { height: 31px; margin: 1px 0; }
.shapesort-cap-8 .shapesort-stone-icon { width: 27px; height: 27px; margin: 2px auto; }
.shapesort-cap-10 .shapesort-tube { width: 44px; padding: 2px; }
.shapesort-cap-10 .shapesort-slot { height: 27px; margin: 1px 0; }
.shapesort-cap-10 .shapesort-stone-icon { width: 24px; height: 24px; margin: 1px auto; }
.shapesort-cap-8 .shapesort-tube-wrap,
.shapesort-cap-10 .shapesort-tube-wrap { margin: 0 4px 12px; }

.board-actions.shapesort-actions {
  justify-content: center;
}

.shapesort-example {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 0 auto;
}

/* Rules page: the solved example drawn as a picture. */
.cake-example-figure {
  margin: 0.5rem 0 0.75rem;
}

.cake-example {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
}

/* Link the Pairs: square cells sized by script (no aspect-ratio on
   e-ink), lines and symbols drawn in one SVG over the cells. */
.linkpairs-wrap {
  max-width: 560px;
  margin: 0 auto;
}

.linkpairs-board {
  position: relative;
  margin: 0 auto;
  border: 3px solid var(--border);
  background: var(--square-light);
  box-sizing: border-box;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.linkpairs-cell {
  float: left;
  position: relative;
  box-sizing: border-box;
  border: 1px solid var(--border);
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.linkpairs-lines {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.board-actions.linkpairs-actions {
  justify-content: center;
}

.linkpairs-example {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  margin: 0 auto;
}

/* Old Maid: picture cards - the animal (or the Black Peter) large, the
   name small underneath; hidden cards show the striped back. */
.pc-card.oldmaid-card {
  width: 4.8rem;
  height: 5.3rem;
  margin: 0 0.1rem 0.6rem;
  padding: 0.2rem 0 0;
  font-size: 0.6rem;
  overflow: hidden;
}

.oldmaid-pic {
  display: block;
  width: 2.9rem;
  height: 2.9rem;
  margin: 0.15rem auto 0.1rem;
}

.oldmaid-name {
  display: block;
  font-size: 0.58rem;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

/* Old Maid: player signs (a person for you, a screen with the number for
   a computer), the "Drawn" field (giver, arrow, card or pair, arrow,
   taker) and an open pile of laid-down pairs per player - the last pair
   large, every pair as a small picture. Frames, never grey alone. */
.oldmaid-sign {
  display: inline-block;
  vertical-align: middle;
  width: 1.5rem;
  height: 1.5rem;
  margin-right: 0.3rem;
}

.oldmaid-sign svg {
  display: block;
  width: 100%;
  height: 100%;
}

.oldmaid-drawn {
  margin: 0.4rem 0 0.6rem;
  padding: 0.5rem 0.3rem 0;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.oldmaid-drawn-cards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.oldmaid-drawn-cards .oldmaid-sign {
  width: 2.2rem;
  height: 2.2rem;
  margin: 0 0 0.6rem;
}

.oldmaid-arrow {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0.3rem 0.6rem;
}

.oldmaid-drawn-group {
  display: inline-flex;
}

.oldmaid-drawn-pair {
  padding: 0.2rem 0.2rem 0;
  margin-bottom: 0.4rem;
  border: 3px double var(--border);
  border-radius: var(--radius);
}

.pc-card.oldmaid-card-mid {
  width: 3.6rem;
  height: 4.2rem;
  margin-bottom: 0.3rem;
}

.pc-card.oldmaid-card-mid .oldmaid-pic {
  width: 2.2rem;
  height: 2.2rem;
}

.oldmaid-piles-wrap {
  margin: 0.8rem 0 0.4rem;
  text-align: center;
}

.oldmaid-pile {
  margin: 0 0 0.5rem;
  padding: 0.3rem 0.3rem 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
}

.oldmaid-pile-head {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.oldmaid-pile-count {
  margin-left: 0.6rem;
}

.oldmaid-pile-last {
  display: inline-block;
  vertical-align: top;
  margin-right: 0.4rem;
}

.oldmaid-pile-strip {
  display: inline-block;
  vertical-align: top;
  max-width: 100%;
}

.oldmaid-mini {
  display: inline-block;
  vertical-align: top;
  width: 1.9rem;
  height: 1.9rem;
  margin: 0 0.15rem 0.2rem 0;
  padding: 0.1rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  box-sizing: border-box;
}

.oldmaid-mini.pc-card-back {
  background: repeating-linear-gradient(45deg, #fff, #fff 4px, var(--border) 4px, var(--border) 5px);
}

.oldmaid-mini .oldmaid-pic {
  width: 100%;
  height: 100%;
  margin: 0;
}

.oldmaid-example {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 0 auto;
}

/* War: the two piles with their card counts, the round in between. */
.war-pile-row .pc-card.war-pile {
  width: 4.2rem;
  height: 5.8rem;
  vertical-align: middle;
}

.war-pile-row .pc-count {
  vertical-align: middle;
  margin: 0 0.4rem;
}

.war-pile-row .pc-row-label {
  margin: 0.3rem 0;
}

.war-table {
  margin: 0.5rem 0;
  padding: 0.4rem 0 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.war-table-row {
  min-height: 4.1rem;
}

.war-example {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 0 auto;
}

/* Snakes and Ladders: the die beside the Roll button, the board as one
   SVG sized by script, token shapes inline in the player list. */
.sl-dice-row {
  margin: 0.4rem 0 0.6rem;
  text-align: center;
}

.sl-dice-row > * {
  vertical-align: middle;
  margin: 0 0.4rem;
}

.sl-die-wrap {
  display: inline-flex;
  align-items: center;
  min-height: 4rem;
}

/* The die large, the roller's token next to it. */
.sl-die {
  display: block;
  width: 4rem;
  height: 4rem;
}

.sl-shape.sl-die-who {
  width: 2rem;
  height: 2rem;
  margin-right: 0.35rem;
}

.sl-token-choice {
  display: inline-flex;
  align-items: center;
  margin: 0 0.6rem 0.3rem 0;
}

.sl-token-choice select {
  margin: 0 0.3rem;
}

.sl-token-pic .sl-shape {
  width: 1.6rem;
  height: 1.6rem;
}

/* Last moves: a small table, newest first. */
.sl-log-wrap {
  margin: 0.6rem 0 0;
  text-align: center;
}

.sl-log {
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.sl-log th,
.sl-log td {
  padding: 0.15rem 0.45rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.sl-log td:first-child {
  white-space: nowrap;
}

.sl-log td.sl-log-roll {
  font-weight: 700;
  text-align: center;
}

.sl-shape {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.25em;
}

.sl-shape-inline {
  margin-right: 0.25rem;
}

[dir="rtl"] .sl-shape-inline {
  margin-right: 0;
  margin-left: 0.25rem;
}

.sl-start-wrap {
  font-weight: 700;
}

.sl-board-wrap {
  max-width: 560px;
  margin: 0 auto;
}

.sl-board {
  margin: 0 auto;
  border: 2px solid var(--border);
  background: #fff;
  box-sizing: border-box;
}

.sl-board-svg {
  display: block;
}

/* Read by screen readers only: what stands where on the board. */
.sl-sr-list {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.sl-example {
  display: block;
  width: 100%;
  max-width: 180px;
  height: auto;
  margin: 0 auto;
}

/* Path Blockers: the board is one SVG sized by script with a button
   over every field; the houses are buttons below the board (dashed
   border = a token can come out, double border = chosen). */
.bl-dice-row {
  margin: 0.4rem 0 0.6rem;
  text-align: center;
}

.bl-dice-row > * {
  vertical-align: middle;
  margin: 0 0.4rem;
}

.bl-die-wrap {
  display: inline-block;
  width: 3.4rem;
  height: 3.4rem;
}

.bl-die {
  display: block;
  width: 100%;
  height: 100%;
}

.bl-board-wrap {
  max-width: 564px;
  margin: 0 auto;
}

.bl-board {
  position: relative;
  margin: 0 auto;
  border: 2px solid var(--border);
  background: #fff;
  box-sizing: content-box;
}

.bl-board-svg {
  display: block;
}

.bl-field {
  position: absolute;
  margin: 0;
  padding: 0;
  min-width: 0;
  min-height: 0;
  border: 0;
  background: transparent;
}

.bl-players {
  margin-top: 0.6rem;
  justify-content: center;
}

.bl-house {
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.bl-house:disabled {
  opacity: 1;
  color: inherit;
  cursor: default;
}

.bl-house-pick {
  border: 3px dashed var(--border);
}

.bl-house-selected {
  border: 4px double var(--border);
}

.bl-shape {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  margin-right: 0.25rem;
  vertical-align: -0.25em;
}

[dir="rtl"] .bl-shape {
  margin-right: 0;
  margin-left: 0.25rem;
}

/* "All tokens in the goal": the count in the player buttons and the
   ranking after the win. */
.bl-house .pc-player-extra,
.bl-house .game-player-name {
  white-space: nowrap;
}

/* In the player buttons on its own line, so it never breaks apart. */
.bl-house .bl-goal-count {
  display: block;
  white-space: nowrap;
}

.bl-ranking .bl-goal-count {
  margin-left: 0.4rem;
  white-space: nowrap;
}

.bl-ranking .bl-goal-count::before {
  content: "\00B7\00A0";
}

.bl-ranking-wrap {
  margin: 0.5rem 0 0;
  text-align: center;
}

.bl-ranking {
  display: inline-block;
  margin: 0;
  padding-left: 1.6rem;
  text-align: left;
  font-weight: 700;
}

.bl-ranking li {
  margin: 0.15rem 0;
}

.bl-example {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 0 auto;
}

/* Blackjack / 17 and 4: the bank's hand above yours, each with its
   points; chips and bet below; the chosen bet has a thick border and a
   tick, not only a different shade. */
.bj-hand {
  margin: 0.3rem 0 0.2rem;
}

.bj-hand-head {
  text-align: center;
  font-size: 1rem;
}

.bj-hand-head .pc-row-label {
  display: inline;
  margin: 0;
  font-size: 1rem;
}

.bj-points {
  font-weight: 700;
}

.bj-points:not(:empty)::before {
  content: "\00B7\00A0";
}

.bj-cards {
  min-height: 5.4rem;
}

.bj-chips-row {
  margin: 0.2rem 0 0.5rem;
  text-align: center;
  font-weight: 700;
}

.bj-bet-now {
  margin-left: 0.8rem;
}

[dir="rtl"] .bj-bet-now {
  margin-left: 0;
  margin-right: 0.8rem;
}

.bj-buttons {
  margin: 0.3rem 0;
  text-align: center;
}

.bj-buttons > * {
  vertical-align: middle;
  margin: 0.2rem 0.25rem;
}

.bj-bet-label {
  font-weight: 700;
}

.bj-bet {
  min-width: 3rem;
}

.bj-bet-selected {
  border-width: 3px;
  font-weight: 700;
}

.bj-bet-selected::before {
  content: "\2713\00A0";
}

.bj-example {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 0 auto;
}

/* Poker: the computers' seats side by side (they wrap on a narrow
   screen), the shared cards and the pot in the middle, your seat below.
   The player on turn has a thick border, a player who folded a dashed
   one; tags such as "Dealer" or "all in" are framed words, not shades. */
.pk-opponents {
  text-align: center;
}

.pk-seat {
  display: inline-block;
  vertical-align: top;
  min-width: 9.5rem;
  margin: 0.2rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
}

.pk-seat-active {
  border-width: 3px;
}

.pk-seat-folded {
  border-style: dashed;
}

.pk-seat-head {
  font-size: 0.85rem;
  line-height: 1.5;
}

.pk-name {
  font-weight: 700;
  margin-right: 0.3rem;
}

.pk-seat-active .pk-name::before {
  content: "\25B6\00A0";
}

.pk-info {
  display: inline-block;
  margin: 0 0.15rem;
  white-space: nowrap;
}

.pk-tag {
  padding: 0 0.25rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-weight: 700;
}

.pk-cards {
  margin-top: 0.3rem;
}

.pk-hand-line {
  margin-top: 0.1rem;
  font-size: 0.85rem;
}

.pk-hand-name {
  font-weight: 700;
}

.pk-table {
  margin: 0.5rem 0;
  text-align: center;
}

.pk-board .pk-card {
  margin-left: 0.1rem;
  margin-right: 0.1rem;
}

.pk-slot {
  border-style: dashed;
}

.pk-pot {
  font-weight: 700;
}

.pk-me {
  text-align: center;
}

.pk-me .pk-seat {
  min-width: 14rem;
}

.pk-buttons {
  margin: 0.4rem 0;
  text-align: center;
}

.pk-buttons > button {
  margin: 0.2rem 0.25rem;
}

.pk-hands-wrap {
  overflow-x: auto;
}

.pk-hands {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.pk-hands th,
.pk-hands td {
  border: 1px solid var(--border);
  padding: 0.25rem 0.35rem;
  text-align: left;
  vertical-align: top;
}

[dir="rtl"] .pk-hands th,
[dir="rtl"] .pk-hands td {
  text-align: right;
}

.pk-ex-cell {
  min-width: 5.5rem;
}

.pk-ex-card {
  white-space: nowrap;
}

.pk-example {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  margin: 0 auto;
}

/* Skat: the game line, the bidding and announcement panels, the open
   hand of an Ouvert declarer and the score list (which may scroll on
   its own on a narrow screen, the page does not). The trick and score
   table reuse the Doppelkopf classes. */
.sk-game-line {
  margin: 0.2rem 0 0.4rem;
  text-align: center;
  font-weight: 700;
}

.sk-values {
  margin: 0.3rem 0;
  text-align: center;
  font-size: 0.9rem;
}

.sk-values-head {
  font-weight: 700;
  margin-right: 0.3rem;
}

[dir="rtl"] .sk-values-head {
  margin-right: 0;
  margin-left: 0.3rem;
}

.sk-value {
  display: inline-block;
  margin: 0.1rem 0.25rem;
  padding: 0 0.3rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  white-space: nowrap;
}

.sk-panel {
  margin: 0.4rem 0;
}

.sk-buttons {
  text-align: center;
}

.sk-buttons > button {
  margin: 0.2rem 0.25rem;
}

.sk-note {
  margin: 0.2rem 0;
  text-align: center;
}

.sk-options {
  margin: 0.3rem 0;
  text-align: center;
}

.sk-options label {
  display: inline-block;
  margin: 0.2rem 0.5rem;
}

.sk-open {
  margin: 0.3rem 0;
}

.sk-list-wrap {
  overflow-x: auto;
}

.sk-list {
  width: 100%;
  font-size: 0.8rem;
}

.sk-list th,
.sk-list td {
  padding: 0.15rem 0.2rem;
}

.sk-list .sk-num {
  white-space: nowrap;
}

.sk-list .sk-game-cell {
  overflow-wrap: anywhere;
}

.sf-list .sk-game-cell {
  text-align: left;
}

/* Long player names (Computer 1 in some languages) on narrow screens. */
@media (max-width: 420px) {
  .sf-list {
    font-size: 0.7rem;
  }

  .sf-list th,
  .sf-list td {
    padding: 0.1rem 0.15rem;
  }
}

.sk-example {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 0 auto;
}

/* Schafkopf reuses the Skat and Doppelkopf classes; only the picture of
   the trump order on the rules page is its own. */
.sf-example {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  margin: 0 auto;
}

/* Canasta: narrow hand cards (15 fit in two rows at 360 px), each meld as
   one box with rank, number of cards and wild cards; a canasta has a
   double frame and says "natural" or "mixed"; a frozen discard pile has a
   double frame and the word "frozen" below. */
.pc-card.cn-card {
  width: 2.05rem;
  height: 3.3rem;
  margin: 0 0.1rem 0.4rem;
  padding-top: 0.2rem;
  font-size: 0.95rem;
}

.pc-card.cn-card .pc-suit {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
}

.cn-hand {
  text-align: center;
  padding-top: 0.4rem;
}

.cn-melds {
  min-height: 1rem;
}

.cn-meld {
  display: inline-block;
  vertical-align: top;
  min-width: 2.6rem;
  margin: 0 0.25rem 0.3rem 0;
  padding: 0.15rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-align: center;
  line-height: 1.15;
  font: inherit;
}

button.cn-meld {
  border-width: 2px;
  cursor: pointer;
}

.cn-meld.cn-canasta {
  border: 4px double var(--border);
}

.cn-meld-rank {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
}

.cn-meld-count {
  display: block;
  font-size: 0.85rem;
}

.cn-meld-tag {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
}

#cn-players .pc-player-extra {
  display: block;
  font-size: 0.85rem;
}

.cn-area {
  margin-bottom: 0.3rem;
}

.cn-piles .pc-card {
  margin-bottom: 0.2rem;
}

.pc-card.cn-frozen {
  border: 5px double var(--border);
}

.cn-pile-info,
.cn-red-line {
  font-size: 0.85rem;
}

.cn-score-table {
  font-size: 0.85rem;
}

#cn-next {
  margin-top: 0.6rem;
}

/* Bridge: the four seats (North on top, West and East side by side, South
   at the bottom), hands as rows by suit with narrow cards, the seat to
   play with a thick frame, guided bidding as rows of buttons, auction and
   score list as small tables. */
.br-line {
  text-align: center;
  font-size: 0.85rem;
  margin: 0.2rem 0;
}

.br-seat {
  margin: 0.3rem 0;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  box-sizing: border-box;
}

.br-seat.br-seat-turn {
  border: 4px double var(--border);
}

.br-ew {
  text-align: center;
}

.br-seat-side {
  display: inline-block;
  vertical-align: top;
  width: 49%;
  margin: 0.3rem 0.5%;
}

.br-seat-head {
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.br-seat-name,
.br-role {
  font-weight: 700;
}

.br-count {
  display: block;
  font-size: 0.85rem;
}

.br-suit-row {
  min-height: 1rem;
}

.br-void {
  display: inline-block;
  font-size: 0.85rem;
  margin: 0.2rem;
}

.br-bidding {
  text-align: center;
  margin: 0.4rem 0;
}

.br-bid-row {
  margin: 0.2rem 0;
}

.br-bid-row button {
  margin: 0.15rem;
}

.br-bid-row .br-bid {
  min-width: 3rem;
}

.br-auction,
.br-list {
  font-size: 0.85rem;
}

.br-auction td,
.br-auction th {
  min-width: 3.2rem;
}

/* Pairs to Ten: nine cells per row; a crossed-out cell shows a hollow
   digit with a thick diagonal line, the selected cell a thick double
   frame, a hinted cell a dashed frame and a corner triangle. */
.tp-grid {
  text-align: center;
  margin: 0.4rem 0;
}

.tp-row {
  white-space: nowrap;
}

.tp-cell {
  display: inline-block;
  vertical-align: top;
  width: 10.6%;
  height: 2.6rem;
  margin: 0 0.2% 0.2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 2.4rem;
  box-sizing: border-box;
  cursor: pointer;
}

.tp-cell:disabled {
  opacity: 1;
  cursor: default;
}

.tp-empty {
  border-color: transparent;
}

.tp-crossed {
  color: #fff;
  -webkit-text-stroke: 1px var(--text);
  background: linear-gradient(to top right, transparent calc(50% - 2px), var(--text) calc(50% - 2px), var(--text) calc(50% + 2px), transparent calc(50% + 2px)) #fff;
  border-style: dotted;
}

.tp-selected {
  border: 4px double var(--border);
}

.tp-hint {
  border: 3px dashed var(--border);
  background: linear-gradient(135deg, var(--text) 0, var(--text) 8px, transparent 8px) #fff;
}

.tp-actions button {
  margin: 0.15rem;
}

.cn-score-table .cn-sum-row td,
.cn-score-table .cn-sum-row th {
  font-weight: 700;
  border-top-width: 3px;
}

/* Home page: one line under a section heading (Children's Games). */
.section-intro {
  margin: 0 0 var(--space-3);
}

/* Home page: "All new games" link under the New Games section. */
.section-more-link {
  text-align: center;
  margin: 0.5rem 0 0;
  font-weight: 700;
}

/* Math Cross (Rechenkreuz): a 7 x 7 grid - number squares, operators,
   "=" and results - and the number pad below. Given numbers are bold in
   a thick frame, entered ones normal; the selected square has a double
   frame. Used numbers on the pad are struck through (never grey alone). */
.mc-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 3rem)) minmax(0, 2rem) minmax(0, 4rem);
  grid-auto-rows: 3rem;
  justify-content: center;
  align-items: center;
  margin: 0.6rem 0;
}

.mc-grid .mc-item {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.mc-cell {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--square-light);
  color: var(--text);
  font-weight: 400;
}

.mc-cell.mc-given {
  border-width: 4px;
  font-weight: 700;
}

.mc-cell.mc-selected {
  border: 6px double var(--border);
}

.mc-op,
.mc-eq {
  font-weight: 700;
}

.mc-res {
  font-weight: 700;
  white-space: nowrap;
}

.mc-pad {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 22rem;
  margin: 0 auto 0.4rem;
}

.mc-num {
  min-width: 3rem;
  min-height: 3rem;
  margin: 0 0.25rem 0.4rem;
  font-size: 1.3rem;
  font-weight: 700;
}

.mc-num-used {
  text-decoration: line-through;
  border-style: dashed;
}

.mc-num-current {
  border: 4px solid var(--border);
}

.mc-clear {
  font-size: 1rem;
}

@media (max-width: 400px) {
  .mc-grid {
    grid-template-columns: repeat(5, minmax(0, 2.6rem)) minmax(0, 1.6rem) minmax(0, 3.6rem);
    grid-auto-rows: 2.6rem;
  }
  .mc-num {
    min-width: 2.6rem;
  }
}

/* Spot the Difference: two pictures, one above the other or side by side
   on wide screens; invisible buttons over each picture's 5 x 3 areas; a
   found difference gets a thick circle, the hint a dashed frame. */
.df-pictures {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.df-pic {
  position: relative;
  flex: 1 1 400px;
  max-width: 540px;
  margin: 0 0.3rem 0.6rem;
}

.df-svg {
  display: block;
  width: 100%;
  height: auto;
}

.df-areas {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.df-area {
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.df-area:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: -3px;
}

.df-found {
  fill: none;
  stroke: #141413;
  stroke-width: 4.5;
}

.df-hint {
  fill: none;
  stroke: #141413;
  stroke-width: 3;
  stroke-dasharray: 7 5;
}

/* Pentomino Puzzle (Legepuzzle): the board as a drawing with an invisible
   grid of buttons on top, the piece in hand with its dot, turn and flip
   buttons, and the pieces to choose from. Laid pieces in the tray are
   dashed, the chosen one has a thick frame. */
.pt-board {
  position: relative;
  width: 100%;
  margin: 0.4rem auto 0.6rem;
}

.pt-svg {
  display: block;
  width: 100%;
  height: auto;
}

.pt-cells {
  position: absolute;
  display: grid;
}

.pt-cell {
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.pt-cell:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: -3px;
}

.pt-hint {
  fill: none;
  stroke: #141413;
  stroke-width: 4;
  stroke-dasharray: 6 4;
}

.pt-hand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.pt-hand > * {
  margin: 0 0.3rem 0.3rem;
}

.pt-current svg {
  display: block;
}

.pt-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.pt-piece {
  width: 3.4rem;
  height: 3.4rem;
  margin: 0 0.25rem 0.4rem;
  padding: 0.25rem;
}

.pt-piece svg {
  display: block;
  width: 100%;
  height: 100%;
}

.pt-piece-selected {
  border: 4px solid var(--border);
}

.pt-piece-laid {
  border-style: dashed;
}

/* Card Duel (cardduel-app.js): the other mage, both rows of creatures and
   your mage as one bordered table, the hand as a list of large cards.
   Ready creatures have a thick frame, possible targets a dashed one, the
   selected card or creature is drawn inverted. Margins instead of `gap`
   (older e-ink browsers). */
.cd-table {
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2);
}

.cd-mage-btn {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
  text-align: start;
  padding: var(--space-2);
  background: #fff;
  color: #141413;
  border: 2px solid var(--border);
  border-radius: var(--radius);
}

.cd-mage-btn > * {
  margin: 0 var(--space-2) 0 0;
}

.cd-mage-name {
  font-weight: 700;
}

.cd-mage-life {
  font-weight: 700;
  font-size: 1.1rem;
}

.cd-mage-facts {
  font-size: 0.85rem;
  flex: 1 1 12rem;
}

.cd-board {
  display: flex;
  flex-wrap: wrap;
  min-height: 3.2rem;
  margin: var(--space-2) 0;
  padding: var(--space-1) 0;
}

.cd-board-own {
  border-top: 2px dashed var(--border);
  padding-top: var(--space-2);
}

.cd-empty {
  color: var(--muted);
  font-size: 0.85rem;
  align-self: center;
}

.cd-creature {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 31%;
  min-width: 5.5rem;
  margin: 0 2% var(--space-2) 0;
  padding: var(--space-1);
  background: #fff;
  color: #141413;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  line-height: 1.25;
}

.cd-creature.cd-ready {
  border-width: 3px;
}

.cd-creature-name {
  font-weight: 700;
  text-align: center;
  overflow-wrap: break-word;
  hyphens: auto;
}

.cd-stats {
  font-weight: 700;
  font-size: 1rem;
}

.cd-hurt {
  font-weight: 400;
  font-size: 0.75rem;
  margin-inline-start: 0.2em;
}

.cd-abil {
  font-size: 0.72rem;
  text-align: center;
}

.cd-emblem {
  width: 1.4rem;
  height: 1.4rem;
  flex: 0 0 auto;
}

.cd-target {
  outline: 3px dashed #141413;
  outline-offset: 2px;
}

.cd-selected,
.cd-selected .cd-cost {
  background: #141413;
  color: #fff;
}

.cd-selected .cd-emblem {
  background: #fff;
  border-radius: 3px;
}

.cd-actions {
  margin: var(--space-2) 0;
  text-align: center;
}

.cd-actions button {
  margin: 0 var(--space-1) var(--space-1) 0;
}

.cd-info {
  text-align: start;
  min-height: 2.6em;
  margin: var(--space-2) 0;
  padding: var(--space-2);
  border-left: 4px solid var(--border);
  font-size: 0.9rem;
}

.cd-heading {
  text-align: start;
  font-size: 1rem;
  margin: var(--space-3) 0 var(--space-1);
}

.cd-hand {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cd-hand li {
  margin: 0 0 var(--space-2);
}

.cd-card {
  display: block;
  width: 100%;
  text-align: start;
  padding: var(--space-2);
  background: #fff;
  color: #141413;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.3;
}

.cd-card.cd-unplayable {
  border-style: dashed;
  border-width: 1px;
}

.cd-card-top {
  display: flex;
  align-items: center;
}

.cd-card-top > * {
  margin: 0 var(--space-2) 0 0;
}

.cd-card-name {
  flex: 1 1 auto;
  font-weight: 700;
  font-size: 1.05rem;
}

.cd-cost {
  display: inline-block;
  min-width: 1.8rem;
  padding: 0.1rem 0.3rem;
  border: 2px solid #141413;
  border-radius: 50%;
  text-align: center;
  font-weight: 700;
  margin: 0;
}

.cd-card-kind {
  font-size: 0.8rem;
  margin-inline-end: var(--space-2);
}

.cd-card-stats {
  font-weight: 700;
}

.cd-card-text {
  display: block;
  font-size: 0.85rem;
  margin-top: var(--space-1);
}

.cd-log {
  text-align: start;
  margin: 0;
  padding-inline-start: 1.4rem;
  font-size: 0.85rem;
}

.cd-log li {
  margin-bottom: 0.15rem;
}

/* Narrow screens: two creatures per row, so names like
   "Flammentänzerin" fit without breaking inside the word. */
@media (max-width: 440px) {
  .cd-creature {
    width: 48%;
  }
}

/* Fairy-Tale Villains (villains-app.js): goal card, the four places of the
   domain (4 in a row, 2 x 2 on a narrow screen), action buttons, a box for
   choices, the hand, the other villains and the log. The place with the
   figure has a thick frame, a place a hero blocks a dashed one, places
   that can be tapped now a dashed outline. Margins instead of `gap`. */
.vl-goal {
  text-align: start;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2);
}

.vl-goal-head {
  font-size: 1rem;
}

.vl-goal-text {
  margin: var(--space-1) 0;
  font-size: 0.9rem;
}

.vl-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
}

.vl-steps li {
  margin: 0 0 0.1rem;
}

.vl-steps .vl-done {
  font-weight: 700;
}

.vl-heading {
  text-align: start;
  font-size: 1rem;
  margin: var(--space-3) 0 var(--space-1);
}

.vl-domain {
  display: flex;
  flex-wrap: wrap;
}

.vl-place {
  display: flex;
  flex-direction: column;
  width: 23.5%;
  margin: 0 2% var(--space-2) 0;
  padding: var(--space-1);
  background: #fff;
  color: #141413;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: start;
  font-size: 0.78rem;
  line-height: 1.25;
}

.vl-place:nth-child(4n) {
  margin-right: 0;
}

.vl-place.vl-here {
  border-width: 4px;
}

.vl-place.vl-blocked {
  border-style: dashed;
  border-width: 2px;
}

.vl-place.vl-here.vl-blocked {
  border-width: 4px;
}

.vl-place.vl-target {
  outline: 3px dashed #141413;
  outline-offset: 2px;
}

.vl-place-name {
  font-weight: 700;
  font-size: 0.9rem;
  overflow-wrap: break-word;
}

.vl-place-acts {
  margin: 0.15rem 0;
}

.vl-figure,
.vl-hero,
.vl-hedge {
  font-weight: 700;
}

.vl-hero {
  border-top: 1px dashed var(--border);
  padding-top: 0.1rem;
}

.vl-actions {
  margin: var(--space-2) 0;
  text-align: center;
}

.vl-actions button,
.vl-chooser button {
  margin: 0 var(--space-1) var(--space-1) 0;
}

.vl-chooser {
  margin: var(--space-2) 0;
  padding: var(--space-2);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: start;
}

.vl-chooser-hint {
  font-weight: 700;
}

.vl-hand,
.vl-others {
  list-style: none;
  margin: 0;
  padding: 0;
}

.vl-hand li,
.vl-others li {
  margin: 0 0 var(--space-2);
}

.vl-card,
.vl-other {
  display: block;
  width: 100%;
  text-align: start;
  padding: var(--space-2);
  background: #fff;
  color: #141413;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.3;
}

.vl-card.vl-unplayable {
  border-style: dashed;
  border-width: 1px;
}

.vl-card.vl-selected,
.vl-other.vl-selected,
.vl-card.vl-selected .vl-cost {
  background: #141413;
  color: #fff;
}

.vl-card.vl-marked {
  outline: 3px dashed #141413;
  outline-offset: 2px;
}

.vl-card-top {
  display: flex;
  align-items: center;
}

.vl-card-name {
  flex: 1 1 auto;
  font-weight: 700;
}

.vl-cost {
  display: inline-block;
  min-width: 1.6rem;
  padding: 0.05rem 0.3rem;
  border: 2px solid #141413;
  border-radius: 50%;
  text-align: center;
  font-weight: 700;
}

.vl-card-kind {
  display: block;
  font-size: 0.8rem;
}

.vl-card-text {
  display: block;
  font-size: 0.85rem;
  margin-top: var(--space-1);
}

.vl-other-full {
  margin-top: var(--space-1);
}

.vl-domain-small .vl-place {
  font-size: 0.72rem;
}

.vl-log {
  text-align: start;
  margin: 0;
  padding-inline-start: 1.4rem;
  font-size: 0.85rem;
}

/* Narrow screens: the domain as 2 x 2. */
@media (max-width: 520px) {
  .vl-place {
    width: 49%;
  }
  .vl-place:nth-child(2n) {
    margin-right: 0;
  }
}

/* Forest Village (forestvillage-app.js): own line, forest map (4 fields in
   a row, 2 on a narrow screen), meadow / hand / village as card grids,
   action buttons, task, points table and log. Fields and cards that can
   be used now have a dashed outline, the selected card is inverted, cards
   that can't be paid have a thin dashed frame. Margins instead of `gap`. */
.fv-me,
.fv-solo,
.fv-task,
.fv-info {
  text-align: start;
  margin: var(--space-1) 0;
  font-size: 0.9rem;
}

.fv-solo:empty,
.fv-info:empty {
  display: none;
}

.fv-res {
  font-weight: 700;
}

.fv-heading {
  text-align: start;
  font-size: 1rem;
  margin: var(--space-3) 0 var(--space-1);
}

.fv-fields {
  display: flex;
  flex-wrap: wrap;
}

.fv-field {
  display: flex;
  flex-direction: column;
  width: 23.5%;
  margin: 0 2% var(--space-2) 0;
  padding: var(--space-1);
  background: #fff;
  color: #141413;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  text-align: start;
  font-size: 0.78rem;
  line-height: 1.25;
}

.fv-field:nth-child(4n) {
  margin-right: 0;
}

.fv-field:disabled {
  opacity: 1;
  color: #141413;
}

.fv-field.fv-taken {
  border-style: dashed;
  border-width: 1px;
}

.fv-field.fv-target {
  outline: 3px dashed #141413;
  outline-offset: 2px;
}

.fv-field-name {
  font-weight: 700;
  font-size: 0.88rem;
  overflow-wrap: break-word;
}

.fv-field-who {
  font-weight: 700;
  border-top: 1px dashed var(--border);
  margin-top: 0.15rem;
  padding-top: 0.1rem;
}

.fv-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}

.fv-cards > li {
  width: 49%;
  margin: 0 2% var(--space-2) 0;
}

.fv-cards > li:nth-child(2n) {
  margin-right: 0;
}

.fv-card {
  display: block;
  width: 100%;
  height: 100%;
  text-align: start;
  padding: var(--space-1) var(--space-2);
  background: #fff;
  color: #141413;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.25;
  font-size: 0.8rem;
}

li.fv-card {
  width: 49%;
  height: auto;
}

.fv-card.fv-unaffordable {
  border-style: dashed;
  border-width: 1px;
}

.fv-card.fv-selected {
  background: #141413;
  color: #fff;
}

.fv-card-name {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  overflow-wrap: break-word;
}

.fv-card-line {
  display: block;
}

.fv-village li.fv-card {
  border-width: 1px;
}

.fv-actions {
  margin: var(--space-2) 0;
  text-align: center;
}

.fv-actions button {
  margin: 0 var(--space-1) var(--space-1) 0;
}

.fv-score-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.fv-score-table {
  border-collapse: collapse;
  font-size: 0.82rem;
  width: 100%;
}

.fv-score-table th,
.fv-score-table td {
  border: 1px solid var(--border);
  padding: 0.15rem 0.3rem;
  text-align: center;
}

.fv-score-table th[scope="row"] {
  text-align: start;
}

.fv-score-count {
  display: block;
  font-weight: 400;
  font-size: 0.85em;
}

.fv-log {
  text-align: start;
  margin: 0;
  padding-inline-start: 1.4rem;
  font-size: 0.85rem;
}

/* Narrow screens: forest 2 per row, cards one per row. */
@media (max-width: 520px) {
  .fv-field {
    width: 49%;
  }
  .fv-field:nth-child(2n) {
    margin-right: 0;
  }
  .fv-cards > li,
  li.fv-card {
    width: 100%;
    margin-right: 0;
  }
  .fv-score-table {
    font-size: 0.68rem;
  }
  .fv-score-table th,
  .fv-score-table td {
    padding: 0.1rem;
  }
}

/* Adventure Book (adventurebook-app.js): creating a hero (classes as
   framed radio choices, values with - and + buttons), the room (text,
   what happened, choices as full-width buttons), fight box, map (SVG),
   backpack list, hero values and log. Margins instead of `gap`. */
.ab-create,
.ab-play {
  text-align: start;
}

.ab-heading {
  text-align: start;
  font-size: 1rem;
  margin: var(--space-3) 0 var(--space-1);
}

.ab-name-row input {
  max-width: 14rem;
  font-size: 1rem;
}

.ab-fieldset {
  border: none;
  margin: var(--space-2) 0;
  padding: 0;
}

.ab-fieldset legend {
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.ab-class {
  display: block;
  margin: 0 0 var(--space-1);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.ab-class.ab-chosen {
  border-width: 3px;
}

.ab-class-name {
  font-weight: 700;
}

.ab-class-desc {
  display: block;
  font-size: 0.85rem;
}

.ab-points {
  font-weight: 700;
  margin: var(--space-2) 0 var(--space-1);
}

.ab-stat-row {
  display: flex;
  align-items: center;
  margin: 0 0 var(--space-1);
}

.ab-stat-name {
  flex: 1 1 auto;
}

.ab-stat-btn {
  min-width: 2.75rem;
  margin-inline-start: var(--space-1);
  font-weight: 700;
}

.ab-create-msg:empty,
.ab-goal:empty,
.ab-event:empty,
.ab-result:empty {
  display: none;
}

.ab-create-msg {
  font-weight: 700;
}

.ab-goal {
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-1) var(--space-2);
  font-size: 0.9rem;
}

.ab-room-text {
  font-size: 1.05rem;
  line-height: 1.4;
  margin: var(--space-1) 0;
}

.ab-event {
  font-weight: 700;
  margin: var(--space-1) 0;
}

.ab-fight {
  border: 3px double var(--border);
  border-radius: var(--radius);
  padding: var(--space-2);
  margin: var(--space-2) 0;
}

.ab-result {
  border-inline-start: 3px solid var(--border);
  padding-inline-start: var(--space-2);
  margin: var(--space-2) 0;
  font-size: 0.9rem;
}

.ab-result p {
  margin: 0 0 0.2rem;
}

.ab-choices {
  margin: var(--space-2) 0;
}

.ab-choice {
  display: block;
  width: 100%;
  margin: 0 0 var(--space-1);
  text-align: start;
}

.ab-actions {
  margin: var(--space-2) 0;
  text-align: center;
}

.ab-actions button {
  margin: 0 var(--space-1) var(--space-1) 0;
}

.ab-panel {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--space-2);
  margin: var(--space-2) 0;
}

.ab-map-svg {
  display: block;
  width: 100%;
  max-width: 330px;
  height: auto;
  margin: 0 auto;
}

.ab-legend,
.ab-compass {
  font-size: 0.85rem;
  margin: var(--space-1) 0 0;
}

.ab-pack-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ab-pack-list li {
  margin: 0 0 var(--space-2);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--border);
}

.ab-fx {
  display: block;
  font-size: 0.85rem;
}

.ab-pack-btns button {
  margin: var(--space-1) var(--space-1) 0 0;
}

.ab-hero {
  border-top: 2px solid var(--border);
  padding-top: var(--space-2);
  margin-top: var(--space-3);
  font-size: 0.9rem;
  line-height: 1.5;
}

.ab-hp {
  font-weight: 700;
}

.ab-log {
  margin: 0;
  padding-inline-start: 1.4rem;
  font-size: 0.85rem;
}

/* Short home page (home-app.js): compact game entries (symbol, name,
   Play, star) in two or three columns, the category tiles and the page
   navigation of the category pages and games.html (game-categories.js).
   Margins instead of `gap` for the flex rows (older e-ink browsers). */
.home-hero-short {
  padding: var(--space-3) var(--space-4);
}

.home-hero-short .home-tagline {
  margin: 0;
}

.home-hero-short .home-hero-actions > * {
  margin-top: var(--space-2);
}

.game-compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.game-select-item.game-compact {
  padding: var(--space-2);
  padding-right: 2rem;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}

.game-compact .game-select-title {
  flex: 1 1 100%;
  margin: 0 0 var(--space-1);
  font-size: 0.95rem;
}

.game-compact-play {
  display: inline-block;
}

.category-tiles {
  display: flex;
  flex-wrap: wrap;
  margin: var(--space-2) 0 0;
}

.category-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 23.5%;
  min-height: 5.5rem;
  margin: 0 2% var(--space-2) 0;
  padding: var(--space-2) var(--space-1);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-align: center;
  text-decoration: none;
  line-height: 1.2;
}

.category-tile:nth-child(4n) {
  margin-right: 0;
}

.category-tile-name {
  font-weight: 700;
  font-size: 0.85rem;
  margin-top: var(--space-1);
  overflow-wrap: anywhere;
}

.category-tile-count {
  font-size: 0.8rem;
}

.about-back-top {
  margin-top: 0;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--space-3) 0 var(--space-1);
}

.pager-btn {
  min-width: 6.5rem;
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-3);
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
}

.pager-off {
  visibility: hidden;
}

.pager-now {
  flex: 1 1 auto;
  text-align: center;
  font-weight: 700;
  margin: 0 var(--space-2);
}

@media (max-width: 520px) {
  .category-tile {
    width: 49%;
  }
  .category-tile:nth-child(2n) {
    margin-right: 0;
  }
  .category-tile:nth-child(4n) {
    margin-right: 0;
  }
  .category-tile:nth-child(odd) {
    margin-right: 2%;
  }
  .pager-btn {
    min-width: 5rem;
    padding: var(--space-2);
  }
}

/* The three home sections stay compact, so the page fits on one e-reader
   screen without started games or favorites. */
#section-continue,
#section-favorites,
#section-categories {
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

#section-continue h2,
#section-favorites h2,
#section-categories h2 {
  margin: 0 0 var(--space-1);
  font-size: 1.15rem;
}

#section-favorites .section-empty-state {
  padding: 0;
  margin: 0;
}

#section-categories .section-more-link {
  margin: 0;
}

.category-tile {
  min-height: 4.6rem;
}

.pager-btn {
  white-space: nowrap;
}

@media (max-width: 520px) {
  .pager-btn {
    min-width: 0;
    font-size: 0.9rem;
    padding: var(--space-2) var(--space-2);
  }
  .pager-now {
    font-size: 0.9rem;
    margin: 0 var(--space-1);
  }
}

/* Card Duel pictures (cardduel-art.js): the hand as a grid of cards with
   the picture on top (three per row, two on a narrow screen), small
   pictures on the creatures, the mage portraits, and the large view of a
   card ("Look"). Black and white; the frame pattern shows the element. */
.cd-hand {
  display: flex;
  flex-wrap: wrap;
}

.cd-hand li {
  width: 32%;
  margin: 0 2% var(--space-2) 0;
}

.cd-hand li:nth-child(3n) {
  margin-right: 0;
}

.cd-hand .cd-card {
  position: relative;
  height: 100%;
  padding: var(--space-1);
  font-size: 0.85rem;
  line-height: 1.25;
}

/* The cost sits in the top corner of the picture, so long names such as
   "Glutsalamander" get the whole width and may wrap. */
.cd-hand .cd-cost {
  position: absolute;
  top: 0.1rem;
  right: 0.1rem;
  min-width: 1.6rem;
  background: #fff;
}

[dir="rtl"] .cd-hand .cd-cost {
  right: auto;
  left: 0.1rem;
}

.cd-hand .cd-selected .cd-cost {
  background: #141413;
}

.cd-hand .cd-card-top > * {
  min-width: 0;
}

/* The frame of the picture already shows the element. */
.cd-hand .cd-card-top .cd-emblem {
  display: none;
}

.cd-hand .cd-card-name {
  font-size: 0.95rem;
  overflow-wrap: break-word;
}

.cda-pic {
  display: block;
  width: 100%;
  height: auto;
}

.cd-card-pic {
  margin-bottom: var(--space-1);
}

.cd-hand .cd-card-text {
  font-size: 0.8rem;
}

.cd-creature-pic {
  width: 100%;
  max-width: 6.5rem;
  margin: 0 auto 0.15rem;
}

.cd-mage-portrait {
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
}

.cd-viewer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  background: #fff;
  overflow-y: auto;
}

.cd-viewer.hidden {
  display: none;
}

.cd-viewer-card {
  width: 100%;
  max-width: 24rem;
  text-align: start;
  border: 3px solid var(--border);
}

.cd-view-pic {
  margin-bottom: var(--space-2);
}

.cd-view-name {
  font-size: 1.3rem;
  margin: 0 0 var(--space-1);
}

.cd-view-line,
.cd-view-stats {
  margin: 0 0 var(--space-1);
}

.cd-view-stats {
  font-size: 1.15rem;
  font-weight: 700;
}

#cd-viewer-close {
  margin-top: var(--space-2);
}

@media (max-width: 520px) {
  .cd-hand li {
    width: 49%;
    margin-right: 2%;
  }
  .cd-hand li:nth-child(3n) {
    margin-right: 2%;
  }
  .cd-hand li:nth-child(2n) {
    margin-right: 0;
  }
  .cd-hand .cd-card-name {
    font-size: 0.8rem;
  }
  .cd-hand .cd-card-pic {
    max-width: 7rem;
    margin: 0 auto var(--space-1);
  }
  .cd-creature-pic {
    max-width: 5.5rem;
  }
}

/* Loosen the Rings (loosen-app.js): the rings as one picture, a round
   tap button over the middle of every ring; the chosen ring has a dashed
   circle inside, the hinted one a thicker one. */
.lr-board {
  position: relative;
  width: 100%;
  margin: 0.4rem auto 0.6rem;
}

.lr-svg {
  display: block;
  width: 100%;
  height: auto;
}

.lr-ring-btn {
  position: absolute;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.lr-ring-btn:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.lr-num {
  font: bold 20px sans-serif;
  fill: #141413;
}

.lr-sel {
  fill: none;
  stroke: #141413;
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.lr-hint {
  fill: none;
  stroke: #141413;
  stroke-width: 4;
  stroke-dasharray: 6 4;
}

/* Cat Places (catplaces-app.js): uses the Pentomino board layout
   (.pt-board, .pt-cells); cats that break a rule get a dashed frame. */
.kz-conflict {
  fill: none;
  stroke: #141413;
  stroke-width: 2.5;
  stroke-dasharray: 5 3;
}

/* Arrows (arrows-app.js): uses the Pentomino board layout (.pt-board,
   .pt-cells); the arrow in the way of a tapped one gets a dotted frame. */
/* 11 x 11 on a narrow screen: the field reaches the card's edges so each
   square stays as large as possible (an arrow takes taps on all its
   squares). */
@media (max-width: 480px) {
  .pt-board.aw-board-large {
    width: calc(100% + 24px);
    margin-left: -12px;
    margin-right: -12px;
  }
}

/* Master: the hearts left, as large symbols under the info line. */
.aw-hearts {
  text-align: center;
  font-size: 1.6rem;
  letter-spacing: 0.3rem;
  line-height: 1.2;
}

.aw-blocker {
  fill: none;
  stroke: #141413;
  stroke-width: 3;
  stroke-dasharray: 2 3;
}

/* Turn the Rings (rings-app.js): the rings as one round picture, under it
   one row per ring (outermost first) with its number and two large turn
   buttons. */
.rg-board {
  width: 100%;
  max-width: 24rem;
  margin: 0.4rem auto 0.6rem;
}

.rg-svg {
  display: block;
  width: 100%;
  height: auto;
}

.rg-turns {
  max-width: 24rem;
  margin: 0 auto 0.5rem;
}

.rg-turn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.35rem;
}

.rg-turn-label {
  min-width: 4.5rem;
  font-weight: 700;
  text-align: end;
  margin-inline-end: 0.6rem;
}

.rg-turn {
  min-width: 3.4rem;
  min-height: 2.8rem;
  font-size: 1.4rem;
  margin: 0 0.3rem;
}

/* Matchstick Puzzles (matches-app.js): the task as a sentence, the
   matches as a drawing with an invisible button over every place a match
   can lie; the match in hand leaves a dashed frame at its old place. */
.mt-task {
  font-weight: 700;
  text-align: center;
  margin: 0.3rem 0 0.2rem;
}

.mt-board {
  position: relative;
  width: 100%;
  margin: 0.4rem auto 0.6rem;
}

.mt-slot {
  position: absolute;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.mt-slot:focus-visible {
  outline: 3px solid var(--text);
}

.mt-held {
  fill: none;
  stroke: #141413;
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

/* Tangram (tangram-app.js): the outline as a dotted area with a thick
   border, laid pieces with their own black-and-white patterns; the piece
   in hand is shown next to the turn and flip buttons. */
.tg-board {
  cursor: pointer;
}

.tg-current svg {
  display: block;
  width: 3.6rem;
  height: 3.6rem;
}

/* Spot the Difference, mode "Picture search": the drawings to find as
   small pictures (found ones are crossed out), the room's name, then one
   large picture of the room. */
.df-search-pic {
  max-width: 600px;
  margin: 0 auto 0.5rem;
}

.df-room-name {
  text-align: center;
  margin: 0 0 0.3rem;
}

.df-room-name:empty {
  display: none;
}

.df-targets-label {
  text-align: center;
  font-weight: 700;
  margin: 0.2rem 0;
}

.df-targets {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0 0 0.5rem;
  padding: 0;
}

.df-target {
  width: 3.4rem;
  height: 3.4rem;
  margin: 0 0.25rem 0.4rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.df-target svg {
  display: block;
  width: 100%;
  height: 100%;
}

.df-target-found {
  border-style: dashed;
}

.rg-turn.hint-cell {
  border: 4px dashed var(--border);
}
