/* HUMAN GATE — solbytech Mini-Game
   Gleiche Tokens wie die Management-Demo (Styleguide 16.03.2022).
   Die gesamte Komposition ist in rem gebaut und skaliert über die Root-Schriftgröße
   proportional auf 16:9 (1920 × 1080 → 16 px, 2560 × 1440 → 21,3 px). */

:root {
  --black: #020000;
  --white: #ffffff;
  --gray-050: #f3f3f3;
  --gray-200: #c8c8cb;
  --gray-400: #8d8d93;
  --gray-600: #55555b;
  --gray-750: #2e2e32;
  --gray-850: #19191c;
  --gray-900: #0d0d0f;
  --line: rgba(255,255,255,.16);
  --line-strong: rgba(255,255,255,.34);
  --panel: rgba(13,13,15,.94);
  --ease: cubic-bezier(.2,.8,.2,1);
  --snap: cubic-bezier(.7,0,.2,1);
  --mono: Consolas, "Cascadia Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }
html {
  width: 100%;
  height: 100%;
  background: var(--black);
  font-size: calc(min(1vw, 1.7778vh) * .8333);
}
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--white);
  background: var(--black);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
body.hide-cursor, body.hide-cursor * { cursor: none !important; }
button, a { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible { outline: .125rem solid var(--white); outline-offset: .25rem; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
ol { margin: 0; padding: 0; list-style: none; }

kbd {
  display: inline-grid;
  min-width: 1.6rem;
  min-height: 1.5rem;
  padding: .2rem .45rem;
  place-items: center;
  border: 1px solid var(--line-strong);
  color: var(--white);
  background: rgba(255,255,255,.06);
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 800;
  box-shadow: inset 0 -2px 0 rgba(255,255,255,.08);
}

.eyebrow { color: var(--gray-200); font-size: .72rem; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; }

/* ---------- Hintergrund & Effekte ---------- */
.ambient-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 3rem 3rem;
  mask-image: linear-gradient(110deg, transparent 2%, #000 45%, transparent 92%);
  animation: grid-drift 28s linear infinite alternate;
}
body[data-screen="game"] .ambient-grid { opacity: .32; animation-duration: 9s; }
body.hurry .ambient-grid { animation-duration: 3s; }

.invert-flash {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  background: var(--white);
  mix-blend-mode: difference;
  opacity: 0;
}
.invert-flash.on { animation: invert 420ms steps(1, end); }

/* ---------- Shell ---------- */
.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 4.5rem minmax(0,1fr) 4.25rem;
  width: 100%;
  height: 100vh;
  padding: 0 3rem;
}
body.shake .app-shell { animation: shake 380ms var(--ease); }

.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid var(--line); }
.brand-lockup { display: inline-flex; align-items: center; gap: 1.1rem; padding: .4rem 0; color: var(--white); }
.sbt-icon, .sbt-wordmark, .sbt-logo { display: block; flex: none; fill: currentColor; overflow: visible; }
.brand-lockup .sbt-icon { width: 2.94rem; height: 1.9rem; }
.brand-lockup .sbt-wordmark { width: 12rem; height: 1.104rem; }
.top-title { display: flex; align-items: center; gap: .8rem; color: var(--gray-200); font-size: .7rem; font-weight: 800; letter-spacing: .26em; }
.top-title span:first-child { color: var(--white); }
.top-title i, .top-status i { width: 1px; height: .9rem; background: var(--line); }
.top-status { display: flex; justify-self: end; align-items: center; gap: .65rem; color: var(--gray-200); font-size: .64rem; font-weight: 700; letter-spacing: .18em; }
.offline-mark { width: .5rem; height: .5rem; background: var(--white); animation: status-breathe 3.6s ease-in-out infinite; }

main { position: relative; min-height: 0; }

/* ---------- Screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(1rem);
  transition: opacity .45s var(--ease), transform .55s var(--ease), visibility 0s linear .45s;
}
body[data-screen="start"] .screen-start,
body[data-screen="countdown"] .screen-countdown,
body[data-screen="game"] .screen-game,
body[data-screen="result"] .screen-result {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .45s var(--ease), transform .55s var(--ease), visibility 0s;
}

/* ---------- Start ---------- */
.screen-start {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: 4.5rem;
  padding: 2.6rem 0 2.2rem;
}
.start-copy { display: flex; flex-direction: column; justify-content: center; }
h1 { margin-top: 1.2rem; font-size: 9.2rem; font-weight: 300; letter-spacing: -.075em; line-height: .8; text-transform: uppercase; }
h1 span { color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.8); font-weight: 700; }
.lead { margin-top: 1.9rem; font-size: 2rem; font-weight: 650; letter-spacing: -.025em; }

.rule-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 2.4rem; border-top: 1px solid var(--line); }
.rule-row li { display: grid; align-content: start; gap: .45rem; padding: 1.1rem 1.4rem 0 0; }
.rule-row li + li { padding-left: 1.4rem; border-left: 1px solid var(--line); }
.rule-row span { color: var(--gray-400); font-family: var(--mono); font-size: .72rem; font-weight: 800; }
.rule-row strong { display: flex; align-items: center; gap: .4rem; font-size: 1.12rem; letter-spacing: -.01em; }
.rule-row strong kbd { font-size: .7rem; color: var(--black); background: var(--white); border-color: var(--white); }
.rule-row small { color: var(--gray-200); font-size: .85rem; line-height: 1.45; }

