:root {
  --paper: #e9dfc7; --paper-dk: #d6c8a6; --ink: #2a241b; --ink-soft: #5b4f3d; --red: #8f2a1f; --brass: #b08a43;
  --night: #15120d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--ink); font-family: 'Libre Baskerville', Georgia, serif; }
canvas#gl, canvas#hud { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
canvas#hud { pointer-events: none; }
.hidden { display: none !important; }

.screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.screen.show { display: flex; }
#menu, #loading { background: radial-gradient(ellipse at center, rgba(30,24,16,0.25), rgba(10,8,5,0.85)); }
#briefing, #controls, #settings, #pause { background: rgba(12,10,7,0.72); overflow-y: auto; }

.load-inner { text-align: center; color: var(--paper); font-family: 'Special Elite', monospace; letter-spacing: 0.1em; }
.reel { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; border: 6px dotted var(--paper); animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.poster { text-align: center; color: var(--paper); max-width: 760px; text-shadow: 0 2px 12px rgba(0,0,0,0.8); }
.kicker { font-family: 'Oswald', sans-serif; letter-spacing: 0.45em; text-transform: uppercase; font-size: 14px; color: #e7c98a; }
.poster h1 { font-family: 'Oswald', sans-serif; font-weight: 700; text-transform: uppercase; font-size: clamp(56px, 12vw, 132px); line-height: 0.95; margin: 12px 0 6px; letter-spacing: 0.04em; color: #f1e6cc; }
.rule { width: 220px; height: 3px; margin: 10px auto 18px; background: linear-gradient(90deg, transparent, #c9a45c, transparent); }
.tag { font-style: italic; font-size: clamp(14px, 2vw, 18px); line-height: 1.6; color: #e6dabd; margin: 0 auto 28px; max-width: 560px; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.foot { margin-top: 26px; font-size: 13px; color: #bfb08f; font-family: 'Special Elite', monospace; }

button { font-family: 'Oswald', sans-serif; font-weight: 500; text-transform: uppercase; letter-spacing: 0.18em; font-size: 15px; padding: 11px 26px; min-width: 260px; cursor: pointer;
  color: var(--paper); background: rgba(26,21,14,0.78); border: 1px solid #a88c55; border-radius: 2px; transition: background 0.15s, color 0.15s, transform 0.1s; }
button:hover { background: #a88c55; color: #1b160e; }
button:active { transform: translateY(1px); }
button.primary { background: #8f2a1f; border-color: #c9a45c; }
button.primary:hover { background: #b23a2a; color: #fff3dc; }
.paper button { color: var(--ink); background: transparent; border-color: var(--ink-soft); min-width: 0; }
.paper button:hover { background: var(--ink); color: var(--paper); }
.paper button.primary { background: var(--red); color: #f6ead0; border-color: var(--red); }

.paper { position: relative; background: var(--paper); background-image: radial-gradient(ellipse at 20% 10%, rgba(255,255,255,0.35), transparent 60%), radial-gradient(ellipse at 80% 90%, rgba(120,90,40,0.18), transparent 60%);
  max-width: 640px; width: 100%; padding: 34px 38px; box-shadow: 0 20px 60px rgba(0,0,0,0.6), inset 0 0 80px rgba(120,90,40,0.25); color: var(--ink); margin: auto; }
.paper.wide { max-width: 1040px; }
.paper.small-paper { max-width: 380px; text-align: center; }
.paper .hdr { font-family: 'Special Elite', monospace; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); border-bottom: 1px solid var(--ink-soft); padding-bottom: 8px; margin-bottom: 14px; }
.paper h2 { font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: 0.06em; font-size: 30px; margin: 4px 0 12px; }
.paper h3 { font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: 0.12em; font-size: 15px; margin: 18px 0 8px; color: var(--red); }
.paper p { line-height: 1.6; font-size: 15px; }
.paper .note { font-style: italic; border-left: 3px solid var(--red); padding-left: 12px; }
.stamp { position: absolute; top: 22px; right: 26px; font-family: 'Oswald', sans-serif; font-weight: 700; letter-spacing: 0.2em; color: rgba(143,42,31,0.75); border: 3px solid rgba(143,42,31,0.75); padding: 2px 10px; transform: rotate(8deg); }
.row { display: flex; gap: 12px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } .paper { padding: 24px 18px; } button { min-width: 200px; } }
.opt { display: block; font-size: 14px; line-height: 1.5; margin: 6px 0; cursor: pointer; }
.chk { display: block; font-size: 14px; margin: 6px 0; cursor: pointer; }
.slider { display: grid; grid-template-columns: 150px 1fr 48px; align-items: center; gap: 10px; font-size: 14px; margin: 8px 0; }
.slider em { font-style: normal; font-family: 'Special Elite', monospace; text-align: right; }
input[type=range] { accent-color: var(--red); width: 100%; }
.keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.keys td { padding: 4px 6px; border-bottom: 1px dotted var(--ink-soft); }
.keys td:first-child { font-family: 'Special Elite', monospace; white-space: nowrap; }
.small { font-size: 13px !important; color: var(--ink-soft); }
.pad-status { font-family: 'Special Elite', monospace; font-size: 13px; padding: 10px; border: 1px dashed var(--ink-soft); margin: 8px 0; }
.pad-status.ok { border-style: solid; border-color: #2f5d2a; color: #2f5d2a; }
#padBind .bind { display: grid; grid-template-columns: 110px 1fr auto auto; gap: 8px; align-items: center; font-size: 13px; margin: 5px 0; }
#padBind .bar { height: 8px; background: var(--paper-dk); position: relative; }
#padBind .bar i { position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; background: var(--red); }
#padBind button { padding: 4px 10px; font-size: 11px; letter-spacing: 0.08em; }
.buy { margin-top: 18px; padding: 4px 16px 10px; background: rgba(176,138,67,0.15); border: 1px solid rgba(91,79,61,0.35); }
.buy p { font-size: 13.5px; margin: 8px 0; }

#msg { position: fixed; left: 50%; top: 14%; transform: translateX(-50%); z-index: 5; pointer-events: none; text-align: center; font-family: 'Special Elite', monospace; color: #f3e8cc;
  font-size: clamp(14px, 1.8vw, 19px); letter-spacing: 0.06em; text-shadow: 0 1px 6px #000, 0 0 2px #000; max-width: 90vw; }
#msg div { margin: 4px 0; opacity: 1; transition: opacity 1s; }
#clickToFly { position: fixed; left: 50%; bottom: 18%; transform: translateX(-50%); z-index: 6; font-family: 'Oswald', sans-serif; letter-spacing: 0.25em; text-transform: uppercase; color: #f3e8cc;
  background: rgba(20,16,10,0.75); padding: 12px 24px; border: 1px solid #a88c55; pointer-events: none; }
#credits { position: fixed; left: 16px; right: 16px; bottom: 10px; z-index: 11; font-size: 10px; color: #a99c7e; text-align: center; }

/* ---------- touch controls */
#touch { position: fixed; inset: 0; z-index: 4; pointer-events: none; user-select: none; -webkit-user-select: none; touch-action: none; }
#touch > * { pointer-events: auto; }
.t-steer { position: absolute; left: 22%; right: 0; top: 0; bottom: 0; }
.t-throttle { position: absolute; left: max(16px, env(safe-area-inset-left)); bottom: 24px; top: 30%; width: 64px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-family: 'Oswald', sans-serif; letter-spacing: 0.15em; font-size: 10px; color: rgba(243,232,204,0.7); }
.t-track { position: relative; flex: 1; width: 16px; border-radius: 8px; background: rgba(20,16,10,0.55); border: 1px solid rgba(168,140,85,0.6); }
.t-knob { position: absolute; left: 50%; bottom: calc(85% - 22px); width: 44px; height: 44px; margin-left: -22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #4a4438, #14120e); border: 2px solid #a88c55; }
.t-fire { position: absolute; right: max(20px, env(safe-area-inset-right)); bottom: 28px; width: 92px; height: 92px; min-width: 0; padding: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b23a2a, #5b1a12); border: 3px solid #c9a45c; color: #f6ead0; font-size: 14px; letter-spacing: 0.15em; opacity: 0.85; }
.t-fire.on { transform: scale(0.94); background: radial-gradient(circle at 35% 30%, #e05a3a, #7b2016); }
.t-top { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); display: flex; gap: 8px; }
.t-top button { min-width: 0; padding: 8px 12px; font-size: 11px; letter-spacing: 0.12em; background: rgba(20,16,10,0.55); }
@media (orientation: portrait) { body.is-touch #touch::after { content: 'Turn your phone sideways to fly'; position: absolute; left: 50%; top: 40%; transform: translateX(-50%); font-family: 'Oswald', sans-serif; letter-spacing: 0.2em; text-transform: uppercase; color: #f3e8cc; background: rgba(20,16,10,0.8); padding: 14px 20px; border: 1px solid #a88c55; } }
body.is-touch .foot { display: none; }

body.flying #gl { cursor: none; }

/* ---------- operations room */
.menu-clock { font-family: 'Special Elite', monospace; color: #e7c98a; letter-spacing: 0.08em; margin: -6px 0 16px; font-size: 15px; }
.ops { max-width: 1240px; }
.ops-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 24px; }
.ops-map canvas { width: 100%; height: auto; display: block; border: 1px solid #5b4f3d; box-shadow: inset 0 0 40px rgba(0,0,0,0.25); }
.ops h2 { margin-top: 0; }
.small-print { font-size: 13.5px !important; }
.tote { width: 100%; border-collapse: collapse; font-size: 13px; font-family: 'Special Elite', monospace; }
.tote th { text-align: left; font-family: 'Oswald', sans-serif; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; color: var(--ink-soft); border-bottom: 1px solid var(--ink-soft); padding: 3px 4px; }
.tote td { padding: 4px; border-bottom: 1px dotted rgba(91,79,61,0.5); }
.tote tr.me td { font-weight: bold; background: rgba(176,138,67,0.15); }
.lamp { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; box-shadow: 0 0 4px currentColor; }
.lamp.g { background: #3e8f3a; color: #3e8f3a; } .lamp.a { background: #d19a26; color: #d19a26; } .lamp.r { background: #a3261b; color: #a3261b; }
.teletype { font-family: 'Special Elite', monospace; font-size: 12.5px; line-height: 1.45; max-height: 240px; overflow-y: auto; background: rgba(255,255,255,0.35); border: 1px solid rgba(91,79,61,0.35); padding: 8px 10px; }
.teletype div { margin: 0 0 6px; } .teletype span { color: var(--red); margin-right: 4px; } .teletype .player { font-weight: bold; }
.brief { font-size: 15px; border-left: 3px solid var(--red); padding-left: 12px; min-height: 1.6em; }
.paper button:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 900px) { .ops-grid { grid-template-columns: 1fr; } }

.t-look { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 8px; pointer-events: auto; }
.t-look button { min-width: 0; padding: 10px 14px; font-size: 13px; background: rgba(20,16,10,0.55); }

.hangar { font-family: 'Special Elite', monospace; font-size: 13px; }
.hangar div { padding: 6px 8px; border: 1px solid rgba(91,79,61,0.35); margin-bottom: 6px; background: rgba(255,255,255,0.25); }
.hangar b { font-family: 'Oswald', sans-serif; letter-spacing: 0.08em; }
.hangar .st-ready { color: #2f5d2a; } .hangar .st-repair { color: #9a6416; } .hangar .st-lost { color: #8f2a1f; }
.hangar .fly { float: right; font-family: 'Oswald', sans-serif; font-size: 11px; letter-spacing: 0.12em; color: var(--red); }

/* ---------- combat report and log book */
.report-paper { max-width: 760px; font-family: 'Special Elite', monospace; }
.form { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 10px; }
.form td { padding: 5px 6px; border-bottom: 1px dotted var(--ink-soft); vertical-align: top; }
.form td:first-child { width: 42%; color: var(--ink-soft); text-transform: uppercase; font-size: 11.5px; letter-spacing: 0.06em; }
.typed { font-family: 'Special Elite', monospace; font-size: 14px !important; line-height: 1.65 !important; }
.sig { text-align: right; font-style: italic; }
.gazette { border: 2px solid var(--red); padding: 6px 14px; margin-top: 10px; background: rgba(143,42,31,0.06); }
.gazette p { font-family: 'Oswald', sans-serif; letter-spacing: 0.05em; color: var(--red); margin: 6px 0; }
.lb-name { font-family: 'Special Elite', monospace; font-size: 14px; } .lb-name input { font-family: 'Special Elite', monospace; font-size: 15px; background: transparent; border: none; border-bottom: 1px solid var(--ink-soft); padding: 2px 6px; width: 260px; color: var(--ink); }
.lb-scroll { max-height: 52vh; overflow-y: auto; } .lb td { font-size: 12.5px; }

/* ---------- missions */
.mission-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 26px; }
.mission-list { display: flex; flex-direction: column; gap: 6px; max-height: 58vh; overflow-y: auto; }
.mission-list .era { font-family: 'Oswald', sans-serif; letter-spacing: 0.2em; font-size: 12px; color: var(--red); margin: 10px 0 2px; }
.mission-list button { text-align: left; min-width: 0; padding: 9px 12px; letter-spacing: 0.06em; text-transform: none; font-size: 15px; }
.mission-list button small { display: block; font-family: 'Special Elite', monospace; font-size: 11.5px; letter-spacing: 0; opacity: 0.75; }
.mission-list button.sel { background: var(--ink); color: var(--paper); }
.mission-brief p { line-height: 1.65; }
@media (max-width: 820px) { .mission-grid { grid-template-columns: 1fr; } }

.credits-btn { min-width: 0; padding: 4px 12px; font-size: 10px; letter-spacing: 0.15em; background: rgba(20,16,10,0.5); border-color: rgba(168,140,85,0.5); }
#creditsText { max-width: 900px; margin: 8px auto 0; background: rgba(15,12,8,0.85); padding: 10px 14px; line-height: 1.5; }

/* fire button on the left for left-handed players: throttle goes to the right */
#touch.left-fire .t-fire { right: auto; left: max(20px, env(safe-area-inset-left)); }
#touch.left-fire .t-throttle { left: auto; right: max(16px, env(safe-area-inset-right)); }
#touch.left-fire .t-steer { left: 0; right: 22%; }
#touch .t-tiltbtn { display: none; } #touch.tilt-on .t-tiltbtn { display: inline-block; }
#touch .muted { opacity: 0.5; text-decoration: line-through; }
.sound-btn { position: fixed; top: 12px; right: 14px; z-index: 12; min-width: 0; padding: 6px 12px; font-size: 11px; letter-spacing: 0.15em; background: rgba(20,16,10,0.55); }

body.flying .sound-btn { display: none; }

/* the squadron */
.cast { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; max-height: 60vh; overflow-y: auto; margin: 10px 0; }
.card { border: 1px solid rgba(60,45,25,0.35); background: rgba(255,250,235,0.5); padding: 10px 12px; display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: start; }
.card .mono { width: 52px; height: 64px; border: 1px solid rgba(60,45,25,0.5); display: flex; align-items: center; justify-content: center; font: 700 20px 'Oswald', sans-serif; letter-spacing: 1px; color: #f3ead2; background: #4a4638; filter: sepia(0.4); }
.card.LW .mono { background: #3e4246; } .card.USAAF .mono { background: #4c4f36; } .card.rival { border-color: #b8901c; } .card.rival .mono { background: #b8901c; color: #222; }
.card h4 { margin: 0; font-size: 14px; line-height: 1.2; } .card .role { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.7; margin: 2px 0 6px; } .card p { margin: 0; font-size: 13px; line-height: 1.4; }
/* the demo: newsreel titles and captions */
#demo { position: fixed; inset: 0; pointer-events: none; z-index: 9; display: none; }
#demo.on { display: block; }
body.in-demo #soundBtn, body.in-demo #credits { display: none; }
.demo-title { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); text-align: center; color: #f3ead2; text-shadow: 0 2px 14px rgba(0,0,0,0.9); opacity: 0; transition: opacity 1.2s; width: min(90vw, 760px); }
.demo-title.show { opacity: 1; }
.demo-title .k { font: 500 13px 'Oswald', sans-serif; letter-spacing: 4px; text-transform: uppercase; opacity: 0.85; }
.demo-title h2 { font: 700 clamp(40px, 9vw, 86px) 'Oswald', sans-serif; letter-spacing: 6px; text-transform: uppercase; margin: 6px 0; }
.demo-title .s { font: italic 17px Georgia, serif; }
.demo-cap { position: absolute; left: 28px; bottom: 60px; color: #f3ead2; text-shadow: 0 1px 8px rgba(0,0,0,0.95); opacity: 0; border-left: 3px solid #c9a227; padding: 4px 0 4px 12px; max-width: 80vw; }
.demo-cap.show { animation: capIn 6.5s ease forwards; }
.demo-cap .k { font: 600 12px 'Oswald', sans-serif; letter-spacing: 3px; text-transform: uppercase; color: #e6c766; }
.demo-cap .t { font: 18px Georgia, serif; }
@keyframes capIn { 0% { opacity: 0; transform: translateX(-12px); } 10% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
.demo-hint { position: absolute; right: 18px; bottom: 18px; font: 12px 'Oswald', sans-serif; letter-spacing: 2px; text-transform: uppercase; color: rgba(243,234,210,0.6); }

/* the squadron's fortunes */
.card.gone { filter: grayscale(0.85); opacity: 0.8; }
.badge { display: inline-block; font: 600 10px 'Oswald', sans-serif; letter-spacing: 1px; text-transform: uppercase; padding: 2px 6px; margin: 0 0 6px; background: #5a1e16; color: #f3ead2; }
.badge.wounded { background: #7a5a1a; } .badge.pow, .badge.missing { background: #3d3d3d; }
.roster { grid-column: 1 / -1; } .roster h4 { margin: 6px 0; } .roster td { font-size: 12px; padding: 3px 6px; }
.roster tr.killed td, .roster tr.missing td, .roster tr.pow td { opacity: 0.6; text-decoration: line-through; text-decoration-thickness: 1px; }
.roster tr.killed td:last-child, .roster tr.pow td:last-child, .roster tr.missing td:last-child { text-decoration: none; }
.letter-wrap { position: fixed; inset: 0; background: rgba(10,8,5,0.75); display: flex; align-items: center; justify-content: center; z-index: 30; padding: 16px; }
.letter { max-width: 520px; max-height: 88vh; overflow-y: auto; background: #f1e8d2; color: #2a2318; padding: 26px 30px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); transform: rotate(-0.6deg); background-image: repeating-linear-gradient(transparent 0 27px, rgba(80,90,140,0.15) 27px 28px); }
.lt-hdr { font: 600 11px 'Oswald', sans-serif; letter-spacing: 2px; text-transform: uppercase; color: #6a2a20; }
.lt-from { font: italic 13px Georgia, serif; margin: 4px 0 14px; opacity: 0.75; }
.lt-body { font: 17px/28px 'Homemade Apple', 'Segoe Script', 'Bradley Hand', cursive; margin-bottom: 18px; }

.badge.exp { background: #2e3a26; }

#fadeBlack { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.5s; z-index: 40; }
#fadeBlack.on { opacity: 1; }

.side-tabs { display: flex; gap: 6px; margin-bottom: 8px; } .side-tabs button { flex: 1; padding: 6px; } .side-tabs button.on, .side-pick button.on { background: #6b2a1e; color: #f3ead2; }
.side-pick { display: flex; gap: 6px; align-items: center; justify-content: center; font: 13px 'Oswald', sans-serif; letter-spacing: 1px; text-transform: uppercase; color: var(--paper); margin: 2px 0 4px; } .side-pick button { padding: 4px 12px; min-width: 0; }

.career { display: flex; gap: 18px; flex-wrap: wrap; font-family: 'Special Elite', monospace; font-size: 13px; margin: -4px 0 12px; padding: 8px 12px; background: rgba(60,40,20,0.08); border-left: 3px solid var(--red); }
.career b { font-family: 'Oswald', sans-serif; letter-spacing: 0.08em; }
.mission-list button.done::after { content: ' ✓'; color: #4d6b2e; font-weight: bold; }
.mission-list button.failed::after { content: ' ✗'; color: #8a2b1e; }
.mission-list button.next { border-color: var(--red); box-shadow: inset 3px 0 0 var(--red); }
.history { margin: 14px 0; padding: 12px 16px; background: rgba(40,30,20,0.07); border-left: 3px solid #6b2a1e; line-height: 1.6; }
.done-panel { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 30; background: rgba(18,16,12,0.86); color: #f3ead2; padding: 14px 18px; border: 1px solid rgba(243,234,210,0.3); max-width: min(92vw, 640px); text-align: center; font-family: 'Oswald', sans-serif; letter-spacing: 0.04em; }
.done-panel.hidden { display: none; }
.done-panel #doneText { font-size: 15px; margin-bottom: 10px; }
.done-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.done-btns button { font: 13px 'Oswald', sans-serif; letter-spacing: 0.06em; padding: 7px 12px; background: #2a2620; color: #f3ead2; border: 1px solid rgba(243,234,210,0.35); cursor: pointer; }
.done-btns button.primary { background: #6b2a1e; }
.done-btns i { opacity: 0.6; font-style: normal; margin-left: 4px; font-size: 11px; }

/* ---- screens never clip: they scroll, and centre only when there is room (safe centring with auto margins) */
.screen { align-items: flex-start; justify-content: flex-start; overflow: auto; -webkit-overflow-scrolling: touch; }
.screen > * { margin: auto; flex-shrink: 0; max-width: 100%; }
#menu { padding: 56px 16px 64px; }
.poster { width: 100%; }
.poster h1 { font-size: clamp(40px, min(12vw, 14vh), 132px); }
.side-pick button { min-width: 0; padding: 8px 14px; }
.menu-buttons button { max-width: 100%; }
/* short screens (laptops, phones on their side): two columns of buttons, a tighter poster */
@media (max-height: 760px) and (min-width: 560px) {
  .menu-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 250px)); justify-content: center; gap: 8px 12px; }
  .menu-buttons button { min-width: 0; width: 100%; padding: 9px 14px; }
  .menu-buttons .primary, .menu-buttons .side-pick { grid-column: 1 / -1; }
  .menu-buttons .primary { justify-self: center; width: min(100%, 512px); }
  .side-pick { justify-content: center; }
  .rule { margin: 6px auto 10px; }
  .tag { margin-bottom: 14px; font-size: 14px; }
  .foot { margin-top: 12px; }
}
@media (max-height: 480px) {
  #menu { padding-top: 44px; padding-bottom: 52px; }
  .tag, .foot { display: none; }
  .kicker { font-size: 11px; letter-spacing: 0.3em; }
  .poster h1 { margin: 4px 0 2px; }
  .menu-clock { font-size: 12px; margin-bottom: 8px; }
  .menu-buttons button { padding: 7px 12px; font-size: 13px; letter-spacing: 0.12em; }
}
/* narrow phones: buttons fill the width, nothing sits under the corner buttons */
@media (max-width: 480px) {
  .kicker { letter-spacing: 0.22em; font-size: 12px; }
  .menu-buttons button { min-width: 0; width: min(100%, 300px); }
  .paper { padding: 22px 14px; }
}
.menu-buttons .side-pick button { width: auto !important; min-width: 0 !important; }
@media (max-height: 480px) { #menu { padding-top: 40px; padding-bottom: 40px; } .poster h1 { font-size: clamp(34px, 12vh, 60px); } .rule { margin: 3px auto 6px; } .menu-buttons { gap: 6px 12px; } }

/* ---- touch layout: steering under one thumb, guns, bombs and throttle under the other.
   Default: fire on the right, so the right thumb has throttle, fire and bombs; the left thumb steers. */
.t-steer { left: 0; right: 50%; top: 56px; bottom: 0; }
.t-pad { position: absolute; left: max(28px, env(safe-area-inset-left)); bottom: 34px; width: 150px; height: 150px; border-radius: 50%; border: 1.5px dashed rgba(243,232,204,0.35); background: radial-gradient(circle, rgba(20,16,10,0.25), rgba(20,16,10,0.05) 70%); pointer-events: none; display: flex; align-items: center; justify-content: center; }
.t-pad span { font: 11px 'Oswald', sans-serif; letter-spacing: 0.2em; color: rgba(243,232,204,0.5); }
.t-throttle { left: auto; right: max(14px, env(safe-area-inset-right)); top: 64px; bottom: 24px; }
.t-fire { right: calc(max(14px, env(safe-area-inset-right)) + 80px); bottom: 26px; }
.t-bomb { position: absolute; right: calc(max(14px, env(safe-area-inset-right)) + 92px); bottom: 136px; width: 72px; height: 72px; min-width: 0; padding: 0; border-radius: 50%; font-size: 12px; letter-spacing: 0.1em; display: none;
  background: radial-gradient(circle at 35% 30%, #5a5238, #22201a); border: 2px solid #c9a45c; color: #f3e8cc; }
.t-bomb.on { transform: scale(0.94); background: radial-gradient(circle at 35% 30%, #c9a45c, #5a4a22); }
#touch.has-bombs .t-bomb { display: block; }
/* fire on the left: everything mirrors */
#touch.left-fire .t-steer { left: 50%; right: 0; }
#touch.left-fire .t-pad { left: auto; right: max(28px, env(safe-area-inset-right)); }
#touch.left-fire .t-throttle { right: auto; left: max(14px, env(safe-area-inset-left)); }
#touch.left-fire .t-fire { right: auto; left: calc(max(14px, env(safe-area-inset-left)) + 80px); }
#touch.left-fire .t-bomb { right: auto; left: calc(max(14px, env(safe-area-inset-left)) + 92px); }
/* tilt-to-fly steers with the phone itself: the pad is only a hint then */
#touch.tilt-on .t-pad { opacity: 0.35; }
/* engine start: a big START in the middle while she is cold; gear and flaps beside the throttle */
.t-start { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); display: none; width: 132px; height: 132px; min-width: 0; padding: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3f6a3a, #18301a); border: 3px solid #c9a45c; color: #f3e8cc; font-size: 22px; letter-spacing: 0.12em; box-shadow: 0 0 0 6px rgba(201,164,92,0.18); }
.t-start small { display: block; font-size: 11px; letter-spacing: 0.2em; opacity: 0.8; margin-top: 2px; }
#touch.need-start .t-start { display: block; animation: startPulse 1.6s ease-in-out infinite; }
@keyframes startPulse { 50% { box-shadow: 0 0 0 14px rgba(201,164,92,0.05); } }
.t-side { position: absolute; top: 64px; right: calc(max(14px, env(safe-area-inset-right)) + 82px); display: flex; flex-direction: column; gap: 8px; }
.t-side button { min-width: 0; width: 72px; padding: 9px 0; font-size: 12px; letter-spacing: 0.12em; background: rgba(20,16,10,0.6); }
#touch.left-fire .t-side { right: auto; left: calc(max(14px, env(safe-area-inset-left)) + 82px); }
/* your place in the battle: aircraft and seat */
.roles h3 { margin: 14px 0 6px; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.8; }
.role-ac { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.role-ac b { min-width: 92px; font-size: 13px; }
.role-ac button { min-width: 0; padding: 6px 10px; font-size: 13px; min-height: 34px; }
.role-ac button.sel { background: var(--ink); color: var(--paper); }

/* the crew bar: change position in a bomber (or a two-seater) */
#crewBar { position: fixed; left: 50%; transform: translateX(-50%); top: max(10px, env(safe-area-inset-top)); z-index: 30; display: none; gap: 4px; align-items: center; padding: 4px 6px; background: rgba(15,13,10,0.62); border: 1px solid rgba(168,140,85,0.45); border-radius: 6px; font-family: 'Oswald', sans-serif; max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center; }
#crewBar.show { display: flex; }
#crewBar .lbl { color: rgba(243,232,204,0.75); font-size: 11px; letter-spacing: 0.14em; margin: 0 4px; }
#crewBar button { min-width: 0; padding: 5px 9px; font-size: 12px; letter-spacing: 0.06em; min-height: 32px; background: rgba(40,34,26,0.85); color: #f3e8cc; border: 1px solid rgba(168,140,85,0.5); }
#crewBar button.on { background: #6b2a1e; border-color: #c9a46a; }
#crewBar button small { opacity: 0.6; margin-right: 4px; }
body.is-touch #crewBar { top: calc(max(10px, env(safe-area-inset-top)) + 46px); }
.crew-pause { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0; }
.crew-pause:empty { display: none; }
.crew-pause button { min-width: 0; padding: 6px 10px; font-size: 13px; }
.crew-pause button.on { background: var(--ink); color: var(--paper); }

body.is-touch #crewBar { flex-wrap: nowrap; gap: 3px; padding: 3px 4px; top: calc(max(8px, env(safe-area-inset-top)) + 44px); }
body.is-touch #crewBar button { padding: 3px 7px; font-size: 11px; min-height: 28px; letter-spacing: 0.03em; }
#crewBar button.frames { margin-left: 6px; border-color: rgba(200,170,110,0.8); }
#crewBar button.frames.on { background: #3d4a2e; }
#crewBar button { white-space: nowrap; }

/* ---------- tour of duty */
#tBody { max-height: 66vh; overflow-y: auto; }
.tour-head { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; margin-bottom: 8px; }
.tour-head h2 { margin: 0; }
.tour-head .ac { font-family: 'Special Elite', monospace; font-size: 15px; }
.tour-prog { display: flex; gap: 3px; margin: 6px 0 12px; flex-wrap: wrap; }
.tour-prog i { width: 16px; height: 16px; border: 1px solid var(--ink); display: inline-block; font-style: normal; font-size: 10px; text-align: center; line-height: 15px; }
.tour-prog i.ok { background: var(--ink); color: var(--paper); }
.tour-prog i.bad { background: #8a3424; color: #f3ead2; border-color: #8a3424; }
.tour-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 22px; }
@media (max-width: 820px) { .tour-grid { grid-template-columns: 1fr; } }
.roster { width: 100%; border-collapse: collapse; font-size: 13px; }
.roster th { text-align: left; font-family: 'Oswald', sans-serif; letter-spacing: 0.08em; font-weight: 500; font-size: 11px; border-bottom: 1px solid var(--ink); padding: 3px 4px; }
.roster td { padding: 4px; border-bottom: 1px dotted rgba(0,0,0,0.25); vertical-align: top; }
.roster td small { display: block; opacity: 0.7; font-size: 11px; }
.roster .st-wounded { color: #8a3424; } .roster .st-ok { color: #2f4a2a; }
.roster .medal { font-size: 10.5px; opacity: 0.85; }
.tour-brief { border: 1px solid var(--ink); padding: 10px 12px; }
.tour-brief h3 { margin: 0 0 4px; font-family: 'Oswald', sans-serif; letter-spacing: 0.08em; }
.tour-seats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tour-seats button { min-width: 0; padding: 5px 9px; font-size: 12.5px; }
.tour-seats button.sel { background: var(--ink); color: var(--paper); }
.cond { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; margin-top: 6px; }
.cond span b { display: inline-block; width: 46px; height: 7px; border: 1px solid var(--ink); vertical-align: middle; margin-left: 4px; position: relative; }
.cond span b i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); }
.tour-debrief { background: rgba(0,0,0,0.05); border-left: 3px solid var(--red); padding: 8px 12px; margin-bottom: 12px; }
.tour-debrief p { margin: 4px 0; }
.tour-start { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .tour-start { grid-template-columns: 1fr; } }
.tour-start .choice { border: 1px solid var(--ink); padding: 10px 12px; cursor: pointer; }
.tour-start .choice.sel { background: rgba(0,0,0,0.08); outline: 2px solid var(--ink); }
#tName { font-family: 'Special Elite', monospace; font-size: 18px; padding: 6px 8px; width: 100%; box-sizing: border-box; background: transparent; border: none; border-bottom: 2px solid var(--ink); }
.suggest { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; } .suggest button { min-width: 0; padding: 3px 8px; font-size: 12px; text-transform: none; letter-spacing: 0; }

/* ---- the cameraman's bar, battle scenes, finest moments ---- */
#camBar { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); z-index: 30; display: none; flex-direction: column; align-items: center; gap: 4px; max-width: calc(100vw - 20px); font-family: 'Oswald', sans-serif; }
#camBar.show { display: flex; }
#camBar .cb-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 4px 6px; background: rgba(15,13,10,0.62); border: 1px solid rgba(168,140,85,0.45); border-radius: 6px; }
#camBar button { min-width: 0; padding: 5px 10px; font-size: 12px; letter-spacing: 0.06em; min-height: 34px; background: rgba(40,34,26,0.85); color: #f3e8cc; border: 1px solid rgba(168,140,85,0.5); }
#camBar button:hover { background: #6b2a1e; }
#camBar .cb-hint { font-size: 11px; letter-spacing: 0.08em; color: rgba(243,232,204,0.7); text-shadow: 0 1px 4px rgba(0,0,0,0.9); text-align: center; }
body.in-scene #msg, body.in-scene #crewBar { display: none !important; }
#sceneVeil { position: fixed; inset: 0; z-index: 12; display: flex; align-items: center; justify-content: center; background: #07060a; opacity: 0; pointer-events: none; transition: opacity 1.4s; color: #f3ead2; text-align: center; padding: 16px; }
#sceneVeil.on { opacity: 1; pointer-events: auto; }
#sceneVeil.ending { background: rgba(7,6,10,0.78); }
#sceneVeil .sv-in { width: min(92vw, 720px); }
#sceneVeil .k { font: 500 13px 'Oswald', sans-serif; letter-spacing: 4px; text-transform: uppercase; color: #e6c766; }
#sceneVeil h2 { font: 700 clamp(34px, 7vw, 70px) 'Oswald', sans-serif; letter-spacing: 5px; text-transform: uppercase; margin: 8px 0 4px; }
#sceneVeil .s { font: italic 17px Georgia, serif; opacity: 0.9; }
#sceneVeil .b { font: 15px/1.6 Georgia, serif; opacity: 0.75; margin: 18px auto 0; max-width: 600px; }
#sceneVeil .sv-roll { font: 12px 'Oswald', sans-serif; letter-spacing: 3px; text-transform: uppercase; opacity: 0.6; margin-top: 26px; animation: svRoll 1.6s ease-in-out infinite; }
#sceneVeil.ending .sv-roll, #sceneVeil.ending .b { display: none; }
@keyframes svRoll { 50% { opacity: 0.2; } }
#sceneVeil .sv-end { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 26px; }
#sceneVeil .sv-end button { min-width: 0; }
#sceneVeil .sv-saved { flex-basis: 100%; font: italic 14px Georgia, serif; opacity: 0.8; }
.scene-top { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 4px 0 10px; }
.scene-top .chk { margin: 0; }
.scene-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; max-height: 56vh; overflow-y: auto; padding-right: 4px; }
.scene-list .era { grid-column: 1 / -1; font-family: 'Oswald', sans-serif; letter-spacing: 0.2em; font-size: 12px; color: var(--red); margin: 8px 0 0; }
.paper .scene-card { position: relative; text-align: left; min-width: 0; padding: 9px 12px 9px 12px; text-transform: none; letter-spacing: 0.04em; font-size: 15px; }
.scene-card b { display: block; font-family: 'Oswald', sans-serif; font-weight: 500; padding-right: 48px; }
.scene-card small { display: block; font-family: 'Special Elite', monospace; font-size: 11px; letter-spacing: 0; opacity: 0.75; margin-top: 2px; }
.scene-card .tag { position: absolute; right: 8px; top: 8px; font: 600 10px 'Oswald', sans-serif; letter-spacing: 0.14em; text-transform: uppercase; padding: 1px 5px; border: 1px solid currentColor; opacity: 0.7; }
.scene-card.LW .tag { color: #8a2b1e; }
.scene-card.RAF .tag { color: #2b4a7a; }
.moment-list { display: flex; flex-direction: column; gap: 8px; max-height: 56vh; overflow-y: auto; margin-top: 10px; }
.moment { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid var(--ink-soft); box-shadow: inset 3px 0 0 #2b4a7a; }
.moment.LW { box-shadow: inset 3px 0 0 #8a2b1e; }
.moment b { font-family: 'Oswald', sans-serif; font-weight: 500; font-size: 16px; }
.moment small { display: block; font-family: 'Special Elite', monospace; font-size: 11.5px; opacity: 0.75; }
.moment .mb { display: flex; gap: 6px; flex-shrink: 0; }
.paper .moment .mb button { min-width: 0; padding: 6px 12px; }
.moment-list .empty { font-style: italic; }
@media (max-width: 600px) { #camBar .cb-hint { display: none; } .moment { flex-direction: column; align-items: stretch; } .moment .mb { justify-content: flex-end; } #camBar button { padding: 5px 7px; font-size: 11px; } }
@media (max-width: 640px) { body.in-cam #msg { top: 150px !important; } }

/* spectator: a button on the screen to let the AI fly while you watch, and to take her back */
#specBtn { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 7; min-width: 0; padding: 8px 14px; font: 13px 'Oswald', sans-serif; letter-spacing: 0.14em; text-transform: uppercase;
  background: rgba(20,16,10,0.62); color: #f3e8cc; border: 1px solid rgba(201,164,92,0.6); border-radius: 4px; cursor: pointer; }
#specBtn small { opacity: 0.6; margin-left: 6px; }
#specBtn:hover { background: #6b2a1e; }
#specBtn.on { background: rgba(107,42,30,0.85); border-color: #c9a45c; animation: startPulse 1.8s ease-in-out infinite; }
body:has(.screen.show) #specBtn { display: none; }
/* phones under the parachute: the flying controls go, a big VIEW button and LAND take their place, the pad looks round */
#touch .t-mode, #touch .t-take { display: none; }
#touch.chute .t-throttle, #touch.chute .t-fire, #touch.chute .t-bomb, #touch.chute .t-side, #touch.chute .t-look, #touch.chute .t-start,
#touch.spec .t-throttle, #touch.spec .t-fire, #touch.spec .t-bomb, #touch.spec .t-side, #touch.spec .t-look, #touch.spec .t-start, #touch.spec .t-steer { display: none !important; }
#touch.chute .t-mode { display: flex; position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: 26px; flex-direction: column; gap: 12px; align-items: center; }
#touch .t-mode button, #touch .t-take { min-width: 0; width: 104px; height: 104px; padding: 0; border-radius: 50%; font-size: 19px; letter-spacing: 0.12em; color: #f3e8cc;
  background: radial-gradient(circle at 35% 30%, #5a5238, #22201a); border: 2px solid #c9a45c; box-shadow: 0 0 0 5px rgba(201,164,92,0.15); }
#touch .t-mode button small, #touch .t-take small { display: block; font-size: 10px; letter-spacing: 0.16em; opacity: 0.75; margin-top: 3px; }
#touch .t-mode .t-cskip { width: 78px; height: 78px; font-size: 15px; }
#touch.chute .t-pad span { font-size: 0; } #touch.chute .t-pad span::after { content: 'LOOK'; font-size: 11px; }
#touch.chute.left-fire .t-mode { right: auto; left: max(16px, env(safe-area-inset-left)); }
#touch.chute .t-specbtn { display: none; }
#touch.spec .t-take { display: block; position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: 26px; background: radial-gradient(circle at 35% 30%, #8a3a26, #3a1610); animation: startPulse 1.8s ease-in-out infinite; }
#touch.chute .t-top [data-t=clear], #touch.chute .t-top [data-t=nav], #touch.chute .t-top [data-t=skip], #touch.chute .t-top [data-t=land], #touch.chute .t-top [data-t=boost], #touch.chute .t-top [data-t=bail], #touch.chute .t-top [data-t=tilt],
#touch.spec .t-top [data-t=clear], #touch.spec .t-top [data-t=land], #touch.spec .t-top [data-t=boost], #touch.spec .t-top [data-t=tilt] { display: none; }

/* the missions screen: aircraft, then the kind of mission */
.mission-list .pick-h { font-family: 'Oswald', sans-serif; letter-spacing: 0.2em; font-size: 11px; text-transform: uppercase; opacity: 0.7; margin: 4px 0 0; }
.mission-list .ac-pick, .mission-list .ty-pick { display: flex; flex-wrap: wrap; gap: 5px; }
.mission-list .ac-pick button, .mission-list .ty-pick button { flex: 0 0 auto; padding: 5px 9px; font-size: 13px; text-align: center; }
.mission-list .ac-pick button small { display: inline; margin-left: 5px; font-size: 11px; opacity: 0.6; }
.mission-list .ac-pick button.on, .mission-list .ty-pick button.on { background: #6b2a1e; color: #f3ead2; }
.mission-list button .mtag { display: inline-block; margin-top: 3px; font-style: normal; font-family: 'Oswald', sans-serif; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--red); }
.mission-list button.sel .mtag { color: #e8b9a0; }

/* 1940s Historical Pacific Newsreel Intro & Outro */
.newsreel-screen { position:fixed; inset:0; z-index:60; display:none; align-items:center; justify-content:center; background:#090807; }
.newsreel-screen.show { display:flex; }
.newsreel-screen canvas { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.nr-card { position:relative; z-index:2; max-width:740px; width:86%; text-align:center; padding:34px 40px; color:#f2ead6; text-shadow:0 2px 10px rgba(0,0,0,0.9); animation:nrFade .9s ease both; }
@keyframes nrFade { 0%,45% { opacity:0; transform:scale(0.97); } 100% { opacity:1; transform:scale(1); } }
.nr-kicker { font:700 14px/1 Oswald, sans-serif; letter-spacing:4px; color:#e5cf9b; margin-bottom:10px; }
.nr-rule { height:2px; width:220px; margin:0 auto 18px; background:linear-gradient(90deg, transparent, #e5cf9b, transparent); }
.nr-card h2 { font:700 clamp(26px, 4.4vw, 46px)/1.08 Oswald, sans-serif; letter-spacing:2px; margin:0 0 10px; color:#faf4e4; }
.nr-sub { font:500 15px/1.3 "Special Elite", monospace; color:#d8caa8; letter-spacing:1px; margin-bottom:18px; }
.nr-body { font:italic 17px/1.55 "Libre Baskerville", Georgia, serif; color:#ebe1c8; margin:0 auto 18px; max-width:620px; }
.nr-stats { font:700 15px/1.4 Oswald, sans-serif; letter-spacing:1.6px; color:#f2d17c; margin-bottom:20px; text-transform:uppercase; }
.nr-skip { margin-top:8px; background:rgba(242,234,214,0.12); border:1px solid rgba(242,234,214,0.45); color:#faf4e4; font:700 14px/1 Oswald, sans-serif; letter-spacing:2px; padding:11px 24px; cursor:pointer; text-transform:uppercase; }
.nr-skip:hover { background:rgba(242,234,214,0.24); }
