/* CHAOS AIR – Flug 404 · chunky cartoon UI, mobile first */
:root {
  --ink: #1b1b2f;
  --sky1: #38b6ff;
  --sky2: #a5e3ff;
  --paper: #fffaf0;
  --yellow: #ffd43b;
  --yellow2: #fab005;
  --blue: #4dabf7;
  --blue2: #1c7ed6;
  --red: #ff5d73;
  --red2: #e03150;
  --green: #51cf66;
  --green2: #2f9e44;
  --purple: #b197fc;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", "Varela Round", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --sh: 0 5px 0 var(--ink);
  --r: 20px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--sky1); color: var(--ink);
  font-family: var(--font); font-weight: 700;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  overscroll-behavior: none;
}
body { position: fixed; inset: 0; }
body.ingame { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hidden { display: none !important; }
kbd { display: inline-block; min-width: 1.5em; padding: 0 .35em; border: 2px solid var(--ink); border-radius: 6px; background: #fff; font: inherit; font-size: .85em; box-shadow: 0 2px 0 var(--ink); text-align: center; }

/* ---------- sky background ---------- */
#sky { position: fixed; inset: 0; background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 100%); overflow: hidden; z-index: 0; }
.cloud { position: absolute; width: 140px; height: 46px; background: #fff; border-radius: 40px; opacity: .85; animation: drift linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 64px; height: 64px; left: 22px; top: -30px; }
.cloud::after { width: 50px; height: 50px; left: 70px; top: -20px; }
.c1 { top: 12%; animation-duration: 38s; animation-delay: -5s; }
.c2 { top: 38%; transform: scale(.7); animation-duration: 52s; animation-delay: -30s; }
.c3 { top: 66%; transform: scale(1.2); animation-duration: 44s; animation-delay: -18s; }
.c4 { top: 85%; transform: scale(.6); animation-duration: 60s; animation-delay: -45s; }
@keyframes drift { from { left: 110%; } to { left: -40%; } }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: none; z-index: 1; }
.screen.active { display: block; }
.scroll {
  position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(24px + var(--sab)) calc(16px + var(--sal));
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.card {
  width: 100%; max-width: 460px; background: var(--paper);
  border: 4px solid var(--ink); border-radius: var(--r); box-shadow: 0 7px 0 var(--ink);
  padding: 18px;
}
h2 { margin: 0 0 10px; font-size: 1.25rem; font-weight: 900; }
.mt { margin-top: 18px; }
.center { text-align: center; }
.lbl { display: block; font-size: .9rem; margin: 0 0 6px; text-transform: uppercase; letter-spacing: .06em; opacity: .75; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; width: 100%; padding: 10px 18px;
  border: 4px solid var(--ink); border-radius: 18px; background: #fff;
  box-shadow: var(--sh); font-weight: 900; font-size: 1.1rem; cursor: pointer;
  transition: transform .06s, box-shadow .06s;
}
.btn:active, .btn.pressed { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn.big { min-height: 64px; font-size: 1.3rem; }
.btn.yellow { background: var(--yellow); }
.btn.blue { background: var(--blue); color: #fff; text-shadow: 0 2px 0 var(--ink); }
.btn.red { background: var(--red); color: #fff; text-shadow: 0 2px 0 var(--ink); }
.btn.ghost { background: transparent; box-shadow: none; border-style: dashed; min-height: 48px; font-size: 1rem; margin-top: 12px; }
.btn.mini { width: 44px; min-height: 44px; height: 44px; padding: 0; border-width: 3px; border-radius: 14px; font-size: 1.2rem; box-shadow: 0 3px 0 var(--ink); }
.btn.mini.muted { opacity: .55; filter: grayscale(1); }
.btn:disabled { opacity: .5; }
.txt {
  width: 100%; min-height: 56px; padding: 10px 16px; border: 4px solid var(--ink); border-radius: 16px;
  font: inherit; font-size: 1.2rem; font-weight: 800; background: #fff; color: var(--ink); outline: none;
  box-shadow: inset 0 4px 0 rgba(0,0,0,.08);
}
.txt:focus { border-color: var(--blue2); }
.txt.code { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-size: 1.5rem; width: 46%; flex: none; }
.joinrow { display: flex; gap: 10px; }
.joinrow .btn { flex: 1; }
.start-card > * + * { margin-top: 14px; }
.or { display: flex; align-items: center; gap: 10px; opacity: .6; font-size: .9rem; }
.or::before, .or::after { content: ""; flex: 1; height: 3px; background: var(--ink); border-radius: 2px; opacity: .3; }
.invite-hint { background: #fff3bf; border: 3px dashed var(--ink); border-radius: 14px; padding: 10px 12px; font-size: .95rem; }
.pulse { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- logo ---------- */
.logo { text-align: center; margin-top: 4px; }
.logo-plane { width: min(240px, 62vw); height: auto; overflow: visible; filter: drop-shadow(0 6px 0 rgba(27,27,47,.35)); }
.plane-wobble { transform-origin: 110px 66px; animation: wobble 2.4s ease-in-out infinite; }
@keyframes wobble { 0%,100% { transform: translateY(0) rotate(-5deg); } 25% { transform: translateY(-7px) rotate(3deg); } 50% { transform: translateY(2px) rotate(-2deg); } 75% { transform: translateY(-4px) rotate(6deg); } }
.plane-eyes { animation: blink 4s infinite; transform-origin: 185px 58px; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.puffs circle { animation: puff 1.2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.puffs circle:nth-child(2) { animation-delay: .5s; }
@keyframes puff { from { opacity: 1; transform: scale(.6); } to { opacity: 0; transform: translateX(-20px) scale(1.4); } }
.logo h1 { margin: 2px 0 0; line-height: .95; }
.logo .l1 {
  display: block; font-size: clamp(2.6rem, 13vw, 4rem); font-weight: 900; color: var(--yellow); letter-spacing: .02em;
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink);
  transform: rotate(-3deg);
}
.logo .l2 {
  display: inline-block; margin-top: 10px; font-size: 1.4rem; background: var(--red); color: #fff;
  border: 4px solid var(--ink); border-radius: 12px; padding: 2px 14px; box-shadow: var(--sh); transform: rotate(2deg);
  text-shadow: 0 2px 0 var(--ink);
}
.tag { margin: 12px 0 0; font-size: 1rem; color: #fff; text-shadow: 0 2px 0 var(--ink); }
.howto ul { margin: 0; padding-left: 1.1em; line-height: 1.4; font-weight: 600; }
.howto li + li { margin-top: 6px; }
.kbd-hint { font-size: .85rem; margin: 12px 0 0; opacity: .8; line-height: 1.8; }
.start-foot { display: flex; gap: 10px; }

/* ---------- lobby ---------- */
.room-code {
  text-align: center; font-size: clamp(3.2rem, 18vw, 4.6rem); font-weight: 900; letter-spacing: .18em; padding-left: .18em;
  color: var(--yellow); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink);
  margin: 0 0 12px; user-select: all; -webkit-user-select: all;
}
.count { font-size: .9rem; background: var(--ink); color: #fff; border-radius: 10px; padding: 2px 8px; vertical-align: middle; }
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plist li { display: flex; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 8px 12px; min-height: 52px; animation: popin .3s; }
.dot { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--ink); flex: none; }
.pn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.1rem; }
.tagc { font-size: .8rem; border: 2px solid var(--ink); border-radius: 8px; padding: 1px 6px; background: var(--yellow); }
.tagc.you { background: var(--blue); color: #fff; }
.note { font-size: .95rem; background: #e7f5ff; border: 3px dashed var(--ink); border-radius: 14px; padding: 10px 12px; margin: 14px 0 0; font-weight: 600; }
.flights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.flight-opt {
  border: 4px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 4px 0 var(--ink);
  min-height: 72px; padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.flight-opt b { font-size: 1.05rem; }
.flight-opt small { font-size: .7rem; opacity: .75; line-height: 1.1; }
.flight-opt.sel { background: var(--green); transform: translateY(2px) rotate(-1deg); box-shadow: 0 2px 0 var(--ink); }
.wait { text-align: center; font-size: 1rem; margin: 14px 0 0; }
.flight-chosen { font-size: 1.1rem; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 10px; }
.dots::after { content: ""; animation: dots 1.5s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@keyframes popin { from { transform: scale(.6); opacity: 0; } }

/* ---------- game ---------- */
#scr-game { background: #222; overflow: hidden; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s; box-shadow: inset 0 0 90px 30px rgba(255, 0, 40, .75); }
#vignette.on { opacity: 1; animation: vig 1s ease-in-out infinite; }
@keyframes vig { 50% { opacity: .35; } }
#flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
#flash.light { animation: flashL .5s; background: #fff; }
#flash.hit { animation: flashL .45s; background: rgba(255, 50, 50, .7); }
@keyframes flashL { 0% { opacity: .9; } 30% { opacity: .2; } 45% { opacity: .7; } 100% { opacity: 0; } }

#joyzone { position: absolute; left: 0; top: 0; bottom: 0; width: 55%; touch-action: none; z-index: 3; }
#joy-hint {
  position: absolute; left: calc(24px + var(--sal)); bottom: calc(40px + var(--sab)); padding: 10px 14px;
  border: 3px dashed rgba(255,255,255,.8); border-radius: 18px; color: #fff; text-shadow: 0 2px 0 var(--ink);
  font-size: .9rem; text-align: center; pointer-events: none; transition: opacity .5s;
  animation: pulse 1.6s ease-in-out infinite;
}
#joy-hint.gone { opacity: 0; animation: none; }
#joy { position: fixed; left: 0; top: 0; width: 140px; height: 140px; border-radius: 50%; z-index: 4; pointer-events: none;
  background: rgba(255,255,255,.18); border: 4px solid rgba(255,255,255,.85); box-shadow: 0 0 0 4px rgba(27,27,47,.35); }
#joy-knob { position: absolute; left: 38px; top: 38px; width: 56px; height: 56px; border-radius: 50%; background: var(--yellow); border: 4px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }

#hud { position: absolute; inset: 0; pointer-events: none; z-index: 5;
  padding: calc(8px + var(--sat)) calc(8px + var(--sar)) 0 calc(8px + var(--sal)); }
#hud button { pointer-events: auto; }
.hud-row1 { display: flex; gap: 6px; align-items: stretch; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 4px 9px; box-shadow: 0 3px 0 var(--ink);
  font-size: .9rem; min-height: 36px;
}
.pill.dest b { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.pill.belt { opacity: .7; }
.pill.belt.on { background: var(--yellow); opacity: 1; animation: pulse 1s infinite; }
.hpbar { flex: 1; min-width: 70px; position: relative; background: #fff; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: 0 3px 0 var(--ink); min-height: 36px; }
.hpbar .fill { position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--green); transition: width .3s, background .3s; border-right: 3px solid var(--ink); }
.hplbl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .9rem; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.hud-left { position: absolute; left: calc(8px + var(--sal)); top: calc(54px + var(--sat)); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 58%; }
.role-badge { color: #fff; text-shadow: 0 2px 0 var(--ink); border: 3px solid var(--ink); border-radius: 14px; padding: 4px 10px; font-size: .95rem; box-shadow: 0 3px 0 var(--ink); }
.pill.item { font-size: .85rem; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 2px 8px; font-size: .78rem; box-shadow: 0 2px 0 var(--ink); white-space: nowrap; animation: popin .25s; }
.chip.ev { background: var(--yellow); }
.chip.bad { background: var(--red); color: #fff; text-shadow: 0 1px 0 var(--ink); }
.chip.good { background: var(--green); }
.chip.funk { background: var(--blue); color: #fff; text-shadow: 0 1px 0 var(--ink); font-size: .9rem; }
.blink { animation: blink2 .7s steps(2) infinite; }
@keyframes blink2 { 50% { background: var(--red); transform: scale(1.06); } }
.hud-right { position: absolute; right: calc(8px + var(--sar)); top: calc(54px + var(--sat)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#radar-mini { width: 120px; height: 72px; border: 3px solid var(--ink); border-radius: 12px; background: #0b3d2e; box-shadow: 0 3px 0 var(--ink); }
.hud-tools { display: flex; gap: 6px; }
.hud-tools .btn.mini { width: 38px; height: 38px; min-height: 38px; font-size: 1rem; border-radius: 12px; }

/* controls */
#controls { position: absolute; right: calc(10px + var(--sar)); bottom: calc(12px + var(--sab)); width: 236px; height: 214px; z-index: 6; pointer-events: none; }
.cbtn {
  position: absolute; pointer-events: auto; touch-action: none; cursor: pointer;
  border: 4px solid var(--ink); border-radius: 50%; background: #fff; box-shadow: 0 5px 0 var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; padding: 0;
  transition: transform .05s, box-shadow .05s;
}
.cbtn.pressed { transform: translateY(4px) scale(.97); box-shadow: 0 1px 0 var(--ink); }
.cbtn small { font-size: .62rem; margin-top: 2px; font-weight: 900; }
.cbtn.act { right: 0; bottom: 0; width: 120px; height: 120px; background: var(--yellow);
  background-image: conic-gradient(rgba(47,158,68,.85) calc(var(--pr, 0) * 360deg), transparent 0); }
.cbtn.act .act-ico { font-size: 2.3rem; }
.cbtn.act .act-lbl { font-size: .82rem; max-width: 100px; text-align: center; line-height: 1.05; margin-top: 4px; }
.cbtn.act.off { background: #ced4da; color: #555; }
.cbtn.act.off .act-ico { opacity: .45; }
.cbtn.act.pulse { animation: actpulse .8s ease-in-out infinite; background-color: var(--red); color: #fff; text-shadow: 0 2px 0 var(--ink); }
@keyframes actpulse { 50% { transform: scale(1.09); box-shadow: 0 5px 0 var(--ink), 0 0 0 10px rgba(255,93,115,.45); } }
.cbtn.ability { right: 128px; bottom: 54px; width: 78px; height: 78px; background: var(--blue); color: #fff; text-shadow: 0 2px 0 var(--ink); overflow: hidden; }
.cbtn.ability::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(rgba(27,27,47,.6) calc(var(--cd, 0) * 360deg), transparent 0); pointer-events: none; }
.cbtn.ability .ab-ico { font-size: 1.7rem; }
.cbtn.ability .ab-name { font-size: .55rem; max-width: 70px; text-align: center; }
.cbtn.ability .ab-cd { position: absolute; z-index: 1; font-size: 1.6rem; }
.cbtn.ability.cooling .ab-ico, .cbtn.ability.cooling .ab-name { opacity: .4; }
.cbtn.drop { right: 30px; bottom: 132px; width: 62px; height: 62px; background: #fff; font-size: 1.4rem; }
.cbtn.emote { right: 172px; bottom: 140px; width: 58px; height: 58px; font-size: 1.5rem; background: #fff; }
#emote-menu { position: absolute; right: calc(12px + var(--sar)); bottom: calc(236px + var(--sab)); z-index: 8; display: grid; gap: 6px; width: min(240px, 70vw); }
.em-btn { pointer-events: auto; text-align: left; border: 3px solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 0 3px 0 var(--ink); min-height: 46px; padding: 6px 10px; font-size: .95rem; cursor: pointer; animation: popin .15s; }
.em-btn kbd { font-size: .75rem; margin-right: 4px; }

/* pilot overlay */
#scr-game.piloting #controls, #scr-game.piloting #joyzone, #scr-game.piloting #joy, #scr-game.piloting .hud-right canvas { display: none; }
#pilot { position: absolute; inset: 0; z-index: 7; display: flex; align-items: flex-end; justify-content: center;
  padding: 0 calc(10px + var(--sar)) calc(12px + var(--sab)) calc(10px + var(--sal)); pointer-events: none; }
.pilot-panel { pointer-events: auto; width: 100%; max-width: 640px; background: rgba(255,250,240,.95); border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 var(--ink); padding: 10px; animation: popin .25s; }
.pilot-title { font-size: 1.2rem; font-weight: 900; text-align: center; }
.pilot-hint { text-align: center; font-size: .95rem; margin: 4px 0 8px; }
#pilot.landing .pilot-hint { background: var(--green); border: 3px solid var(--ink); border-radius: 12px; padding: 4px; animation: pulse 1s infinite; }
.pilot-body { display: flex; gap: 10px; align-items: stretch; }
#radar-big { flex: 1; min-width: 0; height: 210px; border: 4px solid var(--ink); border-radius: 16px; background: #0b3d2e; }
.pilot-btns { display: flex; flex-direction: column; gap: 10px; }
.cbtn.lane { position: relative; width: 96px; height: 100px; border-radius: 22px; font-size: 2.6rem; background: var(--yellow); }
.pilot-foot { display: flex; gap: 10px; margin-top: 10px; }
.pilot-foot .btn { min-height: 52px; font-size: 1rem; }

/* banners & toasts */
.banner {
  position: absolute; left: 50%; top: 52%; z-index: 9; transform: translate(-50%, -50%) rotate(-2deg);
  width: min(92vw, 520px); text-align: center; pointer-events: none;
  background: var(--yellow); border: 5px solid var(--ink); border-radius: 22px; box-shadow: 0 8px 0 var(--ink); padding: 14px 16px;
}
.banner.show { animation: bannerIn .45s cubic-bezier(.2, 1.6, .4, 1); }
.banner.belt { background: var(--blue); color: #fff; text-shadow: 0 2px 0 var(--ink); }
.banner.ev-gewitter, .banner.ev-feuer, .banner.ev-vogelschlag, .banner.ev-turbulenz { background: var(--red); color: #fff; text-shadow: 0 2px 0 var(--ink); }
.b-title { font-size: clamp(1.4rem, 7vw, 2.2rem); font-weight: 900; line-height: 1.05; }
.b-text { font-size: 1rem; margin-top: 6px; font-weight: 700; }
@keyframes bannerIn { from { transform: translate(-50%, -50%) scale(.3) rotate(-12deg); opacity: 0; } }
.announce {
  position: absolute; left: 50%; top: calc(100px + var(--sat)); z-index: 9; transform: translateX(-50%);
  width: min(94vw, 560px); display: flex; gap: 10px; align-items: center; pointer-events: none;
  background: #fff; border: 4px solid var(--ink); border-radius: 20px; box-shadow: 0 6px 0 var(--ink); padding: 10px 14px;
}
.announce.show { animation: slideDown .4s cubic-bezier(.2, 1.5, .4, 1); }
.announce .mic { font-size: 2.2rem; animation: wob .5s ease-in-out infinite alternate; }
@keyframes wob { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
.a-who { font-size: .8rem; text-transform: uppercase; opacity: .7; }
.a-text { font-size: 1rem; line-height: 1.25; }
@keyframes slideDown { from { transform: translate(-50%, -120%); } }
#toasts { position: absolute; left: 50%; top: calc(236px + var(--sat)); transform: translateX(-50%); z-index: 9; width: min(88vw, 440px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: #fff; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); padding: 7px 12px; font-size: .95rem; text-align: center; animation: popin .25s; transition: opacity .4s, transform .4s; }
.toast.good { background: var(--green); }
.toast.bad { background: var(--red); color: #fff; text-shadow: 0 1px 0 var(--ink); }
.toast.info { background: var(--paper); }
.toast.out { opacity: 0; transform: translateY(-12px); }

/* lottery */
#lottery { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: rgba(27,27,47,.55);
  padding: calc(10px + var(--sat)) calc(10px + var(--sar)) calc(10px + var(--sab)) calc(10px + var(--sal)); overflow-y: auto; }
.lot-card { text-align: center; max-height: 100%; overflow-y: auto; animation: popin .3s; }
.lot-head { font-size: 1.2rem; font-weight: 900; }
.lot-reel { display: inline-flex; margin: 10px auto 6px; padding: 6px; border: 4px solid var(--ink); border-radius: 22px; background: linear-gradient(#fff3bf, #ffe066); box-shadow: inset 0 6px 0 rgba(0,0,0,.1), 0 4px 0 var(--ink); }
#lottery:not(.done) .lot-reel { animation: reel .12s linear infinite; }
@keyframes reel { 50% { transform: translateY(2px); } }
#lottery.done .lot-reel { animation: popin .4s cubic-bezier(.2, 1.8, .4, 1); }
.lot-role { font-size: clamp(1.6rem, 8vw, 2.2rem); font-weight: 900; -webkit-text-stroke: 1px var(--ink); }
.lot-desc { margin: 6px 0; font-weight: 600; }
.lot-ab { background: #e7f5ff; border: 3px solid var(--ink); border-radius: 14px; padding: 8px; font-size: .95rem; }
.lot-ab span { font-weight: 600; }
.lot-seat { margin: 10px 0 4px; font-size: 1.05rem; background: var(--yellow); display: inline-block; border: 3px solid var(--ink); border-radius: 12px; padding: 4px 10px; transform: rotate(-1deg); }
.crew { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; text-align: left; }
.crew li { display: flex; align-items: center; gap: 8px; background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 4px 8px; }
.crew canvas { flex: none; border-radius: 50%; border: 2px solid var(--ink); background: #e7f5ff; }
.crew b { display: block; font-size: .9rem; text-shadow: 0 1px 0 rgba(27,27,47,.35); }
.crew small { display: block; font-size: .75rem; opacity: .85; font-weight: 600; }

/* end */
.end-card { text-align: center; }
.end-dest { font-size: 1.2rem; }
#scr-end.crashed .end-card { background: #fff0f0; }
.stars { display: flex; justify-content: center; gap: 4px; margin: 10px 0; min-height: 64px; }
.star { font-size: clamp(2.6rem, 13vw, 3.6rem); color: #dee2e6; -webkit-text-stroke: 3px var(--ink); line-height: 1; transform: scale(.4); opacity: .4; display: inline-block; }
.star.on { color: var(--yellow); animation: starpop .5s cubic-bezier(.2, 2, .4, 1) forwards; }
.star.dud { animation: stardud .4s forwards; }
@keyframes starpop { from { transform: scale(.2) rotate(-90deg); opacity: 1; } to { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes stardud { to { transform: scale(.85); opacity: 1; } }
.end-title { font-size: 1.6rem; margin: 6px 0; }
.end-text { margin: 0 0 12px; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 6px; }
.stat { background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.stat span { font-size: .75rem; }
.stat b { font-size: 1.3rem; }
.awards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.awards li { display: flex; gap: 10px; align-items: center; background: #fff3bf; border: 3px solid var(--ink); border-radius: 14px; padding: 8px 10px; animation: popin .4s; }
.aw-icon { font-size: 2rem; }
.awards b { display: block; }
.aw-name { display: block; font-size: .9rem; color: var(--blue2); }
.awards small { display: block; font-weight: 600; font-size: .8rem; }
.awards .empty { justify-content: center; background: #fff; }
.end-card .btn.big { margin-top: 16px; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(27,27,47,.7); }
.overlay .card { text-align: center; animation: popin .3s; }
.big-emoji { font-size: 3.5rem; }
.err {
  position: fixed; left: 50%; top: calc(14px + var(--sat)); transform: translateX(-50%); z-index: 60; width: min(92vw, 440px);
  background: var(--red); color: #fff; text-shadow: 0 2px 0 var(--ink); text-align: center; padding: 12px 14px;
  border: 4px solid var(--ink); border-radius: 16px; box-shadow: 0 5px 0 var(--ink); font-size: 1rem;
}
.err.pop { animation: errin .4s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes errin { from { transform: translate(-50%, -150%); } }
.ping { position: fixed; left: calc(6px + var(--sal)); bottom: calc(4px + var(--sab)); z-index: 40; font-size: .7rem; color: #fff; text-shadow: 0 1px 0 var(--ink), 0 0 3px var(--ink); pointer-events: none; }
.ping.bad { color: #ffc9c9; }

/* ---------- responsive ---------- */
@media (max-width: 380px) {
  .pill { padding: 3px 6px; font-size: .8rem; }
  #controls { transform: scale(.92); transform-origin: right bottom; }
}
/* landscape phones: short height */
@media (max-height: 520px) and (orientation: landscape) {
  .scroll { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
  .logo { width: 100%; display: flex; align-items: center; justify-content: center; gap: 16px; }
  .logo-plane { width: 130px; }
  .logo .l1 { font-size: 2.4rem; }
  .logo .l2 { font-size: 1rem; margin-top: 4px; }
  .tag { display: none; }
  .card { max-width: 420px; padding: 14px; }
  .room-code { font-size: 3rem; margin-bottom: 6px; }
  .hud-left { top: calc(50px + var(--sat)); }
  .hud-right { top: calc(50px + var(--sat)); }
  #radar-mini { width: 108px; height: 60px; }
  #controls { transform: scale(.82); transform-origin: right bottom; }
  #emote-menu { bottom: calc(190px + var(--sab)); grid-template-columns: 1fr 1fr; width: min(360px, 60vw); }
  #joyzone { width: 50%; }
  .banner { top: 45%; padding: 8px 14px; }
  .announce { top: calc(50px + var(--sat)); }
  #toasts { top: auto; bottom: calc(10px + var(--sab)); flex-direction: column-reverse; width: min(42vw, 380px); }
  .toast { font-size: .85rem; padding: 5px 10px; }
  .pilot-panel { padding: 6px 10px; }
  .pilot-title { display: none; }
  #radar-big { height: calc(100vh - 200px); min-height: 110px; max-height: 220px; }
  .cbtn.lane { width: 84px; height: calc((100vh - 220px) / 2); min-height: 56px; max-height: 100px; }
  .pilot-foot { margin-top: 6px; }
  .pilot-foot .btn { min-height: 46px; }
  .lot-card { max-width: 640px; }
  .lot-reel { margin: 4px auto; }
}
@media (max-height: 380px) and (orientation: landscape) {
  #controls { transform: scale(.7); }
  .hud-left .chips .chip { font-size: .7rem; }
}
/* desktop */
@media (hover: hover) and (pointer: fine) {
  #joy-hint { display: none; }
  .btn:hover { filter: brightness(1.06); }
  .flight-opt:hover { filter: brightness(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
