:root {
  --ink: #0f0d0a; --parch: #e9dfc7; --brass: #c9a45c; --blood: #b3362c; --muted: #9a8f7a;
  --panel: rgba(15, 13, 10, 0.72); --line: rgba(201, 164, 92, 0.55);
  --stencil: 'Big Shoulders Stencil Display', Impact, sans-serif;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--ink); color: var(--parch); font-family: var(--serif); -webkit-font-smoothing: antialiased; touch-action: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 1px solid var(--brass); outline-offset: 2px; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#hud { pointer-events: none; }
#hurt { position: fixed; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(120, 0, 0, 0) 40%, rgba(150, 10, 0, 0.7) 100%); }
#flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; background: #ffd9a0; mix-blend-mode: screen; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(8, 6, 4, 0.55) 100%); }
body::after { content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .07; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

.panel { background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .28em; color: var(--brass); }

/* ---------- flight UI */
#flightUi { position: fixed; inset: 0; pointer-events: none; display: none; }
body[data-state="play"] #flightUi { display: block; }
.match-panel { position: absolute; top: 18px; left: 18px; padding: 10px 14px; min-width: 210px; font-family: var(--mono); }
.mp-mode { font-size: 10px; letter-spacing: .2em; color: var(--brass); }
.mp-row { display: flex; justify-content: space-between; gap: 18px; margin-top: 4px; font-size: 13px; }
.mp-row b { color: var(--parch); font-weight: 600; }
.mp-time { color: var(--parch); font-variant-numeric: tabular-nums; }
.mp-score[hidden] { display: none; }
.enemy-card { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); padding: 10px 16px 10px; width: min(340px, 44vw); }
.ec-top { display: flex; gap: 10px; align-items: center; }
.ec-cross { width: 22px; height: 22px; flex: none; background: #f1ece0; position: relative; }
.ec-cross::before, .ec-cross::after { content: ''; position: absolute; background: #111; }
.ec-cross::before { left: 9px; top: 2px; width: 4px; height: 18px; }
.ec-cross::after { top: 9px; left: 2px; height: 4px; width: 18px; }
.ec-name { font-family: var(--stencil); font-weight: 800; font-size: 19px; letter-spacing: .06em; line-height: 1; text-transform: uppercase; }
.ec-unit { font-style: italic; font-size: 14px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-bar { height: 4px; background: rgba(0, 0, 0, .55); margin-top: 8px; }
.ec-bar i { display: block; height: 100%; width: 100%; background: var(--blood); transition: width .2s; }
.ec-state { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--brass); margin-top: 6px; }
#radar { position: absolute; right: 18px; bottom: 18px; left: auto; top: auto; width: 190px; height: 190px; border-radius: 50%; border: 2px solid var(--brass); box-shadow: 0 0 0 5px rgba(15, 13, 10, .7), 0 10px 30px rgba(0, 0, 0, .5); }
#feed { position: absolute; right: 18px; top: 18px; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; max-width: 42vw; }
.feed-item { font-family: var(--mono); font-size: 12px; padding: 5px 10px; background: var(--panel); border-left: 2px solid var(--brass); transition: opacity .6s, transform .6s; }
.feed-item.good { border-color: #9fb07a; } .feed-item.bad { border-color: var(--blood); } .feed-item.foe { border-color: #6b6b6b; color: #cfc6b0; }
.feed-item.out { opacity: 0; transform: translateX(10px); }
#prompt { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); font-family: var(--serif); font-size: 21px; font-style: italic; text-align: center; padding: 8px 18px; background: rgba(15, 13, 10, .6); border: 1px solid var(--line); opacity: 0; transition: opacity .3s; white-space: nowrap; }
#prompt.show { opacity: 1; }
kbd { font-family: var(--mono); font-style: normal; font-size: 13px; padding: 1px 6px; border: 1px solid var(--brass); color: var(--brass); margin: 0 2px; }
.keys-hint { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: rgba(233, 223, 199, .45); white-space: nowrap; }
.banner { position: fixed; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(.96); text-align: center; pointer-events: none; opacity: 0; transition: opacity .5s, transform .5s; }
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.b-big { font-family: var(--stencil); font-weight: 800; font-size: clamp(40px, 7vw, 92px); letter-spacing: .06em; line-height: .9; color: var(--parch); text-shadow: 0 4px 30px rgba(0, 0, 0, .6); }
.banner.win .b-big { color: #f0d9a0; } .banner.lose .b-big { color: #e0574a; }
.b-small { font-style: italic; font-size: clamp(16px, 2vw, 22px); color: var(--parch); margin-top: 10px; text-shadow: 0 2px 10px rgba(0, 0, 0, .8); }

/* ---------- screens */
.screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; }
.screen.active { display: flex; }
#title { padding-top: 10px; padding-bottom: 10px; background: linear-gradient(90deg, rgba(15, 13, 10, .88) 0%, rgba(15, 13, 10, .55) 44%, rgba(15, 13, 10, 0) 72%); justify-content: flex-start; }
.title-wrap { width: min(560px, 100%); padding-left: clamp(0px, 4vw, 60px); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 42px; color: var(--brass); }
.logo { width: 42px; height: 42px; }
.brand-name { font-family: var(--mono); font-size: 12px; letter-spacing: .34em; }
h1 { font-family: var(--stencil); font-weight: 800; font-size: clamp(64px, 11vw, 132px); line-height: .82; letter-spacing: .02em; margin: 12px 0 16px; color: var(--parch); }
.lede { font-size: clamp(19px, 2vw, 24px); font-style: italic; color: #d8ccb0; max-width: 30ch; line-height: 1.3; }
.modes { display: grid; gap: 8px; margin: 34px 0 22px; }
.mode { display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; text-align: left; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); transition: background .2s, border-color .2s, transform .2s; }
.mode:hover { background: rgba(179, 54, 44, .22); border-color: var(--brass); transform: translateX(4px); }
.mode-k { grid-row: span 2; font-family: var(--mono); font-size: 12px; color: var(--brass); padding-top: 5px; }
.mode-t { font-family: var(--stencil); font-weight: 800; font-size: 24px; letter-spacing: .05em; text-transform: uppercase; }
.mode-d { font-size: 16px; color: #c8bca2; }
.opts { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.opt { display: flex; align-items: center; gap: 8px; }
.opt-l { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; }
.seg { display: flex; border: 1px solid var(--line); }
.seg button { font-family: var(--mono); font-size: 11px; padding: 6px 10px; color: #cfc4aa; background: rgba(15, 13, 10, .6); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--brass); color: var(--ink); }
.ghost { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; padding: 8px 14px; border: 1px solid var(--line); background: rgba(15, 13, 10, .6); text-transform: uppercase; }
.ghost:hover { border-color: var(--brass); }
.fine { margin-top: 16px; font-family: var(--mono); font-size: 10px; letter-spacing: .16em; color: var(--muted); text-transform: uppercase; }
#campaignScreen, #pause, #debrief { background: rgba(10, 8, 6, .55); }
.sheet { width: min(720px, 100%); padding: 30px 32px; }
.sheet.small { width: min(520px, 100%); }
h2 { font-family: var(--stencil); font-weight: 800; font-size: clamp(38px, 6vw, 58px); line-height: .95; letter-spacing: .03em; margin: 8px 0 8px; text-transform: uppercase; }
h2.win { color: #f0d9a0; } h2.lose { color: #e0574a; }
.sheet-sub { font-style: italic; font-size: 19px; color: #d0c4a8; margin-bottom: 20px; }
#ladder { display: grid; gap: 8px; margin-bottom: 20px; }
.ace { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; text-align: left; padding: 12px 14px; border: 1px solid var(--line); background: rgba(15, 13, 10, .5); transition: background .2s, border-color .2s; }
.ace:hover:not(:disabled) { background: rgba(179, 54, 44, .2); border-color: var(--brass); }
.ace.locked { opacity: .45; cursor: not-allowed; }
.ace-n { font-family: var(--stencil); font-weight: 800; font-size: 28px; color: var(--brass); text-align: center; }
.ace-body { display: grid; }
.ace-name { font-family: var(--stencil); font-weight: 800; font-size: 20px; letter-spacing: .04em; text-transform: uppercase; }
.ace-nick { font-style: italic; font-size: 15px; color: var(--brass); }
.ace-note { font-size: 15px; color: #c3b79c; }
.ace-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; color: var(--muted); }
.ace.beaten .ace-tag { color: #9fb07a; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.cta { font-family: var(--stencil); font-weight: 800; font-size: 20px; letter-spacing: .08em; text-transform: uppercase; padding: 10px 22px; background: var(--blood); color: var(--parch); border: 1px solid #d45a4c; }
.cta:hover { background: #c9453a; }
.cta.alt { background: transparent; border-color: var(--brass); color: var(--parch); }
.cta[hidden] { display: none; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stats > div { background: rgba(15, 13, 10, .85); padding: 10px 12px; }
.stats dt { font-family: var(--mono); font-size: 9px; letter-spacing: .18em; color: var(--muted); text-transform: uppercase; }
.stats dd { font-family: var(--mono); font-size: 18px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.score { display: flex; align-items: baseline; gap: 14px; margin-top: 18px; }
.score span { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--brass); }
.score b { font-family: var(--stencil); font-weight: 800; font-size: 52px; line-height: 1; }
.score em { font-style: italic; color: var(--muted); font-size: 16px; }
.ctl-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; }
.ctl-list div { display: flex; gap: 10px; align-items: baseline; }
.ctl-list dt { font-family: var(--mono); font-size: 12px; color: var(--brass); min-width: 64px; }
.ctl-list dd { font-size: 17px; }

/* ---------- touch */
#touchUi { display: none; }
body.touch[data-state="play"] #touchUi { display: block; }
body.touch .keys-hint { display: none; }
#stickZone { position: fixed; left: 0; bottom: 0; width: 50vw; height: 60vh; }
#stickBase { position: fixed; width: 120px; height: 120px; border: 1px solid var(--line); border-radius: 50%; transform: translate(-50%, -50%); opacity: 0; pointer-events: none; background: rgba(15, 13, 10, .35); }
#stickBase.on { opacity: 1; }
#stickKnob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 50%; background: rgba(201, 164, 92, .7); transform: translate(-50%, -50%); }
#thrTrack { position: fixed; right: 16px; bottom: 150px; width: 44px; height: 150px; border: 1px solid var(--line); background: rgba(15, 13, 10, .55); }
#thrTrack span { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-family: var(--mono); font-size: 9px; letter-spacing: .15em; color: var(--brass); }
#thrKnob { position: absolute; left: 3px; right: 3px; bottom: 0; height: 14px; margin-bottom: -7px; background: var(--brass); }
.tbtn { position: fixed; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; padding: 10px 12px; background: rgba(15, 13, 10, .65); border: 1px solid var(--line); }
.tbtn.fire { right: 76px; bottom: 170px; width: 84px; height: 84px; border-radius: 50%; background: rgba(179, 54, 44, .75); border-color: #d45a4c; font-family: var(--stencil); font-size: 20px; }
#tStart { right: 76px; bottom: 262px; }
#tLook { right: 170px; bottom: 170px; }
#tView { right: 170px; bottom: 216px; }
#tPause { top: 18px; right: 18px; }
body.touch #feed { top: 64px; }

@media (max-width: 760px) {
  .match-panel { top: 10px; left: 10px; min-width: 0; padding: 7px 10px; }
  .mp-mode { font-size: 9px; letter-spacing: .12em; }
  .enemy-card { top: auto; bottom: 10px; left: 10px; transform: none; width: calc(100vw - 150px); padding: 8px 10px; }
  .ec-name { font-size: 15px; } .ec-unit { font-size: 12px; }
  #radar { width: 120px; height: 120px; right: 10px; bottom: 10px; }
  #feed { top: auto; bottom: 150px; right: auto; left: 10px; align-items: flex-start; max-width: 70vw; }
  .feed-item { font-size: 10px; }
  #prompt { font-size: 15px; bottom: 30%; white-space: normal; width: max-content; max-width: 88vw; }
  #thrTrack { right: 12px; bottom: 150px; height: 120px; }
  .tbtn.fire { right: 66px; bottom: 150px; width: 72px; height: 72px; }
  #tStart { right: 66px; bottom: 232px; } #tLook { right: 148px; bottom: 150px; } #tView { right: 148px; bottom: 194px; }
  #title { background: linear-gradient(180deg, rgba(15, 13, 10, .45) 0%, rgba(15, 13, 10, .9) 60%); align-items: flex-end; }
  .brand { margin-bottom: 18px; }
  .modes { margin: 20px 0 16px; }
  .mode-d { font-size: 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .sheet { padding: 22px 18px; }
  .ace { grid-template-columns: 34px 1fr; } .ace-tag { display: none; }
  .ctl-list { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body.touch #feed, #feed { top: 168px; bottom: auto; left: 10px; right: auto; max-width: 78vw; }
  #feed .feed-item:nth-child(n+3) { display: none; }
  #prompt { bottom: auto; top: 236px; }
  .banner { top: 44%; }
}

/* copyright line, bottom of the title screen */
.copyright { margin: 12px auto 0; max-width: 720px; font-family: var(--mono); font-size: 9px; line-height: 1.7; letter-spacing: .12em; color: rgba(233, 223, 199, .58); text-transform: uppercase; }
.copyright span { font-size: 8px; letter-spacing: .18em; color: rgba(233, 223, 199, .42); }
/* hide the system cursor while the mouse is flying the plane */
body.mouse-fly, body.mouse-fly canvas { cursor: none; }
