.desk { width: var(--frame); margin: auto; padding: clamp(14px,3vh,36px) 0; }
.route-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.05fr); gap: 14px; }
.route-poster {
    display: flex; flex-direction: column; justify-content: space-between;
    background: #ddcfa9 url("art/chart.webp") center / cover;
    border: 3px solid var(--ink); color: var(--ink); padding: clamp(16px,3vw,42px);
    box-shadow: inset 0 0 0 1px #fbebbf;
}
.section-eyebrow { font: 10px var(--pixel); }
.route-poster h1 { font-size: clamp(36px,5vw,76px); line-height: 1.2; }
#map-diagram { flex: 1; display: grid; place-items: center; }
#map-diagram svg { width: 95%; overflow: visible; max-height: 365px; }
.route-map-note { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; border-top: 2px solid var(--ink); padding-top: 9px; }
.route-map-note b { font: 400 22px var(--display); } .route-map-note span { font-size: 12px; }
.schedule, .instruments, .sheet-body { background: var(--case); }
.schedule { padding: clamp(14px,2.2vw,30px); border: 1px solid var(--edge); border-top: 4px solid var(--sun); }
.schedule .section-bar { margin-bottom: 12px; }
.schedule-row {
    width: 100%; display: grid; grid-template-columns: 38px 1fr auto;
    align-items: center; gap: 12px; padding: 8px 12px;
    text-align: left; background: transparent; border: 0; border-bottom: 1px solid #56665e;
}
.route-id { font: 13px var(--pixel); color: var(--sun); }
.schedule-row b, .schedule-row small { display: block; }
.schedule-row b { font: 400 20px var(--display); }
.schedule-row small { font-size: 12px; color: var(--muted); }
.schedule-row[aria-pressed=true] { background: #f5cf70; color: var(--ink); box-shadow: inset 4px 0 #ea6548; }
.schedule-row[aria-pressed=true] :is(.route-id,small) { color: var(--ink); }
.schedule-row:not(:disabled):hover { box-shadow: inset 4px 0 var(--flare); }
.schedule-row:disabled, .schedule-row:disabled .route-id { color: #aab5a8; }
.schedule-row i { width: 17px; }
.schedule .primary { width: 100%; margin-top: 16px; }

.in-flight .mast { display: none; }
#flight {
    display: grid; min-height: 100dvh; place-items: center; padding: 12px;
    background: linear-gradient(105deg,#122527e8,#203431ed),url("art/alpine.webp") center / cover;
}
.flight-layout { display: grid; grid-template-columns: auto clamp(195px,20vw,275px); gap: clamp(12px,2vw,28px); align-items: center; }
.airspace {
    position: relative; overflow: hidden; aspect-ratio: 3/4;
    width: min(calc((100dvh - 26px)*.75),calc(100vw - clamp(195px,20vw,275px) - 60px));
    border: 1px solid #d7cfa3; box-shadow: 0 0 0 3px var(--ink),0 0 0 5px #667870,0 10px 24px #07141699;
}
#gameCanvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.airspace.drive { border-color: var(--sun); box-shadow: 0 0 0 3px #f5b34b,0 0 17px #f5b34b; }
.instruments { min-width: 0; padding: 16px; border: 1px solid var(--edge); border-top: 4px solid var(--sun); }
.instrument-title, .dial, .log-craft { display: flex; align-items: center; gap: 10px; }
.instrument-title { justify-content: space-between; }
.instrument-title h2 { font-size: clamp(21px,2.2vw,30px); line-height: 1.15; }
.instrument-title small, .log-craft small, .sheet-head small { display: block; color: var(--sun); font: 8px/1.8 var(--pixel); }
#pause, .icon-button { align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; }
#pause:hover, .icon-button:hover, .menu-button:hover, .sheet-secondary:hover:enabled { color: var(--sun); border-color: var(--sun); }
.score-read { margin: 16px 0 7px; padding: 11px; background: #13272a; box-shadow: inset 3px 0 var(--mint); }
.score-read span, .score-read b { display: block; }
.score-read span, .dial>span, .control-note, .loadout h3 { font: 12px/1.5 var(--sans); color: var(--muted); }
.score-read b { color: var(--sun); font: clamp(17px,1.85vw,30px)/1.55 var(--pixel); }
.dial { min-height: 27px; }
.dial>span { min-width: 51px; }
.dial b { font: 12px var(--mono); }
.life-pips { display: flex; flex-wrap: wrap; gap: 3px; }
.life-pips i { width: 7px; height: 13px; transform: skewX(-15deg); background: var(--flare); border-top: 2px solid #ffc9a0; }
.meter { flex: 1; height: 6px; background: #52645e; }
.meter i { display: block; height: 100%; background: var(--mint); }
.log-craft { margin-top: 8px; border-block: 1px solid var(--edge); padding: 10px 0; }
.log-craft img { width: 48px; height: 46px; object-fit: contain; transform: rotate(22deg); }
.log-craft b { font: 400 21px var(--display); }
.loadout { padding: 12px 0; }
.loadout p { margin-top: 4px; font-size: 13px; max-height: 15vh; overflow-y: auto; }
.boost { position: relative; isolation: isolate; width: 100%; color: var(--ink); background: var(--sun); border-color: #fff0b6; }
.boost span { margin-right: auto; font: 400 21px var(--display); }
.boost:disabled { color: #ced8c8; border-color: var(--edge); background: #233638; }
.boost:disabled::before { content:""; position:absolute; z-index:-1; inset:0 auto 0 0; width: var(--charge,0%); background: repeating-linear-gradient(110deg,#517367 0 5px,#43665c 5px 8px); }
.control-note { margin-top: 8px; }
.field-alert { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); max-width: 96%; padding: 4px 15px; pointer-events: none; text-align: center; background: #552d26ed; border: 1px solid var(--flare); color: #fff1c9; font: 400 18px var(--display); white-space: nowrap; }
.field-alert.boss-contact::after { content:""; position:absolute; bottom:0; left:0; width:var(--integrity,100%); height:3px; background:var(--sun); }

dialog {
    width: min(460px,calc(100vw - 20px)); max-height: calc(100dvh - 20px);
    padding: 0; background: var(--case); color: var(--cream);
    border: 2px solid var(--ink); box-shadow: 0 0 0 1px var(--sun),6px 7px 0 #0e1b1c8f;
}
dialog::backdrop { background: #0c1c20b8; }
.sheet-body { padding: clamp(15px,2.5vw,28px); border-top: 5px solid var(--sun); }
.sheet-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 14px; }
.sheet-head h2 { font-size: clamp(28px,4vw,42px); line-height: 1.2; }
.sheet-note { color: var(--muted); font-size: 13px; margin: -4px 0 12px; }
#sheet-content .primary, .menu-button, .sheet-secondary { width: 100%; }
.sheet-actions { margin-top: 12px; }
.menu-button { margin-top: 6px; font-weight: bold; text-align: left; }
.sheet-secondary { justify-content: center; margin-top: 10px; }
.sheet-secondary:disabled { opacity: .55; }
.choice {
    --loot: #b5d6c1;
    display: flex; align-items: center; gap: 12px; width: 100%;
    margin-bottom: 7px; padding: 12px;
    border: 1px solid var(--edge); border-left: 3px solid var(--loot);
    background: #2b4042; text-align: left;
}
.choice[data-rarity=rare] { --loot: #9ddaf0; }
.choice[data-rarity=epic] { --loot: #efb5ed; }
.choice[data-rarity=legendary] { --loot: var(--sun); }
.choice>i { width: 37px; height: 37px; padding: 6px; background: var(--loot); color: var(--ink); }
.choice strong { display: block; font: 400 22px/1.25 var(--display); }
.choice strong em { color: var(--loot); font: 11px var(--sans); white-space: nowrap; }
.choice small { display: block; margin-top: 4px; color: #d0d9c9; font: 13px/1.5 var(--sans); }
.choice kbd { margin-left: auto; color: var(--loot); }
.choice:hover, .choice:focus-visible { background: #36504d; border-color: var(--loot); }
.settings-row { display: grid; grid-template-columns: minmax(68px,1fr) 2fr auto; align-items: center; gap: 10px; border-top: 1px solid var(--edge); padding: 13px 0; }
.settings-row input { min-width: 0; accent-color: var(--sun); }
.settings-row button, select { min-width: 0; border: 1px solid var(--edge); padding: 5px; background: #152b2d; }
.settings-row output { min-width: 36px; text-align: right; font-family: var(--mono); }
.report { display: flex; flex-direction: column; justify-content: end; gap: 6px; min-height: 111px; padding: 15px; margin-bottom: 14px; color: #fff2ce; background: linear-gradient(0deg,#152629ef,transparent),url("art/alpine.webp") center / cover; }
.report b { color: var(--sun); font: 21px/1.4 var(--pixel); }
dialog[data-kind=loss] .report { background-image: linear-gradient(0deg,#152629ef,transparent),url("art/canyon.webp"); }
@media (min-width: 760px) {
    dialog[data-kind=choice] { width: min(750px,90vw); }
    dialog[data-kind=choice] #sheet-content { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
    .sheet-note, .sheet-secondary { grid-column: 1/-1; }
    .choice { position: relative; flex-direction: column; align-items: start; margin: 0; padding: 17px 14px; border: 1px solid var(--edge); border-top: 4px solid var(--loot); }
    .choice>i { width: 44px; height: 44px; padding: 8px; }
    .choice kbd { position: absolute; right: 12px; top: 12px; }
}
@media (max-width: 650px) {
    .route-layout { grid-template-columns: 1fr; }
    #map-diagram svg { height: 115px; }
}
@media (max-width: 650px) and (orientation: portrait) {
    #flight { padding: max(6px,env(safe-area-inset-top)) 5px max(6px,env(safe-area-inset-bottom)); }
    .flight-layout { width: min(100%,calc((100dvh - 157px) * .75)); display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px 10px; }
    .airspace { width: 100%; grid-column: 1/-1; grid-row: 2; box-shadow: 0 0 0 2px #63776d; }
    .instruments { display: contents; }
    .instrument-title { grid-column: 1/-1; grid-row: 1; border-top: 2px solid var(--sun); padding: 3px 0; }
    .instrument-title h2 { font-size: 19px; }
    .instrument-title small { font-size: 6px; }
    .score-read { grid-column: 2; grid-row: 1; align-self: center; justify-self: end; margin: 0 45px 0 0; padding: 0; text-align: right; box-shadow: none; background: none; pointer-events: none; }
    .score-read b { font-size: 13px; }
    .score-read span, .dial>span { font-size: 10px; }
    .dials { grid-area: 3/1; }
    .dial { min-height: 20px; gap: 5px; } .dial>span { min-width: 44px; }
    .boost { grid-area: 3/2; align-self: center; padding: 4px 7px; gap: 5px; } .boost span { font-size: 17px; }
    .log-craft, .control-note { display: none; }
    .loadout { grid-area: 4/1/5/-1; display: flex; align-items: baseline; gap: 8px; border-top: 1px solid var(--edge); padding: 4px 0 0; }
    .loadout h3 { white-space: nowrap; }
    .loadout p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
}
@media (max-height: 540px) and (orientation: landscape) {
    #flight { padding: 4px 8px; }
    .airspace { width: min(73.5dvh,calc(100vw - 212px)); }
    .flight-layout { grid-template-columns: auto minmax(158px,198px); gap: 12px; }
    .instruments { padding: 6px 10px; }
    .instrument-title h2 { font-size: 18px; }
    .score-read { margin: 4px 0; padding: 3px 8px; } .score-read b { font-size: 14px; }
    .dial { min-height: 19px; } .log-craft { display: none; }
    .loadout { padding: 4px 0; }
    .boost { padding: 3px 9px; }
}
