/* ================================================================
   Die große Geburtstagsfahrt – Aussehen
   Dunkler Motorsport-Look: Rot #e10600, Gelb #ffd400, Hintergrund #0b0f14
   ================================================================ */

:root {
  --bg: #0b0f14;
  --red: #e10600;
  --red-d: #8f0300;
  --yellow: #ffd400;
  --text: #eef2f7;
  --muted: #9aa7b6;
  --glass: rgba(15, 21, 29, 0.74);
  --line: rgba(255, 255, 255, 0.13);
  --finale-bg: #05070a;
  --st: env(safe-area-inset-top, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --font-head: 'Russo One', 'Arial Black', Impact, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

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

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

button { font-family: inherit; color: inherit; }

/* ---------- Spiel-Canvas & Konfetti ---------- */
#game {
  position: fixed;
  left: 0; top: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  background: var(--bg);
  z-index: 0;
  touch-action: none;
}
#confetti {
  position: fixed;
  left: 0; top: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 100;
  pointer-events: none;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  z-index: 10;
  top: calc(var(--st) + 8px);
  left: calc(var(--sl) + 8px);
  right: calc(var(--sr) + 8px);
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr 1fr;
  gap: 6px;
  pointer-events: none;
}
.hud-box {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 6px;
  background: rgba(8, 12, 18, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--font-head);
  font-size: clamp(16px, 4.6vw, 26px);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.hud-label {
  font: 700 10px/1.2 var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.hud-center { font-size: 14px; }
.progress {
  width: 100%;
  height: 8px;
  margin-top: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
#hud-progress {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--red), var(--yellow));
}
#hud-time.low {
  color: #ff3b30;
  text-shadow: 0 0 14px rgba(255, 59, 48, 0.7);
  animation: lowPulse 0.6s ease-in-out infinite alternate;
}
@keyframes lowPulse {
  from { transform: scale(1); }
  to { transform: scale(1.18); }
}

/* ---------- Countdown & Toast ---------- */
#countdown {
  position: fixed;
  left: 0; right: 0;
  top: 46%;
  transform: translateY(-50%);
  z-index: 20;
  text-align: center;
  font-family: var(--font-head);
  font-size: clamp(80px, 26vmin, 220px);
  line-height: 1;
  color: #fff;
  text-shadow: 0 6px 0 var(--red), 0 0 46px rgba(225, 6, 0, 0.65);
  opacity: 0;
  pointer-events: none;
}
#countdown.show {
  opacity: 1;
  animation: cdPop 0.65s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes cdPop {
  0% { transform: translateY(-50%) scale(2.3); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translateY(-50%) scale(1); }
}

#toast {
  position: fixed;
  left: 50%;
  top: 30%;
  transform: translateX(-50%) scale(0.8);
  z-index: 20;
  max-width: 90vw;
  padding: 8px 18px;
  font-family: var(--font-head);
  font-size: clamp(15px, 4vw, 20px);
  color: var(--yellow);
  background: rgba(8, 12, 18, 0.78);
  border: 1px solid rgba(255, 212, 0, 0.7);
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  animation: toastPop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes toastPop {
  0% { transform: translateX(-50%) scale(0.6); }
  100% { transform: translateX(-50%) scale(1); }
}

/* ---------- Top-Buttons ---------- */
#topbar {
  position: fixed;
  z-index: 60;
  top: calc(var(--st) + 8px);
  right: calc(var(--sr) + 8px);
  display: flex;
  gap: 8px;
}
body.racing #topbar { top: calc(var(--st) + 66px); }
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 18, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.08s, background 0.15s;
}
.icon-btn:hover { background: rgba(40, 50, 64, 0.8); }
.icon-btn:active { transform: scale(0.92); }

