/* Modern "Changi" style: dark glass panels, clean type, violet/teal accents, amber alerts */
:root {
  --glass: rgba(14, 18, 34, .66);
  --glass-strong: rgba(10, 13, 26, .82);
  --line: rgba(255, 255, 255, .12);
  --text: #eef2ff;
  --muted: #9aa6c4;
  --accent: #8b6cff;          /* violet */
  --accent2: #19c8b4;         /* teal (garden green-blue) */
  --amber: #ffb547;
  --red: #ff5a6a;
  --fids: #0b1530;
  --font: "Inter", "Noto Sans TC", "Noto Sans SC", "Noto Sans KR", "Noto Sans JP", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Inter", monospace;
}
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; font-family: var(--font); color: var(--text); user-select: none; -webkit-user-select: none; -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; touch-action: none; overscroll-behavior: none; }
button, .tag, .dd-item { touch-action: manipulation; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
html.kt #gl { filter: sepia(0.1) saturate(0.92) contrast(1.02); }   /* Kai Tak: a faded 1990s photo */
button { font-family: var(--font); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.glass { background: var(--glass); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .06); }

/* ---- top bar ---- */
#topbar { position: fixed; left: calc(14px + env(safe-area-inset-left)); right: calc(14px + env(safe-area-inset-right)); top: calc(12px + env(safe-area-inset-top)); height: 58px; display: flex; align-items: center; gap: 22px; padding: 0 14px 0 18px; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; letter-spacing: .2px; white-space: nowrap; }
.logo-dot { width: 26px; height: 26px; border-radius: 7px; background: url(../icons/logo.svg) center / cover no-repeat; box-shadow: 0 0 14px rgba(139, 108, 255, .6); }
html.cx80 .logo-dot { background-image: url(../icons/logo-cx.svg); box-shadow: 0 0 14px rgba(0, 101, 100, .6); }
/* in-game top bar: game logo replaces the old "3D" pill */
#topbar .badge { display: none; }
.badge { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
html.cx80 .badge { background: linear-gradient(90deg, #2f8f83, #006564); }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 64px; }
.stat .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--muted); font-weight: 600; }
.stat .val { font-size: 20px; font-weight: 700; }
.stat.clock .val { color: #fff; }
.stat.mood { min-width: 150px; }
.bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 6px; }
#moodFill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent2), var(--amber) 60%, var(--red)); background-size: 150px 100%; transition: width .5s; }
.tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.seg { display: flex; background: rgba(255, 255, 255, .06); border-radius: 10px; padding: 3px; border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 6px 11px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(139, 108, 255, .5); }
button.icon { height: 34px; min-width: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--text); font-weight: 700; font-size: 12.5px; cursor: pointer; }
@media (hover: hover) { button.icon:hover, .seg button:hover { color: #fff; } }
button.icon.on { background: var(--amber); color: #1a1205; }
/* game-speed slider (1.00 – 2.00×): same glass pill as the view switch */
.speed { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; cursor: pointer; }
.speed input { width: 76px; margin: 0; accent-color: var(--accent); cursor: pointer; }
html.cx80 .speed input { accent-color: #2f8f83; }
.speed .sp-val { color: #fff; min-width: 38px; text-align: right; }
.speed.fast .sp-val { color: var(--amber); }
@media (max-width: 1320px) { .speed .sp-lbl { display: none; } .speed input { width: 64px; } }
@media (pointer: coarse) { .speed { height: 44px; font-size: 14px; } .speed input { width: 84px; height: 28px; } }
html.phone #phoneMore .speed { justify-content: space-between; } html.phone #phoneMore .speed .sp-lbl { display: inline; } html.phone #phoneMore .speed input { flex: 1; width: auto; }

/* ---- FIDS ---- */
#fids { position: fixed; left: 14px; top: 82px; padding: 10px 10px 12px; z-index: 4; background: var(--glass-strong); }
.fids-inner { width: 420px; }
.fids-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.fids-tabs button { flex: 1; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--muted); padding: 8px 8px; border-radius: 10px; font-weight: 800; font-size: 13.5px; letter-spacing: .3px; cursor: pointer; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-font-smoothing: antialiased; }
.fids-tabs button.fids-min { flex: 0 0 38px; text-align: center; padding: 0; font-size: 15px; color: #fff; }
#fids.min .fids-head, #fids.min .fids-scroll, #fids.min .fids-resize { display: none; }
#fids.min .fids-tabs { margin-bottom: 0; }
.fids-tabs button.on { background: linear-gradient(90deg, rgba(139, 108, 255, .35), rgba(25, 200, 180, .2)); color: #fff; border-color: rgba(139, 108, 255, .6); }
.fids-tabs button .ico { margin-right: 8px; opacity: .9; }
.fids-head { display: grid; grid-template-columns: 106px 72px 60px 88px 1fr; padding: 0 8px 5px; font-size: 11.5px; letter-spacing: 0.2px; text-transform: uppercase; color: var(--muted); font-weight: 700; -webkit-font-smoothing: antialiased; }
/* each heading stays inside its own column with a small gap, so a long one (Destination, 目的地 / 出發地) never runs into Status */
.fids-head span { min-width: 0; padding-right: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fidsCv { display: block; width: 420px; height: 300px; border-radius: 10px; background: var(--fids); image-rendering: auto; }

/* ---- command card ---- */
#cmdCard { position: fixed; left: calc(14px + env(safe-area-inset-left)); bottom: calc(14px + env(safe-area-inset-bottom)); width: 440px; min-height: 120px; padding: 14px 16px; z-index: 4; }
.ac-head { display: flex; align-items: center; gap: 12px; }
.ac-tail { width: 8px; align-self: stretch; border-radius: 4px; }
.ac-logo { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.ac-logo img { max-width: 100%; max-height: 100%; }
.ac-code { font-size: 22px; font-weight: 800; letter-spacing: .3px; }
.ac-meta { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.ac-phase { margin-left: auto; text-align: center; font-size: 12px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 11.5px; text-align: center; background: rgba(25, 200, 180, .18); color: #7ff3e4; border: 1px solid rgba(25, 200, 180, .45); }
.pill.req { background: rgba(255, 181, 71, .18); color: var(--amber); border-color: rgba(255, 181, 71, .5); animation: pulse 1.2s infinite; }
.ac-info { color: var(--muted); font-size: 12px; margin: 10px 0 6px; }
.cmds { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.cmd { border: 1px solid rgba(139, 108, 255, .55); background: rgba(139, 108, 255, .16); color: #fff; padding: 7px 12px; border-radius: 10px; font-weight: 600; font-size: 13px; cursor: pointer; transition: transform .08s, background .15s; }
.cmd.next-btn { border-color: rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .1); color: #fff; }   /* neutral: not a runway / gate colour */
@media (hover: hover) { .cmd:hover { background: var(--accent); transform: translateY(-1px); } }
.cmd.go { border-color: rgba(25, 200, 180, .7); background: rgba(25, 200, 180, .2); }
@media (hover: hover) { .cmd.go:hover { background: var(--accent2); color: #04201c; } }
.cmd.stand { font-family: var(--mono); font-size: 12px; padding: 5px 9px; }
.cmd.stand small { color: var(--muted); margin-left: 5px; }
.cmd:disabled { opacity: .35; cursor: default; transform: none; background: transparent; }
.empty { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.empty b { color: #fff; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(255, 181, 71, .15); } }

/* ---- radio card ---- */
#radioCard { position: fixed; right: calc(14px + env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); width: 420px; height: 168px; padding: 12px 16px; z-index: 4; display: flex; flex-direction: column; }
.card-title { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.live { width: 9px; height: 9px; border-radius: 50%; background: #3a4560; }
.live.on { background: var(--red); box-shadow: 0 0 10px var(--red); }
#radioScreen { flex: 1; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; font-size: 13px; line-height: 1.35; }
.msg { color: #dbe3ff; animation: fadeIn .3s; }
.msg.twr { color: #fff; }
.msg .who { font-weight: 800; margin-right: 6px; color: var(--accent2); }
.msg.twr .who { color: var(--amber); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } }

/* ---- runway / gate choice labels (full-DPR DOM canvases; pointer-events none so WebGL pick still works) ---- */
#choiceLabels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.choice-label { position: absolute; display: none; pointer-events: none; image-rendering: auto; }

/* ---- aircraft tags ---- */
#tags { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.tag { position: absolute; left: 0; top: 0; will-change: transform; font: 600 11px/1.2 var(--font); color: #fff; background: rgba(12, 16, 32, .74); backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .18); padding: 3px 8px 3px 6px; white-space: nowrap; border-radius: 8px; display: flex; gap: 6px; align-items: center; pointer-events: auto; cursor: pointer;
  -webkit-font-smoothing: antialiased; text-rendering: geometricPrecision; }
.tag .sw { width: 4px; height: 22px; border-radius: 2px; }
/* leader line from the tag down to its aircraft (the tag sits clear of the aircraft) */
.tag::before { content: ""; position: absolute; left: 50%; top: 100%; width: 1.5px; height: var(--lead, 0px); background: linear-gradient(rgba(255,255,255,.7), rgba(255,255,255,.15)); transform: translateX(-50%); pointer-events: none; }
.tag.sel::before { background: linear-gradient(rgba(139,108,255,.95), rgba(139,108,255,.2)); }
.tag .alt { color: var(--muted); font-weight: 500; font-family: var(--mono); font-size: 10px; }
.tag.req { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255, 181, 71, .2); }
.tag.req::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.tag.sel { border-color: var(--accent); background: rgba(60, 40, 140, .85); }
.tag.warn { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255, 90, 106, .3); }
/* paused: tags, board rows and the card's buttons can't be used (see Game.frozen) */
html.frozen .tag, html.frozen #fidsCv { cursor: default; }
.ac-nav .nav-btn:disabled, .ac-nav .nav-btn:disabled:hover { opacity: .35; cursor: default; background: transparent; }

#pausedBanner { position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); padding: 14px 30px; font-weight: 800; font-size: 22px; letter-spacing: 3px; display: none; z-index: 6; }
#fps { position: fixed; right: 18px; top: 76px; color: var(--muted); font: 500 10px var(--mono); z-index: 5; }

/* ---- overlays ---- */
.overlay { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 50;
  background: radial-gradient(1200px 600px at 30% 20%, rgba(139, 108, 255, .25), transparent), linear-gradient(180deg, rgba(5, 8, 20, .25), rgba(5, 8, 20, .75)); }
.overlay.show { display: flex; }
.hero { max-width: 760px; padding: 0 30px; }
.hero .eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: #fff; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid var(--line); }
.hero .t1 { font-size: clamp(38px, 6vw, 76px); line-height: 1.02; font-weight: 900; margin: 18px 0 10px; letter-spacing: -1px;
  background: linear-gradient(100deg, #fff 30%, #cfc4ff 60%, #8ff5e8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .t1 span:not(.icao) { -webkit-text-fill-color: transparent; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; }
/* the ICAO code shares the title's own colour, at a slightly smaller size, so it reads as part of the name */
.hero .t1 .icao { font-size: .5em; font-weight: 800; letter-spacing: .04em; margin-left: .28em; vertical-align: .04em; white-space: nowrap;
  -webkit-text-fill-color: transparent; background: linear-gradient(100deg, #fff 40%, #d9d0ff 78%, #c4eee8); -webkit-background-clip: text; background-clip: text; }
.hero .t2 { font-size: 20px; font-weight: 600; color: #e7eaff; }
.hero .t3 { font-size: 14px; color: var(--muted); margin-top: 6px; }
.session { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.session-lbl { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.session .seg button { font-size: 14px; padding: 9px 14px; }
@media (pointer: coarse) { .session .seg button { min-height: 46px; padding: 0 16px; font-size: 15px; } }
button.primary { margin-top: 22px; font-weight: 800; font-size: 16px; letter-spacing: .5px; color: #fff; border: 0; padding: 15px 30px; border-radius: 14px; cursor: pointer;
  background: linear-gradient(95deg, var(--accent), #5d8bff 55%, var(--accent2)); box-shadow: 0 10px 30px rgba(139, 108, 255, .45); transition: transform .1s; }
button.primary:hover { transform: translateY(-2px); }
.hero .help { margin-top: 16px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.result-card { text-align: center; padding: 34px 48px 30px; min-width: 380px; }
.res-icon { width: 74px; height: 74px; margin: 0 auto 14px; border-radius: 22px; display: flex; align-items: center; justify-content: center; font-size: 36px; }
.res-title { font-size: 34px; font-weight: 900; }
.res-sub { color: var(--muted); font-size: 15px; margin-top: 4px; }
#resultScore { font: 700 18px var(--mono); margin-top: 18px; }
.exit-ask .result-card { background: var(--glass-strong); }
.exit-ask .res-icon { background: #ffb54733; color: #ffb547; border: 1px solid #ffb54788; }
.exit-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 12px; }
.exit-ask .exit-row button.primary.quiet { background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px var(--line); }
html:has(#exitAsk.show) #tutBox, html:has(#exitAsk.show) .tut-arrow { visibility: hidden; }
/* boot / map-switch loading screen – stays up until assets + the 3D world are ready */
#loading { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 28px 22px; box-sizing: border-box;
  background: radial-gradient(120% 80% at 20% 0%, #24305e 0%, #0d1226 55%, #070912 100%);
  color: var(--text); transition: opacity .4s ease; }
#loading.done { opacity: 0; pointer-events: none; }
html.kt #loading { background: radial-gradient(120% 80% at 20% 0%, #3a3428 0%, #1a1712 55%, #0c0a08 100%); }
html.cx80 #loading { background: radial-gradient(120% 80% at 20% 0%, #0f5a57 0%, #0b2a2c 55%, #061314 100%); }
#loading .load-card { width: min(420px, 100%); text-align: left; }
#loading .load-eyebrow { font: 700 11px var(--font); letter-spacing: 2.4px; text-transform: uppercase; color: var(--muted); }
#loading .load-title { margin: 10px 0 4px; font: 900 clamp(28px, 6vw, 38px)/1.08 var(--font); letter-spacing: -.5px; color: #fff; }
#loading .load-title span { -webkit-text-fill-color: transparent; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; }
#loading .load-zh { font: 700 15px var(--font); color: #e7eaff; margin-bottom: 28px; }
#loading .load-bar { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .1); overflow: hidden; }
#loading .load-bar i { display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .25s ease; }
#loading .load-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px;
  font: 600 12.5px var(--font); color: var(--muted); }
#loading #loadPct { font-variant-numeric: tabular-nums; letter-spacing: .4px; }
/* gameplay start (after Start): same screen, indeterminate bar while the session / parked traffic is built */
#loading.starting .load-bar i { width: 38% !important; animation: loadIndeterminate 1.1s ease-in-out infinite; }
#loading.starting #loadPct { visibility: hidden; }
@keyframes loadIndeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

/* tablet / iPad: landscape only – block portrait with a rotate prompt (Safari cannot hard-lock orientation) */
#rotatePad { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center;
  padding: 28px 22px; box-sizing: border-box; background: radial-gradient(120% 80% at 20% 0%, #24305e 0%, #0d1226 55%, #070912 100%); }
html.pad-portrait #rotatePad { display: flex; }
html.cx80.pad-portrait #rotatePad { background: radial-gradient(120% 80% at 20% 0%, #0f5a57 0%, #0b2a2c 55%, #061314 100%); }
#rotatePad .rotate-card { max-width: 420px; width: 100%; text-align: center; padding: 28px 24px; border-radius: 22px;
  background: var(--glass-strong); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
#rotatePad .rotate-ico { width: 72px; height: 72px; margin: 0 auto 18px; color: var(--accent2); }
#rotatePad .rotate-ico svg { width: 100%; height: 100%; animation: rotateHint 1.6s ease-in-out infinite; }
#rotatePad .rotate-title { font: 800 22px/1.25 var(--font); letter-spacing: -.3px; color: #fff; }
#rotatePad .rotate-sub { margin-top: 10px; font: 500 14px/1.45 var(--font); color: var(--muted); }
@keyframes rotateHint {
  0%, 100% { transform: rotate(0deg); }
  35% { transform: rotate(90deg); }
  70% { transform: rotate(90deg); }
}

@media (max-width: 1580px) { .brand #brandName { display: none; } }
@media (max-width: 1320px) {
  #topbar { gap: 14px; padding: 0 10px 0 14px; }
  .brand #brandName { display: none; }
  .stat.mood { min-width: 96px; }
  .dd-btn .lbl { max-width: 84px; overflow: hidden; text-overflow: ellipsis; }
  .seg button { padding-left: 9px; padding-right: 9px; }
}
@media (max-width: 1100px) {
  .stat { min-width: 52px; }
  .stat .lbl { font-size: 9.5px; letter-spacing: .6px; }
  .stat .val { font-size: 17px; }
  .dd-btn .lbl { display: none; }
}

:lang(zh-Hans) { --font: "Inter", "Noto Sans SC", sans-serif; } :lang(ko) { --font: "Inter", "Noto Sans KR", sans-serif; } :lang(ja) { --font: "Inter", "Noto Sans JP", sans-serif; }

/* dropdowns (language / voice) in the same glass style as the top-bar buttons */
.dd { position: relative; }
.dd-btn { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06); color: var(--text); font: 600 12.5px var(--font); cursor: pointer; white-space: nowrap; }
.dd-btn:hover { color: #fff; border-color: rgba(139, 108, 255, .6); }
.dd.open .dd-btn { background: rgba(139, 108, 255, .22); border-color: rgba(139, 108, 255, .7); }
.dd-btn .ico { opacity: .8; font-size: 13px; }
.dd-btn .chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
.dd.open .dd-btn .chev { transform: rotate(-135deg) translate(-2px, 0); }
.dd-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; padding: 6px; display: none; z-index: 20; background: var(--glass-strong); }
.dd.open .dd-menu { display: block; animation: fadeIn .12s; }
.dd-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: var(--text); text-align: left;
  font: 600 13px var(--font); padding: 8px 10px; border-radius: 9px; cursor: pointer; }
@media (hover: hover) { .dd-item:hover { background: rgba(255, 255, 255, .08); } }
.dd-item.on { background: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(139, 108, 255, .45); }
.dd-item .sub { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 500; }
.dd-item.on .sub { color: rgba(255, 255, 255, .8); }
.dd-item:disabled { opacity: .4; cursor: default; background: transparent; }
.dd-head { font-size: 10.5px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 6px 10px 4px; }
.dd-hint { font-size: 11px; line-height: 1.5; color: var(--muted); padding: 6px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; max-width: 260px; }

/* draggable board */
#fids { touch-action: none; z-index: 6; }
#fids.dragging { cursor: grabbing; box-shadow: 0 18px 50px rgba(0, 0, 0, .45), 0 0 0 1px rgba(139, 108, 255, .6); transition: none; }
.grip { width: 18px; flex: 0 0 18px; align-self: stretch; border-radius: 8px; cursor: grab; opacity: .55;
  background-image: radial-gradient(circle, #c9d3f2 1.3px, transparent 1.6px); background-size: 6px 6px; background-position: center; }
.grip:hover { opacity: 1; background-color: rgba(255, 255, 255, .06); }

/* ---- touch screens (iPad / tablets): finger-sized targets ---- */
.kbd-only { }
@media (pointer: coarse) {
  .kbd-only { display: none; }
  #topbar { height: 64px; gap: 16px; }
  .seg button { min-height: 42px; padding: 0 14px; font-size: 14px; }
  button.icon, .dd-btn { height: 44px; min-width: 44px; font-size: 14px; }
  .dd-item { min-height: 46px; font-size: 15px; }
  .dd-menu { min-width: 240px; }
  .fids-tabs button { min-height: 44px; font-size: 14px; }
  .grip { width: 28px; flex-basis: 28px; opacity: .8; }
  .cmds { gap: 10px; }
  .cmd { min-height: 46px; padding: 10px 16px; font-size: 15px; border-radius: 12px; }
  .cmd.stand { min-height: 46px; font-size: 14px; padding: 8px 12px; }
  .tag { font-size: 13px; padding: 6px 10px 6px 8px; border-radius: 10px; }
  .tag .sw { height: 26px; }
  .tag .alt { font-size: 11.5px; }
  #fps { display: none; }
  button.primary { padding: 18px 36px; font-size: 18px; }
}
/* tablet landscape (iPad mini / Air / 11" ≈ 1024–1194 wide): keep the corners compact */
@media (max-width: 1200px) and (pointer: coarse) {
  #topbar { gap: 10px; padding: 0 10px 0 12px; }
  .stat .val { font-size: 18px; }
  .stat.mood { min-width: 80px; }
  .dd-btn .lbl { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
  #radioCard { width: 360px; height: 150px; }
  #cmdCard { width: 420px; }
}
/* portrait tablets (≈ 768–834 wide): two-row top bar, cards across the bottom, smaller board */
@media (max-width: 900px) {
  #topbar { height: auto; flex-wrap: wrap; row-gap: 8px; padding: 8px 12px; }
  .tools { margin-left: 0; width: 100%; justify-content: space-between; }
  .brand { display: none; }
  /* no CSS scale here – scaling blurs the Retina FIDS canvas and column headers */
  #fids { top: calc(140px + env(safe-area-inset-top)); }
  #cmdCard { left: calc(12px + env(safe-area-inset-left)); right: calc(12px + env(safe-area-inset-right)); width: auto; bottom: calc(124px + env(safe-area-inset-bottom)); }
  #radioCard { left: calc(12px + env(safe-area-inset-left)); right: calc(12px + env(safe-area-inset-right)); width: auto; height: 100px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .result-card { min-width: 0; padding: 28px 26px; }
  #fps { display: none; }
}

/* board rows are tappable: jump to that flight */
#fidsCv { cursor: pointer; }
#toast { position: fixed; left: 50%; top: calc(86px + env(safe-area-inset-top)); transform: translate(-50%, -10px); padding: 10px 18px; font-weight: 700; font-size: 14px; z-index: 30; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* the aircraft header in the command card is tappable: centres the camera on it */
#cmdCard .ac-head { cursor: pointer; border-radius: 12px; margin: -4px -6px; padding: 4px 6px; transition: background .15s; }
#cmdCard .ac-head:active { background: rgba(139, 108, 255, .18); }
@media (hover: hover) { #cmdCard .ac-head:hover { background: rgba(255, 255, 255, .05); } }
#cmdCard .ac-code::after { content: " ⌖"; font-size: 15px; color: var(--muted); font-weight: 600; }

/* locating the selected aircraft */
#locRing { position: fixed; transform: translate(-50%, -50%); border-radius: 50%; border: 3px solid #4dff6a; box-shadow: 0 0 0 2px rgba(0,0,0,.25), 0 0 18px rgba(77,255,106,.7);
  pointer-events: none; z-index: 2; animation: locPulse 1.1s ease-in-out infinite; }
@keyframes locPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
#locArrow { position: fixed; transform: translate(-50%, -50%); z-index: 5; display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  border: 2px solid #4dff6a; background: rgba(10, 20, 14, .82); color: #b9ffc6; font: 800 13px var(--mono); cursor: pointer; box-shadow: 0 0 16px rgba(77,255,106,.5); }
#locArrow .ar { display: inline-block; color: #4dff6a; font-size: 16px; }
@media (pointer: coarse) { #locArrow { padding: 10px 14px; font-size: 15px; } }

/* sound toggle: line icon (speaker / mic / muted) + muted / voice-only states */
#btnSound { display: inline-grid; place-items: center; padding: 0; }
#btnSound svg { width: 18px; height: 18px; display: block; }
#btnSound.off { background: rgba(255, 90, 106, .18); border-color: rgba(255, 90, 106, .55); }
html.phone #btnSound svg { width: 20px; height: 20px; }

/* compact tag for quiet ground traffic */
.tag.compact { padding: 2px 7px 2px 5px; font-size: 10.5px; opacity: .88; }
.tag.compact .sw { height: 14px; }
@media (pointer: coarse) { .tag.compact { font-size: 12px; padding: 4px 8px 4px 6px; } }

/* scrolling list + resize corner */
.fids-scroll { max-height: 300px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; border-radius: 10px;
  scrollbar-width: thin; scrollbar-color: rgba(160,180,230,.35) transparent; }
.fids-scroll::-webkit-scrollbar { width: 6px; } .fids-scroll::-webkit-scrollbar-thumb { background: rgba(160,180,230,.35); border-radius: 3px; }
.fids-resize, .card-resize { position: absolute; right: 3px; bottom: 3px; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none; opacity: .7;
  background: linear-gradient(135deg, transparent 50%, rgba(201,211,242,.75) 50% 58%, transparent 58% 70%, rgba(201,211,242,.75) 70% 78%, transparent 78%); }
@media (pointer: coarse) { .fids-resize, .card-resize { width: 30px; height: 30px; } }

/* the aircraft and radio cards move and resize like the board */
#cmdCard, #radioCard { touch-action: none; z-index: 6; }   /* level with the board; the last one moved comes to the front */
#topbar { z-index: 8; }                                     /* its menus open over a panel parked near it */
#cmdCard.dragging, #radioCard.dragging { cursor: grabbing; box-shadow: 0 18px 50px rgba(0, 0, 0, .45), 0 0 0 1px rgba(139, 108, 255, .6); transition: none; }
.panel-front { z-index: 7 !important; }
html:not(.phone) #cmdCard { padding-left: 24px; }
#cmdCard > .grip { position: absolute; left: 4px; top: 12px; bottom: 12px; width: 14px; }
#cmdCard.min > .grip { top: 6px; bottom: 6px; }
#cmdBody { overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(160,180,230,.35) transparent; }
/* a height-limited card scrolls; the padding keeps the nav buttons' and header's outward margins inside the clip */
#cmdBody[style*="overflow-y"] { touch-action: pan-y; margin: -6px -8px; padding: 6px 8px; }
#cmdCard.min .card-resize, #radioCard.min .card-resize { display: none; }
@media (pointer: coarse) { html:not(.phone) #cmdCard { padding-left: 30px; } #cmdCard > .grip { width: 22px; } }
/* tablets: the aircraft card's buttons a size down from the finger-sized defaults (still ~38 px to tap) */
@media (pointer: coarse) {
  html:not(.phone) .cmds { gap: 8px; }
  html:not(.phone) .cmd { min-height: 38px; padding: 7px 13px; font-size: 13.5px; border-radius: 10px; }
  html:not(.phone) .cmd.stand { min-height: 38px; padding: 6px 10px; font-size: 13px; }
  html:not(.phone) .ac-nav .nav-btn { padding: 7px 13px; font-size: 13px; }
  html:not(.phone) .card-min { width: 34px; height: 30px; font-size: 13px; }
}
html.phone #cmdCard > .grip, html.phone #radioGrip, html.phone .card-resize { display: none; }
html.phone #cmdCard, html.phone #radioCard { touch-action: auto; }

/* compact cards: less screen covered, more airport visible */
#cmdCard { min-height: 0; }
#radioCard { height: auto; max-height: 128px; }
#radioScreen { max-height: 88px; }
.card-min { margin-left: auto; width: 28px; height: 24px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: #fff; font-size: 12px; cursor: pointer; }
#cmdCard > .card-min { position: absolute; right: 10px; top: 10px; z-index: 1; }
#cmdCard.min #cmdBody { display: none; }
#cmdCard.min { padding: 8px; width: auto; min-height: 0; }
#cmdCard.min > .card-min { position: static; }
#radioCard.min #radioScreen { display: none; }
#radioCard.min { width: auto; height: auto; padding: 8px 12px; }
#radioCard.min .card-title { margin: 0; }
@media (pointer: coarse) { .card-min { width: 40px; height: 34px; font-size: 14px; } }
#cmdCard .ac-head, #cmdCard .empty { padding-right: 36px; }

/* command buttons tinted like the runway / gate label they choose */
.cmd.tinted { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); color: #fff; box-shadow: inset 3px 0 0 var(--c); }
.cmd.tinted small { color: var(--c); }
@media (hover: hover) { .cmd.tinted:hover { background: color-mix(in srgb, var(--c) 40%, transparent); } }

.tag .fast { color: #ff6a78; font-weight: 800; }
#btnSound.voice { background: rgba(25, 200, 180, .18); border-color: rgba(25, 200, 180, .55); }
/* Back / Next through all aircraft on the aircraft card */
.ac-nav { display: flex; align-items: center; gap: 8px; margin: -2px 40px 10px 0; }
.ac-nav .nav-btn { flex: 0 0 auto; padding: 6px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08); color: #fff; font: 700 12.5px var(--font); cursor: pointer; }
.ac-nav .nav-btn:active { background: rgba(139, 108, 255, .3); }
@media (hover: hover) { .ac-nav .nav-btn:hover { background: rgba(255,255,255,.16); } }
.ac-nav .nav-pos { flex: 1; text-align: center; color: var(--muted); font: 600 12px var(--mono); }
@media (pointer: coarse) { .ac-nav .nav-btn { padding: 10px 18px; font-size: 14px; } }
.cmd small.busy { color: #ffb547; margin-left: 6px; font-weight: 700; }
.hero .disclaimer { margin-top: 14px; max-width: 560px; font-size: 11.5px; line-height: 1.55; color: var(--muted); opacity: .8; }
.session + .session { margin-top: 10px; }
/* start-screen language drop-down, styled like the other title-screen controls */
.lang-drop { position: relative; display: inline-block; }
.lang-drop select { appearance: none; -webkit-appearance: none; font: 600 14px var(--font); color: var(--text); background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 38px 9px 14px; min-width: 190px; cursor: pointer; }
.lang-drop select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-drop select option { background: #141a33; color: var(--text); }
.lang-drop::after { content: ''; position: absolute; right: 15px; top: 50%; width: 7px; height: 7px; margin-top: -5px; border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
@media (hover: hover) { .lang-drop select:hover { border-color: rgba(255, 255, 255, .28); } }
@media (pointer: coarse) { .lang-drop select { min-height: 46px; font-size: 15px; } }
#todSel button { display: inline-flex; align-items: center; gap: 7px; }
#todSel .tod-ico { width: 15px; height: 15px; flex: none; opacity: .9; }
/* short screens: keep the whole start screen clear of the top bar */
@media (max-height: 700px) { .hero .t1 { font-size: clamp(32px, 4.6vw, 52px); margin: 12px 0 8px; } .session { margin-top: 12px; } .hero .help { margin-top: 12px; } }
#title { padding-top: calc(36px + env(safe-area-inset-top)); padding-bottom: 16px; box-sizing: border-box; overflow-y: auto; }
@media (max-height: 1000px) { .hero .t1 { font-size: clamp(34px, 4.8vw, 60px); margin: 12px 0 8px; } }
/* development toggle (temporary) */
.dev-btn { position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 7; padding: 6px 12px; border-radius: 999px; border: 1px dashed rgba(143, 227, 255, .7); background: rgba(10, 14, 30, .75); color: #8fe3ff; font: 600 11px var(--mono); letter-spacing: .4px; cursor: pointer; }
.dev-btn.off { color: var(--muted); border-color: rgba(255, 255, 255, .25); }
#devUsed { transform: translateX(calc(-100% - 6px)); }
#devTaxi { transform: translateX(6px); }
body:has(#title.show) #devTaxi, html.phone #devTaxi, html.app #devTaxi, html.touch #devTaxi { display: none !important; }
/* DEV taxiway editor panel */
.taxi-edit { position: fixed; right: 14px; top: 96px; z-index: 40; width: 328px; max-height: calc(100vh - 120px); overflow: auto; display: none; padding: 12px 14px; border-radius: 14px;
  background: rgba(10, 14, 30, .9); border: 1px solid rgba(143, 227, 255, .45); color: #e8f3ff; font: 500 12px var(--font);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.taxi-edit.show { display: block; }
body:has(#title.show) .taxi-edit { display: none; }
.taxi-edit .te-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: #8fe3ff; font: 700 12px var(--mono); letter-spacing: .3px; }
.taxi-edit .te-map { padding: 1px 7px; border-radius: 999px; background: rgba(143, 227, 255, .15); font-size: 10px; }
.taxi-edit .te-x { margin-left: auto; background: none; border: 0; color: #9aa7bd; font-size: 18px; line-height: 1; cursor: pointer; }
.taxi-edit .te-help { color: #9aa7bd; font-size: 11px; line-height: 1.45; margin-bottom: 8px; }
.taxi-edit .te-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 10.5px; color: #c7d3e6; margin-bottom: 10px; }
.taxi-edit .te-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 4px; vertical-align: -1px; }
.taxi-edit .te-sel { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .05); margin-bottom: 8px; }
.taxi-edit .te-id { grid-column: 1 / -1; font: 600 12px var(--mono); word-break: break-all; }
.taxi-edit .te-ed { color: #ffa63a; }
.taxi-edit label { display: flex; align-items: center; gap: 6px; color: #9aa7bd; }
.taxi-edit input[type=number] { width: 100%; min-width: 0; padding: 4px 6px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(0, 0, 0, .35); color: #fff; font: 600 12px var(--mono); }
.taxi-edit input[type=number]:disabled { opacity: .4; }
.taxi-edit .te-sel > button { grid-column: 1 / -1; }
.taxi-edit .te-links { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; max-height: 108px; overflow: auto; }
.taxi-edit .te-link { display: flex; align-items: center; gap: 6px; font: 600 11px var(--mono); color: #d5e4f5; }
.taxi-edit .te-link em { margin-left: auto; color: #9aa7bd; font-style: normal; font-family: var(--font); font-size: 10.5px; }
.taxi-edit .te-link button { flex: 0 0 22px; padding: 0; }
.taxi-edit select { flex: 1 1 140px; min-width: 0; padding: 5px 6px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(0, 0, 0, .35); color: #e8f3ff; font: 600 11.5px var(--font); }
.taxi-edit button.on { background: rgba(143, 227, 255, .22); border-color: rgba(143, 227, 255, .8); color: #fff; }
.taxi-edit .te-paintbar { position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; margin: 0 -14px 8px; padding: 8px 14px; background: #2a1014; border-bottom: 1px solid #ff4d5e; }
.taxi-edit .te-paintbar button { flex: 1 1 0; }
.taxi-edit button.te-paint { background: rgba(255, 45, 58, .45); border-color: #ff4d5e; color: #ffe4e7; }
.taxi-edit button.te-paint.on { background: #ff2a3a; border-color: #ff8a94; color: #fff; }
.taxi-edit .te-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.taxi-edit .te-chk { color: #c7d3e6; cursor: pointer; }
.taxi-edit .te-count { margin-left: auto; color: #ffa63a; font: 600 11px var(--mono); }
.taxi-edit button:not(.te-x) { flex: 1 1 auto; padding: 6px 9px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .07); color: #e8f3ff; font: 600 11.5px var(--font); cursor: pointer; }
.taxi-edit button:not(.te-x):hover:not(:disabled) { background: rgba(143, 227, 255, .18); border-color: rgba(143, 227, 255, .6); }
.taxi-edit button:disabled { opacity: .4; cursor: default; }
.taxi-edit .te-warn { color: #ffb3bb !important; }
.taxi-edit .te-go { background: rgba(61, 255, 138, .16) !important; border-color: rgba(61, 255, 138, .55) !important; color: #b9ffd4 !important; }
.taxi-edit .te-msg { min-height: 14px; margin-top: 8px; color: #3dff8a; font-size: 11px; }
/* the flight information board is not needed for play (the aircraft card covers it) – hidden completely */
/* flight information board – Chek Lap Kok: a modern digital display; Kai Tak: the original split-flap board */
html:not(.kt) #fidsCv { background: #05080f; }
body:has(#title.show) #fids { display: none; }
/* start screen: just the scenery behind the menu – no top bar */
body:has(#title.show) #topbar, body:has(#title.show) #radioCard, body:has(#title.show) #devUsed { display: none; }   /* start screen: no game panels */

/* map / edition switch: fade the scene out and show LOADING while music finishes fading (avoids a hard cut) */
html.reloading #gl, html.reloading #title, html.reloading #compass, html.reloading .dev-btn { opacity: 0 !important; transition: opacity .35s ease; pointer-events: none !important; }
html.reloading #loading { display: flex !important; opacity: 1; }

/* start-screen music player */
.mplayer { display: flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 12px; padding: 5px 8px; max-width: 360px; }
.mp-b { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.mp-b svg { width: 16px; height: 16px; }
.mp-b.mp-play { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(139, 108, 255, .5); }
.mp-b.mp-play svg { width: 15px; height: 15px; }
.mp-b.mp-shuf.on { color: var(--accent2); background: rgba(25, 200, 180, .12); }
@media (hover: hover) { .mp-b:not(.mp-play):hover { color: #fff; background: rgba(255, 255, 255, .08); } }
.mp-info { flex: 1; min-width: 0; padding: 0 4px; position: relative; }
.mp-info[data-full]::after, .mp-top[data-full]::after { content: attr(data-full); display: none; position: absolute; left: 50%; top: calc(100% + 10px); transform: translateX(-50%); z-index: 30; pointer-events: none;
  white-space: nowrap; padding: 6px 10px; border-radius: 8px; background: var(--glass-strong); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #fff; font-size: 13px; font-weight: 600; }
@media (hover: hover) { .mp-info[data-full]:hover::after { display: block; } #topbar:has(.mp-info:hover) { z-index: 41; } }
html:not(.phone) .mp-top.mp-tip::after { display: block; } html:not(.phone) #topbar:has(.mp-tip) { z-index: 41; }
@media (pointer: coarse) { .mp-top[data-full]::after { font-size: 14px; padding: 8px 12px; } }
.mp-name { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-name.dim { color: var(--muted); }
.mp-bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .12); margin-top: 5px; overflow: hidden; }
.mp-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
@media (pointer: coarse) { .mp-b { width: 42px; height: 42px; } .mp-b.mp-play { width: 44px; height: 44px; } }

/* compass (turns with the camera; N = true north) */
#compass { position: fixed; right: calc(14px + env(safe-area-inset-right)); top: calc(88px + env(safe-area-inset-top)); width: 56px; height: 56px; z-index: 5; border-radius: 50%; background: var(--glass); border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); pointer-events: none; }
#compass svg { width: 100%; height: 100%; display: block; }
#compass .c-ring { fill: none; stroke: rgba(255, 255, 255, .14); stroke-width: 1.5; }
#compass .c-ticks path { stroke: rgba(255, 255, 255, .5); stroke-width: 2; stroke-linecap: round; }
#compass .c-ticks path.minor { stroke: rgba(255, 255, 255, .25); stroke-width: 1.5; }
#compass .c-n { fill: var(--red); } #compass .c-s { fill: rgba(238, 242, 255, .75); } #compass .c-hub { fill: #0b1020; stroke: rgba(255, 255, 255, .6); stroke-width: 1; }
#compass .c-lbl { fill: var(--muted); font: 700 11px var(--font); text-anchor: middle; dominant-baseline: middle; }
#compass .c-lbl-n { fill: #fff; }
body:has(#title.show) #compass { display: none; }
@media (pointer: coarse) { html:not(.phone) #compass { top: calc(92px + env(safe-area-inset-top)); } }
@media (max-width: 700px) { html:not(.phone) #compass { top: calc(78px + env(safe-area-inset-top)); width: 46px; height: 46px; } }

/* start screen: "How to play" button and guide */
.start-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.start-row button.primary { margin-top: 22px; }
.how-btn { margin-top: 22px; font: 700 15px var(--font); color: var(--text); background: rgba(255, 255, 255, .07); border: 1px solid var(--line); padding: 14px 22px; border-radius: 14px; cursor: pointer; }
@media (hover: hover) { .how-btn:hover { background: rgba(255, 255, 255, .13); border-color: rgba(255, 255, 255, .28); } }
/* Android tablet PWA install (shown when Chrome fires beforeinstallprompt) */
.pwa-install { border-color: rgba(25, 200, 180, .55); background: rgba(25, 200, 180, .16); color: #b8fff4; }
@media (hover: hover) { .pwa-install:hover { background: rgba(25, 200, 180, .28); } }
.pwa-install:disabled { opacity: .5; cursor: default; }
.howto { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(5, 8, 18, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.howto.show { display: flex; }
.howto-card { position: relative; width: min(680px, 100%); max-height: min(86vh, 860px); display: flex; flex-direction: column; background: var(--glass-strong); border: 1px solid var(--line); border-radius: 18px; padding: 22px 22px 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.howto-card h2 { margin: 0 40px 12px 2px; font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.howto-x { position: absolute; right: 12px; top: 12px; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; }
.howto-body { overflow-y: auto; padding-right: 4px; }
.howto-sec { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); }
.howto-sec:first-child { border-top: 0; }
.howto-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--accent2); background: rgba(25, 200, 180, .12); }
.howto-ico svg { width: 21px; height: 21px; }
.howto-sec h3 { margin: 2px 0 4px; font-size: 15px; font-weight: 700; color: #fff; }
.howto-sec ul { margin: 0; padding-left: 18px; color: #c9d1ee; font-size: 13.5px; line-height: 1.55; }
.howto-sec li { margin: 2px 0; }
.howto-ok { align-self: flex-end; margin-top: 12px !important; padding: 11px 26px !important; font-size: 15px !important; }
@media (max-width: 560px) { .howto-card { padding: 18px 14px 14px; } .howto-card h2 { font-size: 20px; } .howto-sec { grid-template-columns: 30px 1fr; gap: 10px; } .howto-ico { width: 30px; height: 30px; } }
.howto-body { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .22) transparent; }
/* start screen: airport, session length and time of day side by side (wrapping); Settings opens the dialog below */
.title-opts { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 28px; margin-top: 18px; }
.title-opts .session, .title-opts .session + .session { margin-top: 0; }
html.phone .title-opts { margin-top: 10px; gap: 10px 20px; }
.set-btn { display: inline-flex; align-items: center; gap: 8px; }
.set-btn svg { width: 18px; height: 18px; flex: none; }
.set-sum { margin-top: 10px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.set-sum:empty { display: none; }
/* Settings dialog: the How-to card holding the start screen's language / mode / graphics / tutorial rows */
.settings { z-index: 62; }   /* above the edition toggle and the DEV link on the start screen */
html.reloading .settings { display: none; }
.settings { z-index: 62; }   /* above the edition toggle and DEV links on the start screen */
.settings .howto-card { width: min(560px, 100%); }
.set-body .session, .set-body .session + .session { margin-top: 0; padding: 14px 2px; border-top: 1px solid var(--line); }
.set-body .session:first-child { border-top: 0; padding-top: 2px; }
.set-body .seg { flex-wrap: wrap; max-width: 100%; box-sizing: border-box; }
html.kt .settings .howto-card { border-color: rgba(207, 106, 44, .45); }
html.kt .settings .lang-drop select option { background: #2a2118; }
.howto-body::-webkit-scrollbar { width: 6px; } .howto-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 3px; } .howto-body::-webkit-scrollbar-track { background: transparent; }

/* the same player, compact, in the top bar during a game */
.mplayer.mp-top { position: relative; padding: 3px 6px; gap: 2px; max-width: 250px; border-radius: 10px; }
.mp-top .mp-b { width: 28px; height: 28px; } .mp-top .mp-b svg { width: 13px; height: 13px; }
.mp-top .mp-b.mp-play { width: 30px; height: 30px; } .mp-top .mp-b.mp-play svg { width: 12px; height: 12px; }
.mp-top .mp-info { width: 104px; flex: none; padding: 0 3px; } .mp-top .mp-name { font-size: 11.5px; } .mp-top .mp-bar { margin-top: 3px; height: 2px; }
@media (max-width: 1180px) { .mp-top .mp-info { width: 72px; } #topbar { gap: 8px; } }
@media (max-width: 1100px) { .mp-top .mp-info { width: 56px; } #topbar { gap: 6px; padding-right: 8px; } .tools { gap: 4px; } }
@media (max-width: 700px) { .mp-top .mp-b[data-a="prev"], .mp-top .mp-shuf { display: none; } }
/* room for the three view buttons (Overview / Follow / Tower) up to the 12.9" iPad Pro's width: no speed label, tighter
   buttons, a shorter track name (the whole name shows on tap / hover) */
@media (max-width: 1400px) { .speed .sp-lbl { display: none; } }
@media (pointer: fine) and (max-width: 1320px) { #viewBtns button { padding-left: 6px; padding-right: 6px; } }
@media (pointer: coarse) and (max-width: 1400px) { #viewBtns button { padding: 0 9px; } }
@media (pointer: coarse) and (max-width: 1320px) { .speed input { width: 64px; } .mp-top .mp-info { width: 96px; } }
@media (pointer: coarse) and (max-width: 1180px) { .mp-top .mp-info { width: 48px; } }
@media (max-width: 1100px) { #viewBtns button { padding-left: 7px; padding-right: 7px; } .speed input { width: 52px; } .mp-top .mp-info { width: 40px; } }
@media (pointer: coarse) and (max-width: 1100px) { .mp-top .mp-info { display: none; } }

/* top bar: flights cleared – arrivals parked / departures airborne, and a progress bar for the session */
.stat.flights .fl-row { display: flex; gap: 10px; font-size: 15px; }
.stat.flights .fl-a { color: #8fd4ff; } .stat.flights .fl-d { color: #ffc27a; }
.stat.flights .fl-bar { margin-top: 4px; height: 4px; }
#flFill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .5s; }
.stat.flights .lbl, .stat.flights .fl-row span { white-space: nowrap; }
.stat.flights { min-width: 96px; }
/* Kai Tak start screen: the scenery as a faded 1990s colour print – warm, washed-out colours, film grain, a soft
   vignette and a light leak in the corner (the game itself keeps the lighter grade above) */
html.kt body:has(#title.show) #gl { filter: sepia(0.42) saturate(0.8) contrast(1.04) brightness(1.1) hue-rotate(-6deg); }
html.kt #title { background:
  radial-gradient(900px 520px at 88% 6%, rgba(255, 168, 92, .26), transparent 70%),
  radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(40, 22, 8, .42) 100%),
  linear-gradient(180deg, rgba(60, 36, 14, .08), rgba(30, 18, 8, .5)); }
html.kt #title::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .2; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1.4 -.2'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: ktGrain .5s steps(4) infinite; }
@keyframes ktGrain { 0% { background-position: 0 0; } 25% { background-position: -60px 40px; } 50% { background-position: 50px -70px; } 75% { background-position: -30px -20px; } }
html.kt #title > * { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { html.kt #title::before { animation: none; } }
/* Kai Tak: a 1990s palette everywhere – cream text, burnt-orange and mustard accents, warm brown glass (in place of
   Chek Lap Kok's modern violet / teal) */
html.kt {
  --glass: rgba(34, 24, 15, .7); --glass-strong: rgba(27, 19, 12, .86); --line: rgba(255, 232, 196, .15);
  --text: #f4e8cf; --muted: #c4b08e; --accent: #cf6a2c; --accent2: #e3a83c; --amber: #ffbf5a;
}
html.kt .logo-dot { box-shadow: 0 0 14px rgba(207, 106, 44, .6); }
html.kt .seg button.on, html.kt .dd-item.on, html.kt .mp-b.mp-play { box-shadow: 0 2px 10px rgba(207, 106, 44, .5); }
html.kt .seg button.on, html.kt .dd-item.on, html.kt .mp-b.mp-play, html.kt button.primary { color: #fff8ea; }
html.kt .fids-tabs button.on { background: linear-gradient(90deg, rgba(207, 106, 44, .4), rgba(227, 168, 60, .22)); border-color: rgba(207, 106, 44, .65); }
html.kt .tag.sel { background: rgba(110, 52, 18, .88); }
html.kt .overlay { background: radial-gradient(1200px 600px at 30% 20%, rgba(207, 106, 44, .2), transparent), linear-gradient(180deg, rgba(20, 12, 6, .25), rgba(20, 12, 6, .75)); }
html.kt .hero .t1 { background: linear-gradient(100deg, #fff6e4 30%, #f6d7a4 62%, #eaa65a); -webkit-background-clip: text; background-clip: text; }
html.kt .hero .t1 .icao { background: linear-gradient(100deg, #fff6e4 20%, #f3d7a8 70%, #e8c48a); -webkit-background-clip: text; background-clip: text; }
html.kt .hero .t2 { color: #f1dfbd; }
html.kt .hero .eyebrow { background: rgba(255, 226, 180, .1); }
html.kt button.primary { background: linear-gradient(95deg, #c45a24, #d9822f 55%, #e3a83c); box-shadow: 0 10px 30px rgba(196, 90, 36, .45); }
html.kt .dd-btn:hover { border-color: rgba(207, 106, 44, .6); }
html.kt .dd.open .dd-btn { background: rgba(207, 106, 44, .22); border-color: rgba(207, 106, 44, .7); }
html.kt #fids.dragging, html.kt #cmdCard.dragging, html.kt #radioCard.dragging { box-shadow: 0 18px 50px rgba(0, 0, 0, .45), 0 0 0 1px rgba(207, 106, 44, .6); }
html.kt #btnSound.voice { background: rgba(227, 168, 60, .18); border-color: rgba(227, 168, 60, .55); }
html.kt .mp-b.mp-shuf.on, html.kt .howto-ico { background: rgba(227, 168, 60, .14); }
/* (Kai Tak: the aircraft card keeps the standard colours for its buttons, status labels and text) */
html.kt #cmdCard { --accent: #8b6cff; --accent2: #19c8b4; --amber: #ffb547; --red: #ff5a6a; --text: #eef2ff; --muted: #9aa6c4; --line: rgba(255, 255, 255, .12); color: var(--text); }
/* board tab icons – Chek Lap Kok: a glowing LED chip like the digital board; Kai Tak: a split-flap tile like the old board */
.fids-tabs button .ico { display: inline-grid; place-items: center; width: 22px; height: 20px; margin-right: 8px; vertical-align: -5px; opacity: 1; }
.fids-tabs button .ico svg { width: 15px; height: 15px; fill: currentColor; }
html:not(.kt) .fids-tabs button .ico { border-radius: 6px; color: #7fcfff; background: rgba(80, 140, 255, .14); box-shadow: inset 0 0 0 1px rgba(127, 207, 255, .3); }
html:not(.kt) .fids-tabs button .ico svg { filter: drop-shadow(0 0 3px rgba(127, 207, 255, .7)); }
html:not(.kt) .fids-tabs button.on .ico { color: #bfe8ff; background: rgba(80, 140, 255, .24); }
html.kt .fids-tabs button[data-tab] { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0; font-size: 11px; padding-left: 6px; padding-right: 6px; }
html.kt .fids-tabs button .ico { margin-right: 6px; }
html.kt .fids-tabs button.on { color: #ffc94a; }
html.kt .fids-tabs button .ico { position: relative; border-radius: 3px; color: #fff; background: linear-gradient(#1d2a4e 50%, #16213f 50%);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .07); }
html.kt .fids-tabs button .ico::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; margin-top: -.5px; background: rgba(0, 0, 0, .55); }
html.kt .fids-tabs button:not(.on) .ico { color: #c9d3ee; }
html:not(.kt) .fids-tabs button[data-tab] { padding-left: 6px; padding-right: 6px; letter-spacing: 0; font-size: 12.5px; }
.fids-tabs button[data-tab] { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.15; }
html:not(.kt) .fids-tabs button .ico { margin-right: 6px; }
/* icon always beside its label: each tab is as wide as its label (Departures gets more room than All), and a label
   that still has to wrap does so next to its icon, never under it */
.fids-tabs button[data-tab] { display: flex; align-items: center; flex: 1 1 auto; }
.fids-tabs button[data-tab] .ico { flex: none; }
.fids-tabs button[data-tab] .lbl { min-width: 0; }
/* result: star rating */
.res-stars { margin-top: 14px; min-height: 0; }
.res-stars > span { display: inline-block; font-size: 42px; line-height: 1; margin: 0 4px; color: rgba(255, 255, 255, .16); transform: scale(.4); opacity: 0;
  animation: starIn .45s cubic-bezier(.3, 1.6, .5, 1) forwards; }
.res-stars > span.on { color: #ffcf4a; text-shadow: 0 0 18px rgba(255, 207, 74, .65); }
@keyframes starIn { to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .res-stars > span { animation: none; transform: none; opacity: 1; } }
.res-best { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .3px; }
.res-best.new { color: #ffcf4a; }
.res-stats { margin-top: 6px; font-size: 14px; color: var(--muted); }
.res-how { margin: 10px auto 0; max-width: 420px; font-size: 12px; line-height: 1.5; color: var(--muted); opacity: .85; }
.res-how:empty, .res-stars:empty { display: none; }
.seg button .best-stars { margin-left: 6px; font-size: 11px; letter-spacing: -1px; color: #ffcf4a; }
.session[hidden] { display: none; }
/* edition toggle: lower right of the start screen (Regular / Cathay Pacific 80th anniversary) */
.model-credits { margin-top: 14px; font-size: 10.5px; line-height: 1.5; color: var(--muted); opacity: .75; max-width: 560px; }
.model-credits a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.edition-toggle { position: fixed; right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60; display: none; gap: 4px; padding: 4px; border-radius: 12px; }
body:has(#title.show) .edition-toggle { display: flex; }
.edition-toggle button { border: 0; background: transparent; color: var(--muted); font: 700 12.5px var(--font); padding: 8px 12px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.edition-toggle button.on { background: var(--accent); color: #fff; }
html.cx80 .edition-toggle button.on { background: linear-gradient(135deg, #00756f, #005652); color: #fff; box-shadow: inset 0 0 0 1px rgba(124, 196, 181, .8), 0 2px 10px rgba(0, 101, 100, .5); }
@media (hover: hover) { .edition-toggle button:not(.on):hover { color: #fff; } }
@media (pointer: coarse) { .edition-toggle button { min-height: 42px; } }

/* Cathay Pacific 80th anniversary start screen: jade green and anniversary gold, the "80" mark above the title */
.cx80-mark { display: none; }
html.cx80 .cx80-mark { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 14px 22px; max-width: calc(100vw - 32px); box-sizing: border-box;
  padding: 16px 26px; margin-bottom: 14px; border-radius: 22px;
  background: radial-gradient(120% 140% at 50% 30%, rgba(255, 255, 255, .96), rgba(226, 240, 246, .9) 70%, rgba(205, 228, 238, .85));
  box-shadow: 0 10px 30px rgba(0, 30, 30, .35), inset 0 0 0 1px rgba(255, 255, 255, .6); }
html.cx80 .cx80-mark img { display: block; height: auto; }
html.cx80 .cx80-mark .cx-logo { width: 250px; max-width: 100%; }
html.cx80 .cx80-mark .cx-80 { width: 128px; }
html.cx80 .cx80-mark .cx-div { width: 1px; align-self: stretch; background: rgba(0, 101, 100, .35); }
@media (max-width: 560px) { html.cx80 .cx80-mark .cx-div { display: none; } html.cx80 .cx80-mark .cx-logo { width: 200px; } html.cx80 .cx80-mark .cx-80 { width: 110px; } }
/* short screens: a slightly smaller anniversary mark and full-width small print, so the start screen fits without scrolling */
@media (max-height: 900px) and (min-width: 561px) {
  html.cx80 .cx80-mark { padding: 10px 22px; margin-bottom: 10px; gap: 12px 20px; }
  html.cx80 .cx80-mark .cx-logo { width: 210px; } html.cx80 .cx80-mark .cx-80 { width: 92px; }
  .hero .disclaimer, .model-credits { max-width: none; margin-top: 10px; }
  .hero .help { margin-top: 12px; }
}
html.cx80 #title { --accent: #00756f; --accent2: #7cc4b5; --text: #f4f7f3; --muted: #b8cfc9;
  background: radial-gradient(900px 520px at 85% 8%, rgba(190, 228, 240, .22), transparent 70%),
    radial-gradient(1200px 700px at 20% 30%, rgba(0, 101, 100, .45), transparent 75%),
    linear-gradient(180deg, rgba(0, 40, 38, .3), rgba(0, 28, 27, .82)); }
html.cx80 #title::before { content: none; }
html.cx80 .hero .eyebrow { color: #d6f0ea; background: rgba(0, 101, 100, .5); border-color: rgba(124, 196, 181, .55); }
html.cx80 .hero .t1 { background: linear-gradient(100deg, #ffffff 35%, #dff2ee 60%, #9fd8cc); -webkit-background-clip: text; background-clip: text; }
html.cx80 .hero .t1 span:not(.icao) { background: linear-gradient(90deg, #bfe8df, #7cc4b5); -webkit-background-clip: text; background-clip: text; }
html.cx80 .hero .t1 .icao { background: linear-gradient(100deg, #ffffff 30%, #e7f4f0 70%, #c5e4dc); -webkit-background-clip: text; background-clip: text; }
html.cx80 .hero .t2 { color: #e3efe9; }
html.cx80 #title .seg button.on, html.cx80 #title .dd-item.on { background: #00756f; color: #fff; box-shadow: inset 0 0 0 1px rgba(124, 196, 181, .7), 0 2px 10px rgba(0, 101, 100, .5); }
html.cx80 #title button.primary { background: linear-gradient(95deg, #005f5b, #00807a 55%, #0a9a8f); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(160, 220, 208, .8), 0 10px 30px rgba(0, 101, 100, .5); }
html.cx80 #title .glass, html.cx80 #title .seg { background: rgba(0, 40, 38, .55); }
/* the Settings dialog in the anniversary colours: jade card, gold edge and heading */
html.cx80 .settings { --accent: #00756f; --accent2: #7cc4b5; --text: #f4f7f3; --muted: #b8cfc9; --line: rgba(124, 196, 181, .22); background: rgba(0, 22, 21, .62); }
html.cx80 .settings .howto-card { background: linear-gradient(180deg, rgba(0, 66, 63, .97), rgba(0, 30, 29, .97)); border-color: rgba(227, 192, 106, .55);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(227, 192, 106, .35); }
html.cx80 .settings h2 { color: #e3c06a; }
html.cx80 .settings .seg { background: rgba(0, 40, 38, .55); }
html.cx80 .settings .seg button.on { background: #00756f; color: #fff; box-shadow: inset 0 0 0 1px rgba(124, 196, 181, .7), 0 2px 10px rgba(0, 101, 100, .5); }
html.cx80 .settings button.primary { background: linear-gradient(95deg, #005f5b, #00807a 55%, #0a9a8f); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(160, 220, 208, .8), 0 10px 30px rgba(0, 101, 100, .5); }
html.cx80 .settings .lang-drop select option { background: #0b2a2c; }
html.cx80 .set-sum { color: #d8cc9c; }
html.kt.cx80 body:has(#title.show) #gl { filter: sepia(0.15) saturate(0.9) contrast(1.03); }   /* Kai Tak in the CX edition: lighter grade */
.liv80 { color: #e3c06a; font-weight: 700; }
/* tall start screen on a short/narrow screen: centre it when it fits, otherwise start at the top and scroll (plain centring pushed the top out of reach) */
#title { align-items: flex-start; } #title > .hero { margin-top: auto; margin-bottom: auto; }
@media (max-width: 700px) { #title { padding-bottom: calc(76px + env(safe-area-inset-bottom)); } }   /* room to scroll past the edition toggle */
/* the livery editor link: start screen only (development) */
#devLivery { text-decoration: none; display: none; z-index: 61; }   /* above the start screen (z 50), where it is shown */
body:has(#title.show) #devLivery { display: inline-block; }

/* ===================================================================================================================
   Phone layout (html.phone: short side ≤ 500 px, or iPhone Duo–class ≤ ~700; html.land when sideways).
   See js/phone.js. Tablets and desktops are unaffected.
   =================================================================================================================== */
.phone-only { display: none !important; }
html.phone .phone-only { display: inline-flex !important; align-items: center; justify-content: center; }
/* the aircraft card never shows through the start screen (any device) */
body:has(#title.show) #cmdCard { display: none; }

/* top bar: one compact row */
html.phone #topbar { top: calc(6px + env(safe-area-inset-top)); left: calc(6px + env(safe-area-inset-left)); right: calc(6px + env(safe-area-inset-right));
  height: 48px; flex-wrap: nowrap; gap: 8px; padding: 0 4px 0 10px; border-radius: 14px; row-gap: 0; }
html.phone #topbar .brand, html.phone #topbar .stat:not(.clock):not(.mood):not(.flights), html.phone #topbar .stat .lbl, html.phone #topbar .fl-bar { display: none; }
html.phone #topbar .stat { min-width: 0; }
html.phone #topbar .stat .val { font-size: 16px; }
html.phone #topbar .stat.mood { min-width: 28px; flex: 0 1 48px; }
html.phone #topbar .fl-row { font-size: 12.5px; gap: 4px; display: flex; white-space: nowrap; }
html.phone .tools { margin-left: auto; width: auto; gap: 2px; justify-content: flex-end; }
html.phone #topbar button.icon { height: 40px; min-width: 40px; width: 40px; padding: 0; font-size: 15px; flex: none; }
html.phone.board-open #btnBoard { background: var(--accent); border-color: var(--accent); }

/* the ⋯ menu: view switch, music player, language */
#phoneMore { display: none; }
html.phone #phoneMore.open { display: flex; flex-direction: column; align-items: stretch; gap: 10px; position: fixed; z-index: 40; padding: 12px;
  top: calc(60px + env(safe-area-inset-top)); right: calc(8px + env(safe-area-inset-right)); width: min(300px, calc(100vw - 16px)); }
html.phone #phoneMore .seg { display: flex; } html.phone #phoneMore .seg button { flex: 1; }
html.phone #phoneMore .mplayer.mp-top { max-width: none; } html.phone #phoneMore .mp-top .mp-info { display: block; flex: 1; width: auto; }
html.phone #phoneMore .mp-top .mp-b { display: grid; }
html.phone #phoneMore .dd-btn { width: 100%; justify-content: flex-start; }
html.phone #phoneMore .dd-btn .lbl { display: inline; max-width: none; }
html.phone #phoneMore .dd-menu { left: 0; right: 0; min-width: 0; }

/* the flight board: hidden until 📋 is tapped, then scaled to fit under the top bar */
html.phone #fids { display: none; }
html.phone.board-open body:not(:has(#title.show)) #fids, html.phone.board-open #fids { display: block; left: 8px !important; top: calc(62px + env(safe-area-inset-top)) !important; right: auto !important;
  /* zoom (not transform:scale) – keeps board tabs + canvas text sharp on Retina */
  zoom: var(--fs, 1); z-index: 22; }
html.phone #fids .grip, html.phone #fids .fids-resize, html.phone #fidsMin { display: none; }
body:has(#title.show) #fids { display: none !important; }

/* aircraft card: bottom sheet (upright) */
html.phone #cmdCard { left: calc(6px + env(safe-area-inset-left)); right: calc(6px + env(safe-area-inset-right)); width: auto; bottom: calc(6px + env(safe-area-inset-bottom));
  max-height: 46vh; overflow-y: auto; padding: 10px 12px; border-radius: 16px; }
html.phone #cmdCard .cmd { min-height: 44px; }
html.phone #cmdCard { box-sizing: border-box; }   /* (so its width includes the padding – the ticker sits right beside it) */
/* … and a panel down the right when sideways, leaving the airport in the middle */
html.phone.land #cmdCard { left: auto; width: min(340px, 44vw); top: calc(62px + env(safe-area-inset-top)); bottom: auto; max-height: calc(100vh - 70px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
html.phone #cmdCard.min { top: auto; width: auto; max-height: none; }

/* radio: a one-line ticker under the top bar (the last message) */
html.phone #radioCard { top: calc(60px + env(safe-area-inset-top)); bottom: auto; left: calc(8px + env(safe-area-inset-left)); right: calc(56px + env(safe-area-inset-right));
  width: auto; height: auto; max-height: none; padding: 5px 10px; border-radius: 10px; }
html.phone.land #radioCard { right: calc(min(340px, 44vw) + 22px + env(safe-area-inset-right)); }
html.phone #radioCard .card-title { display: none; }
html.phone #radioScreen { max-height: 18px; font-size: 12px; line-height: 18px; }
html.phone #radioScreen .msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.phone.board-open #radioCard { display: none; }

/* compass: small, top right (upright) or bottom left (sideways) */
html.phone #compass { top: calc(60px + env(safe-area-inset-top)); right: calc(8px + env(safe-area-inset-right)); width: 40px; height: 40px; }
html.phone.land #compass { top: auto; right: auto; left: calc(8px + env(safe-area-inset-left)); bottom: calc(8px + env(safe-area-inset-bottom)); }
html.phone #toast { top: calc(92px + env(safe-area-inset-top)); max-width: calc(100vw - 32px); }
html.phone #devUsed, html.phone #devLivery { display: none !important; }

/* start screen: tighter, and the edition toggle in the page (under START) instead of floating over it */
html.phone #title { padding-top: calc(20px + env(safe-area-inset-top)); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
html.phone .hero { padding: 0 18px; }
html.phone .hero .t1 { font-size: 30px; margin: 10px 0 6px; }
html.phone .hero .t2 { font-size: 16px; } html.phone .hero .t3 { font-size: 12.5px; }
html.phone .session { margin-top: 10px; }
html.phone .hero #editionSel { position: static; display: inline-flex; margin-top: 18px; }
html.phone.land .hero { max-width: none; }
html.phone #phoneMore #btnExit { width: 100%; height: 44px; gap: 8px; font-size: 15px; }
html.phone #phoneMore #btnExit::after { content: attr(title); font: 600 14px var(--font); }
/* inside the iOS app: no developer tools */
html.app #devUsed, html.app #devLivery { display: none !important; }
/* Cathay 80th edition: jade in place of the violet accents (Cathay-style jade #2f8f83 / #006564 / #003f44, the logo jades; white text on
   #006564 = 6.9:1). Kai Tak keeps its own 1990s amber palette; its aircraft card goes jade instead of violet. */
html.cx80:not(.kt) { --accent: #006564; --accent2: #2f8f83; }
html.cx80:not(.kt) .seg button.on, html.cx80:not(.kt) .dd-item.on, html.cx80:not(.kt) .mp-b.mp-play { box-shadow: 0 2px 10px rgba(0, 101, 100, .5); }
html.cx80:not(.kt) .fids-tabs button.on { background: linear-gradient(90deg, rgba(0, 101, 100, .55), rgba(47, 143, 131, .22)); border-color: rgba(47, 143, 131, .7); }
html.cx80:not(.kt) .cmd { border-color: rgba(47, 143, 131, .55); background: rgba(0, 101, 100, .3); }
html.cx80:not(.kt) .tag.sel::before { background: linear-gradient(rgba(47, 143, 131, .95), rgba(47, 143, 131, .2)); }
html.cx80:not(.kt) .tag.sel { background: rgba(0, 63, 68, .9); }
html.cx80:not(.kt) .overlay { background: radial-gradient(1200px 600px at 30% 20%, rgba(0, 101, 100, .3), transparent), linear-gradient(180deg, rgba(5, 8, 20, .25), rgba(5, 8, 20, .75)); }
html.cx80:not(.kt) button.primary { background: linear-gradient(95deg, #003f44, #006564); box-shadow: 0 10px 30px rgba(0, 101, 100, .45); }
html.cx80:not(.kt) .dd-btn:hover { border-color: rgba(47, 143, 131, .6); }
html.cx80:not(.kt) .dd.open .dd-btn { background: rgba(0, 101, 100, .35); border-color: rgba(47, 143, 131, .7); }
html.cx80:not(.kt) #fids.dragging, html.cx80:not(.kt) #cmdCard.dragging, html.cx80:not(.kt) #radioCard.dragging { box-shadow: 0 18px 50px rgba(0, 0, 0, .45), 0 0 0 1px rgba(47, 143, 131, .6); }
html.cx80:not(.kt) #cmdCard .ac-head:active { background: rgba(0, 101, 100, .3); }
html.cx80:not(.kt) .ac-nav .nav-btn:active { background: rgba(0, 101, 100, .4); }
html.cx80.kt #cmdCard { --accent: #006564; --accent2: #2f8f83; }

/* stand picker area group header (colour = map stand label colour) */
.stand-grp { flex-basis: 100%; display: flex; align-items: center; gap: 6px; margin: 4px 0 -2px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c); }
.stand-grp i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 60%, transparent); }
.stand-grp::after { content: ''; flex: 1; height: 1px; background: color-mix(in srgb, var(--c) 35%, transparent); }

/* Settings → Button size → Small: the aircraft card's buttons a size down on every device (still ~30 px to tap on touch) */
html.btn-sm #cmdCard .cmds { gap: 5px; margin-top: 8px; }
html.btn-sm #cmdCard .cmd { min-height: 0; padding: 4px 9px; font-size: 12px; border-radius: 8px; }
html.btn-sm #cmdCard .cmd.stand { min-height: 0; padding: 3px 7px; font-size: 11px; }
html.btn-sm #cmdCard .ac-nav .nav-btn { padding: 4px 10px; font-size: 11.5px; border-radius: 8px; }
html.btn-sm .card-min { width: 26px; height: 22px; font-size: 12px; }
@media (pointer: coarse) {
  html.btn-sm #cmdCard .cmd, html.btn-sm #cmdCard .cmd.stand { min-height: 30px; }
  html.btn-sm #cmdCard .ac-nav .nav-btn { padding: 6px 11px; }
  html.btn-sm .card-min { width: 30px; height: 26px; }
}
