@font-face {
  font-family:"Barlow Condensed";
  src:url("assets/BarlowCondensed-Bold.ttf") format("truetype");
  font-weight:700 900;
  font-display:swap;
}
#game, #playcontrols { touch-action:none; }
#handsalways,#camera,#connectcam,#calibrate,#camoff,#camview,#handcursor { display:none!important; }
#home .intro {
  box-sizing:border-box; left:6%; right:5%; top:clamp(72px,18dvh,180px);
  max-width:35rem; padding:0; background:transparent;
}
#home {
  background:linear-gradient(90deg,#faf9f5f7 5%,#faf9f5ef 46%,#faf9f594 69%,#faf9f508 91%);
}
#home :is(.hint,.subtitle,.intro p) { width:fit-content; max-width:min(65vw,340px); }
#home .intro p { font:500 clamp(13px,3.5vw,17px)/1.4 Arial,sans-serif; color:#13282e; }
#home button,#skip,#score-now { font-family:"Barlow Condensed",Arial,sans-serif; }
#music-prompt {
  box-sizing:border-box; width:min(316px,88vw); margin:auto; padding:24px;
  color:#142a32; background:#faf8ee; border:2px solid #142a32;
  box-shadow:5px 5px 0 #1687ab; text-align:center;
}
#music-prompt::backdrop { background:rgba(13,32,41,.58); }
#music-prompt h2 { font:800 32px/1.05 "Barlow Condensed",Arial,sans-serif; margin:0 0 18px; }
#music-prompt button { display:block; width:100%; min-height:44px; margin:0; }
#music-prompt #silent-entry {
  margin-top:8px; background:transparent; color:#283e46; box-shadow:none; border:0;
}
#home h1 {
  width:fit-content; margin:clamp(12px,2vh,24px) 0;
  font:800 clamp(52px,min(23vw,12dvh),128px)/.86 "Barlow Condensed","Arial Narrow",sans-serif;
  letter-spacing:-.035em; transform-origin:bottom left;
}
#home .hint { font:700 clamp(12px,3vw,16px)/1.35 Arial,sans-serif; letter-spacing:0; max-width:34ch; }
#save-game { margin-top:9px; padding:9px 14px; min-height:44px; font-family:Arial,sans-serif; }
:root { --reach:7dvh; --thumb-bottom:max(10px,env(safe-area-inset-bottom),min(var(--reach),140px)); }
:root[data-reach="low"] { --reach:3dvh; }
:root[data-reach="high"] { --reach:13dvh; }
#height-setting {
  position:absolute; top:calc(100% + 8px); right:0; display:flex; gap:10px; align-items:center;
  background:#17323f; border:1px solid #b6d3dc; padding:4px 6px 4px 12px;
  font:700 15px "Barlow Condensed",Arial,sans-serif; color:white;
}
#thumb-height { min-height:44px; padding:4px 8px; font:inherit; color:#13282e; background:#fffcf3; }
#playcontrols {
  position:absolute; left:max(clamp(18px,5vw,32px),env(safe-area-inset-left)); right:max(clamp(18px,5vw,32px),env(safe-area-inset-right));
  bottom:var(--thumb-bottom); width:auto; max-width:none; height:96px;
  display:block; pointer-events:none; user-select:none; -webkit-user-select:none;
  --ice:#c6f6ff; --ice-edge:#e4faffc9;
}
#playcontrols #steer, #playcontrols button {
  pointer-events:auto; touch-action:none; -webkit-touch-callout:none; -webkit-tap-highlight-color:transparent;
}
#steer {
  position:absolute; bottom:0; left:29%; width:clamp(132px,42vw,210px); height:81px;
  transform:translateX(-50%);
  display:flex; align-items:center; justify-content:center;
}
.steer-glass {
  position:relative; width:80px; height:80px; border-radius:50%;
  background:radial-gradient(circle,#31596b44 30%,#32506459 33%,#41627430 64%,#bde4eb66 67%);
  border:1px solid #ecffffd9; box-shadow:0 0 0 1px #17384866,inset 0 0 0 3px #d4f3f777,0 2px 7px #13314233;
  -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px);
}
.steer-glass::before {
  content:""; position:absolute; inset:50% 22px auto; height:2px; border-radius:2px;
  background:linear-gradient(90deg,transparent,#e0f9fbcc 30% 70%,transparent);
  box-shadow:0 1px 1px #21495742;
}
.steer-grip {
  position:absolute; left:50%; top:50%; width:38px; height:38px; border-radius:50%;
  transform:translate(calc(-50% + var(--offset,0px)),-50%);
  background:linear-gradient(145deg,#f4ffffff,#d5e8e9ed 56%,#a3c7cde8);
  border:1px solid #ffffffd6; box-shadow:0 2px 6px #12384a52,inset 0 -2px 3px #486c7b38;
  display:grid; place-items:center; transition:transform .16s ease-out;
}
.steer-grip i {
  width:13px; height:12px; border-radius:3px;
  background:repeating-linear-gradient(90deg,#416879bd 0 2px,transparent 2px 5px);
}
#steer.pressed .steer-grip { transition:none; background:linear-gradient(145deg,#f1ffff,#9de6ed); }
#steer.pressed .steer-glass {
  position:absolute; left:var(--contact-x); top:var(--contact-y);
  transform:translate(-50%,-50%); pointer-events:none;
}
#playcontrols #blast,#playcontrols #nova {
  position:absolute; box-sizing:border-box; padding:0; min-width:0; min-height:0; margin:0;
  border:1px solid var(--ice-edge); border-radius:50%; color:#f6ffff;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  background:radial-gradient(circle at 45% 36%,#385c6dc9,#1d3c4dd9 70%);
  box-shadow:inset 0 1px 2px #fff6,0 2px 8px #17374845;
  -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px);
  font:700 12px/1 "Barlow Condensed",Arial,sans-serif; letter-spacing:.11em;
  transform:none; transition:transform .09s,box-shadow .12s;
}
#playcontrols #blast { left:calc(68% - 37px); bottom:0; width:74px; height:74px; }
#playcontrols #nova { left:calc(68% + clamp(38px,12vw,58px) - 27px); bottom:64px; width:54px; height:54px; gap:2px; font-size:10px; }
.flight-action::after {
  content:""; position:absolute; inset:4px; border:1px solid #b6e6f15e; border-radius:50%; pointer-events:none;
}
#nova::after {
  border:0; background:conic-gradient(from -90deg,#b5f2fb var(--charge,0%),#b6e6f133 0);
  -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 2px),black calc(100% - 1.5px));
  mask:radial-gradient(farthest-side,transparent calc(100% - 2px),black calc(100% - 1.5px));
}
.bolt {
  display:block; width:24px; height:27px; background:linear-gradient(160deg,white 40%,#99e7f5);
  clip-path:polygon(57% 0,96% 0,62% 39%,88% 39%,19% 100%,37% 56%,10% 56%);
}
.spark {
  display:block; width:21px; height:21px; background:#d6f8ff;
  clip-path:polygon(50% 0,62% 34%,86% 15%,68% 40%,100% 50%,67% 60%,83% 84%,59% 69%,50% 100%,40% 67%,15% 84%,32% 59%,0 50%,34% 40%,16% 16%,40% 33%);
}
#playcontrols #nova.ready { color:#fff4c5; background:linear-gradient(145deg,#676350ef,#443e35eb 65%,#322e2b); box-shadow:0 0 0 1px #fce0a6c4,0 0 10px #efbe6c77; }
#nova.ready::after,#nova.ready .spark { background:#ffdf8a; }
#playcontrols #blast.pressed,#playcontrols #nova:active { transform:scale(.94); box-shadow:inset 0 0 14px #67d8fb96,0 0 0 2px #b6f2ffc2; }
@media (prefers-reduced-motion:reduce) {
  .steer-grip,#playcontrols #blast,#playcontrols #nova { transition:none; }
}
#aimstatus { bottom:max(6px,calc(var(--thumb-bottom) - 29px)); }
#boss-instruction {
  position:absolute; z-index:4; top:max(98px,20dvh); left:50%; transform:translateX(-50%);
  width:max-content; max-width:88%; padding:7px 12px; text-align:center; pointer-events:none;
  color:#f1fcff; background:#132e3bed; border:1px solid #b9deea;
  font:700 clamp(13px,3.5vw,18px)/1.15 "Barlow Condensed",sans-serif; letter-spacing:.06em;
}
#hud .hudbox #phone-hp { display:inline; font:700 12px/1 Arial,sans-serif; letter-spacing:0; }
#boss-instruction b { display:block; font-size:15px; }
.acid-meter { height:5px; background:#566a73; margin:3px 0 5px; min-width:140px; }
#acid-fill { display:block; height:100%; background:#f4b658; }
#dialogue,#aimstatus,#stagebubble { pointer-events:none; }
#install-panel { width:min(92vw,420px); max-height:85vh; overflow:auto; background:#fffcf3; color:#13282e; border:3px solid; padding:20px; font-family:Arial,sans-serif; }
#install-panel::backdrop { background:#11242bd9; }
#install-panel p { font-size:15px; line-height:1.4; }
#install-panel button { margin:4px 8px 6px 0; }
#cinema > div:last-child { gap:8px; bottom:max(14px,env(safe-area-inset-bottom)); }
#cinema > div:last-child button { min-height:44px; padding:7px 12px; }
#cliplabel { flex:1; }
#cinema #clip[src$="victory-dream23.mp4"] { border:0; box-shadow:none; }
@media (orientation:portrait) {
  #cinema {
    display:grid; box-sizing:border-box; align-content:center; justify-items:stretch; align-items:center;
    padding:12px 4vw 62px; grid-template-columns:64px 1fr; gap:12px 16px;
  }
  #cinema #cinemastage { position:relative; inset:auto; grid-column:1/-1; grid-row:1; justify-self:start; max-width:95%; }
  #cinema #clip { grid-column:1/-1; grid-row:2; height:auto; aspect-ratio:16/9; border:2px solid #173949; background:#fff; }
  #cinema #comicbook { position:relative; inset:auto; width:64px; grid-column:1; grid-row:3; }
  #comicbook figcaption { display:none; }
  #cinema #cinematalk { position:relative; inset:auto!important; width:auto!important; max-width:none!important; grid-column:2; grid-row:3; }
  #cinema #cinemareward { position:relative; inset:auto; grid-column:1/-1; grid-row:4; }
}
@media(max-height:600px) {
  #home .intro { top:82px; }
  #home h1 { font-size:clamp(36px,10dvh,61px); margin:5px 0 8px; }
  #home .intro p { margin:5px 0; } #home .bottom { bottom:4px; padding:5px 0; }
  #home .hint { margin-top:4px; }
}
@media(orientation:landscape) and (max-height:550px) {
  #home .intro { top:70px; bottom:40px; overflow:auto; padding:0 8px; }
  #home .actions { display:inline-flex; vertical-align:middle; }
  #save-game { margin:0 0 0 10px; vertical-align:middle; }
  :root { --reach:5dvh; }
  :root[data-reach="low"] { --reach:3dvh; }
  :root[data-reach="high"] { --reach:10dvh; }
  #steer { height:58px; width:min(32vw,240px); }
  .steer-glass { width:62px; height:62px; }
  #playcontrols #nova { bottom:58px; }
  #cinematalk,#cinema #comicbook { display:none; }
  #cinema #cinemastage { top:12px; font-size:14px; padding:6px 10px; }
}

