@font-face { font-family: 'Gabarito'; src: url('./fonts/gabarito.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }
:root {
  --ink: #10233f; --ink2: #183253; --cream: #fff4df; --sun: #ffc93c; --red: #e63946; --sky: #7cc8ff; --blue: #3da5ff; --foe: #ff4d5e; --ok: #3ee07a;
  --panel: rgba(12, 28, 52, 0.74); --line: rgba(255, 255, 255, 0.14);
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: #fff; font-family: 'Gabarito', system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
#cloudFx { position: fixed; inset: 0; background: radial-gradient(ellipse at center, rgba(240, 246, 252, .55), rgba(236, 243, 250, .95)); opacity: 0; pointer-events: none; z-index: 1; }

.btn { border: 0; border-radius: 14px; padding: 12px 20px; font-weight: 800; font-size: 17px; letter-spacing: .01em; min-height: 48px; transition: transform .12s ease, filter .12s ease, background .12s; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.primary { background: linear-gradient(180deg, #ffd96a, #ffb22a); color: #3a2300; box-shadow: 0 4px 0 #c27c00, 0 10px 26px rgba(255, 178, 42, .35); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:disabled { filter: grayscale(.6) brightness(.85); cursor: progress; }
.btn.big { font-size: 24px; padding: 14px 28px; width: 100%; text-transform: uppercase; letter-spacing: .08em; }
.btn.ghost { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .2); }
.btn.ghost:hover { background: rgba(255, 255, 255, .18); }
.btn:focus-visible, .seg button:focus-visible, .mode-card:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* ---------- Menü ---------- */
.screen { position: fixed; inset: 0; z-index: 20; }
.menu-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 1.2s ease; }
body.ready .menu-art { opacity: 0; }
.menu-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10, 24, 46, .9) 0%, rgba(10, 24, 46, .7) 30%, rgba(10, 24, 46, .15) 58%, rgba(10, 24, 46, 0) 75%); pointer-events: none; }
.back { position: absolute; top: calc(14px + var(--st)); right: calc(16px + var(--sr)); color: #fff; text-decoration: none; font-weight: 700; background: rgba(10, 24, 46, .45); padding: 8px 12px; border-radius: 10px; z-index: 2; backdrop-filter: blur(4px); }
.menu-panel { position: absolute; left: calc(4vw + var(--sl)); top: 0; bottom: 0; width: min(520px, 92vw); display: flex; flex-direction: column; gap: 10px; padding: calc(28px + var(--st)) 4px calc(40px + var(--sb)); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; justify-content: safe center; }
.menu-panel::-webkit-scrollbar { display: none; }
.kicker { margin: 0; color: var(--sun); font-weight: 800; text-transform: uppercase; letter-spacing: .14em; font-size: 13px; }
h1 { margin: 0; font-size: clamp(42px, 5vw, 74px); white-space: nowrap; line-height: .88; font-weight: 900; letter-spacing: -.025em; text-transform: uppercase; text-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
h1 span { color: var(--red); -webkit-text-stroke: 0; }
.lede { margin: 2px 0 4px; font-size: 16px; line-height: 1.45; color: #e3eefb; max-width: 44ch; }
.lbl { margin: 6px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: #a9c2e2; font-weight: 800; }
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mode-card { text-align: left; border: 0; border-radius: 14px; padding: 10px 12px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line); display: flex; flex-direction: column; gap: 2px; min-height: 58px; backdrop-filter: blur(6px); transition: box-shadow .15s, background .15s; }
.mode-card b { font-size: 17px; }
.mode-card small { color: #b8cbe5; font-size: 13px; }
.mode-card:hover { background: rgba(24, 50, 83, .85); }
.mode-card.on { box-shadow: inset 0 0 0 2.5px var(--sun); background: rgba(40, 52, 60, .85); }
.mode-card.on b { color: var(--sun); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border-radius: 14px; padding: 6px 6px 6px 14px; backdrop-filter: blur(6px); }
.opt > span { font-weight: 700; color: #cfe0f6; font-size: 15px; }
.seg { display: inline-flex; background: rgba(0, 0, 0, .28); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-weight: 700; font-size: 15px; color: #cfe0f6; min-height: 36px; }
.seg button.on { background: var(--sun); color: #3a2300; }
#play { margin-top: 4px; }
.load { height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; transition: opacity .4s; }
.load i { display: block; height: 100%; width: 0; background: var(--sun); transition: width .3s; }
body.ready .load { opacity: 0; height: 0; margin-top: -10px; }
.menu-row { display: flex; gap: 10px; }
.menu-row .btn { flex: 1; }
.best { margin: 0; color: #cfe0f6; font-size: 14px; min-height: 1em; }
.legal { position: absolute; bottom: calc(10px + var(--sb)); right: calc(16px + var(--sr)); margin: 0; font-size: 13px; color: #e3eefb; z-index: 2; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.legal a { color: inherit; }
.legal a[data-consent-settings]::before { content: '·'; margin: 0 .4em; display: inline-block; }

/* ---------- Dialoge ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(6, 14, 30, .55); padding: 16px; }
.card { background: var(--ink2); border-radius: 22px; padding: 22px; width: min(580px, 100%); max-height: calc(100dvh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); border: 2px solid rgba(255, 255, 255, .08); touch-action: pan-y; }
.card h2 { margin: 0; font-size: 28px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; line-height: 1.45; color: #e3eefb; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.keys h3 { margin: 0 0 4px; font-size: 15px; color: var(--sun); }
.keys p { margin: 0; font-size: 14px; line-height: 1.5; color: #cfe0f6; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 700; flex-wrap: wrap; }
.row input[type=range] { width: 46%; accent-color: var(--sun); }
.muted { color: #b9cbea; margin: 0; }
.small { font-size: 13px; }
.res { text-align: center; }
.res h2 { font-size: 52px; line-height: 1; }
#result.won h2 { color: var(--sun); }
.rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.rows div { background: rgba(0, 0, 0, .22); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column-reverse; gap: 2px; }
.rows b { font-size: 24px; }
.rows span { font-size: 12.5px; color: #b9cbea; }
.rboard table, #board table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rboard th, #board th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #9fb6d6; font-weight: 800; text-align: right; padding: 4px 6px; }
.rboard td, #board td { padding: 5px 6px; text-align: right; border-top: 1px solid rgba(255, 255, 255, .07); font-variant-numeric: tabular-nums; }
.rboard th:first-child, .rboard td:first-child, #board th:first-child, #board td:first-child { text-align: left; }
.rboard th:nth-child(2), .rboard td:nth-child(2), #board th:nth-child(2), #board td:nth-child(2) { text-align: left; color: #b9cbea; }
tr.me td { background: rgba(255, 201, 60, .12); }

/* ---------- Anzeige im Flug ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hc { position: absolute; inset: 0; width: 100%; height: 100%; }
#score { position: absolute; top: calc(10px + var(--st)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); font-variant-numeric: tabular-nums; }
#score .big { font-size: 24px; font-weight: 900; padding: 2px 12px; background: rgba(10, 24, 46, .55); border-radius: 10px; }
#score .dim { font-size: 12px; color: #dbe8f7; }
#score .trow, #score .zrow { display: flex; align-items: center; gap: 10px; }
#score .trow b { font-size: 26px; font-weight: 900; min-width: 40px; text-align: center; padding: 1px 8px; border-radius: 10px; background: rgba(10, 24, 46, .55); }
#score .trow b.t0 { color: var(--blue); }
#score .trow b.t1 { color: var(--foe); }
#score .trow b.me { color: var(--sun); }
.zb { width: min(26vw, 190px); height: 12px; border-radius: 7px; background: rgba(10, 24, 46, .6); overflow: hidden; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); }
.zb i { display: block; height: 100%; transition: width .2s; }
.zb.t0 i { background: var(--blue); margin-left: auto; }
.zb.t0 { display: flex; }
.zb.t1 i { background: var(--foe); }
#radarBox { position: absolute; top: calc(12px + var(--st)); right: calc(12px + var(--sr)); width: 156px; height: 156px; border-radius: 50%; box-shadow: 0 4px 18px rgba(0, 0, 0, .35); }
#radar { width: 100%; height: 100%; display: block; }
#feed { position: absolute; top: calc(178px + var(--st)); right: calc(12px + var(--sr)); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 46vw; }
.fi { background: rgba(10, 24, 46, .62); border-radius: 9px; padding: 4px 9px; font-size: 13.5px; white-space: nowrap; transition: opacity .3s; }
.fi .how { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #ffd98a; margin: 0 5px; font-weight: 800; }
#vitals { position: absolute; left: calc(14px + var(--sl)); bottom: calc(14px + var(--sb)); width: 230px; display: grid; gap: 6px; background: rgba(10, 24, 46, .55); padding: 10px 12px; border-radius: 14px; backdrop-filter: blur(4px); }
.vrow { display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 8px; }
.vl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #b9cbea; font-weight: 800; }
.bar { height: 9px; border-radius: 6px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; border-radius: 6px; transition: width .12s linear; }
.bar.hp i { background: linear-gradient(90deg, #5fe08b, #3ec46e); }
.bar.hp i.low { background: var(--foe); animation: pulse .6s infinite alternate; }
.bar.bo i { background: linear-gradient(90deg, #6fd6ff, #38b6ff); }
.bar.he i { background: linear-gradient(90deg, #ffd96a, #ff8a3b); }
#heat.hot .bar.he i { background: var(--foe); animation: pulse .3s infinite alternate; }
#heat.hot .vl { color: var(--foe); }
#heat.cold .vl { color: #7fe3ff; }
.vrow.buff { grid-template-columns: 62px 1fr 22px; }
.vrow.buff[hidden] { display: none; }
.vrow.buff .vl { white-space: nowrap; }
.vrow.buff b { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
#bf-cold .vl, #bf-cold b { color: #7fe3ff; } #bf-cold .bar i { background: linear-gradient(90deg, #bdf3ff, #38d6ff); }
#bf-agile .vl, #bf-agile b { color: #cfa6ff; } #bf-agile .bar i { background: linear-gradient(90deg, #dcc2ff, #b77bff); }
#bf-power .vl, #bf-power b { color: #ffe07a; } #bf-power .bar i { background: linear-gradient(90deg, #ffe9a0, #ffc21a); }
.vrow.buff.ending .bar i { animation: pulse .35s infinite alternate; }
@keyframes pulse { to { opacity: .45; } }
.vrow.ammo { grid-template-columns: 1fr auto; }
.mis { display: flex; gap: 4px; }
.mis i, .mis s { width: 9px; height: 20px; border-radius: 5px 5px 2px 2px; display: block; }
.mis i { background: #f2efe8; box-shadow: inset 0 -5px 0 var(--red); }
.mis s { background: rgba(255, 255, 255, .15); }
.flare { font-size: 11px; font-weight: 900; letter-spacing: .06em; padding: 3px 7px; border-radius: 7px; background: conic-gradient(rgba(255, 255, 255, .12) calc(var(--p, 0) * 360deg), rgba(255, 201, 60, .35) 0); color: #ffe7a6; }
.flare.ready { background: var(--sun); color: #3a2300; }
#tele { position: absolute; left: 50%; bottom: calc(16px + var(--sb)); transform: translateX(-50%); display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); background: rgba(10, 24, 46, .45); padding: 4px 12px; border-radius: 10px; }
#tele b { font-size: 18px; min-width: 2.6ch; text-align: right; }
#tele small { font-size: 11px; color: #cfe0f6; margin-right: 10px; }
#tele small:last-child { margin-right: 0; }
#toast { position: absolute; left: 50%; top: 29%; transform: translateX(-50%); background: rgba(10, 24, 46, .78); padding: 8px 16px; border-radius: 12px; font-weight: 700; font-size: 15px; white-space: nowrap; }
#banner { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); text-align: center; font-size: clamp(24px, 3.6vw, 40px); font-weight: 900; text-transform: uppercase; letter-spacing: .02em; text-shadow: 0 3px 0 rgba(0, 0, 0, .3), 0 0 22px rgba(0, 0, 0, .35); animation: bannerIn .35s cubic-bezier(.2, 1.4, .4, 1); white-space: nowrap; }
#banner small { display: block; font-size: 15px; font-weight: 700; text-transform: none; letter-spacing: 0; color: #fff4df; margin-top: 2px; }
#banner.kill { color: var(--sun); }
@keyframes bannerIn { from { transform: translateX(-50%) scale(.6); opacity: 0; } }
#dead { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; text-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
#dead b { font-size: clamp(30px, 5vw, 52px); font-weight: 900; text-transform: uppercase; color: var(--foe); }
#dead span { font-size: 18px; }
#dead small { font-size: 15px; color: #e3eefb; margin-top: 6px; }
#board { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, 92vw); background: rgba(10, 24, 46, .88); border-radius: 18px; padding: 14px; }
.tl { position: absolute; top: calc(12px + var(--st)); left: calc(12px + var(--sl)); display: flex; gap: 8px; pointer-events: auto; }
.icon { width: 46px; height: 46px; border-radius: 12px; border: 0; background: rgba(10, 24, 46, .55); display: grid; place-items: center; }
.icon svg { width: 22px; height: 22px; }
#boardBtn { display: none; }

/* ---------- Touch ---------- */
#touch { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
#stickZone { position: absolute; left: 0; top: 70px; bottom: 0; width: 50%; pointer-events: auto; touch-action: none; }
#stick { position: absolute; left: calc(40px + var(--sl)); bottom: calc(40px + var(--sb)); width: 120px; height: 120px; border-radius: 50%; background: rgba(10, 24, 46, .28); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .3); pointer-events: none; opacity: .65; }
#stick.on { opacity: 1; }
#stick i { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 255, 255, .85); box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.tb { position: absolute; pointer-events: auto; touch-action: none; border: 0; border-radius: 50%; width: 66px; height: 66px; display: grid; place-items: center; background: rgba(10, 24, 46, .5); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .35); color: #fff; }
.tb svg { width: 28px; height: 28px; }
.tb.on { background: rgba(255, 201, 60, .85); color: #3a2300; }
.tb.fire { width: 96px; height: 96px; right: calc(26px + var(--sr)); bottom: calc(30px + var(--sb)); background: rgba(230, 57, 70, .55); }
.tb.fire svg { width: 40px; height: 40px; }
.tb.fire.on { background: rgba(255, 90, 90, .9); color: #fff; }
#tMissile { right: calc(136px + var(--sr)); bottom: calc(40px + var(--sb)); }
#tBoost { right: calc(40px + var(--sr)); bottom: calc(140px + var(--sb)); }
#tFlare { right: calc(130px + var(--sr)); bottom: calc(126px + var(--sb)); width: 54px; height: 54px; }
body.touch #vitals { left: calc(12px + var(--sl)); top: calc(66px + var(--st)); bottom: auto; width: 180px; padding: 8px 10px; gap: 4px; }
body.touch .vrow { grid-template-columns: 50px 1fr; }
body.touch #boardBtn { display: grid; }
body.touch #tele { bottom: auto; top: calc(62px + var(--st)); }
body.touch #feed { display: none; }
body.touch #radarBox { width: 118px; height: 118px; }

@media (max-width: 760px), (max-height: 500px) {
  .menu-panel { left: calc(12px + var(--sl)); width: min(480px, calc(100vw - 24px)); gap: 8px; }
  .lede { display: none; }
  h1 { font-size: clamp(42px, 9vw, 64px); }
  .menu-shade { background: linear-gradient(90deg, rgba(10, 24, 46, .92) 0%, rgba(10, 24, 46, .75) 60%, rgba(10, 24, 46, .35) 100%); }
  .keys { grid-template-columns: 1fr; }
  .mode-card { min-height: 50px; padding: 8px 10px; }
  .mode-card small { font-size: 12px; }
}
@media (max-height: 500px) {
  .menu-panel { justify-content: flex-start; padding-top: calc(14px + var(--st)); }
  #radarBox { width: 110px; height: 110px; }
  #score .big { font-size: 20px; }
  #banner { top: 14%; }
}
/* Handy quer: Menü in zwei Spalten, damit Abheben ohne Scrollen sichtbar ist */
@media (max-height: 500px) and (min-width: 620px) {
  .menu-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); column-gap: 18px; row-gap: 7px; align-content: center; width: min(880px, calc(100vw - 190px - var(--sl) - var(--sr))); padding-bottom: calc(14px + var(--sb)); }
  .menu-panel > * { grid-column: 1; min-width: 0; }
  .menu-panel > .kicker { grid-row: 1; }
  .menu-panel > h1 { grid-row: 2; font-size: clamp(30px, 4.5vw, 54px); }
  .menu-panel > h2.lbl:nth-of-type(1) { grid-row: 3; }
  #modes { grid-row: 4 / span 3; align-self: start; }
  .menu-panel > .lede { display: block; grid-column: 2; grid-row: 1 / span 3; align-self: end; margin: 0; font-size: 14px; }
  #skillRow { grid-column: 2; grid-row: 4; }
  #play { grid-column: 2; grid-row: 5; margin-top: 0; }
  .menu-panel > .load { grid-column: 2; grid-row: 6; }
  .menu-panel > .menu-row { grid-column: 2; grid-row: 7; }
  #best { grid-column: 1; grid-row: 7; align-self: center; margin: 0; }
  .btn.big { min-height: 48px; }
}
/* Handy hoch: Menükarten schmaler, HUD oben entzerrt */
@media (max-width: 540px) {
  .tl { gap: 6px; }
  .icon { width: 40px; height: 40px; }
  #radarBox, body.touch #radarBox { width: 92px; height: 92px; }
  #score .trow { gap: 5px; }
  #score .trow b { font-size: 20px; min-width: 30px; padding: 1px 6px; }
  #score .big { font-size: 18px; padding: 2px 8px; }
  #score .dim { font-size: 11px; max-width: 150px; text-align: center; }
  .zb { width: 44px; height: 10px; }
  #tele, body.touch #tele { top: calc(112px + var(--st)); bottom: auto; left: auto; right: calc(12px + var(--sr)); transform: none; padding: 3px 8px; }
  #tele b { font-size: 15px; }
  #tele small { margin-right: 6px; }
  body.touch #vitals { top: calc(60px + var(--st)); width: 160px; }
  #banner { top: 24%; font-size: 26px; white-space: normal; width: 92vw; }
  #toast { top: 33%; white-space: normal; text-align: center; max-width: 86vw; }
}
@media (prefers-reduced-motion: reduce) {
  #banner { animation: none; }
  .menu-art { transition: none; }
}