/* ---------- Touch-Steuerung ---------- */
#touch {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 15;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 calc(var(--sr) + 14px) calc(var(--sb) + 14px) calc(var(--sl) + 14px);
  pointer-events: none;
}
.touch-left { display: flex; gap: 12px; }
.tbtn {
  pointer-events: auto;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  min-width: 76px;
  min-height: 76px;
  padding: 0;
  border-radius: 22px;
  border: 2px solid rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 30px;
  cursor: pointer;
}
.tbtn:active, .tbtn.active, .tbtn.pressed {
  background: rgba(255, 255, 255, 0.36);
  transform: scale(0.95);
}
.tbtn.brake {
  min-width: 120px;
  min-height: 88px;
  padding: 0 14px;
  background: rgba(225, 6, 0, 0.34);
  border-color: rgba(255, 130, 120, 0.65);
  font-family: var(--font-head);
  font-size: 18px;
  letter-spacing: 0.08em;
}
.tbtn.brake:active, .tbtn.brake.active, .tbtn.brake.pressed { background: rgba(225, 6, 0, 0.62); }

/* ---------- Bildschirme ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--st) + 58px) calc(var(--sr) + 14px) calc(var(--sb) + 18px) calc(var(--sl) + 14px);
  background: radial-gradient(ellipse at center, rgba(5, 8, 12, 0.38), rgba(5, 8, 12, 0.8));
  user-select: none;
}
.screen > .card { margin: auto; }
.screen.fade-in { animation: screenIn 0.35s ease both; }
@keyframes screenIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.screen.fade-in > .card { animation: cardIn 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
@keyframes cardIn {
  from { transform: translateY(14px) scale(0.98); }
  to { transform: none; }
}

.card {
  width: min(100%, 520px);
  padding: 22px 20px;
  text-align: center;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.09);
}
.card-wide { width: min(100%, 760px); }

h1 {
  margin: 0.15em 0 0.4em;
  font-family: var(--font-head);
  font-weight: 400;
  font-size: clamp(24px, 6.6vw, 38px);
  line-height: 1.12;
  letter-spacing: 0.01em;
}
p { margin: 0.5em 0; line-height: 1.5; color: #d3dbe5; }
.small { font-size: 12px; color: var(--muted); }
.kicker {
  font: 800 12px/1.3 var(--font-body);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--yellow);
}

.controls-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 14px 0 4px;
}
.controls-info div {
  padding: 6px 12px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.controls-info b { color: var(--yellow); }

.portrait-hint { display: none; }

/* ---------- Buttons ---------- */
.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}
.btn {
  min-height: 52px;
  padding: 13px 26px;
  border: 0;
  border-radius: 14px;
  font-family: var(--font-head);
  font-size: 18px;
  letter-spacing: 0.02em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(#ff3326, var(--red));
  box-shadow: 0 5px 0 var(--red-d), 0 12px 22px rgba(225, 6, 0, 0.32);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
  -webkit-touch-callout: none;
}
.btn:hover { filter: brightness(1.1); }
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--red-d), 0 4px 10px rgba(225, 6, 0, 0.3);
}
.btn:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.btn.secondary {
  background: linear-gradient(#34414f, #232c37);
  box-shadow: 0 5px 0 #0f141a, 0 12px 22px rgba(0, 0, 0, 0.35);
}
.btn.secondary:active { box-shadow: 0 1px 0 #0f141a, 0 4px 10px rgba(0, 0, 0, 0.35); }
.btn.ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid var(--line);
  box-shadow: none;
  color: var(--text);
}
.btn.ghost:active { transform: scale(0.97); }
.btn.gold {
  color: #2a1d00;
  background: linear-gradient(#ffe766, var(--yellow));
  box-shadow: 0 5px 0 #9c8000, 0 12px 22px rgba(255, 212, 0, 0.3);
}
.btn.gold:active { box-shadow: 0 1px 0 #9c8000, 0 4px 10px rgba(255, 212, 0, 0.3); }

/* ---------- Statistik-Kacheln ---------- */
.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 4px;
}
.stats:empty { display: none; }
.stat {
  flex: 1 1 96px;
  max-width: 180px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.stat b {
  display: block;
  font-family: var(--font-head);
  font-weight: 400;
  font-size: 21px;
  color: #fff;
  line-height: 1.2;
}
.stat span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--yellow);
}
.bonus {
  display: inline-block;
  margin: 10px 0 2px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 14px;
  color: var(--yellow);
  background: rgba(255, 212, 0, 0.1);
  border: 1px solid rgba(255, 212, 0, 0.5);
  border-radius: 12px;
}

/* ---------- Titel-Layout ---------- */
.title-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}
@media (min-width: 640px) {
  .title-grid { grid-template-columns: minmax(0, 1fr) 250px; text-align: left; gap: 22px; }
  .title-grid .controls-info { justify-content: flex-start; }
}