.enter-action {
  position: relative;
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 2.4rem;
  min-width: 19rem;
  margin-top: 2.6rem;
  padding: .9rem 1rem .9rem 1.4rem;
  border: 1px solid var(--white);
  color: var(--black);
  background: var(--white);
  cursor: pointer;
  text-align: left;
  transition: transform .2s var(--ease), background .2s ease;
}
.enter-action::before, .control-primary::before {
  position: absolute;
  inset: -.45rem;
  border: 1px solid rgba(255,255,255,.3);
  content: "";
  animation: enter-pulse 2.4s ease-out infinite;
}
.enter-action:hover { transform: translateY(-2px); background: var(--gray-050); }
.enter-action.pressed { transform: scale(.97); }
.enter-copy { display: grid; gap: .15rem; }
.enter-copy small { font-size: .6rem; font-weight: 800; letter-spacing: .2em; }
.enter-copy strong { font-size: 1.5rem; letter-spacing: .12em; }
.enter-key { display: grid; width: 2.8rem; height: 2.8rem; margin-left: auto; place-items: center; border: 1px solid var(--black); font-size: 1.5rem; }

.start-side { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 1.4rem; min-height: 0; }
.attract-frame { position: relative; display: grid; grid-template-rows: auto 1fr; min-height: 0; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,0)); overflow: hidden; }
.attract-head, .board-head, .col-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--gray-400); font-size: .62rem; font-weight: 800; letter-spacing: .2em; }
.attract-head { padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); }
.head-brand { display: inline-flex; align-items: center; gap: .7rem; }
.head-brand .sbt-icon { width: 1.4rem; height: .9rem; color: var(--white); }
.attract-head strong, .board-head strong, .col-head strong { color: var(--white); font-family: var(--mono); letter-spacing: .12em; }
.attract-stage { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; }
.attract-stage .gcard { width: 47rem; zoom: .76; }

.board { border: 1px solid var(--line); background: rgba(255,255,255,.025); }
.board-head { padding: .8rem 1.2rem; border-bottom: 1px solid var(--line); }
.ranking { display: grid; padding: .35rem 0; }
.ranking li { display: grid; grid-template-columns: 2.2rem 1fr auto auto; align-items: center; gap: 1rem; padding: .5rem 1.2rem; font-size: .9rem; }
.ranking li + li { border-top: 1px solid rgba(255,255,255,.06); }
.ranking .pos { color: var(--gray-400); font-family: var(--mono); font-weight: 800; }
.ranking .who { overflow: hidden; color: var(--gray-200); font-size: .72rem; font-weight: 800; letter-spacing: .14em; white-space: nowrap; text-overflow: ellipsis; }
.ranking .when { color: var(--gray-400); font-family: var(--mono); font-size: .72rem; }
.ranking .pts { min-width: 4.5rem; font-family: var(--mono); font-size: 1.05rem; font-weight: 800; text-align: right; }
.ranking li.me { color: var(--black); background: var(--white); animation: row-in .6s var(--ease) both; }
.ranking li.me .pos, .ranking li.me .who, .ranking li.me .when { color: var(--black); }
.ranking .empty { display: block; padding: 1rem 1.2rem; color: var(--gray-400); font-size: .85rem; }

/* ---------- Countdown ---------- */
.screen-countdown { display: grid; place-content: center; justify-items: center; gap: 2.2rem; text-align: center; }
.count-ring { position: relative; display: grid; width: 21rem; height: 21rem; place-items: center; }
.count-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 2; }
.ring-fill { fill: none; stroke: var(--white); stroke-width: 3; stroke-dasharray: 578; stroke-dashoffset: 578; }
.count-brand { margin-top: .6rem; color: var(--white); opacity: .92; }
.count-brand .sbt-logo { width: 21rem; height: 3.675rem; }
#count-number { font-size: 11rem; font-weight: 200; letter-spacing: -.06em; line-height: 1; font-variant-numeric: tabular-nums; }
#count-number.pop { animation: count-pop .6s var(--ease); }
#count-number.go { font-size: 6rem; font-weight: 800; letter-spacing: .08em; }
.count-rules { display: flex; gap: 0; border: 1px solid var(--line); }
.count-rules li { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.6rem; color: var(--gray-200); font-size: 1.1rem; font-weight: 650; }
.count-rules li + li { border-left: 1px solid var(--line); }
.count-rules span { display: grid; min-width: 2rem; height: 2rem; place-items: center; border: 1px solid var(--line-strong); color: var(--white); font-family: var(--mono); font-size: .8rem; font-weight: 800; }
.count-rules li.em { color: var(--black); background: var(--white); }
.count-rules li.em kbd { color: var(--white); background: var(--black); border-color: var(--black); font-size: .8rem; }

/* ---------- Game ---------- */
.screen-game { display: grid; grid-template-rows: 6.2rem minmax(0, 1fr); gap: 1.2rem; padding: 1.3rem 0 1.1rem; }

