@font-face {
  font-family: "Atkinson Next";
  src: url("fonts/atkinson-next.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
:root {
  color-scheme: light dark;
  --papier: #f5efe3; --flaeche: #fffaf0; --fach: #e9e0cf; --linie: #cfc4ae;
  --tinte: #22302a; --leise: #55605a;
  --tanne: #1c4a3b; --auf-tanne: #fffaf0; --tanne-hauch: #dbe6dc;
  --bernstein: #efb04a; --auf-bernstein: #2a1c04; --bernstein-tief: #8a5a0b;
  --ziegel: #9c3119;
  --schatten-fach: inset 0 2px 5px rgb(70 55 25 / .16);
  --tippen: max(56px, 3.1rem);
}
@media (prefers-color-scheme: dark) {
  :root {
    --papier: #141d1a; --flaeche: #1d2925; --fach: #0f1714; --linie: #3a4a43;
    --tinte: #efe9dc; --leise: #b3b4a8;
    --tanne: #8fd1b5; --auf-tanne: #0e201a; --tanne-hauch: #24392f;
    --bernstein-tief: #efb04a;
    --ziegel: #f0a48e;
    --schatten-fach: inset 0 2px 6px rgb(0 0 0 / .45);
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; scrollbar-color: var(--linie) var(--papier); }
html[data-gross="1"] { font-size: 20px; }
html[data-gross="2"] { font-size: 22px; }
html[data-gross="3"] { font-size: 25px; }
body {
  margin: 0; background: var(--papier); color: var(--tinte);
  font-family: "Atkinson Next", "Atkinson Hyperlegible", system-ui, sans-serif;
  line-height: 1.45; font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--tanne); color: var(--auf-tanne); }
:focus-visible { outline: 3px solid var(--tanne); outline-offset: 2px; border-radius: 6px; }
main:focus, h1:focus { outline: none; }
.sprung { position: absolute; left: -999px; }
.sprung:focus { left: 8px; top: 8px; background: var(--flaeche); padding: .6rem 1rem; z-index: 40; }
#inhalt {
  max-width: 38rem; margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem calc(6.5rem + env(safe-area-inset-bottom));
}
h1 { font-size: 1.7rem; line-height: 1.15; margin: .3rem 0 .9rem; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.2rem; line-height: 1.2; margin: 1.8rem 0 .6rem; font-weight: 700; }
h3 { font-size: 1.05rem; margin: 1.1rem 0 .3rem; }
p { margin: .4rem 0 .8rem; max-width: 62ch; }
a { color: var(--tanne); text-underline-offset: 3px; }
.klein { font-size: .9rem; color: var(--leise); }
.leise { color: var(--leise); }

/* Knoepfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tippen); min-width: 0; max-width: 100%; padding: .5rem 1.15rem; border: 2px solid transparent; border-radius: 12px;
  background: var(--tanne); color: var(--auf-tanne); font: inherit; font-weight: 700; text-decoration: none;
  cursor: pointer; touch-action: manipulation; transition: transform .08s ease, background-color .15s ease;
}
.knopf:active { transform: translateY(1px); }
.knopf:disabled { opacity: .55; cursor: default; }
.knopf.zweit { background: transparent; color: var(--tanne); border-color: var(--tanne); }
.knopf.leise-k { background: transparent; color: var(--tinte); border-color: var(--linie); font-weight: 500; }
.knopf.gefahr { background: transparent; color: var(--ziegel); border-color: var(--ziegel); }
.knopf.breit { width: 100%; }
.reihe { display: flex; flex-wrap: wrap; gap: .6rem; margin: .8rem 0; }
.reihe > .knopf { flex: 1 1 auto; }
.zurueck { display: inline-flex; align-items: center; gap: .3rem; min-height: var(--tippen); color: var(--tinte); text-decoration: none; margin-left: -.2rem; }
svg.ic { width: 1.35em; height: 1.35em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Wochenleiste: sieben Deckel */
.woche { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; margin: 0 0 .5rem; }
.deckel {
  display: grid; justify-items: center; gap: .1rem; min-height: 4.2rem; padding: .35rem 0 .4rem;
  border: 0; border-radius: 10px 10px 6px 6px; background: var(--flaeche); color: var(--tinte); font: inherit;
  box-shadow: 0 2px 0 var(--linie); cursor: pointer; touch-action: manipulation;
}
.deckel b { font-size: .95rem; font-weight: 700; }
.deckel span { font-size: .78rem; color: var(--leise); }
.deckel i { width: 1rem; height: 1rem; display: block; }
.deckel.ist-heute b { text-decoration: underline; text-underline-offset: 3px; }
.deckel[aria-pressed="true"] { background: var(--tanne); color: var(--auf-tanne); box-shadow: 0 2px 0 var(--tinte); }
.deckel[aria-pressed="true"] span { color: inherit; }
.deckel svg { display: block; width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.wochenwahl { display: flex; align-items: center; justify-content: space-between; gap: .4rem; margin-bottom: .3rem; text-align: center; }
.pfeil { min-width: var(--tippen); min-height: var(--tippen); border: 0; background: none; color: var(--tinte); cursor: pointer; display: inline-grid; place-items: center; }

/* Jetzt dran: die eine bernsteinfarbene Flaeche */
.jetzt { background: var(--bernstein); color: var(--auf-bernstein); border-radius: 16px; padding: .9rem 1rem 1rem; margin: 1rem 0; }
.jetzt h2 { margin: 0 0 .4rem; font-size: 1.35rem; }
.jetzt .zeile { border-color: rgb(42 28 4 / .28); }
.jetzt .klein, .jetzt .leise { color: inherit; }
.jetzt .knopf { background: var(--auf-bernstein); color: #fff7e6; }
.jetzt .wahl summary, .jetzt .knopf.leise-k { color: var(--auf-bernstein); border-color: rgb(42 28 4 / .55); background: transparent; }
.ruhig { background: var(--flaeche); border-radius: 14px; padding: .8rem 1rem; margin: 1rem 0; }
.ruhig p { margin: 0; }

/* Faecher: eingelassene Mulden */
.fach { background: var(--fach); box-shadow: var(--schatten-fach); border-radius: 14px; padding: .35rem .9rem .6rem; margin: .7rem 0; }
.fach > h2 { display: flex; justify-content: space-between; align-items: baseline; margin: .5rem 0 .2rem; font-size: 1.05rem; }
.fach-zu { display: flex; width: 100%; align-items: center; gap: .6rem; min-height: var(--tippen); padding: .3rem .9rem; margin: .4rem 0; border: 0; border-radius: 14px; background: var(--fach); color: var(--leise); font: inherit; text-align: left; cursor: pointer; }
.fach-zu b { color: var(--tinte); font-weight: 700; }
.fach-zu .rechts { margin-left: auto; }
.eben-zu { animation: schliessen .34s cubic-bezier(.2, .8, .2, 1); }
@keyframes schliessen { from { opacity: .3; transform: scaleY(2.4); transform-origin: top; } to { opacity: 1; transform: none; } }
.zeile { display: grid; grid-template-columns: 3.1rem 1fr; gap: 0 .55rem; padding: .6rem 0; border-top: 1px solid var(--linie); }
.zeile:first-of-type { border-top: 0; }
.zeile .uhr { font-weight: 700; }
.zeile .name { font-weight: 700; overflow-wrap: anywhere; }
.zeile .tun { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.zeile .tun .knopf { flex: 1 1 8rem; }
.status-ok { color: var(--tanne); font-weight: 700; }
.status-aus { color: var(--ziegel); font-weight: 700; }
.wahl { flex: 1 1 8rem; }
.wahl summary { list-style: none; display: flex; align-items: center; justify-content: center; min-height: var(--tippen); padding: .4rem .8rem; border: 2px solid var(--linie); border-radius: 12px; cursor: pointer; }
.wahl summary::-webkit-details-marker { display: none; }
.wahl[open] { flex-basis: 100%; }
.wahl .reihe { margin-bottom: 0; }

/* Listen */
.liste { list-style: none; margin: 0; padding: 0; }
.eintrag { display: flex; align-items: center; gap: .8rem; width: 100%; min-height: var(--tippen); padding: .7rem .2rem; border: 0; border-bottom: 1px solid var(--linie); background: none; color: var(--tinte); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.eintrag > span:first-of-type:not(.bild) { min-width: 0; }
.eintrag b { display: block; overflow-wrap: anywhere; }
.eintrag .rechts { margin-left: auto; color: var(--leise); }
.bild { flex: none; width: 3.1rem; height: 3.1rem; border-radius: 10px; overflow: hidden; background: var(--fach); display: grid; place-items: center; color: var(--tanne); }
.bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.warn { color: var(--ziegel); font-weight: 700; }
.leer { text-align: left; padding: 1rem 0; }

/* Formulare */
.feld { display: block; margin: 1rem 0; }
.feld > span, legend { display: block; font-weight: 700; margin-bottom: .3rem; }
.feld small { display: block; color: var(--leise); margin-top: .25rem; font-size: .9rem; }
input, select, textarea {
  width: 100%; min-width: 0; min-height: var(--tippen); padding: .55rem .75rem; font: inherit; color: var(--tinte);
  background: var(--flaeche); border: 2px solid var(--linie); border-radius: 10px;
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--tanne); outline: none; }
input[type="time"], input[type="date"] { -webkit-appearance: none; appearance: none; }
fieldset { border: 0; padding: 0; margin: 1rem 0; min-width: 0; }
.zwei { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(10.5rem, 100%), 1fr)); gap: .7rem; }
.zwei .feld { margin: .4rem 0; }
.wahlen { display: flex; flex-wrap: wrap; gap: .45rem; }
.wahlen label { position: relative; flex: 1 1 auto; }
.wahlen input { position: absolute; inset: 0; opacity: 0; min-height: 0; margin: 0; cursor: pointer; }
.wahlen span { display: flex; align-items: center; justify-content: center; min-height: var(--tippen); padding: .3rem .8rem; border: 2px solid var(--linie); border-radius: 10px; background: var(--flaeche); text-align: center; }
.wahlen input:checked + span { background: var(--tanne); color: var(--auf-tanne); border-color: var(--tanne); font-weight: 700; }
.wahlen input:focus-visible + span { outline: 3px solid var(--tanne); outline-offset: 2px; }
.haken { display: flex; align-items: center; gap: .7rem; min-height: var(--tippen); }
.haken input { width: 1.6rem; min-height: 0; height: 1.6rem; accent-color: var(--tanne); flex: none; }
.zeitzeile { display: grid; grid-template-columns: 1fr 1fr var(--tippen); gap: .5rem; align-items: center; margin: .5rem 0; }
.weg { min-height: var(--tippen); border: 0; background: none; color: var(--ziegel); cursor: pointer; display: grid; place-items: center; }
details.mehr-feld { margin: 1.2rem 0; border-top: 1px solid var(--linie); border-bottom: 1px solid var(--linie); }
details.mehr-feld > summary { min-height: var(--tippen); display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.fehler { color: var(--ziegel); font-weight: 700; }
.foto-vorschau { max-width: 9rem; border-radius: 10px; display: block; margin: .5rem 0; }
.klebend { position: sticky; bottom: calc(5.2rem + env(safe-area-inset-bottom)); background: var(--papier); padding: .5rem 0; z-index: 5; }

/* Hinweise */
.hinweis { background: var(--tanne-hauch); border-radius: 12px; padding: .8rem 1rem; margin: 1rem 0; }
.hinweis p { margin: 0 0 .5rem; }
.hinweis p:last-child { margin-bottom: 0; }
.hinweis .reihe { margin-bottom: 0; }

/* Navigation */
#nav { position: fixed; inset: auto 0 0; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--flaeche); border-top: 1px solid var(--linie); padding-bottom: env(safe-area-inset-bottom); }
#nav a { display: grid; justify-items: center; align-content: center; gap: .05rem; min-height: 4.3rem; color: var(--leise); text-align: center; text-decoration: none; font-size: .9rem; }
#nav a[aria-current="page"] { color: var(--tanne); font-weight: 700; box-shadow: inset 0 3px 0 var(--tanne); }

/* Meldung */
#meldung { position: fixed; left: 50%; bottom: calc(5rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; width: min(36rem, calc(100% - 2rem)); }
.toast { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .4rem .5rem .4rem 1rem; background: var(--tinte); color: var(--papier); border-radius: 12px; box-shadow: 0 6px 18px rgb(0 0 0 / .25); }
.toast button { min-height: 3rem; padding: 0 .9rem; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.toast span { padding: .5rem 0; }

/* Sperre */
#sperre { position: fixed; inset: 0; z-index: 50; background: var(--papier); padding: 3rem 1.2rem; overflow: auto; }
#sperre form { max-width: 22rem; margin: 0 auto; }

/* Scanner */
.sucher { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; }
.sucher video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sucher::after { content: ""; position: absolute; inset: 18% 12%; border: 3px solid var(--bernstein); border-radius: 12px; }

/* Verlauf und Bericht */
.verlauf { width: 100%; height: auto; display: block; background: var(--fach); border-radius: 12px; }
.verlauf text { fill: var(--leise); font-size: 11px; }
.verlauf .l1 { fill: none; stroke: var(--tanne); stroke-width: 2.5; }
.verlauf .l2 { fill: none; stroke: var(--bernstein-tief); stroke-width: 2.5; stroke-dasharray: 6 4; }
.verlauf .p1 { fill: var(--tanne); }
.verlauf .p2 { fill: var(--bernstein-tief); }
.balken { display: block; width: 100%; height: .7rem; margin: .3rem 0; }
.balken .grund { fill: var(--fach); }
.balken .teil { fill: var(--tanne); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .45rem .3rem; border-bottom: 1px solid var(--linie); vertical-align: top; overflow-wrap: anywhere; }
th { font-size: .9rem; color: var(--leise); }
td.zahl, th.zahl { text-align: right; }
.luecken { list-style: none; margin: 0; padding: 0; }
.luecken li { padding: .5rem 0; border-bottom: 1px solid var(--linie); color: var(--leise); }
.luecken b { display: block; color: var(--tinte); overflow-wrap: anywhere; }
.karte-feld { padding: .4rem 0; border-bottom: 1px solid var(--linie); }
.karte-feld b { display: block; font-size: .9rem; color: var(--leise); font-weight: 500; }
.ohne-js { padding: 1rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  #nav, #meldung, .kein-druck, .sprung { display: none !important; }
  #inhalt { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
}