/* ---------- Puzzle ---------- */
.puzzle-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.puzzle-title {
  margin-bottom: 8px;
  font-family: var(--font-head);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--yellow);
}
.puzzle-hint { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.puzzle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  width: min(100%, 250px);
  aspect-ratio: 3 / 2;
  padding: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: gap 0.8s ease, padding 0.8s ease, box-shadow 0.8s ease, border-color 0.8s ease;
}
.ptile {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background-color: #141b24;
  background-repeat: no-repeat;
  background-size: 200% 200%;
  transition: border-radius 0.8s ease;
}
.ptile:nth-child(1) { background-position: 0 0; }
.ptile:nth-child(2) { background-position: 100% 0; }
.ptile:nth-child(3) { background-position: 0 100%; }
.ptile:nth-child(4) { background-position: 100% 100%; }
.pcover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: clamp(26px, 8vw, 40px);
  color: rgba(255, 212, 0, 0.9);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  background:
    linear-gradient(135deg, rgba(255, 212, 0, 0.1), transparent 55%),
    repeating-linear-gradient(45deg, #1b2430 0 9px, #151c26 9px 18px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.ptile.open .pcover {
  opacity: 0;
  transform: scale(1.25) rotate(8deg);
  pointer-events: none;
}
.ptile.pop { animation: tilePop 1.4s ease; z-index: 1; }
@keyframes tilePop {
  0% { box-shadow: 0 0 0 0 rgba(255, 212, 0, 0); transform: scale(1); }
  35% { box-shadow: 0 0 0 4px rgba(255, 212, 0, 0.9), 0 0 36px rgba(255, 212, 0, 0.8); transform: scale(1.07); }
  100% { box-shadow: 0 0 0 0 rgba(255, 212, 0, 0); transform: scale(1); }
}
.puzzle.complete {
  gap: 0;
  padding: 0;
  border-color: rgba(255, 212, 0, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 212, 0, 0.55), 0 0 60px rgba(255, 212, 0, 0.4), 0 20px 50px rgba(0, 0, 0, 0.6);
}
.puzzle.complete .ptile { border-radius: 0; }
.puzzle-big { width: min(94vw, 600px, calc((100vh - 130px) * 1.5)); width: min(94vw, 600px, calc((100dvh - 130px) * 1.5)); }

/* ---------- Ergebnis / Erinnerung ---------- */
.result-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: 14px;
}
.memory { width: 100%; animation: memIn 0.7s 0.25s ease both; }
@keyframes memIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.memory-label {
  font-family: var(--font-head);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--yellow);
}
#memory-caption { margin: 8px auto 0; max-width: 34em; font-size: 14px; font-style: italic; }

.photo-frame {
  position: relative;
  width: min(100%, 270px);
  margin: 12px auto 0;
  background: #fafaf7;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.photo-frame.polaroid { padding: 10px 10px 30px; border-radius: 3px; transform: rotate(-2deg); }
.photo-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #dcdde3;
}
.photo-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  aspect-ratio: 4 / 3;
  font-size: 36px;
  color: #8a8f99;
  background: repeating-linear-gradient(45deg, #e8e9ee 0 10px, #dfe1e7 10px 20px);
}
.photo-ph span { font: 600 12px var(--font-body); }
.photo-frame:not(.has-img) img { display: none; }
.photo-frame.has-img .photo-ph { display: none; }