body:has(#hud:not([hidden])), body:has(#hud:not([hidden])) * {
  -webkit-user-select:none; user-select:none; -webkit-touch-callout:none;
}
#steer *, .flight-action > * { pointer-events:none; }
#phone-install { display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; }
#home .actions:has(#apk-link:not([hidden])) {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; width:min(100%,380px); max-width:none;
}
#home .actions:has(#apk-link:not([hidden])) :is(#start,#apk-link) {
  display:grid; place-content:center; padding:10px 6px; min-height:50px;
  box-sizing:border-box; border:2px solid #142e36; box-shadow:3px 3px 0 #142e36;
  font:700 clamp(16px,4.2vw,21px)/1 "Barlow Condensed",sans-serif; text-decoration:none;
}
#home .actions:has(#apk-link:not([hidden])) #start { display:block; }
#apk-link { background:#ffd466; color:#142e36; }
#apk-link:focus-visible { outline:3px solid #087fb6; outline-offset:4px; }
#install-steps { padding-left:1.5em; font:600 15px/1.5 Arial,sans-serif; }
#install-steps li { padding:4px 0; }
#install-steps:empty { display:none; }
#install-panel.ios-guide {
  width:min(92vw,410px); max-height:88dvh; padding:0; border:2px solid #15333c;
  background:#fffaf0; box-shadow:4px 5px 0 #167ba1; text-align:left;
  font-family:system-ui,sans-serif; overscroll-behavior:contain; touch-action:pan-y;
}
.ios-guide #install-title, .ios-guide #install-detail {
  background:#15333c; color:#fffaf0; margin:0; padding-inline:18px;
}
.ios-guide #install-title {
  padding-top:16px; font:700 clamp(26px,7.6vw,34px)/1.1 "Barlow Condensed",sans-serif;
}
#install-panel.ios-guide #install-detail {
  padding-block:4px 14px; border-bottom:3px solid #28bbdb; font-size:14px; color:#d5ebec;
}
.ios-guide #install-steps { margin:0 16px; padding:0; list-style:none; counter-reset:instruction; }
.ios-guide #install-steps li {
  counter-increment:instruction; display:grid; grid-template-columns:22px minmax(0,1fr) 35px;
  align-items:center; gap:10px; padding:12px 0; border-bottom:1px solid #d4d9d1;
}
.ios-guide #install-steps li::before {
  content:counter(instruction); align-self:start; text-align:center; background:#d7edf0; color:#174655;
  border-radius:50%; font:700 13px/22px system-ui,sans-serif;
}
.ios-guide #install-steps strong { display:block; font:700 17px/1.2 system-ui,sans-serif; }
.ios-guide #install-steps div > span { display:block; margin-top:4px; font:400 14px/1.35 system-ui,sans-serif; }
.ios-symbol { width:30px; height:30px; justify-self:center; fill:none; stroke:#09658a; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.ios-add { color:#09658a; text-align:center; font:650 16px/1.2 system-ui,sans-serif; }
#install-panel.ios-guide #close-install {
  display:block; min-height:44px; margin:3px 9px 3px auto; padding:8px 12px;
  border:0; box-shadow:none; background:transparent; color:#18566b; font:700 14px/1.2 system-ui,sans-serif;
}
@media (max-height:570px) {
  #install-panel.ios-guide { max-height:94dvh; max-width:96vw; }
  .ios-guide #install-steps { margin-inline:12px; }
  .ios-guide #install-steps li { gap:7px; padding-block:8px; }
  .ios-guide #install-title { padding-top:10px; }
  #install-panel.ios-guide #install-detail { padding-bottom:9px; }
}
#end .card { max-height: 91dvh; overflow: auto; overscroll-behavior: contain; }
#name-form { display: grid; gap: .65rem; margin: 1rem 0; text-align: left; }
#name-form[hidden], #mobile-board[hidden] { display: none; }
#name-form label, #mobile-board h3 { font: bold 1.35rem 'Barlow Condensed', sans-serif; }
#pilot-name { box-sizing: border-box; width: 100%; padding: .7rem; font: 1.05rem system-ui; border: 2px solid #233a40; background: #fffcf2; color: #102a32; }
#end.show-board {
  display:block; padding:0; overflow:auto; overscroll-behavior:contain; background:#f6f2e7;
  color:#102e37; touch-action:pan-y;
}
#end.show-board .card {
  display:grid; grid-template-columns:1fr 1fr; grid-template-rows:1fr auto; gap:12px;
  width:100%; min-height:100%; max-width:760px; max-height:none; margin:auto; box-sizing:border-box;
  padding:0 max(18px,env(safe-area-inset-right)) max(18px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left));
  background:transparent; border:0; box-shadow:none; overflow:visible;
}
#end.show-board :is(#endlabel,#endtitle) { display:none; }
#end.show-board :is(#retry,#back) { margin:0; min-width:0; min-height:48px; font:700 19px/1 "Barlow Condensed",sans-serif; }
#mobile-board { grid-column:1/-1; min-width:0; text-align:left; }
.board-banner {
  position:relative; isolation:isolate; overflow:hidden; margin:0 -18px;
  padding:max(32px,env(safe-area-inset-top)) 18px 22px; background:#123641; color:#fff9e9;
  border-bottom:6px solid #16b6d5;
}
.board-banner::before {
  content:""; position:absolute; z-index:-1; inset:0;
  background:linear-gradient(90deg,#102f39 5%,#102f39b0),url("assets/singapore-cbd-ink.webp") center 46% / cover;
  opacity:.7;
}
#mobile-board small { display:block; font:700 11px/1.3 Arial,sans-serif; letter-spacing:.16em; }
#mobile-board .board-banner h2 {
  margin:12px 0 0; font:800 clamp(50px,17.8vw,112px)/.93 "Barlow Condensed",sans-serif;
  text-transform:uppercase; letter-spacing:-.03em;
}
.board-run { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; padding:24px 0 19px; border-bottom:3px solid; }
.board-run strong { display:block; font:800 clamp(44px,16.8vw,88px)/1 "Barlow Condensed",sans-serif; font-variant-numeric:tabular-nums; }
#run-standing { flex:none; text-align:right; color:#006283; }
#mobile-board #result { margin:4px 0 0; font:700 18px/1.2 Arial,sans-serif; overflow-wrap:anywhere; }
#mobile-board h3 { margin:20px 0 8px; font:700 24px/1 "Barlow Condensed",sans-serif; text-transform:uppercase; }
#board-status { font:15px/1.4 Arial,sans-serif; }
#board-status:empty { display:none; }
#board-list { padding:0; margin:0 0 16px; }
#board-list li { display:grid; grid-template-columns:2.2rem minmax(0,1fr) auto; align-items:center; gap:8px; padding:11px 9px; border-bottom:1px solid #b2c3c3; font:700 18px/1.2 Arial,sans-serif; }
#board-list i,#board-list b { font:700 25px/1 "Barlow Condensed",sans-serif; }
#board-list i { opacity:.78; }
#board-list span { overflow-wrap:anywhere; }
#board-list li:first-child {
  position:relative; isolation:isolate; overflow:hidden; min-height:116px;
  grid-template-columns:auto minmax(0,1fr) 20%; grid-template-areas:"rank pilot ." "rank points .";
  align-content:center; gap:2px 12px; padding:18px 14px; color:#fff8df;
  background:linear-gradient(105deg,#173945 40%,#214f5cdc),url("assets/singapore-cbd-ink.webp") center / cover;
}
#board-list li:first-child::after {
  content:""; position:absolute; right:1%; top:9%; height:86%; aspect-ratio:.77;
  background:url("assets/supplied-flight.webp") left top / 800% 400% no-repeat;
  transform:rotate(9deg); z-index:-1;
}
#board-list li:first-child i { grid-area:rank; color:#ffd46c; opacity:1; font-size:clamp(40px,13vw,68px); }
#board-list li:first-child span { grid-area:pilot; font:700 clamp(22px,7.7vw,38px)/1 "Barlow Condensed",sans-serif; }
#board-list li:first-child b { grid-area:points; margin-top:4px; font-size:clamp(20px,6.5vw,30px); color:#b5e7f2; }
#board-list .own-run { box-shadow:inset 4px 0 #0baac8; background:#d6eff2; }