.hud { display: grid; grid-template-columns: 1.25fr .95fr 1.7fr 1.1fr 1.1fr 1fr; border: 1px solid var(--line); background: rgba(255,255,255,.025); }
.hud-tile { position: relative; display: grid; align-content: center; gap: .3rem; padding: 0 1.3rem; }
.hud-tile + .hud-tile { border-left: 1px solid var(--line); }
.hud-tile span { color: var(--gray-400); font-size: .58rem; font-weight: 800; letter-spacing: .2em; }
.hud-tile strong { font-family: var(--mono); font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score-tile strong { font-size: 2.6rem; }
.hud-tile strong.bump { animation: bump .45s var(--ease); }
.damage-tile strong:not(.zero) { text-decoration: line-through; text-decoration-thickness: .08em; }
.pips { position: absolute; right: 1.3rem; bottom: 1.15rem; display: flex; gap: .25rem; }
.pips i { width: .55rem; height: 1.4rem; border: 1px solid var(--line-strong); transition: background .2s ease, transform .2s var(--ease); }
.pips i.on { background: var(--white); transform: scaleY(1.12); }
.streak-tile.hot strong { animation: hot 1s ease-in-out infinite; }
.time-tile { grid-template-columns: auto 1fr; align-items: center; column-gap: 1.2rem; }
.time-tile span { grid-column: 1 / -1; }
.time-tile strong { font-size: 2.2rem; min-width: 3.2rem; }
.time-track { height: .55rem; background: rgba(255,255,255,.1); overflow: hidden; }
.time-track span { display: block; width: 100%; height: 100%; background: var(--white); transform-origin: left; }
body.hurry .time-tile strong { animation: hurry-blink .5s steps(2, end) infinite; }
body.hurry .time-track span { background: repeating-linear-gradient(90deg, var(--white) 0 .5rem, var(--gray-400) .5rem .75rem); }

.arena { display: grid; grid-template-columns: 15rem minmax(0, 1fr) 4.6rem 23rem; gap: 1.4rem; min-height: 0; }
.col-head { padding: 0 0 .8rem; border-bottom: 1px solid var(--line); }

.queue { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; }
.queue-list { position: relative; display: grid; align-content: start; gap: .6rem; padding-top: .9rem; overflow: hidden; }
.qcard { display: grid; grid-template-columns: 2rem 1fr; gap: .2rem .7rem; align-items: center; padding: .7rem .8rem; border: 1px solid var(--line); background: var(--gray-900); transition: opacity .35s ease, transform .35s var(--ease); animation: q-in .45s var(--ease) both; }
.qcard .gicon { grid-row: span 2; width: 2rem; height: 2rem; }
.qcard small { color: var(--gray-400); font-size: .52rem; font-weight: 800; letter-spacing: .16em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qcard b { display: block; height: .55rem; width: 85%; background: rgba(255,255,255,.14); }
.qcard:nth-child(2) { opacity: .7; }
.qcard:nth-child(3) { opacity: .45; }
.qcard:nth-child(4) { opacity: .25; }
.qcard:nth-child(n+5) { display: none; }
.autopilot-status { display: flex; align-items: center; gap: .8rem; padding: .9rem; border: 1px solid var(--line); }
.autopilot-status strong { display: block; font-size: .66rem; letter-spacing: .18em; }
.autopilot-status small { color: var(--gray-400); font-size: .68rem; }
.ap-dot { flex: none; width: .7rem; height: .7rem; border-radius: 50%; background: var(--white); animation: status-breathe 1.2s ease-in-out infinite; }

.stage { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 1.2rem; min-height: 0; }
.card-slot { position: relative; display: grid; place-items: center; min-height: 0; }

/* Spielkarte */
.gcard {
  position: relative;
  width: min(100%, 50rem);
  border: 1px solid var(--line-strong);
  background: var(--gray-900);
  box-shadow: 0 2.5rem 5rem rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08);
}
.gcard.enter { animation: card-in .45s var(--ease) both; }
.gcard.urgent { border-color: var(--white); }
.gcard.urgent .ap-fill { animation: hurry-blink .3s steps(2, end) infinite; }
.gcard-head { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 1rem; padding: 1rem 1.4rem; border-bottom: 1px solid var(--line); }
.gicon { display: grid; width: 2.6rem; height: 2.6rem; place-items: center; border: 1px solid var(--line-strong); }
.gicon svg { width: 58%; height: 58%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.gcard-source { display: grid; gap: .15rem; }
.gcard-source small { color: var(--gray-400); font-size: .55rem; font-weight: 800; letter-spacing: .2em; }
.gcard-source strong { font-size: .85rem; letter-spacing: .14em; }
.gcard-chip { padding: .3rem .6rem; border: 1px solid var(--line-strong); color: var(--gray-200); font-size: .58rem; font-weight: 800; letter-spacing: .16em; }
.gcard-state { display: flex; align-items: center; gap: .45rem; color: var(--gray-200); font-size: .58rem; font-weight: 800; letter-spacing: .16em; }
.gcard-state::before { width: .45rem; height: .45rem; background: var(--white); content: ""; animation: status-breathe 1s ease-in-out infinite; }
.gcard-title { padding: 1.3rem 1.4rem .9rem; font-size: 2.15rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.12; }
.gcard-lines { display: grid; margin: 0; padding: 0 1.4rem 1rem; }
.gline { position: relative; display: grid; grid-template-columns: 9.5rem 1fr; align-items: baseline; gap: 1rem; padding: .62rem 2.6rem .62rem .8rem; border-top: 1px solid rgba(255,255,255,.08); transition: background .25s ease, color .25s ease; }
.gline dt { color: var(--gray-400); font-family: var(--mono); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.gline dd { margin: 0; font-size: 1.3rem; font-weight: 600; letter-spacing: -.01em; }
.gline-flag { position: absolute; top: 50%; right: .8rem; display: none; font-size: 1.1rem; font-weight: 900; transform: translateY(-50%); }
.gcard.revealed .gline.key { color: var(--black); background: var(--white); animation: key-reveal .5s var(--ease); }
.gcard.revealed .gline.key dt { color: var(--gray-600); }
.gcard.revealed .gline.key .gline-flag { display: block; }

.gcard-bottom { display: grid; min-height: 6.4rem; border-top: 1px solid var(--line); }
.gcard-bottom > * { grid-area: 1 / 1; }
.gcard-foot { display: grid; align-content: center; gap: .7rem; padding: 1rem 1.4rem; transition: opacity .2s ease; }
.autopilot { display: flex; align-items: baseline; justify-content: space-between; color: var(--gray-200); font-size: .62rem; font-weight: 800; letter-spacing: .2em; }
.ap-seconds { color: var(--white); font-family: var(--mono); font-size: 1.5rem; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.ap-track { height: .6rem; background: rgba(255,255,255,.1); overflow: hidden; }
.ap-fill { display: block; width: 100%; height: 100%; background: var(--white); transform-origin: left; }
.gcard-verdict { display: grid; grid-template-columns: 3.6rem 1fr; align-items: center; gap: 1.1rem; padding: .9rem 1.4rem; opacity: 0; visibility: hidden; }
.gcard.resolved .gcard-foot { opacity: 0; }
.gcard.resolved .gcard-verdict { opacity: 1; visibility: visible; animation: verdict-in .4s var(--ease) both; }
.verdict-icon { display: grid; width: 3.6rem; height: 3.6rem; place-items: center; border: 2px solid var(--white); border-radius: 50%; font-size: 1.8rem; font-weight: 900; }
.gcard.wrong .verdict-icon { color: var(--black); background: var(--white); }
.verdict-copy { display: grid; gap: .3rem; }
.verdict-copy strong { font-size: 1.15rem; letter-spacing: -.01em; }
.verdict-copy span { color: var(--gray-200); font-size: .92rem; line-height: 1.35; }
.gcard.resolved .gcard-state { visibility: hidden; }

.gcard-stamp {
  position: absolute;
  top: 34%;
  left: 50%;
  z-index: 3;
  padding: .45rem 1.3rem .5rem;
  border: .3rem solid var(--white);
  color: var(--white);
  background: rgba(2,0,0,.82);
  font-size: 3.6rem;
  font-weight: 900;
  letter-spacing: .08em;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-7deg) scale(1.6);
}
.gcard-stamp.ghost { border-style: dashed; color: transparent; background: rgba(2,0,0,.95); -webkit-text-stroke: 2px var(--white); }
.gcard.resolved .gcard-stamp { animation: stamp .42s var(--snap) forwards; }

.gcard.stopped.resolved { animation: knock .4s var(--ease); }
.gcard.passed.resolved { animation: nudge .5s var(--ease) forwards; }
.gcard.wrong.resolved { animation: wrong-shake .5s var(--ease); }
.gcard.resolved.exit-pass { animation: exit-pass .42s var(--snap) forwards; }
.gcard.resolved.exit-stop { animation: exit-stop .42s var(--snap) forwards; }

.popups { position: absolute; inset: 0; pointer-events: none; }
.popup { position: absolute; top: 4%; right: 4%; font-family: var(--mono); font-size: 2.6rem; font-weight: 900; text-shadow: 0 .3rem 1.6rem rgba(0,0,0,.8); animation: popup 1.3s var(--ease) forwards; }
.popup small { display: block; font-size: .9rem; letter-spacing: .14em; color: var(--gray-200); }
.popup.neg { color: var(--black); background: var(--white); padding: .2rem .7rem; text-shadow: none; }
.popup.neg small { color: var(--gray-600); }

.press-hint {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  width: 100%;
  min-height: 5.6rem;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.025);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, opacity .2s ease;
  opacity: .45;
}
body.can-stop .press-hint { opacity: 1; border-color: var(--line-strong); }
.press-key {
  display: grid;
  min-width: 9rem;
  height: 3.6rem;
  place-items: center;
  border: 1px solid var(--white);
  color: var(--black);
  background: var(--white);
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: .14em;
  box-shadow: 0 .35rem 0 var(--gray-400);
  transition: transform .08s ease, box-shadow .08s ease;
}
.press-key.small { min-width: 6rem; height: 2.6rem; font-size: .95rem; box-shadow: 0 .25rem 0 var(--gray-400); }
.press-hint.pressed .press-key, .again.pressed .press-key { transform: translateY(.35rem); box-shadow: 0 0 0 var(--gray-400); }
.press-copy { display: grid; text-align: left; }
.press-copy strong { font-size: 1.7rem; letter-spacing: .06em; }
.press-copy small { color: var(--gray-400); font-size: .78rem; font-weight: 700; letter-spacing: .08em; }

/* Gate */
.gate { position: relative; overflow: hidden; border-left: 1px solid var(--line); border-right: 1px solid var(--line); background: repeating-linear-gradient(180deg, rgba(255,255,255,.04) 0 1px, transparent 1px .9rem); }
.door { position: absolute; left: 0; right: 0; height: 16%; background: var(--gray-850); border: 1px solid var(--line-strong); transition: height .16s var(--snap), background .16s ease; }
.door-top { top: 0; border-top: 0; }
.door-bottom { bottom: 0; border-bottom: 0; }
.gate-core { position: absolute; top: 50%; left: 50%; z-index: 2; display: grid; justify-items: center; gap: 1.1rem; color: var(--white); mix-blend-mode: difference; transform: translate(-50%, -50%); }
.gate-core .sbt-icon { width: 2.9rem; height: 1.875rem; }
.gate.closed .gate-core .sbt-icon { animation: gate-icon .4s var(--snap); }
.gate-label { color: var(--white); font-size: .62rem; font-weight: 800; letter-spacing: .4em; white-space: nowrap; writing-mode: vertical-rl; transform: rotate(180deg); }
.gate.closed .door { height: 50.5%; background: var(--white); }
.gate.flow { animation: gate-flow .5s ease; }

/* Audit Trail */
.audit { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.audit-list { display: grid; align-content: start; gap: .5rem; padding-top: .9rem; overflow: hidden; mask-image: linear-gradient(180deg, #000 70%, transparent); }
.audit-list li { display: grid; grid-template-columns: 2.2rem 1fr; gap: .15rem .8rem; align-items: center; padding: .65rem .8rem; border: 1px solid var(--line); background: var(--gray-900); animation: audit-in .45s var(--ease) both; }
.audit-list .mark { grid-row: span 2; display: grid; width: 2.2rem; height: 2.2rem; place-items: center; border: 1px solid var(--line-strong); font-weight: 900; }
.audit-list li.bad .mark { color: var(--black); background: var(--white); border-color: var(--white); }
.audit-list li.bad { border-color: var(--line-strong); }
.audit-list b { overflow: hidden; font-size: .82rem; white-space: nowrap; text-overflow: ellipsis; }
.audit-list small { overflow: hidden; color: var(--gray-400); font-family: var(--mono); font-size: .66rem; font-weight: 800; letter-spacing: .06em; white-space: nowrap; text-overflow: ellipsis; }
.audit-list li.bad small { color: var(--gray-200); }

/* ---------- Result ---------- */
.screen-result { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: 4rem; padding: 2.4rem 0 2rem; }
.result-main { display: flex; flex-direction: column; justify-content: center; }
.rank-title { margin-top: 1rem; font-size: 6.4rem; font-weight: 800; letter-spacing: -.055em; line-height: .88; text-transform: uppercase; }
.rank-title span { color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.85); font-weight: 700; }
.screen-result.show .rank-title { animation: title-in .8s var(--ease) both; }
.rank-sub { max-width: 46rem; margin-top: 1.2rem; color: var(--gray-200); font-size: 1.35rem; line-height: 1.4; }
.result-score { display: flex; align-items: baseline; gap: 1.4rem; margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.result-score span { color: var(--gray-400); font-size: .7rem; font-weight: 800; letter-spacing: .22em; }
.result-score strong { font-family: var(--mono); font-size: 4.6rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.result-score small { padding: .35rem .7rem; color: var(--black); background: var(--white); font-size: .8rem; font-weight: 800; letter-spacing: .14em; }
.result-score small:empty { display: none; }
.balance { display: grid; gap: .55rem; margin-top: 1.6rem; max-width: 46rem; }
.balance-row { display: grid; grid-template-columns: 8rem 1fr auto; align-items: baseline; gap: 1rem; }
.balance-row span { font-size: .72rem; font-weight: 800; letter-spacing: .2em; }
.balance-row small { color: var(--gray-400); font-size: .82rem; }
.balance-row strong { font-family: var(--mono); font-size: 1.15rem; }
.balance-track { height: .7rem; margin-bottom: .6rem; background: rgba(255,255,255,.1); }
.balance-track span { display: block; width: 0; height: 100%; background: var(--white); transition: width 1.2s var(--ease) .35s; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 46rem; margin-top: 1.2rem; border: 1px solid var(--line); }
.result-stats div { display: grid; gap: .4rem; padding: .9rem 1rem; }
.result-stats div + div { border-left: 1px solid var(--line); }
.result-stats span { color: var(--gray-400); font-size: .55rem; font-weight: 800; letter-spacing: .18em; }
.result-stats strong { font-family: var(--mono); font-size: 1.3rem; white-space: nowrap; }

.result-side { display: grid; grid-template-rows: minmax(0, 1fr) auto auto auto; gap: 1rem; min-height: 0; }
.lessons { min-height: 0; overflow: hidden; }
.lesson-list { display: grid; align-content: start; }
.lesson-list li { display: grid; grid-template-columns: 2.2rem 1fr; gap: .25rem .9rem; padding: .8rem 1.2rem; animation: row-in .5s var(--ease) both; }
.lesson-list li + li { border-top: 1px solid rgba(255,255,255,.06); }
.lesson-list .mark { grid-row: span 2; display: grid; width: 2.2rem; height: 2.2rem; place-items: center; color: var(--black); background: var(--white); font-weight: 900; }
.lesson-list li.ok .mark { color: var(--white); background: transparent; border: 1px solid var(--line-strong); }
.lesson-list strong { font-size: .95rem; }
.lesson-list span { color: var(--gray-200); font-size: .85rem; line-height: 1.4; }
.lesson-list li:nth-child(2) { animation-delay: .1s; }
.lesson-list li:nth-child(3) { animation-delay: .2s; }
.result-side .ranking li { padding-top: .38rem; padding-bottom: .38rem; }
.cta { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 1.4rem; padding: 1rem 1.2rem; color: var(--black); background: var(--white); }
.cta-brand { padding-right: 1.4rem; border-right: 1px solid rgba(2,0,0,.18); }
.cta-brand .sbt-logo { width: 11.5rem; height: 2.0125rem; }
.cta p { font-size: .92rem; line-height: 1.4; }
.cta strong { display: block; font-size: 1.05rem; }
.again { display: flex; align-items: center; gap: 1.1rem; padding: .8rem 1.2rem; border: 1px solid var(--line-strong); }
.again strong { font-size: 1.05rem; letter-spacing: .12em; }
.again small { margin-left: auto; color: var(--gray-400); font-family: var(--mono); font-size: .75rem; }
body.result-locked .again { opacity: .4; }

/* ---------- Footer / Steuerung ---------- */
.controlbar { display: flex; align-items: center; gap: .8rem; border-top: 1px solid var(--line); }
.control-primary { position: relative; display: flex; align-items: center; gap: .65rem; min-width: 15.5rem; padding: .45rem .8rem; background: rgba(255,255,255,.07); font-size: .66rem; }
.control-primary::before { inset: -2px; animation-duration: 3s; }
.control-cluster { display: flex; align-items: center; gap: .3rem; }
.control-button { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.4rem; padding: .3rem .5rem; border: 1px solid transparent; color: var(--gray-200); background: transparent; cursor: pointer; font-size: .62rem; text-decoration: none; }
.control-button:hover, .control-button[aria-pressed="true"] { border-color: var(--line-strong); color: var(--white); background: rgba(255,255,255,.07); }
.control-button[aria-pressed="true"] kbd { color: var(--black); background: var(--white); }
.kiosk-status { margin-left: auto; color: var(--gray-400); font-size: .6rem; font-weight: 800; letter-spacing: .14em; }

.mode-toast { position: fixed; top: 5.6rem; right: 3rem; z-index: 90; padding: .65rem .85rem; border: 1px solid var(--line-strong); background: rgba(2,0,0,.94); font-size: .62rem; font-weight: 800; letter-spacing: .13em; opacity: 0; transform: translateY(-.5rem); pointer-events: none; transition: opacity .2s ease, transform .2s var(--ease); }
.mode-toast.show { opacity: 1; transform: none; }
.pause-overlay { position: absolute; inset: 0; z-index: 40; display: grid; place-content: center; justify-items: center; gap: 1rem; background: rgba(2,0,0,.82); backdrop-filter: blur(4px); }
.pause-overlay .sbt-icon { width: 6.2rem; height: 4rem; margin-bottom: .6rem; }
.pause-overlay strong { font-size: 6rem; font-weight: 300; letter-spacing: .3em; }
.pause-overlay span { color: var(--gray-200); font-size: 1rem; letter-spacing: .14em; }
body.is-paused *, body.is-paused *::before, body.is-paused *::after { animation-play-state: paused !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

/* ---------- Keyframes ---------- */
@keyframes grid-drift { to { background-position: 1.75rem 1.1rem; } }
@keyframes status-breathe { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes enter-pulse { 0% { opacity: .65; transform: scale(1); } 75%,100% { opacity: 0; transform: scale(1.06,1.3); } }
@keyframes invert { 0% { opacity: 1; } 30% { opacity: 0; } 55% { opacity: 1; } 100% { opacity: 0; } }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-.6rem); } 40% { transform: translateX(.5rem); } 60% { transform: translateX(-.3rem); } 80% { transform: translateX(.15rem); } }
@keyframes count-pop { from { opacity: 0; transform: scale(1.45); } to { opacity: 1; transform: scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes hot { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes hurry-blink { 50% { opacity: .35; } }
@keyframes q-in { from { opacity: 0; transform: translateY(-.8rem); } }
@keyframes card-in { from { opacity: 0; transform: translateX(-6rem) scale(.94); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes key-reveal { 0% { transform: scaleX(.96); } 60% { transform: scaleX(1.015); } 100% { transform: none; } }
@keyframes verdict-in { from { opacity: 0; transform: translateY(.6rem); } }
@keyframes stamp { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(-7deg) scale(1.7); } 60% { opacity: 1; transform: translate(-50%, -50%) rotate(-7deg) scale(.94); } 100% { opacity: 1; transform: translate(-50%, -50%) rotate(-7deg) scale(1); } }
@keyframes knock { 0% { transform: none; } 30% { transform: translateX(-1.6rem); } 100% { transform: none; } }
@keyframes nudge { to { transform: translateX(2.2rem); } }
@keyframes wrong-shake { 0%,100% { transform: none; } 15% { transform: translateX(-1rem) rotate(-.6deg); } 35% { transform: translateX(.9rem) rotate(.5deg); } 55% { transform: translateX(-.5rem); } 75% { transform: translateX(.3rem); } }
@keyframes exit-pass { from { opacity: 1; transform: translateX(2.2rem); } to { opacity: 0; transform: translateX(46rem) scale(.55); filter: blur(4px); } }
@keyframes exit-stop { from { opacity: 1; } to { opacity: 0; transform: translateY(5rem) scale(.9); filter: blur(4px); } }
@keyframes popup { 0% { opacity: 0; transform: translateY(1rem) scale(.8); } 15% { opacity: 1; transform: translateY(0) scale(1.06); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-3.5rem); } }
@keyframes gate-flow { 0% { background-color: rgba(255,255,255,0); } 30% { background-color: rgba(255,255,255,.14); } 100% { background-color: rgba(255,255,255,0); } }
@keyframes audit-in { from { opacity: 0; transform: translateX(-2rem); } }
@keyframes row-in { from { opacity: 0; transform: translateX(1.4rem); } }
@keyframes gate-icon { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes title-in { from { opacity: 0; transform: translateY(1.6rem); letter-spacing: .02em; } }

/* ---------- Web-Modus & gemeinsame Ergänzungen ---------- */
.sbt-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
html[data-mode="stand"] .web-only { display: none !important; }
html[data-mode="web"] .stand-only { display: none !important; }
.touch-label { display: none; }
html.touch .key-label { display: none; }
html.touch .touch-label { display: inline; }
html.touch kbd, html.touch .control-primary { display: none !important; }
html.no-fullscreen #fullscreen-button { display: none; }
button, a { touch-action: manipulation; }
.web-nav { display: flex; justify-self: end; align-items: center; gap: 1rem; }
.back-link { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.6rem; padding: .5rem .9rem; border: 1px solid var(--line-strong); color: var(--white); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-decoration: none; text-transform: uppercase; transition: background .2s ease, border-color .2s ease; }
.back-link:hover { border-color: var(--white); background: rgba(255,255,255,.08); }
.intro-note { max-width: 46rem; margin-top: 1.1rem; padding: .8rem 1rem; border-left: 2px solid var(--white); color: var(--gray-050); background: rgba(255,255,255,.04); font-size: .98rem; line-height: 1.5; }
.cta-link { display: inline-flex; gap: .4rem; margin-top: .45rem; color: var(--black); font-weight: 800; text-decoration: none; border-bottom: 1px solid var(--black); }
.cta-link:hover { border-bottom-width: 2px; }
.legal-links { display: flex; gap: 1rem; margin-left: auto; }
.legal-links a { color: var(--gray-400); font-size: .6rem; font-weight: 700; letter-spacing: .1em; text-decoration: none; text-transform: uppercase; }
.legal-links a:hover { color: var(--white); }
.legal-links + .kiosk-status { margin-left: 1.2rem; }

/* ---------- Kompakt: Handy hoch & quer, kleine Fenster ---------- */
@media (max-width: 820px), (max-height: 560px) {
  html { font-size: clamp(13px, min(4vw, 3.4vh), 17px); }
  .app-shell { grid-template-rows: 3.6rem minmax(0, 1fr) auto; height: 100vh; height: 100dvh; padding: 0 .9rem; }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: .6rem; }
  .top-title { min-width: 0; overflow: hidden; white-space: nowrap; }
  .brand-lockup { gap: .6rem; }
  .brand-lockup .sbt-icon { width: 2.3rem; height: 1.5rem; }
  .brand-lockup .sbt-wordmark { width: 7.6rem; height: .7rem; }
  .top-title { justify-self: center; gap: .5rem; font-size: .58rem; letter-spacing: .16em; }
  .top-title i, .top-title span:last-child { display: none; }
  .back-link { min-height: 2.5rem; padding: .4rem .7rem; font-size: .62rem; }
  .screen { overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; }

  .screen-start { display: flex; flex-direction: column; gap: 1.4rem; padding: 1.2rem 0 1.6rem; }
  h1 { margin-top: .8rem; font-size: 3.7rem; }
  .lead { margin-top: 1rem; font-size: 1.2rem; }
  .intro-note { font-size: .92rem; }
  .rule-row { grid-template-columns: 1fr; margin-top: 1.2rem; }
  .rule-row li, .rule-row li + li { padding: .8rem 0; border-left: 0; }
  .rule-row li + li { border-top: 1px solid var(--line); }
  .rule-row strong { font-size: 1rem; }
  .rule-row small { font-size: .85rem; }
  .enter-action { align-self: stretch; width: 100%; min-width: 0; margin-top: 1.4rem; }
  .start-side { display: block; }
  .attract-frame { display: none; }

  .count-ring { width: 13rem; height: 13rem; }
  #count-number { font-size: 7rem; }
  #count-number.go { font-size: 3.6rem; }
  .count-rules { flex-direction: column; width: 100%; }
  .count-rules li { justify-content: center; padding: .7rem 1rem; font-size: .95rem; }
  .count-rules li + li { border-left: 0; border-top: 1px solid var(--line); }

  .screen-game { grid-template-rows: auto minmax(0, 1fr); gap: .6rem; padding: .6rem 0 .7rem; overflow: hidden; }
  .hud { grid-template-columns: repeat(3, 1fr); }
  .hud-tile { gap: .2rem; padding: .45rem .6rem; }
  .hud-tile:nth-child(4) { border-left: 0; }
  .hud-tile:nth-child(n+4) { border-top: 1px solid var(--line); }
  .hud-tile span { font-size: .5rem; letter-spacing: .14em; }
  .hud-tile strong { font-size: 1.1rem; }
  .score-tile strong { font-size: 1.45rem; }
  .time-tile { column-gap: .5rem; }
  .time-tile strong { min-width: 1.8rem; font-size: 1.3rem; }
  .pips { display: none; }
  .arena { grid-template-columns: minmax(0, 1fr); }
  .queue, .gate, .audit { display: none; }
  .stage { grid-template-rows: minmax(0, 1fr) auto; gap: .6rem; }
  .card-slot { overflow: hidden; }
  .gcard { width: 100%; }
  .gcard-head { grid-template-columns: auto 1fr auto; gap: .6rem; padding: .55rem .7rem; }
  .gicon { width: 2rem; height: 2rem; }
  .gcard-source small, .gcard-state { display: none; }
  .gcard-source strong { font-size: .72rem; }
  .gcard-chip { padding: .2rem .45rem; font-size: .52rem; }
  .gcard-title { padding: .7rem .8rem .5rem; font-size: 1.32rem; }
  .gcard-lines { padding: 0 .8rem .6rem; }
  .gline { grid-template-columns: 5.4rem 1fr; gap: .5rem; padding: .45rem 1.9rem .45rem .5rem; }
  .gline dt { font-size: .58rem; letter-spacing: .06em; }
  .gline dd { font-size: .95rem; }
  .gline-flag { right: .5rem; font-size: .9rem; }
  .gcard-bottom { min-height: 5.4rem; }
  .gcard-foot { gap: .5rem; padding: .6rem .8rem; }
  .autopilot { font-size: .52rem; letter-spacing: .14em; }
  .ap-seconds { font-size: 1.15rem; }
  .gcard-verdict { grid-template-columns: 2.5rem 1fr; gap: .6rem; padding: .55rem .8rem; }
  .verdict-icon { width: 2.5rem; height: 2.5rem; font-size: 1.25rem; }
  .verdict-copy strong { font-size: .88rem; }
  .verdict-copy span { font-size: .78rem; }
  .gcard-stamp { padding: .3rem .8rem; border-width: .2rem; font-size: 2rem; }
  .popup { font-size: 1.7rem; }
  .press-hint { min-height: 5.2rem; gap: 1rem; opacity: .6; }
  .press-key { min-width: 6.4rem; height: 3.1rem; font-size: 1.05rem; }
  .press-copy strong { font-size: 1.2rem; }
  .press-copy small { font-size: .66rem; }

  .screen-result { display: flex; flex-direction: column; gap: 1.2rem; padding: 1rem 0 1.6rem; }
  .rank-title { font-size: 3.3rem; }
  .rank-sub { font-size: 1rem; }
  .result-score { gap: .9rem; margin-top: 1.2rem; }
  .result-score strong { font-size: 3rem; }
  .balance-row { grid-template-columns: 7.5rem 1fr auto; }
  .balance-row small { display: none; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
  .result-stats div:nth-child(3) { border-left: 0; }
  .result-stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .result-side { display: flex; flex-direction: column; gap: .9rem; }
  .cta { grid-template-columns: 1fr; gap: .8rem; }
  .cta-brand { padding: 0 0 .8rem; border-right: 0; border-bottom: 1px solid rgba(2,0,0,.18); }
  .again { min-height: 3.6rem; }

  .controlbar { gap: .4rem; overflow-x: auto; padding: .3rem 0; }
  .control-primary, .kiosk-status { display: none; }
  .control-button { flex: none; min-height: 2.6rem; }
  .control-button span { font-size: .6rem; }
  .legal-links { flex: none; gap: .8rem; padding-left: .4rem; }
  .mode-toast { top: 4rem; right: .9rem; left: .9rem; text-align: center; }
}

/* Sehr schmal: Seitentitel steht groß auf der Seite, in der Kopfzeile reicht Logo + Zurück */
@media (max-width: 520px) {
  .top-title { display: none; }
}

/* Handy quer: Karte links, STOPP-Taste rechts – alles ohne Scrollen sichtbar */
@media (max-height: 560px) and (orientation: landscape) {
  .app-shell { grid-template-rows: 3rem minmax(0, 1fr) auto; }
  .hud { grid-template-columns: repeat(6, 1fr); }
  .hud-tile:nth-child(4) { border-left: 1px solid var(--line); }
  .hud-tile:nth-child(n+4) { border-top: 0; }
  .hud-tile { padding: .35rem .5rem; }
  .stage { grid-template-columns: minmax(0, 1fr) 10.5rem; grid-template-rows: minmax(0, 1fr); }
  .press-hint { flex-direction: column; justify-content: center; min-height: 0; text-align: center; }
  .press-copy { text-align: center; }
  .gcard-title { font-size: 1.12rem; padding-top: .5rem; }
  .gline { padding-top: .3rem; padding-bottom: .3rem; }
  .gcard-bottom { min-height: 4.4rem; }
  .screen-start { display: grid; grid-template-columns: 1.1fr .9fr; align-items: start; }
}

/* ---------- Kleinere / abweichende Ansichten ---------- */
@media (max-aspect-ratio: 4/3) and (min-width: 821px) and (min-height: 561px) {
  html { font-size: calc(min(1.25vw, 2.2vh) * .8333); }
  .arena { grid-template-columns: 0 minmax(0, 1fr) 3.4rem 18rem; }
  .queue { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
