@font-face {
  font-family: "Zilla Slab";
  src: url("../fonts/zilla-slab-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Zilla Slab";
  src: url("../fonts/zilla-slab-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --seite: #e4ece8;
  --wasser: #d3e2dd;
  --raster: #9fbab3;
  --rahmen: #8aa59e;
  --sand: #f3e4bb;
  --kueste: #8d6b3a;
  --tinte: #1d3442;
  --zahl: #1d3442;
  --tinte-leise: #4c6470;
  --holz: #6b4425;
  --rot: #b23b26;
  --ok-flaeche: #1d3442;
  --ok-text: #f3e4bb;
  --wahl: #2c6f8f;
  --fokus: #2c6f8f;
  --knopf-rand: rgb(29 52 66 / 0.35);
  --knopf-hover: rgb(255 255 255 / 0.45);
  --knopf-voll: #1d3442;
  --knopf-voll-text: #f3e4bb;
  --dialog: #eef3f0;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --seite: #0d1d23;
    --wasser: #11272e;
    --raster: #2c4c55;
    --rahmen: #3a5f69;
    --sand: #d9c595;
    --kueste: #e2c88f;
    --tinte: #e2ece8;
    --zahl: #142a31;
    --tinte-leise: #9fb5b8;
    --holz: #d4a46b;
    --rot: #ff8a6e;
    --ok-flaeche: #4f8f80;
    --ok-text: #f6ecd0;
    --wahl: #8fd0ec;
    --fokus: #8fd0ec;
    --knopf-rand: rgb(226 236 232 / 0.3);
    --knopf-hover: rgb(226 236 232 / 0.08);
    --knopf-voll: #d9c595;
    --knopf-voll-text: #10232a;
    --dialog: #142a31;

    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template:
    "kopf leiste" auto
    "tisch tisch" minmax(0, 1fr)
    "fuss fuss" auto
    / minmax(0, 1fr) auto;
  background: var(--seite);
  color: var(--tinte);
  font: 500 1.0625rem/1.45 "Zilla Slab", Georgia, serif;
  font-variant-numeric: lining-nums;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.kopf {
  grid-area: kopf;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 1.25rem;
  row-gap: 0.1rem;
  min-width: 0;
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem 0.4rem max(1rem, env(safe-area-inset-left));
}

.titel {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
}

.status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.9rem;
  margin: 0;
  color: var(--tinte-leise);
  font-variant-numeric: lining-nums tabular-nums;
}

.status [hidden] {
  display: none;
}

#zeit,
#bestzeit {
  color: var(--tinte);
  font-weight: 700;
}

#zeit {
  display: inline-block;
  min-width: 2.4em;
}

