:root {
  --grund: #111111;
  --flaeche: #1e1e1e;
  --text: #f5f5f5;
  --text-leise: #a8a8a8;
  --gruen: #22c55e;
  --gelb: #facc15;
  --rot: #ef4444;
  --orange: #f97316;
  --rand: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--grund);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
}

body { display: flex; flex-direction: column; }

/* Modus Entsorgen: unübersehbarer oranger Rahmen (A9) */
body.entsorgen { box-shadow: inset 0 0 0 10px var(--orange); }
body.entsorgen header { background: var(--orange); color: #000; }
body.entsorgen #spieltag { color: #000; }

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px var(--rand);
  background: #000;
  font-size: 18px;
  min-height: 64px;
}
#spieltag { flex: 1; color: var(--text-leise); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#uhr { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; }

.kopf-knopf {
  font: inherit;
  font-size: 34px;
  min-width: 76px;
  min-height: 52px;
  border-radius: 14px;
  border: 3px solid #444;
  background: var(--flaeche);
  color: var(--text);
  cursor: pointer;
}
.kopf-knopf.klein { min-width: 52px; font-size: 24px; opacity: .7; }
.kopf-knopf:active { transform: scale(.95); }
#entsorgen[aria-pressed="true"] { background: #000; border-color: #000; color: var(--orange); }

.status { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; min-width: 64px; }
.lampe { width: 22px; height: 22px; border-radius: 50%; background: var(--gruen); flex: none; }
.status.wartet .lampe { background: var(--gelb); }
.status.fehler .lampe { background: var(--rot); animation: pulsen 1s infinite; }
@keyframes pulsen { 50% { opacity: .3; } }

main { flex: 1; display: flex; min-height: 0; }
.ansicht { flex: 1; padding: var(--rand); display: flex; flex-direction: column; gap: var(--rand); min-height: 0; }
.mitte { align-items: center; justify-content: center; text-align: center; }
.gross-symbol { font-size: 120px; line-height: 1; }
.hinweis-text { font-size: 26px; color: var(--text-leise); }

.knopf {
  font: inherit;
  font-size: 48px;
  color: var(--text);
  background: var(--flaeche);
  border: 3px solid #444;
  border-radius: 20px;
  min-height: 96px;
  min-width: 140px;
  cursor: pointer;
}
.knopf:active { transform: scale(.97); }
.knopf.start { background: var(--gruen); border-color: var(--gruen); color: #000; font-size: 64px; }
.knopf:disabled { opacity: .35; }

.liste { display: flex; flex-direction: column; gap: var(--rand); flex: 1; overflow-y: auto; }
.veranstaltung {
  font: inherit;
  text-align: left;
  font-size: 26px;
  padding: 20px 24px;
  color: var(--text);
  background: var(--flaeche);
  border: 4px solid transparent;
  border-radius: 16px;
}
.veranstaltung small { display: block; font-size: 20px; color: var(--text-leise); margin-top: 4px; }
.veranstaltung[aria-pressed="true"] { border-color: var(--gruen); }

/* Raster: eine Zeile je Reihe, ein Feld je Produkt */
#raster { flex: 1; display: flex; flex-direction: column; gap: var(--rand); min-height: 0; }
.zeile { flex: 1; display: flex; gap: var(--rand); min-height: 110px; border-radius: 22px; }
.zeile.aktiv { outline: 6px solid #fff; outline-offset: 4px; }
.reihe-nr {
  width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 44px;
  font-weight: 800;
  color: var(--text);
  background: #000;
  border: 3px solid #333;
  border-radius: 16px;
  cursor: pointer;
}
.scan-symbol { font-size: 18px; letter-spacing: -2px; color: #555; }
.zeile.aktiv .reihe-nr { background: #fff; color: #000; border-color: #fff; }
.zeile.aktiv .scan-symbol { color: #000; }
.reihe-nr.blinkt { animation: blinken .3s 4; }
@keyframes blinken { 50% { background: var(--rot); } }

.feld {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  border: none;
  border-radius: 20px;
  color: #000;
  font: inherit;
  font-size: 40px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .08s;
}
.feld:active { transform: scale(.97); }
.feld svg { width: 96px; height: 64px; flex: none; }
.feld .zahl, .feld .weg {
  position: absolute;
  top: 10px;
  font-size: 28px;
  background: rgba(0, 0, 0, .75);
  color: #fff;
  border-radius: 12px;
  padding: 2px 12px;
  font-variant-numeric: tabular-nums;
}
.feld .zahl { right: 16px; }
.feld .weg { left: 16px; color: var(--orange); }
.feld.ok { outline: 8px solid var(--gruen); outline-offset: -8px; }
body.entsorgen .feld.ok { outline-color: var(--orange); }

#hinweis {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  background: var(--rot);
  color: #fff;
  font-size: 64px;
  font-weight: 800;
  padding: 24px 48px;
  border-radius: 24px;
  pointer-events: none;
}

#blitz { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s; }
#blitz.ok { background: var(--gruen); opacity: .25; transition: none; }
#blitz.fehler { background: var(--rot); opacity: .6; transition: none; }

@media (max-width: 700px) {
  header { gap: 6px; }
  .kopf-knopf { min-width: 52px; font-size: 26px; }
  .reihe-nr { width: 70px; font-size: 28px; }
  .feld { font-size: 28px; gap: 10px; }
  .feld svg { width: 64px; height: 44px; }
}
