/* Sudoku "Detektiv-Notizbuch" (AP3-32, AP3-33). Loaded only by the game document, after styles.css: the colours are the
   game's own tokens per theme (concept, table "Farben"), built on the site tokens; layouts follow the width of the game
   document (sudoku/E-18: wide from 720px, narrow below). Every movement sits in the no-preference block at the end; the
   notebook, the threads and the help card of AP3-33 add none. */

:root {
  --sudoku-feld: #ffffff;
  --sudoku-nachbar: #f2f7fc;
  --sudoku-gleich: #dbeaf7;
  --sudoku-auswahl: #cde4f6;
  --sudoku-eingetragen: #2f6f9f;
  --sudoku-moeglich: #146b3a;
  --sudoku-aus: #b3261e;
  --sudoku-aus-grund: #fde3df;
  --sudoku-fokus: var(--navy);
  --sudoku-linie-stark: var(--navy);
  --sudoku-linie: #d5e0ea;
  --sudoku-auf-farbe: #ffffff;
  --sudoku-schatten: 0 12px 32px rgba(29, 47, 62, 0.18);
  --sudoku-abdunkeln: rgba(15, 27, 37, 0.45);
  --sudoku-bereich: #fff1c2;
  --sudoku-neu: #e3f3e8;
  --sudoku-etikett-belegt: #2b4a63;
  --sudoku-etikett-belegt-grund: #eef3f8;
  --sudoku-etikett-eigen: #6a4a1c;
  --sudoku-etikett-eigen-grund: #f6efe4;
  --sudoku-etikett-widerspruch: #9e1f17;
  --sudoku-etikett-widerspruch-grund: #fdecea;
  --sudoku-etikett-aufgeraeumt: #44525d;
  --sudoku-etikett-aufgeraeumt-grund: #edf0f3;
}

[data-theme="dark"] {
  --sudoku-feld: #14232e;
  --sudoku-nachbar: #172a38;
  --sudoku-gleich: #1b3346;
  --sudoku-auswahl: #1f3a50;
  --sudoku-eingetragen: var(--accent-solid);
  --sudoku-moeglich: #7fd6a0;
  --sudoku-aus: #ff9b8f;
  --sudoku-aus-grund: #3a1c1c;
  --sudoku-fokus: var(--accent-solid);
  --sudoku-linie-stark: var(--accent-solid);
  --sudoku-linie: rgba(215, 235, 250, 0.18);
  --sudoku-auf-farbe: var(--paper);
  --sudoku-schatten: 0 12px 32px rgba(0, 0, 0, 0.5);
  --sudoku-abdunkeln: rgba(0, 0, 0, 0.6);
  --sudoku-bereich: #3a3214;
  --sudoku-neu: #173a27;
  --sudoku-etikett-belegt: #b9d7ee;
  --sudoku-etikett-belegt-grund: #1b3346;
  --sudoku-etikett-eigen: #f0d3a6;
  --sudoku-etikett-eigen-grund: #3a2c16;
  --sudoku-etikett-widerspruch: #ffb4aa;
  --sudoku-etikett-widerspruch-grund: #3a1c1c;
  --sudoku-etikett-aufgeraeumt: #c9d3db;
  --sudoku-etikett-aufgeraeumt-grund: #23313c;
}

/* The game document has a calm, solid ground instead of the layered page background of styles.css. */
.sudoku-body {
  min-height: 100dvh;
  background: var(--paper);
  font-size: 16px;
  line-height: 1.5;
}

.sudoku-body::before,
.sudoku-body::after {
  content: none;
}

.sudoku-body p {
  margin: 0;
  line-height: 1.5;
}