/* ---------- Finale ---------- */
.screen.reveal {
  background: var(--finale-bg);
  align-items: flex-start;
  padding-top: calc(var(--st) + 24px);
}
.reveal-inner {
  width: 100%;
  max-width: 600px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
#reveal-lines { width: 100%; transition: opacity 0.6s ease; }
#reveal-lines.fade { opacity: 0; }
.reveal-line {
  margin: 0.7em 0;
  font-family: var(--font-head);
  font-size: clamp(21px, 5.6vw, 36px);
  line-height: 1.28;
  color: #fff;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}
.reveal-line.in { opacity: 1; transform: none; }
.reveal-line:last-child.in { text-shadow: 0 0 26px rgba(255, 212, 0, 0.35); }
.reveal-puzzle { width: 100%; display: flex; justify-content: center; animation: memIn 0.9s ease both; }
.skip-hint {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--sb) + 18px);
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: none;
  animation: hintPulse 2s ease-in-out infinite;
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.9; }
}

.ticket-wrap {
  width: min(100%, 440px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 4px;
}
.ticket {
  position: relative;
  width: 100%;
  overflow: hidden;
  text-align: left;
  color: #2b1d00;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff2ad 0%, #f8d24f 22%, #d9a21f 48%, #fadf7c 72%, #c98f12 100%);
  box-shadow:
    0 0 0 1px rgba(255, 236, 150, 0.7),
    0 0 50px rgba(255, 200, 40, 0.3),
    0 28px 60px rgba(0, 0, 0, 0.65);
  -webkit-user-select: text;
  user-select: text;
}
.ticket::before {
  content: "60";
  position: absolute;
  right: -4px;
  top: 34px;
  font-family: var(--font-head);
  font-size: 190px;
  line-height: 1;
  color: rgba(110, 65, 0, 0.09);
  pointer-events: none;
}
.ticket::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.55) 50%, transparent 62%);
  transform: translateX(-130%);
  animation: shine 4s 2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shine {
  0% { transform: translateX(-130%); }
  35%, 100% { transform: translateX(130%); }
}
.ticket.in { animation: ticketIn 1.7s cubic-bezier(0.2, 0.85, 0.25, 1) both; }
@keyframes ticketIn {
  0% { opacity: 0; transform: perspective(900px) translateY(-85vh) rotateY(-540deg) rotateZ(-10deg) scale(0.45); }
  15% { opacity: 1; }
  72% { transform: perspective(900px) translateY(10px) rotateY(12deg) rotateZ(1deg) scale(1.04); }
  100% { opacity: 1; transform: perspective(900px) translateY(0) rotateY(0deg) rotateZ(0deg) scale(1); }
}
.checker-band {
  height: 14px;
  background: conic-gradient(#14110a 25%, #fff 0 50%, #14110a 0 75%, #fff 0) 0 0 / 14px 14px;
}
.ticket-main { position: relative; padding: 14px 20px 12px; }
.ticket-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ticket .kicker { color: #7a0b00; font-size: 11px; }
.flag {
  flex: none;
  width: 60px;
  height: 30px;
  border: 2px solid #2b1d00;
  border-radius: 3px;
  background: conic-gradient(#14110a 25%, #fff 0 50%, #14110a 0 75%, #fff 0) 0 0 / 15px 15px;
  transform: rotate(-5deg);
}
.ticket h1 {
  margin: 10px 0 8px;
  font-size: clamp(21px, 6vw, 28px);
  color: #2a1200;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}
#t-details {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  font-size: clamp(13px, 3.7vw, 15px);
  font-weight: 700;
  color: #3b2700;
}
#t-details li { position: relative; padding-left: 22px; line-height: 1.35; }
#t-details li::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 0.3em;
  width: 11px;
  height: 11px;
  border: 1px solid #2b1d00;
  background: conic-gradient(#14110a 25%, #fff 0 50%, #14110a 0 75%, #fff 0) 0 0 / 11px 11px;
}
.ticket .small-frame { width: 100%; margin: 4px 0 0; padding: 6px; transform: rotate(-0.8deg); box-shadow: 0 6px 16px rgba(60, 30, 0, 0.4); }
.ticket .small-frame img { aspect-ratio: 16 / 8; max-height: 130px; }
.ticket-bottom {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 16px 20px 8px;
  border-top: 2px dashed rgba(60, 35, 0, 0.5);
}
.ticket-bottom::before, .ticket-bottom::after {
  content: "";
  position: absolute;
  top: -11px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--finale-bg);
}
.ticket-bottom::before { left: -10px; }
.ticket-bottom::after { right: -10px; }
.ticket-bottom > div { min-width: 0; }
.tlabel {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7a4b00;
}
.ticket-bottom b {
  display: block;
  font-family: var(--font-head);
  font-weight: 400;
  font-size: clamp(13px, 3.8vw, 16px);
  color: #2a1200;
  overflow-wrap: anywhere;
}
.t-message {
  margin: 0;
  padding: 4px 20px 14px;
  text-align: center;
  font-weight: 800;
  font-style: italic;
  font-size: 15px;
  color: #5a0a00;
}
.ticket-wrap .buttons { margin-top: 20px; }

/* ---------- Anpassungen ---------- */
@media (pointer: coarse) {
  .controls-info { display: none; }
}
@media (orientation: portrait) and (pointer: coarse) {
  .portrait-hint { display: block; }
}
@media (max-width: 400px) {
  .card { padding: 18px 14px; }
  .btn { padding: 12px 20px; font-size: 17px; }
}

/* Querformat am Handy: kompakt */
@media (max-height: 520px) {
  .screen {
    padding: calc(var(--st) + 8px) calc(var(--sr) + 62px) calc(var(--sb) + 8px) calc(var(--sl) + 62px);
  }
  .screen.reveal { padding-top: calc(var(--st) + 14px); }
  .card { padding: 14px 18px; border-radius: 16px; }
  h1 { font-size: clamp(20px, 5.4vh, 28px); margin-bottom: 0.25em; }
  p { margin: 0.3em 0; font-size: 13px; line-height: 1.4; }
  .buttons { margin-top: 10px; gap: 8px; }
  .btn { min-height: 44px; padding: 9px 18px; font-size: 16px; }
  .stats { margin: 8px 0 2px; }
  .stat { padding: 6px 8px; }
  .stat b { font-size: 17px; }
  .puzzle { width: min(100%, 210px); }
  .photo-frame { width: min(100%, 170px); margin-top: 6px; }
  .photo-frame.polaroid { padding: 7px 7px 20px; }
  #memory-caption { font-size: 12px; margin-top: 4px; }
  .puzzle-box { flex: none; }
  .puzzle-big { width: min(60vw, calc((100vh - 70px) * 1.5)); width: min(60vw, calc((100dvh - 70px) * 1.5)); }
  .ticket-wrap { width: min(100%, 520px); }
  .touch-left { gap: 10px; }
  .tbtn { min-width: 76px; min-height: 76px; }
  .tbtn.brake { min-height: 80px; }
  #hud { gap: 5px; }
  .hud-box { padding: 3px 6px; font-size: clamp(15px, 4.4vh, 22px); }
  body.racing #topbar { top: calc(var(--st) + 56px); }
}

/* Querformat, aber breit genug für zwei Spalten */
@media (max-height: 520px) and (min-width: 600px) {
  .title-grid { grid-template-columns: minmax(0, 1fr) 210px; text-align: left; gap: 16px; }
  .title-grid .controls-info { justify-content: flex-start; margin-top: 8px; }
  .result-body { flex-direction: row; justify-content: center; align-items: center; gap: 22px; margin-top: 8px; }
  .memory { width: auto; flex: 1 1 0; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .ticket::after { display: none; }
}

/* Ticket-Ansicht: Ecken freihalten (Screenshot-freundlich) */
body.ticket-shown #topbar { display: none; }
