:root {
  --ink: #0a1020;
  --panel: rgba(10, 17, 34, 0.78);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f3f6fb;
  --muted: #9fb0c9;
  --ice: #8fdcff;
  --accent: #ff5a36;
  --accent-2: #ffb547;
  --good: #3ee08f;
  --bad: #ff5468;
  --bronze: #d9925a;
  --silver: #cdd6e2;
  --gold: #ffcc33;
  --plat: #a5f3ff;
  --r: 14px;
  --display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--text);
  font-family: var(--body); -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: 0.45; cursor: default; }
input { font: inherit; user-select: text; -webkit-user-select: text; }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
kbd {
  display: inline-block; min-width: 20px; padding: 1px 6px; margin: 0 1px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.18); border-bottom-width: 2px;
  font: 600 11px/1.5 var(--body); color: var(--text); text-align: center;
}

#game { position: fixed; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; }
#ui { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#ui .screen { position: absolute; inset: 0; pointer-events: auto; overflow-y: auto; padding: 28px clamp(16px, 4vw, 56px) 40px; }
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#touch { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }

/* ---------- Ladebildschirm ---------- */
#loading { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 18px; background: radial-gradient(ellipse at 50% 30%, #1b2b52, #0a1020 70%); }
.ld-logo { font: italic 900 64px/1 var(--display); text-transform: uppercase; letter-spacing: 0.01em; }
.ld-logo span { color: var(--accent); }
.ld-bar { width: 220px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.ld-bar i { display: block; width: 40%; height: 100%; background: var(--accent); animation: ld 1.1s ease-in-out infinite; }
@keyframes ld { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
#loading p { color: var(--muted); margin: 0; font-size: 14px; }

/* ---------- Gemeinsame Bausteine ---------- */
.eyebrow { font: 700 12px/1 var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ice); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 18px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); font-weight: 600; transition: background 0.15s, transform 0.1s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 8px 24px -10px rgba(255, 90, 54, 0.8); }
.btn.primary:hover:not(:disabled) { background: #ff6d4d; }
.btn.big { padding: 14px 24px; font-size: 16px; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn kbd { background: rgba(0, 0, 0, 0.2); border-color: rgba(255, 255, 255, 0.3); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.panel.narrow { max-width: 560px; margin: 0 auto; }
h4 { margin: 22px 0 10px; font: 700 13px/1 var(--body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.panel > h4:first-child, .ch-head h4 { margin-top: 0; }

.topbar { display: flex; align-items: center; gap: 18px; max-width: 1100px; margin: 0 auto 18px; }
.topbar h2 { margin: 0; font: italic 800 clamp(30px, 5vw, 46px)/1 var(--display); text-transform: uppercase; }
.back { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; font-weight: 600; white-space: nowrap; }
.back:hover { background: rgba(255, 255, 255, 0.15); }

.seg { display: inline-flex; flex-wrap: nowrap; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; }
.seg.wrap { flex-wrap: wrap; display: flex; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.sel { background: var(--text); color: var(--ink); }
.seg.light button.sel { background: var(--ice); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.chip svg { width: 18px; height: 18px; }
.chip:hover { background: rgba(255, 255, 255, 0.14); }
.chip.sel { background: var(--ice); color: var(--ink); border-color: transparent; }

/* ---------- Hauptmenü ---------- */
.screen-menu { background: linear-gradient(90deg, rgba(6, 11, 24, 0.92) 0%, rgba(6, 11, 24, 0.7) 36%, rgba(6, 11, 24, 0) 70%); display: flex; }
.menu-wrap { display: flex; flex-direction: column; justify-content: center; gap: 28px; max-width: 520px; min-height: 100%; }
.logo { margin: 10px 0 0; font: italic 900 clamp(64px, 11vw, 124px)/0.82 var(--display); text-transform: uppercase; letter-spacing: -0.01em; display: flex; flex-direction: column; text-shadow: 0 10px 40px rgba(0, 0, 0, 0.35); }
.logo span:last-child { color: var(--accent); padding-left: 0.32em; }
.tag { margin: 14px 0 0; color: #cfdbec; font-size: 16px; line-height: 1.5; max-width: 420px; }
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.btn-big {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 13px 20px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.btn-big span { font: italic 800 26px/1 var(--display); text-transform: uppercase; letter-spacing: 0.01em; }
.btn-big small { color: var(--muted); font-size: 13px; }
.btn-big:hover, .btn-big:focus-visible { background: rgba(255, 255, 255, 0.14); transform: translateX(4px); border-color: rgba(255, 255, 255, 0.25); }
.btn-big.primary { background: var(--accent); border-color: transparent; box-shadow: 0 14px 34px -14px rgba(255, 90, 54, 0.9); }
.btn-big.primary small { color: rgba(255, 255, 255, 0.85); }
.btn-big.primary:hover { background: #ff6d4d; }
.menu-foot { color: var(--muted); font-size: 13px; line-height: 2; }

/* ---------- Modi ---------- */
.screen-modes, .screen-setup, .screen-online, .screen-lobby, .screen-challenges, .screen-board, .screen-settings {
  background: linear-gradient(180deg, rgba(6, 11, 24, 0.86), rgba(6, 11, 24, 0.94));
}
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; max-width: 1100px; margin: 0 auto; }
.mode-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; padding: 22px 18px; min-height: 230px; border-radius: 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)); border: 1px solid var(--line); transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.mode-card:hover, .mode-card:focus-visible { transform: translateY(-4px); border-color: var(--accent); background: linear-gradient(160deg, rgba(255, 90, 54, 0.22), rgba(255, 255, 255, 0.03)); }
.mode-ico { width: 52px; height: 52px; color: var(--accent); }
.mode-ico svg { width: 100%; height: 100%; }
.mode-name { font: italic 800 30px/1 var(--display); text-transform: uppercase; margin-top: 6px; }
.mode-desc { color: #c9d5e6; font-size: 14px; line-height: 1.45; flex: 1; }
.mode-best { font-size: 12px; color: var(--ice); font-weight: 600; }

/* ---------- Setup ---------- */
.setup { max-width: 1100px; margin: 0 auto; }
.track-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.track-card {
  display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.06);
  border: 2px solid transparent; outline: 1px solid var(--line); transition: background 0.15s;
}
.track-card:hover { background: rgba(255, 255, 255, 0.11); }
.track-card.sel { border-color: var(--accent); background: rgba(255, 90, 54, 0.12); outline-color: transparent; }
.tc-top { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.diff { font: 700 11px/1 var(--body); letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 8px; border-radius: 6px; }
.diff.d0 { background: #1f9d5b; } .diff.d1 { background: #2563eb; } .diff.d2 { background: #dc2626; } .diff.d3 { background: #111; border: 1px solid #fff; }
.tc-name { font: italic 800 24px/1 var(--display); text-transform: uppercase; }
.tc-meta { color: var(--muted); font-size: 13px; }
.tc-secs { color: var(--ice); font-size: 12px; line-height: 1.4; }
.goal { margin-top: 10px; color: var(--ice); font-size: 13px; font-weight: 600; }
.info-card { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; max-width: 640px; line-height: 1.55; }
.info-card p { margin: 0 0 8px; }
.setup-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.setup-row h4 { width: 100%; }
.stepper { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); }
.stepper button { width: 36px; height: 36px; border-radius: 9px; border: 0; background: rgba(255, 255, 255, 0.1); font-size: 20px; font-weight: 700; }
.stepper span { min-width: 64px; text-align: center; font-weight: 700; }
.stepper span::after { content: ' Bots'; font-weight: 500; color: var(--muted); }
.setup-go { margin-top: 28px; }

/* ---------- Online ---------- */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .join-row input {
  width: 100%; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); color: var(--text); font-size: 16px;
}
.field input:focus, .join-row input:focus { outline: 2px solid var(--ice); border-color: transparent; }
.online-actions { display: flex; flex-direction: column; gap: 14px; }
.online-actions > .btn { width: 100%; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 8px; }
.join-row input { font: 800 22px/1 var(--display); letter-spacing: 0.3em; text-transform: uppercase; text-align: center; }
.note { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 18px 0 0; }
.status { min-height: 20px; margin-top: 12px; font-size: 14px; color: var(--ice); }
.status.bad { color: var(--bad); }

.lobby { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.lobby-code { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lobby-code .code { font: italic 900 clamp(56px, 12vw, 96px)/1 var(--display); letter-spacing: 0.12em; color: #fff; text-shadow: 0 8px 30px rgba(255, 90, 54, 0.45); }
.lobby-code .link { max-width: 100%; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.lobby-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.lobby-cols .panel { display: flex; flex-direction: column; gap: 12px; }
.lobby-cols .panel h4 { margin: 0; }
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.plist li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); font-weight: 600; }
.plist li i { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2); }
.plist li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist em { font-style: normal; font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.plist em.me { background: var(--ice); color: var(--ink); }
.plist em.race { background: var(--good); color: var(--ink); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.waiting { color: var(--ice); margin: 6px 0 0; }

/* ---------- Challenges ---------- */
.ch-wrap { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.ch-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.streak { font-size: 13px; color: var(--accent-2); font-weight: 600; }
.daily { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.daily li { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.daily li i { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3); display: grid; place-items: center; font-style: normal; font-weight: 800; }
.daily li.done { border-color: rgba(62, 224, 143, 0.5); background: rgba(62, 224, 143, 0.08); }
.daily li.done i { background: var(--good); border-color: var(--good); color: var(--ink); }
.daily b { display: block; font-weight: 600; }
.daily small { color: var(--muted); font-size: 12px; }
.medals .mgroup { margin-bottom: 14px; }
.medals h5 { margin: 0 0 6px; font-size: 13px; color: var(--ice); }
.mrow { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-size: 14px; }
.mbest { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Bestenliste ---------- */
.board { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
.tbl th, .tbl td { padding: 11px 14px; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-size: 14px; }
.tbl th { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.tbl td.num { font: 700 18px/1 var(--display); font-variant-numeric: tabular-nums; }
.tbl tbody tr:first-child td { color: var(--gold); }
.tbl .empty { text-align: center; color: var(--muted); padding: 30px; }

/* ---------- Einstellungen ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); }
.swatch.sel { border-color: #fff; box-shadow: 0 0 0 3px var(--accent); }
.keys { width: 100%; border-collapse: collapse; font-size: 14px; }
.keys td { padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.keys td:first-child { white-space: nowrap; padding-right: 16px; }

/* ---------- Pause ---------- */
.screen-pause { background: rgba(6, 11, 24, 0.6); display: grid; place-items: center; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal { display: flex; flex-direction: column; gap: 10px; min-width: min(320px, 90vw); padding: 28px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.modal h2 { margin: 0 0 8px; font: italic 900 52px/1 var(--display); text-transform: uppercase; text-align: center; }

/* ---------- Ergebnis ---------- */
.screen-results { background: linear-gradient(180deg, rgba(6, 11, 24, 0.55), rgba(6, 11, 24, 0.92) 45%); }
.results { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.res-head h2 { margin: 8px 0 0; font: italic 900 clamp(46px, 8vw, 80px)/0.95 var(--display); text-transform: uppercase; }
.res-main { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 24px; align-items: center; padding: 20px 24px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.res-medal { grid-row: span 2; display: flex; flex-direction: column; align-items: center; gap: 6px; font: italic 800 18px/1 var(--display); text-transform: uppercase; }
.res-medal.none { color: var(--muted); }
.res-medal.m1 { color: var(--bronze); } .res-medal.m2 { color: var(--silver); } .res-medal.m3 { color: var(--gold); } .res-medal.m4 { color: var(--plat); }
.res-medal svg { filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.4)); animation: pop 0.6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { transform: scale(0.3) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
.res-value { font: italic 900 clamp(48px, 9vw, 88px)/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.res-sub { color: var(--muted); font-size: 14px; }
.res-ch { display: flex; flex-direction: column; gap: 6px; }
.res-ch div { padding: 10px 14px; border-radius: 10px; background: rgba(62, 224, 143, 0.12); border: 1px solid rgba(62, 224, 143, 0.4); font-size: 14px; }
.res-ch i { font-style: normal; color: var(--good); font-weight: 800; margin-right: 4px; }
.res-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.res-stats { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 0; padding: 14px 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); align-content: start; }
.res-stats dt, .res-stats dd { padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.res-stats dt { color: var(--muted); font-size: 14px; }
.res-stats dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.res-side { padding: 14px 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.res-side h4 { margin: 0 0 10px; }
.rank { list-style: none; margin: 0; padding: 0; counter-reset: r; display: flex; flex-direction: column; gap: 4px; }
.rank li { counter-increment: r; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; font-size: 14px; }
.rank li::before { content: counter(r); width: 18px; color: var(--muted); font-weight: 700; }
.rank li i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.rank li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank li small { color: var(--muted); }
.rank li b { font: 700 17px/1 var(--display); font-variant-numeric: tabular-nums; }
.rank li.me { background: rgba(255, 90, 54, 0.18); }
.res-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- HUD ---------- */
.hud-tl { position: absolute; top: 18px; left: 22px; }
.hud-label { font: 700 11px/1 var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255, 255, 255, 0.75); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.hud-time { font: italic 900 clamp(40px, 6vw, 60px)/1 var(--display); font-variant-numeric: tabular-nums; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45); margin-top: 4px; }
.hud-sub { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.delta { font: italic 800 22px/1 var(--display); font-variant-numeric: tabular-nums; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
.delta.good { color: var(--good); } .delta.bad { color: var(--bad); }
.section { font: 600 12px/1 var(--body); padding: 5px 8px; border-radius: 6px; background: rgba(8, 14, 28, 0.55); color: #dfe8f5; }
.hud-tc { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); width: min(38vw, 420px); }
.progress { position: relative; height: 26px; }
.progress .bar { position: absolute; left: 0; right: 0; top: 11px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.35); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); }
.progress .flag { position: absolute; right: -4px; top: -6px; font: 800 10px/1 var(--body); letter-spacing: 0.1em; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); transform: translateX(100%); padding-left: 8px; }
#h-marks i { position: absolute; top: 7px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; border: 2px solid rgba(8, 14, 28, 0.85); }
#h-marks i.me { width: 18px; height: 18px; top: 4px; margin-left: -9px; border-color: #fff; z-index: 2; }
#h-marks i.ghost { opacity: 0.7; border-style: dashed; }
.avgap { display: flex; align-items: center; gap: 10px; font: 700 12px/1 var(--body); letter-spacing: 0.1em; text-transform: uppercase; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.avbar { flex: 1; height: 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.avbar i { display: block; height: 100%; background: var(--good); transform-origin: left; transition: background 0.3s; }
.avbar i.warn { background: var(--accent-2); }
.avbar i.danger { background: var(--bad); animation: blink 0.4s infinite alternate; }
@keyframes blink { to { opacity: 0.45; } }
.avgap b { font: italic 800 20px/1 var(--display); min-width: 64px; text-align: right; }
.hud-tr { position: absolute; top: 18px; right: 70px; text-align: right; }
.hud-big { font: italic 900 clamp(40px, 6vw, 60px)/1 var(--display); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45); }
.hud-bl { position: absolute; left: 22px; bottom: calc(22px + var(--safe-b)); }
.speed { display: flex; align-items: baseline; gap: 6px; }
.speed span { font: italic 900 48px/1 var(--display); font-variant-numeric: tabular-nums; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45); }
.speed small { font: 700 13px/1 var(--body); color: rgba(255, 255, 255, 0.8); }
.speedbar { width: 160px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.25); margin-top: 6px; overflow: hidden; }
.meter { margin-top: 10px; width: 160px; }
.meter span { display: flex; align-items: center; gap: 6px; font: 700 10px/1 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.8); text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.meter kbd { font-size: 9px; padding: 0 4px; }
.meterbar { height: 7px; border-radius: 7px; background: rgba(255,255,255,0.22); margin-top: 5px; overflow: hidden; }
.meterbar i { display: block; height: 100%; background: linear-gradient(90deg, #7c5cff, #ff4fd8); transform-origin: left; transform: scaleX(0); }
.meter.full .meterbar { box-shadow: 0 0 12px rgba(255, 79, 216, 0.8); }
.meter.on .meterbar i { background: linear-gradient(90deg, #fff, #ff4fd8); }
.speedbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ice), var(--accent)); transform-origin: left; transform: scaleX(0); }
.hud-center { position: absolute; top: 34%; left: 0; right: 0; display: grid; place-items: center; }
.count { font: italic 900 clamp(90px, 18vw, 180px)/1 var(--display); text-transform: uppercase; text-shadow: 0 6px 30px rgba(0, 0, 0, 0.45); animation: countIn 0.5s cubic-bezier(.2, 1.4, .4, 1) both; }
.count.go { color: var(--good); animation: countIn 0.5s cubic-bezier(.2, 1.4, .4, 1) both, fadeOut 0.4s 0.5s forwards; }
.count.finish { color: #fff; font-size: clamp(64px, 12vw, 130px); }
@keyframes countIn { from { transform: scale(1.8); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: scale(0.9); } }
.hud-tricks { position: absolute; left: 0; right: 0; top: 58%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.trick { display: flex; align-items: baseline; gap: 10px; padding: 8px 16px; border-radius: 12px; background: rgba(8, 14, 28, 0.6); animation: trickIn 0.35s cubic-bezier(.2, 1.5, .4, 1) both; transition: opacity 0.4s, transform 0.4s; }
.trick b { font: italic 800 26px/1 var(--display); text-transform: uppercase; }
.trick span { font: italic 800 22px/1 var(--display); color: var(--accent-2); }
.trick em { font-style: normal; color: var(--ice); }
.trick small { color: var(--muted); font-size: 12px; }
.trick.sketchy b { color: #cfd8e6; }
.trick.out { opacity: 0; transform: translateY(-10px); }
@keyframes trickIn { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.hud-popups { position: absolute; top: 120px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pop { font: italic 800 26px/1 var(--display); text-transform: uppercase; padding: 8px 16px; border-radius: 10px; background: rgba(8, 14, 28, 0.6); animation: popUp 1.7s ease forwards; }
.pop.bad { color: #ffb3bd; } .pop.good { color: var(--ice); } .pop.info { color: #fff; font-size: 20px; }
@keyframes popUp { 0% { opacity: 0; transform: translateY(10px) scale(0.9); } 12% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.vignette { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at 50% 45%, rgba(255,255,255,0) 45%, rgba(235,242,250,0.55) 75%, rgba(255,255,255,0.95) 100%); transition: opacity 0.2s; }
.hud-banner { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); text-align: center; opacity: 0; pointer-events: none; }
.hud-banner b { display: block; font: italic 900 30px/1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; text-shadow: 0 2px 12px rgba(0,0,0,0.5); }
.hud-banner span { display: inline-block; margin-top: 6px; padding: 4px 10px; border-radius: 8px; background: rgba(8,14,28,0.55); font: 600 13px/1.3 var(--body); color: var(--ice); }
.hud-banner.show { animation: banner 3.2s ease forwards; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -8px); } 10% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }
.hud-pause { pointer-events: auto; position: absolute; top: 18px; right: 18px; width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(8, 14, 28, 0.5); font-weight: 900; letter-spacing: -1px; }

/* ---------- Touch ---------- */
.t-left, .t-right { position: absolute; bottom: calc(18px + var(--safe-b)); display: flex; gap: 10px; pointer-events: auto; }
.t-left { left: 16px; }
.t-col { display: flex; flex-direction: column; gap: 10px; align-items: center; }
#touch button.boost { background: rgba(124, 92, 255, 0.6); }
.t-right { right: 16px; align-items: flex-end; }
#touch button { width: 76px; height: 76px; border-radius: 22px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(8, 14, 28, 0.45); color: #fff; font: 700 15px/1.1 var(--body); touch-action: none; -webkit-user-select: none; user-select: none; }
#touch .t-left button { width: 84px; height: 84px; font-size: 26px; }
#touch button.sm { width: 62px; height: 62px; font-size: 12px; }
#touch button small { font-size: 10px; color: var(--muted); font-weight: 600; }
#touch button.jump { background: rgba(255, 90, 54, 0.7); border-color: transparent; width: 86px; height: 86px; }
#touch button.on { background: rgba(143, 220, 255, 0.55); }

/* ---------- Toast ---------- */
.toast { padding: 10px 16px; border-radius: 10px; background: rgba(8, 14, 28, 0.9); border: 1px solid var(--line); font-size: 14px; font-weight: 600; animation: toastIn 0.25s ease both; transition: opacity 0.4s, transform 0.4s; }
.toast.bad { border-color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 720px) {
  #ui .screen { padding: 18px 16px 32px; }
  .screen-menu { background: linear-gradient(180deg, rgba(6, 11, 24, 0.55), rgba(6, 11, 24, 0.92) 55%); }
  .menu-wrap { justify-content: flex-end; max-width: none; gap: 18px; }
  .menu-foot { display: none; }
  .btn-big span { font-size: 22px; }
  .hud-tc { top: 84px; width: 60vw; }
  .hud-tr { right: 66px; }
  .speed span { font-size: 36px; }
  .speedbar { width: 110px; }
  .hud-bl { bottom: calc(118px + var(--safe-b)); }
  .res-main { grid-template-columns: 1fr; text-align: center; }
  .res-medal { grid-row: auto; }
  .tbl th:nth-child(4), .tbl td:nth-child(4), .tbl th:nth-child(5), .tbl td:nth-child(5) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