.sudoku-unsichtbar {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sudoku {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px;
}

.sudoku-seite {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.sudoku-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sudoku-kopf-text {
  min-width: 0;
}

.sudoku-augenbraue {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sudoku-titel,
.sudoku-blatt-titel {
  margin: 0;
  font-family: "Newsreader", serif;
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
}

.sudoku-titel {
  font-size: 22px;
}

.sudoku-blatt-titel {
  font-size: 1.3rem;
}

.sudoku-einleitung,
.sudoku-info,
.sudoku-speicherzeile,
.sudoku-tipp,
.sudoku-speichertext {
  text-wrap: pretty;
}

.sudoku-info {
  color: var(--muted);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.sudoku-speicher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.sudoku-speicherzeile {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.sudoku-symbol {
  flex: none;
  width: 18px;
  height: 18px;
}

/* Buttons: borders in --sudoku-linie-stark, which stays above 3:1 against the ground in both themes. */
.sudoku-knopf,
.sudoku-spielknopf,
.sudoku-schliessen,
.sudoku-notizziffer,
.sudoku-loeschen,
.sudoku-modusknopf,
.sudoku-ziffer,
.sudoku-streifen-knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--sudoku-linie-stark);
  border-radius: 5px;
  background: var(--sudoku-feld);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.sudoku-knopf:focus-visible,
.sudoku-spielknopf:focus-visible,
.sudoku-schliessen:focus-visible,
.sudoku-notizziffer:focus-visible,
.sudoku-loeschen:focus-visible,
.sudoku-modusknopf:focus-visible,
.sudoku-ziffer:focus-visible,
.sudoku-streifen-knopf:focus-visible,
.sudoku-schalter input:focus-visible {
  outline: 3px solid var(--sudoku-fokus);
  outline-offset: 2px;
}

.sudoku-knopf[aria-pressed="true"],
.sudoku-knopf--haupt {
  background: var(--accent-solid);
  color: var(--sudoku-auf-farbe);
}

.sudoku-knopf--warnung {
  border-color: var(--sudoku-aus);
  background: var(--sudoku-aus);
  color: var(--sudoku-auf-farbe);
}

.sudoku-knopf--gross {
  min-height: 52px;
}

.sudoku-knopf[aria-disabled="true"] {
  border-style: dashed;
  color: var(--muted);
  cursor: default;
}

/* "Tipp" below the board (sudoku/E-33): filled in the strong line colour; after the solution it is off (sudoku/E-22). */
.sudoku-knopf--tipp {
  background: var(--sudoku-linie-stark);
  color: var(--sudoku-auf-farbe);
}

.sudoku-knopf--tipp[aria-disabled="true"] {
  background: var(--sudoku-feld);
  color: var(--muted);
}

.sudoku-spielknopf {
  flex: none;
  padding: 0 10px 0 14px;
}

.sudoku-schliessen {
  flex: none;
  width: 44px;
  padding: 0;
}

.sudoku-stufen {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sudoku-stufen .sudoku-knopf {
  flex: 1 1 auto;
}

.sudoku-stufen--raster {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* The board: a grid of nine rows of nine cells, square, with its size set per layout below. */
.sudoku-spielfeld {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.sudoku-brett {
  display: grid;
  grid-template-rows: repeat(9, minmax(0, 1fr));
  width: min(100%, 582px);
  aspect-ratio: 1;
  container-type: inline-size;
  border: 3px solid var(--sudoku-linie-stark);
  border-radius: 5px;
  overflow: hidden;
  background: var(--sudoku-feld);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* The board is the containing block of its layer of threads and the area frame (.sudoku-ebene). */
.sudoku-brett {
  position: relative;
}

.sudoku-zeile {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  min-height: 0;
}

.sudoku-feld {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--sudoku-linie);
  border-bottom: 1px solid var(--sudoku-linie);
  background: var(--sudoku-feld);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

.sudoku-feld:nth-child(3n) {
  border-right: 2px solid var(--sudoku-linie-stark);
}

.sudoku-feld:last-child {
  border-right: 0;
}

.sudoku-zeile:nth-child(3n) > .sudoku-feld {
  border-bottom: 2px solid var(--sudoku-linie-stark);
}

/* The ninth row by its number, not :last-child: the layer (.sudoku-ebene) is the board's last child. */
.sudoku-zeile:nth-child(9) > .sudoku-feld {
  border-bottom: 0;
}

.sudoku-feld.ist-nachbar {
  background: var(--sudoku-nachbar);
}

.sudoku-feld.ist-gleich {
  background: var(--sudoku-gleich);
}

/* Marks of the tip (AP3-33, "Reihenfolge der Feldmarken"): each later rule wins over the one before it, from the area
   over the selection and the target to the cell the tip just filled. Target and new carry a ring, so no state is colour
   alone. */
.sudoku-feld.ist-bereich {
  background: var(--sudoku-bereich);
}

.sudoku-feld.ist-auswahl {
  background: var(--sudoku-auswahl);
}

.sudoku-feld.ist-ziel {
  background: var(--sudoku-gleich);
  box-shadow: inset 0 0 0 3px var(--sudoku-eingetragen);
}

.sudoku-feld.ist-ziel.ist-ziel-fehler {
  background: var(--sudoku-aus-grund);
  box-shadow: inset 0 0 0 3px var(--sudoku-aus);
}

.sudoku-feld.ist-neu {
  background: var(--sudoku-neu);
  box-shadow: inset 0 0 0 3px var(--sudoku-moeglich);
}

.sudoku-feld:focus {
  outline: none;
}

.sudoku-feld:focus-visible {
  outline: 3px solid var(--sudoku-fokus);
  outline-offset: -3px;
}

/* On a cell with a ring of its own the focus ring lies inside it, so both stay visible. */
.sudoku-feld.ist-ziel:focus-visible,
.sudoku-feld.ist-neu:focus-visible {
  outline-offset: -6px;
}

.sudoku-wert {
  font-size: clamp(24px, 5.5cqi, 32px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sudoku-feld.ist-vorgabe .sudoku-wert {
  font-weight: 700;
}

.sudoku-feld.ist-eingetragen .sudoku-wert {
  color: var(--sudoku-eingetragen);
  font-weight: 600;
}

.sudoku-feld.ist-neu .sudoku-wert {
  color: var(--sudoku-moeglich);
  font-weight: 700;
}

.sudoku-notizen {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  width: 100%;
  height: 100%;
  padding: 1px;
}

.sudoku-notiz {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  font-size: clamp(10px, 2.2cqi, 15px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sudoku-notiz::before {
  content: attr(data-sudoku-ziffer);
}

.sudoku-notiz.ist-moeglich,
.sudoku-probe--moeglich,
.sudoku-probe--widerspruch {
  color: var(--sudoku-moeglich);
  font-weight: 700;
}

.sudoku-notiz.ist-aus,
.sudoku-probe--aus {
  border-radius: 3px;
  background: var(--sudoku-aus-grund);
  color: var(--sudoku-aus);
  font-weight: 600;
  text-decoration: line-through 2px;
}

.sudoku-notiz.ist-widerspruch,
.sudoku-probe--widerspruch {
  text-decoration: underline wavy var(--sudoku-aus);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

/* Progress ring of a long press (concept, "Schmales Layout"); it grows only in the motion block. */
.sudoku-feld.ist-druck::after {
  content: "";
  position: absolute;
  inset: 12%;
  border: 3px solid var(--sudoku-fokus);
  border-radius: 50%;
  pointer-events: none;
}

/* The layer over the board (AP3-33): threads and the area frame, decoration only (aria-hidden), placed in cells: the
   SVG draws in a viewBox of 9 × 9, the frame and the labels sit at percentages, so nothing is measured. */
.sudoku-ebene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.sudoku-faeden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.sudoku-faden line,
.sudoku-faden circle {
  fill: none;
  stroke: var(--sudoku-aus);
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
}

.sudoku-faden[data-sudoku-faden-art="ausschluss"] line {
  stroke-dasharray: 6 4;
}

.sudoku-fadenetikett,
.sudoku-bereichsetikett {
  position: absolute;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--sudoku-feld);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.sudoku-fadenetikett {
  border: 1px solid var(--sudoku-aus);
  color: var(--sudoku-aus);
  transform: translate(-50%, -50%);
}

.sudoku-bereichsrahmen {
  position: absolute;
  border: 2px dashed var(--sudoku-linie-stark);
  border-radius: 3px;
}

.sudoku-bereichsetikett {
  left: 4px;
  border: 1px solid var(--sudoku-linie-stark);
  color: var(--ink);
}

.sudoku-bereichsrahmen[data-sudoku-etikett-lage="oben"] .sudoku-bereichsetikett {
  top: 0;
  transform: translateY(-50%);
}

.sudoku-bereichsrahmen[data-sudoku-etikett-lage="unten"] .sudoku-bereichsetikett {
  bottom: 0;
  transform: translateY(50%);
}

.sudoku-bereichsrahmen[data-sudoku-etikett-lage="innen"] .sudoku-bereichsetikett {
  top: 2px;
}

.sudoku-unter-brett {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.sudoku-unter-brett-knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sudoku-bereich-legende {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.sudoku-probe--bereich {
  width: 1.6em;
  height: 1.2em;
  border: 2px dashed var(--sudoku-linie-stark);
  border-radius: 3px;
  background: var(--sudoku-bereich);
}

.sudoku-legende {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.sudoku-probe {
  display: inline-block;
  min-width: 1.4em;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* Narrow controls: reason strip, button row, mode choice and digit bar (concept, "Schmales Layout"). */
.sudoku-bedienung {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sudoku-streifen {
  min-height: 56px;
}

.sudoku-streifen-text,
.sudoku-streifen-knopf {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  width: 100%;
  min-height: 56px;
  padding: 6px 12px;
  border-radius: 5px;
  text-align: start;
}

.sudoku-streifen-text {
  border: 1px solid var(--sudoku-linie);
  background: var(--sudoku-feld);
}

.sudoku-streifen-titel {
  font-family: "Newsreader", serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.sudoku-streifen-zeile {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.sudoku-knopfreihe {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 8px;
}

.sudoku-knopfreihe .sudoku-knopf {
  padding: 0 6px;
}

.sudoku-knopf--notizbuch {
  position: relative;
}

/* The count of the notebook; the name of its button says the number (sudoku/E-11). */
.sudoku-plakette {
  position: absolute;
  top: -8px;
  right: -4px;
  min-width: 22px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--sudoku-linie-stark);
  color: var(--sudoku-auf-farbe);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

.sudoku-modus {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.sudoku-modusknopf {
  padding: 0 6px;
}

.sudoku-modusknopf[aria-pressed="true"] {
  background: var(--accent-solid);
  color: var(--sudoku-auf-farbe);
}

.sudoku-modusknopf[data-sudoku-art="g"] {
  border-color: var(--sudoku-moeglich);
}

.sudoku-modusknopf[data-sudoku-art="g"][aria-pressed="true"] {
  background: var(--sudoku-moeglich);
}

.sudoku-modusknopf[data-sudoku-art="r"] {
  border-color: var(--sudoku-aus);
}

.sudoku-modusknopf[data-sudoku-art="r"][aria-pressed="true"] {
  background: var(--sudoku-aus);
}

.sudoku-ziffern {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 4px;
}

.sudoku-ziffer {
  flex-direction: column;
  gap: 0;
  min-height: 56px;
  padding: 0;
  color: var(--sudoku-eingetragen);
  font-size: 1.4rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.sudoku-ziffern[data-sudoku-art="g"] .sudoku-ziffer {
  border-color: var(--sudoku-moeglich);
  color: var(--sudoku-moeglich);
}

.sudoku-ziffern[data-sudoku-art="r"] .sudoku-ziffer {
  border-color: var(--sudoku-aus);
  color: var(--sudoku-aus);
}

.sudoku-rest {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.sudoku-rest::before {
  content: attr(data-sudoku-rest);
}

/* Pale bar: no cell, a given, or a note mode on a filled cell. Text keeps its contrast; the border turns dashed. */
.sudoku-ziffern[data-sudoku-blass] .sudoku-ziffer {
  border-style: dashed;
  border-color: var(--sudoku-linie-stark);
  color: var(--muted);
  cursor: default;
}

.sudoku-tipp {
  min-height: 1.5em;
  color: var(--muted);
  font-size: 0.95rem;
}

/* "Deine Begründungen" (AP3-33): counters, the hint "neueste zuerst" and up to twelve entries; a section of the wide side
   column and the same content in the notebook sheet of the narrow layout. */
.sudoku-buch {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--sudoku-linie);
  border-radius: 5px;
  background: var(--sudoku-feld);
}

.sudoku-buch-titel {
  margin: 0;
  font-family: "Newsreader", serif;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
}

.sudoku-zaehler {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 8px 0 0;
}

.sudoku-zaehler > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.sudoku-zaehler dd {
  order: -1;
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sudoku-body .sudoku-buch-hinweis,
.sudoku-body .sudoku-buch-leer {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.sudoku-eintraege,
.sudoku-gruende {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.sudoku-eintrag {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  width: 100%;
  padding: 8px 4px;
  border: 0;
  border-bottom: 1px solid var(--sudoku-linie);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
  touch-action: manipulation;
}

.sudoku-eintrag:focus-visible {
  outline: 3px solid var(--sudoku-fokus);
  outline-offset: 2px;
}

.sudoku-eintrag-ziffer {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sudoku-eintrag-ziffer[data-sudoku-art="r"] {
  background: var(--sudoku-aus-grund);
  color: var(--sudoku-aus);
  text-decoration: line-through 2px;
}

.sudoku-eintrag-ziffer[data-sudoku-art="g"] {
  border: 2px solid var(--sudoku-aus);
  color: var(--sudoku-moeglich);
}

.sudoku-eintrag-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-weight: 700;
}

.sudoku-eintrag-text,
.sudoku-grund-text {
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.sudoku-etikett {
  display: inline-block;
  padding: 0 6px;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.6;
}

.sudoku-etikett[data-sudoku-kategorie="belegt"] {
  background: var(--sudoku-etikett-belegt-grund);
  color: var(--sudoku-etikett-belegt);
}

.sudoku-etikett[data-sudoku-kategorie="eigen"] {
  background: var(--sudoku-etikett-eigen-grund);
  color: var(--sudoku-etikett-eigen);
}

.sudoku-etikett[data-sudoku-kategorie="widerspruch"] {
  background: var(--sudoku-etikett-widerspruch-grund);
  color: var(--sudoku-etikett-widerspruch);
}

.sudoku-etikett[data-sudoku-kategorie="aufgeraeumt"] {
  background: var(--sudoku-etikett-aufgeraeumt-grund);
  color: var(--sudoku-etikett-aufgeraeumt);
}

.sudoku-grund {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--sudoku-linie);
}

/* "Warum?" in the note sheet and the reason strip (AP3-33). */
.sudoku-warum {
  margin-top: 14px;
}

.sudoku-warum-titel {
  margin: 0;
  font-family: "Newsreader", serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.sudoku-body .sudoku-warum-leer {
  margin-top: 4px;
  color: var(--muted);
}

.sudoku-warum-marke {
  color: var(--ink);
  font-weight: 700;
}

/* The one help card (AP3-33, part D): large text for older players. Narrow sizes here, wide ones in the wide block. The
   art "tipp" has the strong line as its frame, "geschafft" and "frei" the green one. */
.sudoku-karte {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 2px solid var(--sudoku-linie-stark);
  border-radius: 5px;
  background: var(--sudoku-feld);
  color: var(--ink);
  box-shadow: var(--sudoku-schatten);
}

.sudoku-karte[data-sudoku-art="geschafft"],
.sudoku-karte[data-sudoku-art="frei"] {
  border-color: var(--sudoku-moeglich);
}

.sudoku-karte-titel {
  margin: 0;
  font-family: "Newsreader", serif;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
}

.sudoku-karte-balken {
  display: flex;
  gap: 6px;
}

.sudoku-karte-balken > span {
  flex: 1 1 0;
  height: 6px;
  border-radius: 3px;
  background: var(--sudoku-linie);
}

.sudoku-karte-balken > span.ist-voll {
  background: var(--sudoku-linie-stark);
}

.sudoku-karte .sudoku-karte-text,
.sudoku-body .sudoku-ruhig {
  font-size: 17px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.sudoku-karte-knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sudoku-karte-knoepfe .sudoku-knopf {
  flex: 1 1 auto;
  min-height: 48px;
  padding: 6px 14px;
  font-size: 17px;
  line-height: 1.3;
  text-align: center;
}

/* Note rows of menu and sheet: three groups of nine toggle buttons. */
.sudoku-notizgruppe {
  margin-top: 10px;
}

.sudoku-notizgruppe-name {
  margin-bottom: 4px;
  font-size: 0.9rem;
  font-weight: 700;
}

.sudoku-notizreihe {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 3px;
}

.sudoku-notizziffer {
  min-height: 34px;
  padding: 0;
  border-width: 1px;
  font-variant-numeric: tabular-nums;
}

.sudoku-notizziffer--wert {
  color: var(--sudoku-eingetragen);
}

.sudoku-notizziffer--moeglich {
  border-color: var(--sudoku-moeglich);
  color: var(--sudoku-moeglich);
}

.sudoku-notizziffer--aus {
  border-color: var(--sudoku-aus);
  color: var(--sudoku-aus);
}

.sudoku-notizziffer--wert[aria-pressed="true"] {
  background: var(--accent-solid);
  color: var(--sudoku-auf-farbe);
}

.sudoku-notizziffer--moeglich[aria-pressed="true"] {
  background: var(--sudoku-moeglich);
  color: var(--sudoku-auf-farbe);
}

.sudoku-notizziffer--aus[aria-pressed="true"] {
  background: var(--sudoku-aus);
  color: var(--sudoku-auf-farbe);
  text-decoration: line-through 2px;
}

.sudoku-loeschen {
  width: 100%;
  margin-top: 12px;
}

.sudoku-schalter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 8px;
  cursor: pointer;
}

.sudoku-schalter input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent-solid);
}

/* Dialogs: the non-modal note menu beside the cell, sheets from below, and centred dialogs (sudoku/E-20). */
.sudoku-notizmenue,
.sudoku-blatt,
.sudoku-dialog {
  border: 2px solid var(--sudoku-linie-stark);
  border-radius: 5px;
  background: var(--sudoku-feld);
  color: var(--ink);
  box-shadow: var(--sudoku-schatten);
}

.sudoku-notizmenue {
  position: absolute;
  inset: auto;
  z-index: 2;
  width: min(340px, calc(100vw - 16px));
  margin: 0;
  padding: 10px 12px 12px;
}

.sudoku-blatt-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sudoku-notizmenue-titel {
  font-family: "Newsreader", serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.sudoku-blatt {
  position: fixed;
  inset: auto 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 80dvh;
  margin: 0 auto;
  padding: 6px 16px 20px;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  overflow-y: auto;
}

.sudoku-griff {
  display: block;
  width: 44px;
  height: 4px;
  margin: 2px auto 8px;
  border-radius: 2px;
  background: var(--muted);
}

.sudoku-blatt .sudoku-stufen,
.sudoku-blatt > .sudoku-knopf {
  margin-top: 12px;
}

.sudoku-blatt > .sudoku-knopf {
  width: 100%;
}

.sudoku-speichertext {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.sudoku-dialog {
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 20px;
  overflow-y: auto;
}

.sudoku-dialog > * + * {
  margin-top: 10px;
}

.sudoku-blatt::backdrop,
.sudoku-dialog::backdrop {
  background: var(--sudoku-abdunkeln);
}

.sudoku-hinweis {
  color: var(--muted);
}

.sudoku-dialog-knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.sudoku-dialog-knoepfe .sudoku-knopf {
  flex: 1 1 160px;
}

.sudoku-fallakte {
  position: relative;
}

.sudoku-stempel {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 2px 10px;
  border: 3px solid var(--sudoku-aus);
  border-radius: 5px;
  color: var(--sudoku-aus);
  font-family: "Newsreader", serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-8deg);
}

.sudoku-kennzahlen {
  display: grid;
  gap: 4px;
  margin: 12px 0 0;
}

.sudoku-kennzahlen > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
  border-bottom: 1px solid var(--sudoku-linie);
}

.sudoku-kennzahlen dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Wide layout from 720px: board left, side column right (sudoku/E-18). */
@media (min-width: 720px) {
  .sudoku {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr);
    grid-template-rows: auto auto auto 1fr;
    grid-template-areas:
      "feld seite"
      "feld hilfe"
      "feld buch"
      "feld .";
    align-items: start;
    gap: 16px 24px;
    padding: 16px 24px;
  }

  .sudoku-hilfe {
    grid-area: hilfe;
  }

  .sudoku-buch {
    grid-area: buch;
  }

  .sudoku-karte-titel {
    font-size: 27px;
  }

  .sudoku-karte .sudoku-karte-text,
  .sudoku-body .sudoku-ruhig {
    font-size: 19px;
    line-height: 1.5;
  }

  .sudoku-karte[data-sudoku-art="tipp"] .sudoku-karte-text {
    font-size: 20px;
  }

  .sudoku-karte-knoepfe .sudoku-knopf {
    min-height: 52px;
    font-size: 18px;
  }

  .sudoku-seite {
    grid-area: seite;
    gap: 12px;
    padding-top: 4px;
  }

  .sudoku-spielfeld {
    grid-area: feld;
  }

  .sudoku-brett {
    width: max(330px, min(582px, calc(50vw - 24px), calc(100dvh - 104px)));
  }

  .sudoku-titel {
    font-size: 30px;
  }

  .sudoku-nur-schmal {
    display: none;
  }
}

@media (max-width: 719.98px) {
  .sudoku-nur-breit {
    display: none;
  }

  /* Without a card the narrow layout shows the reason strip in its place, and the empty help place takes no gap. */
  .sudoku-hilfe:has(> .sudoku-karte[hidden]) {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes sudoku-menue-ein {
    from {
      opacity: 0;
      transform: translateY(-4px);
    }
  }

  @keyframes sudoku-blatt-ein {
    from {
      transform: translateY(100%);
    }
  }

  @keyframes sudoku-akte-ein {
    from {
      opacity: 0;
      transform: scale(0.96);
    }
  }

  @keyframes sudoku-stempel-ein {
    from {
      opacity: 0;
      transform: rotate(-8deg) scale(1.6);
    }
  }

  @keyframes sudoku-ring {
    from {
      transform: scale(0.2);
    }
  }

  .sudoku-notizmenue[open] {
    animation: sudoku-menue-ein 140ms ease-out;
  }

  .sudoku-blatt[open] {
    animation: sudoku-blatt-ein 200ms ease-out;
  }

  .sudoku-fallakte[open] {
    animation: sudoku-akte-ein 260ms ease-out;
  }

  .sudoku-fallakte[open] .sudoku-stempel {
    animation: sudoku-stempel-ein 420ms ease-out 180ms both;
  }

  .sudoku-feld.ist-druck::after {
    animation: sudoku-ring 450ms linear;
  }

  .sudoku-feld,
  .sudoku-knopf,
  .sudoku-modusknopf,
  .sudoku-ziffer,
  .sudoku-notizziffer {
    transition: background-color 120ms ease-out, color 120ms ease-out;
  }
}