.leiste {
  grid-area: leiste;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
  padding: max(0.6rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.4rem 0;
}

.knopf {
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0 0.9rem;
  border: 1px solid var(--knopf-rand);
  border-radius: 0.45rem;
  background: transparent;
  color: var(--tinte);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.knopf:hover:not(:disabled) {
  background: var(--knopf-hover);
}

.knopf:disabled {
  opacity: 0.4;
  cursor: default;
}

.knopf:focus-visible,
.feld:focus-visible,
.pillen input:focus-visible + span {
  outline: 3px solid var(--fokus);
  outline-offset: 2px;
}

.knopf[hidden] {
  display: none;
}

.knopf-symbol {
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.knopf-symbol svg {
  width: 1.4rem;
  height: 1.4rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.knopf-symbol[aria-pressed="true"] {
  background: var(--knopf-voll);
  color: var(--knopf-voll-text);
}

.knopf-rund {
  border-radius: 50%;
  font-size: 1.3rem;
  line-height: 1;
}

.knopf-voll {
  background: var(--knopf-voll);
  border-color: var(--knopf-voll);
  color: var(--knopf-voll-text);
}

.knopf-voll:hover:not(:disabled) {
  background: var(--knopf-voll);
  filter: brightness(1.12);
}

.knopf.nachfrage {
  border-color: var(--rot);
  color: var(--rot);
}

.tisch {
  grid-area: tisch;
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  padding: 0.25rem max(0.75rem, env(safe-area-inset-right)) 0 max(0.75rem, env(safe-area-inset-left));
}

.karte {
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.karte.gezoomt {
  place-items: start;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.karte.gezoomt > .feld {
  margin: auto;
}

.feld {
  display: block;
  border-radius: 0.35rem;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.feld .wasser {
  fill: var(--wasser);
  stroke: var(--rahmen);
  stroke-width: 0.03;
}

.feld .punkt {
  fill: var(--raster);
}

.feld .luecke {
  fill: transparent;
  cursor: pointer;
}

.feld .bruecke line {
  stroke: var(--holz);
  stroke-linecap: butt;
}

.feld .bruecke .planke {
  stroke-dasharray: 0.075 0.035;
}

.feld .bruecke .holm {
  stroke-width: 0.025;
}

.feld .bruecke.falsch line {
  stroke: var(--rot);
  animation: blinken 0.5s steps(2, jump-none) 4;
}

.feld .bruecke.blinkt line {
  animation: blinken 0.3s steps(2, jump-none) 3;
}

@keyframes blinken {
  50% {
    opacity: 0.15;
  }
}

.feld .vorschau {
  stroke: var(--wahl);
  stroke-width: 0.06;
  stroke-dasharray: 0.12 0.08;
  stroke-linecap: round;
  pointer-events: none;
}

.feld .insel {
  cursor: pointer;
}

.feld .insel .treffer {
  fill: transparent;
}

.feld .insel .kueste {
  fill: none;
  stroke: var(--kueste);
  stroke-width: 0.022;
  opacity: 0.7;
}

.feld .insel .scheibe {
  fill: var(--sand);
  stroke: var(--kueste);
  stroke-width: 0.05;
}

.feld .insel text {
  fill: var(--zahl);
  font-variant-numeric: lining-nums;
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 700;
  font-size: 0.46px;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.feld .insel.erfuellt .scheibe {
  fill: var(--ok-flaeche);
  stroke: var(--ok-flaeche);
}

.feld .insel.erfuellt text {
  fill: var(--ok-text);
}

.feld .insel.zuviel .scheibe {
  stroke: var(--rot);
  stroke-width: 0.075;
}

.feld .insel.zuviel .kueste {
  stroke: var(--rot);
  opacity: 1;
}

.feld .insel.zuviel text {
  fill: var(--rot);
}

.feld .insel .ring {
  fill: none;
  stroke: none;
  stroke-width: 0.06;
}

.feld .insel.gewaehlt .ring,
.feld .insel.ziel .ring {
  stroke: var(--wahl);
}

.feld .insel.ziel .ring {
  stroke-dasharray: 0.1 0.07;
}

.feld:focus-visible .insel.cursor .ring {
  stroke: var(--fokus);
  stroke-dasharray: none;
}

.bau {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--tinte-leise);
  font-style: normal;
  pointer-events: none;
}

.bau[hidden] {
  display: none;
}

.unterzeile {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
  align-items: center;
  gap: 0.5rem;
  min-height: 3.1rem;
  padding: 0.15rem 0;
}

.unterzeile .knopf {
  grid-column: 3;
  grid-row: 1;
}

.tipp {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  color: var(--tinte-leise);
  font-size: 0.95rem;
  text-align: center;
}

.meldung {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: min(20rem, calc(100% - 2rem));
  padding: 1.25rem 1.4rem 1.4rem;
  border: 1px solid var(--rahmen);
  border-radius: 0.6rem;
  background: var(--dialog);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
  text-align: center;
}

.meldung[hidden] {
  display: none;
}

.meldung h2 {
  margin: 0 0 0.4rem;
  font-size: 1.5rem;
}

.meldung p {
  margin: 0 0 1rem;
  color: var(--tinte-leise);
}

.ansage {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.fuss {
  grid-area: fuss;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem max(1rem, env(safe-area-inset-right)) max(0.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  color: var(--tinte-leise);
  font-size: 0.9rem;
}

.teilen {
  margin: -0.45rem 0;
  padding: 0.45rem 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.teilen:focus-visible,
.teilen-feld input:focus-visible {
  outline: 3px solid var(--fokus);
  outline-offset: 2px;
}

.teilen-feld {
  width: min(24rem, calc(100vw - 2rem));
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--rahmen);
  border-radius: 0.6rem;
  background: var(--dialog);
  color: var(--tinte);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
}

.teilen-feld label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--tinte-leise);
}

.teilen-feld input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0 0.6rem;
  border: 1px solid var(--knopf-rand);
  border-radius: 0.45rem;
  background: var(--seite);
  color: var(--tinte);
  font: inherit;
}

.wahl {
  width: min(30rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  padding: 1.1rem 1.25rem 1.25rem;
  border: 1px solid var(--rahmen);
  border-radius: 0.6rem;
  background: var(--dialog);
  color: var(--tinte);
}

.wahl::backdrop,
.anleitung::backdrop {
  background: rgb(10 25 30 / 0.45);
}

.wahl h2 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
}

.wahl h3 {
  margin: 1rem 0 0.4rem;
  font-size: 1.1rem;
}

.wahl-gruppe {
  margin: 0 0 0.9rem;
  padding: 0;
  border: 0;
}

.wahl-gruppe legend {
  margin-bottom: 0.35rem;
  color: var(--tinte-leise);
}

.pillen {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.pillen label {
  display: block;
}

.pillen input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pillen span {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--knopf-rand);
  border-radius: 0.45rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.bestzeiten small {
  font-weight: 500;
}

.pillen small {
  color: var(--tinte-leise);
  font-weight: 500;
  font-size: 0.8rem;
}

.pillen input:checked + span {
  background: var(--knopf-voll);
  border-color: var(--knopf-voll);
  color: var(--knopf-voll-text);
}

.pillen input:checked + span small {
  color: inherit;
  opacity: 0.8;
}

.tasten {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.8rem;
  margin: 0;
}

.tasten dd {
  margin: 0;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.3em;
  border: 1px solid var(--knopf-rand);
  border-radius: 0.25rem;
  font: inherit;
  font-size: 0.9em;
  text-align: center;
}

.bestzeiten table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.bestzeiten th,
.bestzeiten td {
  padding: 0.2rem 0.3rem;
  text-align: center;
}

.bestzeiten th:first-child {
  text-align: left;
}

.bestzeiten thead th {
  color: var(--tinte-leise);
  font-weight: 500;
}

.leise {
  margin: 0.4rem 0 0;
  color: var(--tinte-leise);
  font-size: 0.9rem;
}

.anleitung {
  width: min(34rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  padding: 0;
  border: 1px solid var(--rahmen);
  border-radius: 0.6rem;
  background: var(--dialog);
  color: var(--tinte);
}

.anleitung[open] {
  display: flex;
}

.anleitung-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.anleitung-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.6rem 0.5rem 1.25rem;
  border-bottom: 1px solid var(--knopf-rand);
}

.anleitung-kopf h2 {
  margin: 0;
  font-size: 1.5rem;
}

.anleitung-kopf .knopf {
  border-color: transparent;
}

.anleitung-inhalt {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 1.25rem 0.75rem;
}

.anleitung h3 {
  margin: 1rem 0 0.3rem;
  font-size: 1.15rem;
}

.anleitung h4 {
  margin: 0.6rem 0 0.2rem;
  color: var(--tinte-leise);
  font-size: 1rem;
}

.anleitung p {
  margin: 0 0 0.4rem;
}

.anleitung ul {
  margin: 0;
  padding-left: 1.15rem;
}

.anleitung li {
  margin-bottom: 0.25rem;
}

.beispiel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.4rem;
  max-width: 24rem;
  margin: 0.9rem auto 0.2rem;
}

.beispiel svg {
  width: 100%;
  height: auto;
  pointer-events: none;
}

.beispiel-pfeil {
  color: var(--tinte-leise);
  font-size: 1.4rem;
}

.beispiel figcaption {
  grid-column: 1 / -1;
  color: var(--tinte-leise);
  font-size: 0.9rem;
  text-align: center;
}

.anleitung-fuss {
  display: flex;
  justify-content: flex-end;
  padding: 0.6rem 1.25rem 0.9rem;
  border-top: 1px solid var(--knopf-rand);
}

.wahl-aktionen {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

@media (max-width: 640px) {
  body {
    grid-template:
      "kopf" auto
      "leiste" auto
      "tisch" minmax(0, 1fr)
      "fuss" auto
      / minmax(0, 1fr);
  }

  .kopf {
    justify-content: space-between;
  }

  .titel {
    font-size: 1.7rem;
  }

  .leiste {
    justify-content: center;
    padding: 0.2rem max(0.75rem, env(safe-area-inset-right)) 0.3rem max(0.75rem, env(safe-area-inset-left));
  }

  .leiste {
    gap: 0.3rem;
  }

  .knopf {
    padding: 0 0.6rem;
  }

  .leiste .knopf-symbol {
    min-width: 2.5rem;
    padding: 0;
  }

  .leiste .knopf-rund {
    align-self: center;
    height: 2.5rem;
    min-height: 2.5rem;
  }
}

@media (max-width: 380px) {
  .leiste {
    gap: 0.2rem;
  }

  .leiste .knopf {
    font-size: 0.95rem;
  }

  .leiste .knopf:not(.knopf-symbol) {
    padding: 0 0.45rem;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .tisch {
    grid-template-rows: minmax(0, 1fr);
  }

  .unterzeile {
    position: absolute;
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: 0;
    left: max(0.75rem, env(safe-area-inset-left));
    grid-template-columns: minmax(0, 1fr) 2.75rem;
    pointer-events: none;
  }

  .unterzeile > * {
    pointer-events: auto;
  }

  .tipp {
    grid-column: 1;
    max-width: 14rem;
    text-align: left;
  }

  .unterzeile .knopf {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .feld .bruecke.falsch line,
  .feld .bruecke.blinkt line {
    animation: none;
  }
}
