/* Saltline v0.4 UI — dark nautical theme. Design tokens first; everything else uses them.
   8 px spacing grid, system font stack with tabular numbers, ≥ 44 px touch targets, 150 ms transitions.
   Layout layers: canvas (0) · HUD (10) · harbour sheet (20) · chart / ships / help (25) · compare (27) · hail / prompts (30)
   · rescue (35) · welcome (40). */
:root {
  --bg: #06111c; --bg-2: #0a1a2a;
  --surface: rgba(8, 19, 31, 0.97); --surface-2: #0d1f31;
  --card: #0f2235; --card-2: #142b42; --card-hi: #183553;
  --glass: rgba(7, 18, 30, 0.6); --glass-strong: rgba(7, 18, 30, 0.84);
  --line: rgba(150, 195, 230, 0.14); --line-2: rgba(150, 195, 230, 0.28);
  --fg: #e8f1f8; --fg-2: #c3d5e3; --muted: #8ea9bf; --faint: #5f7b92;
  --accent: #f2b134; --accent-2: #ffd27a; --accent-ink: #201500; --accent-soft: rgba(242, 177, 52, 0.16);
  --cyan: #5ad6ff; --cyan-soft: rgba(90, 214, 255, 0.14);
  --green: #4fd18b; --green-soft: rgba(79, 209, 139, 0.16);
  --red: #ff6b6b; --red-soft: rgba(255, 107, 107, 0.16);
  --violet: #b892ff; --violet-soft: rgba(184, 146, 255, 0.16);
  --orange: #ff9f43;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r1: 6px; --r2: 10px; --r3: 14px; --r4: 20px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --t: 150ms ease;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  --tap: 44px;
  --sat: env(safe-area-inset-top, 0px); --sar: env(safe-area-inset-right, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px);
  --bar: 60px;      /* touch bottom bar */
  --top-h: 64px;    /* space taken by the top bar (incl. margins) */
  --gut: 16px;      /* HUD edge gutter */
  --tel-w: 440px;   /* instrument strip width (desktop) */
  --radar-w: 232px; /* radar card width (desktop) */
  color-scheme: dark;
}

/* ---------------------------------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); font-variant-numeric: tabular-nums; overflow: hidden; overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
body { height: 100dvh; -webkit-text-size-adjust: 100%; }
canvas#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.up { color: var(--green); } .down { color: var(--red); }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
a { color: var(--cyan); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: 0.01em; }
p { margin: 0 0 var(--s2); }
kbd { font: 600 11px/1 var(--mono); padding: 2px 5px; border-radius: 4px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: rgba(255, 255, 255, 0.05); color: var(--fg); }
.ic { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: -0.25em; }
.si { display: inline-flex; align-items: center; justify-content: center; flex: none; line-height: 0; }
.si .ic { width: 20px; height: 20px; vertical-align: 0; }

button { font: inherit; color: var(--fg); background: var(--card-2); border: 1px solid var(--line-2); border-radius: var(--r2); padding: 0 14px; min-height: 36px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); white-space: nowrap; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  transition: background var(--t), border-color var(--t), color var(--t), transform var(--t), box-shadow var(--t); }
button:hover { background: var(--card-hi); border-color: rgba(150, 195, 230, 0.4); }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled, button[aria-disabled="true"] { opacity: 0.42; cursor: not-allowed; transform: none; }
button.primary { background: linear-gradient(180deg, #ffc451, #e9a320); color: var(--accent-ink); border-color: transparent; font-weight: 650; }
button.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffd06a, #f2ad2c); }
button.danger { border-color: rgba(255, 107, 107, 0.55); color: #ffc9c9; background: rgba(120, 30, 30, 0.35); }
button.danger:hover:not(:disabled) { background: rgba(160, 40, 40, 0.5); }
button.ghost { background: transparent; border-color: var(--line-2); }
button.on { background: var(--green-soft); border-color: var(--green); color: #dcffe9; }
button.small { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
button.big { min-height: 48px; padding: 0 22px; font-size: 16px; }
button.block { width: 100%; }
.iconBtn { width: 40px; min-width: 40px; padding: 0; }
input, select { font: inherit; color: var(--fg); background: rgba(0, 0, 0, 0.32); border: 1px solid var(--line-2); border-radius: var(--r2); padding: 0 10px; min-height: 36px; transition: border-color var(--t); }
input:focus { border-color: var(--accent); outline: none; }
input[type="number"] { font-family: var(--mono); text-align: center; -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; border: 0; padding: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--pct, 50%), rgba(255, 255, 255, 0.12) var(--pct, 50%)); }
input[type="range"]::-moz-range-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); }
input[type="range"]::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -8px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }

/* chips, pills, bars */
.chip, .pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--cyan-soft); color: var(--cyan); white-space: nowrap; line-height: 18px; vertical-align: middle; }
.chip .ic, .pill .ic { width: 14px; height: 14px; }
.chip.bad, .pill.bad { background: var(--red-soft); color: #ff9c9c; }
.chip.good, .pill.good { background: var(--green-soft); color: var(--green); }
.chip.warn, .pill.pax, .chip.amber { background: var(--accent-soft); color: var(--accent-2); }
.chip.violet { background: var(--violet-soft); color: var(--violet); }
.chip.ghost { background: rgba(255, 255, 255, 0.06); color: var(--fg-2); }
.meter { position: relative; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.meter > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 3px; background: var(--cyan); transition: width 300ms ease; }
.meter.good > i { background: var(--green); } .meter.warn > i { background: var(--accent); } .meter.bad > i { background: var(--red); }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r3); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22); }
.thumbBox { position: relative; display: block; overflow: hidden; background: radial-gradient(120% 90% at 50% 100%, #1f5d82 0%, #12324d 45%, #0b1b2b 100%); }
.thumbBox::before { content: ""; position: absolute; inset: 0; background: center / 34% no-repeat; background-image: var(--ph, none); opacity: 0.55; }
.thumbBox img { position: relative; display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 300ms ease; }
.thumbBox img.loaded { opacity: 1; }
.thumbBox.loaded::before { opacity: 0; }

/* ---------------------------------------------------------------------------------------------- overlays */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(2, 8, 14, 0.55); z-index: 20; padding: var(--s4); }
#chartWrap, #shipsWrap, #helpWrap { z-index: 25; }
#welcome { z-index: 40; }

/* ---------------------------------------------------------------------------------------------- welcome hero */
#welcome { padding: 0; background: radial-gradient(120% 90% at 20% 30%, rgba(30, 80, 120, 0.55), rgba(3, 10, 18, 0.92) 60%), linear-gradient(180deg, rgba(4, 12, 22, 0.6), rgba(2, 8, 14, 0.95)); overflow: auto; align-items: center; }
.hero { width: min(1180px, 100%); min-height: min(680px, 100%); display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); align-items: center; gap: var(--s5); padding: var(--s6) var(--s5); }
.heroArt { position: relative; aspect-ratio: 16 / 10; border-radius: var(--r4); overflow: hidden; background: radial-gradient(100% 80% at 50% 95%, #2a7fa8 0%, #134467 38%, #0a2238 70%, #071624 100%); box-shadow: var(--shadow), inset 0 0 0 1px var(--line); }
.heroArt::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 80px rgba(2, 8, 14, 0.55); pointer-events: none; }
.heroArt img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.03); transition: opacity 600ms ease, transform 1200ms ease; }
.heroArt img.loaded { opacity: 1; transform: none; }
.heroGlow { position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(180deg, transparent, rgba(3, 10, 18, 0.35)); pointer-events: none; }
.heroPanel { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.brand { font-size: clamp(34px, 5vw, 54px); letter-spacing: 0.32em; font-weight: 800; color: var(--accent); line-height: 1; text-shadow: 0 4px 30px rgba(242, 177, 52, 0.25); }
.tag { color: var(--fg-2); font-size: 16px; margin: 0; max-width: 40ch; }
.login { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s2); }
.login label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.loginRow { display: flex; gap: var(--s2); }
.loginRow input { flex: 1; min-width: 0; min-height: 48px; font-size: 16px; border-radius: var(--r2); }
.features { list-style: none; margin: var(--s2) 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.features li { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s2) var(--s3); border-radius: var(--r2); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-size: 12.5px; color: var(--fg-2); line-height: 1.35; }
.features li .si { color: var(--accent); margin-top: 1px; }
.features li b { display: block; color: var(--fg); font-size: 13px; }
.keys { font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: var(--s2); }
.keys summary { cursor: pointer; color: var(--fg-2); min-height: 32px; display: flex; align-items: center; }
.keys p { margin: var(--s2) 0 0; }
.keys b { color: var(--fg); }


/* mobile drawer & pill: hidden on desktop */
.mobileOnly { display: none !important; }
#navPill, #navDrawerScrim { display: none !important; }

/* ---------------------------------------------------------------------------------------------- HUD frame */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#hud > #log, #hud > #alerts, #hud > #ctxStack, #hud > #ctxLeft, #hud > #touchHelm { pointer-events: none; }
#ctxLeft > * { pointer-events: auto; }
#ctxLeft { position: absolute; left: calc(var(--gut) + var(--sal)); bottom: calc(var(--gut) + var(--sab) + 170px); width: min(540px, calc(100vw - var(--radar-w) - 4 * var(--gut))); display: flex; flex-direction: column-reverse; gap: var(--s2); }
#ctxLeft .ctxCard { max-width: none; }
#ctxStack > *, #alerts > * { pointer-events: auto; }

/* top bar */
#topbar { position: absolute; top: calc(8px + var(--sat)); left: calc(var(--gut) + var(--sal)); right: calc(var(--gut) + var(--sar)); height: 48px; display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s3) 0 6px; border-radius: var(--r3); }
.tbShip { display: flex; align-items: center; gap: var(--s2); min-width: 0; flex: 0 1 auto; padding-right: var(--s3); border-right: 1px solid var(--line); height: 36px; }
.tbThumb { width: 58px; height: 36px; border-radius: var(--r1); }
.tbShipTxt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.tbShipTxt b { font-size: 13.5px; color: var(--accent-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.tbShipTxt small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.tbStats, .tbEnv { display: flex; align-items: center; gap: var(--s4); min-width: 0; }
.tbBreak { display: none; }
.tbEnv { margin-left: auto; gap: var(--s3); }
.stat { display: flex; align-items: center; gap: 6px; min-width: 0; }
.stat .si { color: var(--muted); }
.stat .si .ic { width: 18px; height: 18px; }
.stat .sv { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.stat small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); white-space: nowrap; }
.stat b { font: 600 13px/1.25 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat.gauge .sv { width: 96px; }
.gbar { display: block; height: 4px; margin-top: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.gbar > i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--green); transition: width 400ms ease, background var(--t); }
.windArrow { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 50%; background: rgba(90, 214, 255, 0.12); color: var(--cyan); transition: transform 600ms ease; }
.windArrow .ic { width: 15px; height: 15px; }
#connPill { text-transform: uppercase; letter-spacing: 0.04em; }

/* log, alerts, warp banner */
#log { position: absolute; top: calc(var(--top-h) + var(--sat) + 6px); left: calc(var(--gut) + var(--sal)); width: min(420px, 46vw); max-height: 30vh; overflow: hidden; display: flex; flex-direction: column; gap: 4px; }
#log .ev { background: var(--glass-strong); border: 1px solid var(--line); border-left: 3px solid var(--cyan); padding: 5px 10px; border-radius: 0 var(--r2) var(--r2) 0; font-size: 13px; line-height: 1.35; animation: fadein 0.25s ease; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
#log .ev.warn { border-left-color: var(--accent); } #log .ev.law { border-left-color: var(--red); } #log .ev.shady { border-left-color: var(--violet); } #log .ev.pirate { border-left-color: var(--orange); }
#log .ev.fade { opacity: 0; transition: opacity 600ms ease; }
@keyframes fadein { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
#alerts { position: absolute; top: calc(var(--top-h) + var(--sat) + 6px); right: calc(var(--gut) + var(--sar)); display: flex; flex-direction: column; gap: 6px; align-items: flex-end; max-width: min(420px, 46vw); }
#alerts .alert { background: rgba(130, 26, 26, 0.86); border: 1px solid rgba(255, 107, 107, 0.6); padding: 7px 12px; border-radius: var(--r2); font-weight: 650; font-size: 13px; box-shadow: var(--shadow); animation: fadein 0.2s ease; }
#alerts .alert.warn { background: rgba(110, 72, 8, 0.88); border-color: rgba(242, 177, 52, 0.6); }
#warpBanner { position: absolute; top: calc(var(--top-h) + var(--sat) + 6px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: var(--s2); padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--accent-2); border-color: rgba(242, 177, 52, 0.45); background: rgba(40, 28, 6, 0.72); max-width: min(560px, calc(100vw - 2 * var(--gut))); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#warpBanner .si { color: var(--accent); }
#warpBannerText { overflow: hidden; text-overflow: ellipsis; }

/* context stack: bottom centre above the dock */
/* centred in the free span between the instrument strip and the radar, not on the viewport */
#ctxStack { position: absolute; left: calc(2 * var(--gut) + var(--tel-w) + var(--sal)); right: calc(2 * var(--gut) + var(--radar-w) + var(--sar)); bottom: calc(var(--gut) + var(--sab) + 72px); display: flex; flex-direction: column-reverse; align-items: center; gap: var(--s2); }
.ctxCard { width: 100%; max-width: 540px; padding: var(--s2) var(--s3); }
#berthLine { display: flex; align-items: center; gap: var(--s3); }
#berthLine .berthInfo { display: flex; align-items: center; gap: var(--s2); flex: 1; min-width: 0; color: var(--accent-2); font-size: 13px; font-weight: 600; }
#berthLine .berthInfo .si { color: var(--accent); }
#berthText { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#berthLine .berthBtns { display: flex; gap: 6px; flex: none; }
#berthLine button { min-height: 34px; font-size: 12.5px; padding: 0 12px; }
/* live AIS vessel card */
#aisCardWrap { position: absolute; top: calc(var(--top-h) + var(--sat) + 6px); right: calc(var(--gut) + var(--sar)); width: min(340px, calc(100vw - 2 * var(--gut))); max-height: calc(100vh - var(--top-h) - 280px); overflow: auto; padding: var(--s3) var(--s3) var(--s2); font-size: 12.5px; z-index: 6; }
#aisCardWrap .close { position: absolute; top: 6px; right: 6px; }
#aisCardWrap .aisHead { padding-right: 36px; }
#aisCardWrap dd { overflow-wrap: anywhere; }
body.touch #aisCardWrap { top: auto; bottom: calc(var(--bar) + var(--sab) + 8px); left: calc(var(--gut) + var(--sal)); right: calc(var(--gut) + var(--sar)); width: auto; max-height: 52vh; z-index: 8; }
/* contract card: the next step of the accepted jobs */
#jobLine { --job: #f2b134; display: flex; flex-direction: column; gap: 4px; border-left: 3px solid var(--job); }
#jobLine .jobHead { display: flex; align-items: center; gap: var(--s2); font-size: 13px; min-width: 0; }
#jobLine .jobIc { color: var(--job); flex: none; }
#jobTitle { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
#jobLine .jobPay { font-family: var(--mono); color: var(--accent-2); font-size: 12.5px; flex: none; }
#jobLine .jobStep { font-size: 12.5px; color: var(--fg-2); line-height: 1.35; }
#jobLine .jobFoot { display: flex; align-items: center; gap: 4px var(--s3); flex-wrap: wrap; }
#jobLine .jobWhere { font-family: var(--mono); font-size: 12.5px; color: var(--job); white-space: nowrap; }
#jobLine .jobLeft { font-size: 12px; color: var(--muted); white-space: nowrap; }
#jobLine .jobLeft.late { color: var(--red); }
#jobLine .jobBtns { margin-left: auto; display: flex; align-items: center; gap: 6px; }
#jobLine button { min-height: 32px; font-size: 12.5px; padding: 0 10px; }
#jobLine button.on { color: var(--green); border-color: rgba(79, 209, 139, 0.45); }
#jobLine button.primary.attention { box-shadow: 0 0 0 0 rgba(242, 177, 52, 0.7); animation: jobPulse 1.4s ease-out infinite; }
@keyframes jobPulse { 0% { box-shadow: 0 0 0 0 rgba(242, 177, 52, 0.7); } 100% { box-shadow: 0 0 0 10px rgba(242, 177, 52, 0); } }
#jobLine .jobNav { display: inline-flex; align-items: center; gap: 2px; }
#jobLine .jobNav b { font-family: var(--mono); font-size: 11.5px; color: var(--muted); min-width: 28px; text-align: center; }
#jobLine .jobNav .iconBtn { width: 30px; min-width: 30px; height: 30px; min-height: 30px; padding: 0; }
#fishPanel .ctxHead { display: flex; align-items: center; gap: var(--s2); font-size: 13px; color: var(--cyan); margin-bottom: 4px; }
#fishPanel .rows { display: flex; gap: var(--s4); }
#fishPanel .rows div { display: flex; flex-direction: column; min-width: 0; }
#fishPanel label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
#fishPanel b { font-family: var(--mono); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.warnLine { margin-top: 6px; padding: 4px 8px; border-radius: var(--r1); background: var(--red-soft); color: #ffb0b0; font-weight: 600; font-size: 12.5px; }
#warpCtl { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; }
#warpCtl button { width: 40px; min-width: 40px; height: 34px; min-height: 34px; padding: 0; border-radius: 999px; background: transparent; border-color: transparent; color: var(--fg-2); }
#warpCtl button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); color: var(--fg); }
#warpCtl .warpLevel { display: flex; flex-direction: column; align-items: center; min-width: 56px; line-height: 1.05; }
#warpCtl .warpLevel small { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
#warpCtl .warpLevel b { font: 700 15px/1.1 var(--mono); }
#warpCtl.active { border-color: rgba(242, 177, 52, 0.55); background: rgba(40, 28, 6, 0.7); }
#warpCtl.active .warpLevel b { color: var(--accent-2); }

/* side panel (weather) */
.sidePanel { position: absolute; right: calc(var(--gut) + var(--sar)); top: calc(var(--top-h) + var(--sat) + 8px); width: 340px; max-height: calc(100vh - var(--top-h) - var(--radar-w) - 70px); overflow: auto; background: var(--glass-strong); }
.panelHead { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s2) var(--s2) var(--s3); border-bottom: 1px solid var(--line); font-size: 14px; position: sticky; top: 0; background: inherit; z-index: 1; }
.panelHead .si { color: var(--cyan); }
.panelHead .close { margin-left: auto; }
#weatherBody { padding: var(--s2) var(--s3) var(--s3); }
.wxGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.wxTile { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: var(--r2); padding: var(--s2) var(--s3); min-width: 0; }
.wxTile.wide { grid-column: 1 / -1; }
.wxTile label { display: flex; align-items: center; gap: 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.wxTile label .ic { width: 14px; height: 14px; }
.wxTile b { display: block; font-size: 15px; margin-top: 2px; }
.wxTile span { display: block; font-size: 12px; color: var(--fg-2); }
.wxSrc { margin-top: var(--s2); font-size: 11.5px; color: var(--muted); }

/* instrument strip */
#telemetry { position: absolute; left: calc(var(--gut) + var(--sal)); bottom: calc(var(--gut) + var(--sab)); width: var(--tel-w); padding: 6px var(--s2) 6px var(--s3); }
#telToggle { position: absolute; top: 4px; right: 4px; width: 30px; min-width: 30px; min-height: 30px; height: 30px; background: transparent; border-color: transparent; color: var(--muted); }
#telToggle .ic { width: 16px; height: 16px; transition: transform var(--t); }
#telemetry.collapsed #telToggle .ic { transform: rotate(180deg); }
#telemetry.collapsed .iRow.detail { display: none; }
.iRow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px var(--s2); padding: 4px 0; border-top: 1px solid var(--line); }
.iRow:first-of-type { border-top: 0; }
.iRow.big { grid-template-columns: repeat(5, minmax(0, 1fr)); padding-right: 28px; }
.iRow .cell { grid-column: span 1; min-width: 0; }
.iRow.sec .cell, .iRow.detail .cell { grid-column: span 1; }
.iRow .cell.w2 { grid-column: span 2; }
.iRow.sec { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.iRow.detail { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cell label { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell > b { display: block; font: 600 12.5px/1.3 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 1px; }
.iRow.big .cell > b { font-size: 19px; line-height: 1.15; font-weight: 650; }
.cell > b u { text-decoration: none; font-size: 11px; color: var(--muted); margin-left: 2px; font-weight: 500; }
.cell > b span { color: inherit; }
.cell .bar { display: block; height: 4px; margin-top: 3px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; position: relative; overflow: hidden; }
.cell .bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--green); border-radius: 2px; }
.cell .bar.rud::before { content: ""; position: absolute; left: 50%; top: -1px; bottom: -1px; width: 1px; background: rgba(255, 255, 255, 0.4); }
.cell .bar.rud i { left: 50%; background: var(--cyan); }

/* radar */
#radarWrap { position: absolute; right: calc(var(--gut) + var(--sar)); bottom: calc(var(--gut) + var(--sab)); width: var(--radar-w); padding: 8px; border-radius: var(--r4); }
#radar { display: block; width: calc(var(--radar-w) - 18px); height: calc(var(--radar-w) - 18px); border-radius: 50%; background: radial-gradient(circle, rgba(6, 30, 44, 0.92), rgba(3, 14, 22, 0.95)); border: 1px solid var(--line-2); box-shadow: inset 0 0 24px rgba(90, 214, 255, 0.08); }
#radarCtl { display: flex; justify-content: center; gap: 4px; align-items: center; margin-top: 6px; font-family: var(--mono); font-size: 12px; }
#radarCtl button { width: 34px; min-width: 34px; min-height: 30px; height: 30px; padding: 0; background: rgba(255, 255, 255, 0.05); border-color: var(--line); }
#radarCtl button .ic { width: 16px; height: 16px; }
#radarCtl #radarRange { min-width: 56px; text-align: center; }
#radarHU { font-size: 12px; width: 40px !important; min-width: 40px !important; }
#radarHU.on { color: var(--accent-2); border-color: rgba(242, 177, 52, 0.5); }

/* action dock */
#actions { position: absolute; left: calc(2 * var(--gut) + var(--tel-w) + var(--sal)); right: calc(2 * var(--gut) + var(--radar-w) + var(--sar)); width: max-content; max-width: calc(100vw - var(--tel-w) - var(--radar-w) - 4 * var(--gut)); margin: 0 auto; bottom: calc(var(--gut) + var(--sab)); display: flex; gap: 2px; padding: 4px; border-radius: var(--r3); }
.dockBtn { flex-direction: column; gap: 2px; min-width: 60px; min-height: 52px; padding: 4px 6px; background: transparent; border-color: transparent; border-radius: var(--r2); color: var(--fg-2); }
.dockBtn:hover { background: rgba(255, 255, 255, 0.07); border-color: transparent; color: var(--fg); }
.dockBtn .lbl { font-size: 11px; font-weight: 550; line-height: 1.1; max-width: 76px; overflow: hidden; text-overflow: ellipsis; }
.dockBtn .si .ic { width: 21px; height: 21px; }
.dockBtn.on { background: var(--green-soft); color: #c8ffe0; border-color: rgba(79, 209, 139, 0.45); }
.dockBtn.accent { color: var(--accent-2); }
#btnDock.attention { background: var(--accent-soft); color: var(--accent-2); border-color: rgba(242, 177, 52, 0.5); }
#moreSheet { position: absolute; bottom: calc(var(--gut) + var(--sab) + 70px); left: 50%; transform: translateX(-50%) translateY(6px); display: none; flex-direction: column; gap: 2px; padding: 6px; min-width: 220px; opacity: 0; transition: opacity var(--t), transform var(--t); background: var(--glass-strong); }
#moreSheet.open { display: flex; opacity: 1; transform: translateX(-50%); }
.menuBtn { justify-content: flex-start; gap: var(--s3); min-height: 40px; background: transparent; border-color: transparent; padding: 0 var(--s3); }
.menuBtn:hover { background: rgba(255, 255, 255, 0.07); border-color: transparent; }
.menuBtn.on { background: var(--green-soft); border-color: transparent; }
.menuBtn.danger { color: #ffb3b3; }
.touchOnly { display: none !important; }

/* chat */
#chatWrap { position: absolute; left: calc(var(--gut) + var(--sal)); bottom: calc(var(--gut) + var(--sab) + 108px); width: var(--tel-w); }
body.telOpen #chatWrap { bottom: calc(var(--gut) + var(--sab) + 232px); }
body.telOpen #ctxLeft { bottom: calc(var(--gut) + var(--sab) + 294px); }
#chat { max-height: 110px; overflow-y: auto; font-size: 12.5px; display: flex; flex-direction: column-reverse; gap: 2px; }
#chat div { background: var(--glass-strong); padding: 3px 8px; border-radius: var(--r1); }
#chat b { color: var(--cyan); }
#chatInput { width: 100%; margin-top: 4px; font-size: 12.5px; min-height: 32px; opacity: 0.6; background: var(--glass); }
#chatInput:focus { opacity: 1; }

/* interior / ashore HUD */
#interiorHud, #ashoreHud { position: absolute; top: calc(var(--top-h) + var(--sat) + 8px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: var(--s2); max-width: calc(100vw - 2 * var(--gut)); }
.glassBtn { min-height: 44px; padding: 0 18px; background: var(--glass-strong); border-color: var(--line-2); border-radius: 999px; font-weight: 600; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.glassBtn.primary { background: linear-gradient(180deg, #ffc451, #e9a320); }
.hintLine { display: flex; align-items: center; gap: 6px; font-size: 13px; background: var(--glass-strong); border: 1px solid var(--line); padding: 5px 14px; border-radius: 999px; max-width: 100%; text-align: center; }
.hintLine .si { color: var(--accent); }
#ashoreHintText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hudRow { display: flex; gap: var(--s2); justify-content: center; flex-wrap: wrap; }
/* the view toggles that interior.js / ashore.js create are moved into these rows by the HUD; re-skin them to match */
.hudRow > #interiorView, .hudRow > #ashoreView { position: static !important; right: auto !important; top: auto !important; border-radius: 999px !important; background: var(--glass-strong) !important; border: 1px solid var(--line-2) !important; font: 600 14px var(--font) !important; color: var(--fg) !important; padding: 0 16px !important; min-height: 44px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
#ashorePrompt, #interiorPrompt { font-family: var(--font) !important; border-radius: var(--r3) !important; }
body.touch #ashorePrompt, body.touch #interiorPrompt { bottom: calc(196px + var(--sab)) !important; max-width: calc(100vw - 32px); }
body.interior #log, body.ashore #log { top: calc(var(--top-h) + var(--sat) + 104px); }
body.interior #telemetry, body.interior #radarWrap, body.interior #actions, body.interior #chatWrap, body.interior #ctxStack, body.interior #ctxLeft, body.interior #moreSheet, body.interior #warpBanner { display: none !important; }
body.ashore #telemetry, body.ashore #radarWrap, body.ashore #actions, body.ashore #chatWrap, body.ashore #ctxStack, body.ashore #ctxLeft, body.ashore #moreSheet, body.ashore #warpBanner, body.ashore #interiorHud { display: none !important; }

/* ---------------------------------------------------------------------------------------------- full-screen sheets */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(6, 16, 27, 0.97), rgba(5, 13, 22, 0.98)); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: sheetIn 180ms ease; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sheetHead { flex: none; display: flex; align-items: center; gap: var(--s3); min-height: 64px; padding: calc(10px + var(--sat)) calc(var(--s4) + var(--sar)) 10px calc(var(--s4) + var(--sal)); border-bottom: 1px solid var(--line); background: rgba(8, 20, 33, 0.92); position: relative; z-index: 3; }
.sheetIcon { width: 40px; height: 40px; border-radius: var(--r2); display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.sheetIcon .ic { width: 22px; height: 22px; }
.sheetTitle { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.sheetTitle b { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheetTitle small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.headMoney { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; min-height: 36px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); font-weight: 650; white-space: nowrap; }
.headMoney .ic { width: 16px; height: 16px; color: var(--accent); }
.headBtn { min-height: 40px; }
.sheetHead .close { width: 44px; min-width: 44px; height: 44px; border-radius: var(--r2); }
.sheetMain { flex: 1; min-height: 0; display: flex; }
.sheetNav { flex: none; width: 212px; display: flex; flex-direction: column; gap: 2px; padding: var(--s3) var(--s2) var(--s3) calc(var(--s2) + var(--sal)); border-right: 1px solid var(--line); background: rgba(8, 20, 33, 0.55); overflow-y: auto; }
.sheetNav button { justify-content: flex-start; gap: var(--s3); min-height: 44px; padding: 0 var(--s3); background: transparent; border-color: transparent; color: var(--fg-2); position: relative; border-radius: var(--r2); }
.sheetNav button:hover { background: rgba(255, 255, 255, 0.05); color: var(--fg); }
.sheetNav button.on { background: var(--accent-soft); color: var(--accent-2); border-color: rgba(242, 177, 52, 0.35); }
.sheetNav button.on::before { content: ""; position: absolute; left: -8px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--accent); }
.sheetNav .si .ic { width: 20px; height: 20px; }
.sheetNav .sl { display: none; }
.sheetNav .badge { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: rgba(255, 255, 255, 0.1); color: var(--fg-2); display: inline-flex; align-items: center; justify-content: center; }
.sheetNav .badge:empty { display: none; }
.sheetBody { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; padding: var(--s5) calc(var(--s5) + var(--sar)) calc(var(--s6) + var(--sab)) var(--s5); }
.sheetBody.solo { padding-left: calc(var(--s5) + var(--sal)); }
.sheetInner, .sheetBody > .tab { max-width: 1240px; margin: 0 auto; }
.tab { min-width: 0; }
.secHead { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin: 0 0 var(--s3); }
.secHead h2 { font-size: 20px; display: flex; align-items: center; gap: var(--s2); }
.secHead h2 .ic { color: var(--accent); width: 22px; height: 22px; }
.secHead p { margin: 2px 0 0; color: var(--muted); font-size: 13px; max-width: 70ch; }
.secHead .tools { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.subHead { display: flex; align-items: center; gap: var(--s2); margin: var(--s5) 0 var(--s3); font-size: 15px; color: var(--fg-2); }
.subHead .ic { color: var(--muted); }
.empty { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); border-radius: var(--r3); border: 1px dashed var(--line-2); color: var(--muted); }
.empty .ic { width: 28px; height: 28px; color: var(--faint); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--s3); }
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(296px, 1fr)); }
.cards2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r3); padding: var(--s4); min-width: 0; transition: border-color var(--t), background var(--t), transform var(--t); }
.card:hover { border-color: var(--line-2); }
.card h3 { display: flex; align-items: center; gap: var(--s2); font-size: 15px; margin: 0 0 var(--s2); }
.card h3 .ic { color: var(--accent); }
.card p { color: var(--fg-2); font-size: 13.5px; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px var(--s3); font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* overview */
.banner { position: relative; border-radius: var(--r4); overflow: hidden; min-height: 200px; aspect-ratio: 1200 / 340; max-height: 300px; width: 100%; background: linear-gradient(180deg, #23436a, #0b1b2c); margin-bottom: var(--s4); box-shadow: var(--shadow); }
.banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bannerTxt { position: absolute; left: var(--s5); right: var(--s5); bottom: var(--s4); display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.bannerTxt h2 { font-size: clamp(22px, 3vw, 32px); font-weight: 750; text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6); }
.bannerTxt .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.bannerTxt .chip { background: rgba(4, 12, 20, 0.6); color: var(--fg); border: 1px solid var(--line-2); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: var(--s2); margin-bottom: var(--s4); }
.quick button { flex-direction: column; align-items: flex-start; gap: 2px; min-height: 64px; padding: var(--s2) var(--s3); background: var(--card); border-color: var(--line); text-align: left; white-space: normal; }
.quick button:hover { background: var(--card-2); }
.quick button .ic { color: var(--accent); }
.quick button b { font-size: 13.5px; }
.quick button small { color: var(--muted); font-size: 11.5px; }
.berthList { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.berthRow { display: grid; grid-template-columns: minmax(0, 1fr) 72px 72px; gap: var(--s2); align-items: center; padding: 6px var(--s2); border-radius: var(--r1); background: rgba(255, 255, 255, 0.03); font-size: 12.5px; }
.berthRow.mine { background: var(--green-soft); outline: 1px solid rgba(79, 209, 139, 0.4); }
.berthRow .num { text-align: right; }
.berthRow .meter { margin-top: 3px; }
.myShip { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: var(--s3); align-items: center; }
.myShip .thumbBox { width: 132px; height: 82px; border-radius: var(--r2); }
.gaugeRow { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: var(--s2); align-items: center; font-size: 12.5px; margin: 4px 0; }
.gaugeRow label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.gaugeRow b { font-family: var(--mono); font-size: 12.5px; }

/* contracts */
.jobCard { display: flex; flex-direction: column; gap: var(--s2); position: relative; overflow: hidden; }
.jobCard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--jc, var(--cyan)); }
.jobCard.t-freight { --jc: var(--cyan); } .jobCard.t-passengers, .jobCard.t-charter { --jc: var(--accent); } .jobCard.t-fishing { --jc: var(--green); }
.jobCard.t-supply { --jc: #ffb35c; } .jobCard.t-tow { --jc: #9fb7ff; } .jobCard.t-smuggling { --jc: var(--violet); }
.jobTop { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.jobType { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--jc, var(--cyan)); }
.jobType .ic { width: 18px; height: 18px; }
.jobCard h4 { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.route { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-2); min-width: 0; flex-wrap: wrap; }
.route .ic { width: 15px; height: 15px; color: var(--muted); }
.route b { font-weight: 600; color: var(--fg); }
.payRow { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); margin-top: auto; }
.pay { font-size: 24px; font-weight: 750; color: var(--accent-2); letter-spacing: -0.01em; }
.pay small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.perT { font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.elig { display: flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 5px var(--s2); border-radius: var(--r1); }
.elig .ic { width: 15px; height: 15px; }
.elig.ok { background: var(--green-soft); color: #b8f5d2; }
.elig.bad { background: var(--red-soft); color: #ffc2c2; }
.jobCard .actions { display: flex; gap: var(--s2); }
.jobCard .actions button { flex: 1; }
.mineList { display: flex; flex-direction: column; gap: var(--s2); }
.mineRow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: var(--s3); align-items: center; padding: var(--s2) var(--s3); background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); }
.mineRow .ic { color: var(--accent); }
.mineRow .t { min-width: 0; }
.mineRow .t b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mineRow .t small { color: var(--muted); font-size: 12px; }
.mineRow .p { font-weight: 700; color: var(--accent-2); white-space: nowrap; }

/* job boards */
.boardList { display: flex; flex-direction: column; gap: var(--s2); }
.boardCard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r3); overflow: hidden; }
.boardHead { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s2) var(--s2) var(--s3); min-height: 56px; cursor: pointer; }
.boardHead:hover { background: rgba(255, 255, 255, 0.03); }
.boardHead .bh { flex: 1; min-width: 0; }
.boardHead .bh b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.boardHead .bh small { color: var(--muted); font-size: 12px; }
.boardHead .cnt { font-weight: 700; color: var(--accent-2); white-space: nowrap; font-size: 13px; }
.boardHead .chev .ic { width: 18px; height: 18px; color: var(--muted); transition: transform var(--t); }
.boardCard.open .boardHead .chev .ic { transform: rotate(180deg); }
.boardJobs { display: none; padding: 0 var(--s3) var(--s3); gap: 6px; flex-direction: column; }
.boardCard.open .boardJobs { display: flex; }
.miniJob { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: var(--s2) var(--s3); align-items: center; padding: 6px var(--s2); border-radius: var(--r1); background: rgba(255, 255, 255, 0.03); font-size: 13px; }
.miniJob .ic { width: 18px; height: 18px; color: var(--cyan); }
.miniJob .t { min-width: 0; }
.miniJob .t div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.miniJob .t small { color: var(--muted); font-size: 11.5px; }
.miniJob .p { text-align: right; font-weight: 700; color: var(--accent-2); white-space: nowrap; }
.miniJob .p small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }

/* market */
.goodCard { display: flex; flex-direction: column; gap: var(--s2); }
.goodTop { display: flex; align-items: center; gap: var(--s3); }
.goodIcon { width: 44px; height: 44px; border-radius: var(--r2); background: var(--cyan-soft); color: var(--cyan); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.goodIcon .ic { width: 24px; height: 24px; }
.goodCard.contra .goodIcon { background: var(--violet-soft); color: var(--violet); }
.goodName { flex: 1; min-width: 0; }
.goodName b { display: block; font-size: 15px; }
.goodName small { color: var(--muted); font-size: 12px; }
.price { text-align: right; }
.price b { display: block; font-size: 20px; font-weight: 750; }
.price small { font-size: 11.5px; color: var(--muted); }
.trend { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 650; }
.trend .ic { width: 15px; height: 15px; }
.trend.up { color: var(--green); } .trend.down { color: var(--red); } .trend.flat { color: var(--muted); }
.stockRow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2); align-items: center; font-size: 12px; color: var(--muted); }
.stockRow .meter { grid-column: 1 / -1; }
.stepper { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; gap: 4px; }
.stepper button { padding: 0; min-width: 0; }
.stepper input { width: 100%; min-width: 0; }
.presets { display: flex; gap: 4px; flex-wrap: wrap; }
.presets button { flex: 1; min-height: 30px; font-size: 12px; padding: 0 6px; background: rgba(255, 255, 255, 0.04); }
.tradeBtns { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.tradeNote { font-size: 12px; color: var(--muted); min-height: 1.4em; }

/* shipyard */
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); gap: 2px; }
.seg button { border-radius: 999px; min-height: 34px; background: transparent; border-color: transparent; color: var(--fg-2); padding: 0 14px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chipBtn { min-height: 34px; border-radius: 999px; padding: 0 14px; font-size: 13px; background: rgba(255, 255, 255, 0.04); border-color: var(--line-2); color: var(--fg-2); }
.chipBtn.on { background: var(--cyan-soft); border-color: rgba(90, 214, 255, 0.6); color: var(--cyan); }
.chipBtn .ic { width: 16px; height: 16px; }
.yardBar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; justify-content: space-between; margin-bottom: var(--s4); }
.shipCard { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.shipCard:hover { transform: translateY(-2px); border-color: rgba(150, 195, 230, 0.35); }
.shipCard .thumbBox { aspect-ratio: 16 / 10; width: 100%; }
.shipCard .catTag { position: absolute; left: var(--s2); top: var(--s2); z-index: 1; background: rgba(4, 12, 20, 0.66); color: var(--fg); border: 1px solid var(--line-2); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.shipCard .ownTag { position: absolute; right: var(--s2); top: var(--s2); z-index: 1; }
.shipBody { padding: var(--s3) var(--s4) var(--s4); display: flex; flex-direction: column; gap: var(--s2); flex: 1; }
.shipName { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); }
.shipName h3 { font-size: 15.5px; margin: 0; min-width: 0; }
.shipName .p { font-weight: 750; font-size: 16px; color: var(--accent-2); white-space: nowrap; }
.shipCard .desc { font-size: 12.5px; color: var(--muted); margin: 0; min-height: 2.6em; }
.dims { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--fg-2); }
.dims span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.dims .ic { width: 14px; height: 14px; color: var(--muted); }
.specs { display: flex; flex-direction: column; gap: 5px; margin: 2px 0; }
.spec { display: grid; grid-template-columns: 62px minmax(0, 1fr) 76px; gap: var(--s2); align-items: center; font-size: 11.5px; }
.spec label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-size: 10.5px; }
.spec .meter { height: 6px; }
.spec .v { text-align: right; font-family: var(--mono); font-size: 11.5px; color: var(--fg-2); white-space: nowrap; }
.spec.cost .meter > i { background: var(--orange); }
.spec.cond .meter > i { background: var(--green); }
.shipFoot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s2); margin-top: auto; padding-top: var(--s2); }
.shipFoot button.cmp.on { background: var(--cyan-soft); border-color: rgba(90, 214, 255, 0.6); color: var(--cyan); }
.netLine { font-size: 12px; color: var(--muted); }
.netLine b { color: var(--fg); }
.compareTray { position: sticky; bottom: 0; margin: var(--s4) 0 0; padding: var(--s3); border-radius: var(--r3); border: 1px solid var(--line-2); box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35); display: flex; align-items: center; gap: var(--s3); background: rgba(8, 20, 33, 0.96); border-top: 1px solid var(--line-2); z-index: 2; flex-wrap: wrap; }
.compareTray .slots { display: flex; gap: var(--s2); flex: 1; min-width: 0; overflow-x: auto; }
.compareTray .slot { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); font-size: 12.5px; white-space: nowrap; }
.compareTray .slot .thumbBox { width: 44px; height: 28px; border-radius: 999px; }
#compareWrap { position: fixed; inset: 0; z-index: 27; background: rgba(2, 8, 14, 0.7); display: flex; align-items: center; justify-content: center; padding: var(--s4); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.compareBox { width: min(1100px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r4); overflow: hidden; box-shadow: var(--shadow); }
.compareBox .sheetHead { padding-top: 10px; min-height: 60px; }
.compareGrid { overflow: auto; padding: var(--s4); display: grid; gap: var(--s3); }
.cmpCol { background: var(--card); border: 1px solid var(--line); border-radius: var(--r3); overflow: hidden; min-width: 0; }
.cmpCol .thumbBox { aspect-ratio: 16 / 10; }
.cmpCol .cmpBody { padding: var(--s3); }
.cmpCol h3 { font-size: 15px; margin-bottom: 4px; }
.cmpRow { display: flex; justify-content: space-between; gap: var(--s2); padding: 5px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.cmpRow span { color: var(--muted); }
.cmpRow b { font-family: var(--mono); font-weight: 600; text-align: right; }
.cmpRow b.best { color: var(--green); }
.cmpRow b.best::after { content: " ★"; color: var(--accent); }
.cmpTable { display: grid; gap: 0; padding: var(--s3); overflow: auto; font-size: 12.5px; }
.cmpTable > div { padding: 7px 6px; border-top: 1px solid var(--line); min-width: 0; }
.cmpTable .ct-h { border-top: 0; display: flex; flex-direction: column; gap: 4px; padding-bottom: var(--s2); }
.cmpTable .ct-h .thumbBox { aspect-ratio: 16 / 10; width: 100%; border-radius: var(--r1); }
.cmpTable .ct-h b { font-size: 12.5px; line-height: 1.2; }
.cmpTable .ct-l { color: var(--muted); font-size: 11.5px; }
.cmpTable .ct-v { font-family: var(--mono); font-weight: 600; text-align: right; font-size: 12px; overflow-wrap: anywhere; }
.cmpTable .ct-v.best { color: var(--green); }
.cmpTable .ct-b { border-top: 0; padding-top: var(--s2); }
.cmpTable .ct-b button { width: 100%; padding: 0 4px; font-size: 13px; }

/* services */
.svcCard { display: flex; flex-direction: column; gap: var(--s3); }
.tank { position: relative; height: 30px; border-radius: var(--r2); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); overflow: hidden; }
.tank > i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #2a8f5e, var(--green)); transition: width 300ms ease; }
.tank > i.add { background: repeating-linear-gradient(135deg, rgba(242, 177, 52, 0.85) 0 6px, rgba(242, 177, 52, 0.6) 6px 12px); }
.tank > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 600 12.5px var(--mono); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
.buyLine { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); font-size: 13px; }
.buyLine b { font-size: 17px; color: var(--accent-2); }
.btnRow { display: flex; gap: var(--s2); flex-wrap: wrap; }
.btnRow button { flex: 1 1 auto; }
.cargoList { display: flex; flex-direction: column; gap: 6px; }
.cargoRow { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: var(--s2); align-items: center; font-size: 13px; padding: 4px 0; border-top: 1px solid var(--line); }
.cargoRow:first-child { border-top: 0; }
.cargoRow .ic { color: var(--cyan); }
.cargoRow .chip { margin-left: 4px; }

/* players / ships list */
.personCard { display: flex; gap: var(--s3); align-items: center; }
.personCard .avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--cyan-soft); color: var(--cyan); display: inline-flex; align-items: center; justify-content: center; flex: none; font-weight: 700; font-size: 16px; }
.personCard .pc { flex: 1; min-width: 0; }
.personCard .pc b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.personCard .pc small { color: var(--muted); }
.actRow { display: flex; gap: 6px; flex-wrap: wrap; }
.vesselCard { padding: 0; overflow: hidden; display: grid; grid-template-columns: 132px minmax(0, 1fr); }
.vesselCard .thumbBox { height: 100%; min-height: 96px; }
.vesselCard .vb { padding: var(--s2) var(--s3); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vesselCard .vb b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vesselCard .vb small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vesselCard .vstats { display: flex; gap: var(--s3); font-size: 12px; font-family: var(--mono); color: var(--fg-2); flex-wrap: wrap; }
.vesselCard .actRow { margin-top: 4px; }

/* help prose */
.prose .card p { margin: 0; }
.prose h3 .ic { width: 18px; height: 18px; }

/* ---------------------------------------------------------------------------------------------- chart (full screen) */
#chartWrap { padding: 0; background: var(--bg); }
.chartPanel { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; }
.chartHead .sheetIcon { background: var(--cyan-soft); color: var(--cyan); }
.chartHint kbd { font-size: 10px; padding: 1px 4px; }
.chartBody { position: relative; flex: 1; min-height: 0; background: #0a2238; }
#chart { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; }
#chartTools { position: absolute; top: var(--s3); right: calc(var(--s3) + var(--sar)); display: flex; flex-direction: column; gap: 4px; padding: 6px; align-items: stretch; background: var(--glass-strong); max-height: calc(100% - 2 * var(--s3)); overflow-y: auto; }
#chartTools .toolRow { display: flex; gap: 4px; }
#chartTools .iconBtn { flex: 1; width: 44px; height: 44px; min-height: 44px; background: rgba(255, 255, 255, 0.05); border-color: var(--line); }
#chartTools .toolBtn { justify-content: flex-start; gap: var(--s2); min-height: 40px; font-size: 13px; background: rgba(255, 255, 255, 0.05); border-color: var(--line); padding: 0 12px; }
#chartTools .toolBtn.on { background: var(--green-soft); border-color: rgba(79, 209, 139, 0.6); color: #d4ffe6; }
#chartTools .toolBtn.primary { background: linear-gradient(180deg, #ffc451, #e9a320); color: var(--accent-ink); border-color: transparent; }
#chartTools .toolSep { height: 1px; background: var(--line); margin: 2px 0; }
#chartPopup { position: absolute; z-index: 3; width: min(460px, calc(100% - 16px)); max-height: 62%; overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r3); font-size: 13px; box-shadow: var(--shadow); }
#chartPopup .popHead { display: flex; align-items: center; gap: 6px; padding: var(--s2) var(--s2) var(--s2) var(--s3); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); flex-wrap: wrap; }
#chartPopup .popHead b { font-size: 14.5px; }
#chartPopup .popHead .close { margin-left: auto; width: 36px; min-width: 36px; padding: 0; }
#chartPopup .popBody { padding: var(--s2) var(--s3) var(--s3); }
#chartPopup .popBody > div { margin: 3px 0; }
#chartPopup .inline { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
#chartPopup table { width: 100%; border-collapse: collapse; }
#chartPopup td, #chartPopup th { padding: 5px 6px; font-size: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
#chartPopup th { color: var(--muted); font-weight: 500; }
#chartPopup .num { text-align: right; white-space: nowrap; }
#voyageLine { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: var(--s2) calc(var(--s4) + var(--sar)) var(--s2) calc(var(--s4) + var(--sal)); border-top: 1px solid var(--line); background: rgba(8, 20, 33, 0.95); font-size: 13px; }
#voyageLine .vsum { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; font-family: var(--mono); font-size: 12.5px; min-width: 0; }
#voyageLine .vsum .ic { color: var(--accent); }
#voyageLine button { min-height: 36px; font-size: 13px; }
#chartInfo { padding: 6px calc(var(--s4) + var(--sar)) calc(6px + var(--sab)) calc(var(--s4) + var(--sal)); font-family: var(--mono); font-size: 12px; border-top: 1px solid var(--line); background: rgba(6, 16, 27, 0.96); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 30px; }

/* ---------------------------------------------------------------------------------------------- rescue, hail, prompts */
#rescueWrap { position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(10, 30, 50, 0.35), rgba(2, 8, 14, 0.85)); padding: var(--s4); }
.rescueCard { border: 2px solid rgba(242, 177, 52, 0.7); border-radius: var(--r4); padding: var(--s5) var(--s6); width: min(540px, 100%); text-align: center; background: var(--glass-strong); }
.rescueIcon { display: inline-flex; color: var(--orange); margin-bottom: var(--s2); animation: bob 2.4s ease-in-out infinite; }
.rescueIcon .ic { width: 48px; height: 48px; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(4deg); } }
.rescueCard h2 { margin: 0 0 var(--s2); color: var(--red); letter-spacing: 0.32em; }
.rescueCard p { margin: 6px 0; font-size: 16px; }
.progress { height: 12px; background: rgba(0, 0, 0, 0.4); border-radius: 6px; overflow: hidden; margin: var(--s3) 0; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.5s linear; }
#hail { position: fixed; top: 22%; left: 50%; transform: translateX(-50%); z-index: 30; background: rgba(130, 24, 24, 0.92); border: 2px solid var(--red); border-radius: var(--r3); padding: var(--s3) var(--s5); font-size: 18px; font-weight: 750; letter-spacing: 0.04em; text-align: center; box-shadow: 0 0 40px rgba(255, 60, 60, 0.4); max-width: calc(100vw - 32px); }
#hail small { display: block; font-size: 13px; font-weight: 500; letter-spacing: 0; color: #ffd6d6; margin-top: 2px; }
#prompts { position: fixed; top: calc(var(--top-h) + var(--sat) + 60px); right: calc(var(--gut) + var(--sar)); z-index: 30; display: flex; flex-direction: column; gap: var(--s2); }
#prompts .prompt { background: var(--surface); border: 1px solid rgba(90, 214, 255, 0.55); border-radius: var(--r3); padding: var(--s3) var(--s4); width: 320px; max-width: calc(100vw - 2 * var(--gut)); box-shadow: var(--shadow); font-size: 13.5px; }
#prompts .prompt .inline { display: flex; gap: var(--s2); margin-top: var(--s2); }
#prompts .prompt .inline button { flex: 1; }

/* ---------------------------------------------------------------------------------------------- touch helm (touch.js) */
#touchHelm { display: none; }
body.touch #touchHelm { display: block; position: absolute; inset: 0; pointer-events: none; }
body.touch #touchHelm > * { pointer-events: auto; }
.touchHelm .thThr { position: absolute; right: calc(8px + var(--sar)); bottom: calc(var(--bar) + 204px + var(--sab)); width: 56px; height: 214px; display: flex; flex-direction: column-reverse; align-items: center; gap: 4px; }
.touchHelm .thThr .thTrack { position: relative; width: 48px; flex: 1; border-radius: 24px; background: var(--glass-strong); border: 1px solid var(--line-2); touch-action: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.touchHelm .thThr .thFill { position: absolute; left: 7px; right: 7px; background: rgba(79, 209, 139, 0.6); border-radius: 4px; }
.touchHelm .thThr .thFill.astern { background: rgba(242, 177, 52, 0.65); }
.touchHelm .thThr .thDetent { position: absolute; left: 4px; right: 4px; height: 2px; background: rgba(255, 255, 255, 0.55); }
.touchHelm .thThr .thKnob { position: absolute; left: 50%; width: 42px; height: 28px; margin-left: -21px; border-radius: 9px; background: #e8f1f8; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); pointer-events: none; }
.touchHelm .thThr .thVal { font: 600 12px var(--mono); color: var(--fg); background: var(--glass-strong); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.touchHelm .thThr.astern .thVal { color: var(--accent); }
.touchHelm .thThr .thLbl { display: none; }
.touchHelm .thRud { position: absolute; left: calc(68px + var(--sal)); right: calc(132px + var(--sar)); bottom: calc(var(--bar) + 204px + var(--sab)); display: flex; flex-direction: column; align-items: center; }
.touchHelm .thRud .thTrack { position: relative; width: 100%; height: 52px; border-radius: 26px; background: var(--glass-strong); border: 1px solid var(--line-2); touch-action: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.touchHelm .thRud .thCentre { position: absolute; left: 50%; top: 8px; bottom: 8px; width: 2px; margin-left: -1px; background: rgba(255, 255, 255, 0.5); }
.touchHelm .thRud .thFill { position: absolute; top: 10px; bottom: 10px; background: rgba(90, 214, 255, 0.55); border-radius: 4px; }
.touchHelm .thRud .thKnob { position: absolute; top: 50%; width: 28px; height: 42px; margin-top: -21px; border-radius: 9px; background: #e8f1f8; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); pointer-events: none; }
.touchHelm .thRud .thVal { display: none; }
.touchHelm .thBtns { position: absolute; left: calc(8px + var(--sal)); right: calc(72px + var(--sar)); bottom: calc(var(--bar) + 204px + var(--sab)); display: flex; flex-direction: row; justify-content: space-between; pointer-events: none !important; }
.touchHelm .thBtns > * { pointer-events: auto; }
.touchHelm .thBtn { width: 52px; height: 52px; min-height: 52px; border-radius: 50%; padding: 0; font-size: 12px; font-weight: 750; background: var(--glass-strong); border: 2px solid var(--line-2); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.touchHelm .thBtn.stop { border-color: var(--red); color: var(--red); }
.touchHelm .thBtn.auto { border-color: var(--accent); color: var(--accent); }
.touchHelm .thBtn.auto.on { background: var(--accent); color: var(--accent-ink); }
.touchHelm .thStick { position: absolute; left: calc(14px + var(--sal)); bottom: calc(24px + var(--sab)); width: 150px; height: 150px; touch-action: none; }
.touchHelm .thStickBase { position: absolute; inset: 10px; border-radius: 50%; background: var(--glass-strong); border: 2px solid var(--line-2); }
.touchHelm .thStickNub { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(232, 241, 248, 0.9); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
body.docked .touchHelm .thThr, body.docked .touchHelm .thRud, body.docked .touchHelm .thBtns { display: none; }

/* ---------------------------------------------------------------------------------------------- narrower desktop windows */
@media (max-width: 1280px) {
  .tbStats { gap: var(--s3); }
  .netStat { display: none; }
  .stat.gauge .sv { width: 84px; }
}
@media (max-width: 1240px) {
  :root { --tel-w: 400px; --radar-w: 200px; }
  .dockBtn { min-width: 46px; } .dockBtn .lbl { display: none; }
}
@media (max-width: 1100px) {
  :root { --tel-w: 372px; --radar-w: 192px; }
  .dockBtn { min-width: 42px; padding: 4px; }
  .tbEnv .stat:nth-child(2) { display: none; }
  .tbShipTxt b, .tbShipTxt small { max-width: 120px; }
  .sheetNav { width: 92px; padding-left: calc(6px + var(--sal)); padding-right: 6px; }
  .sheetNav button { flex-direction: column; gap: 3px; min-height: 60px; padding: 6px 2px; justify-content: center; }
  .sheetNav .lbl { display: none; }
  .sheetNav .sl { display: block; font-size: 11px; }
  .sheetNav .badge { position: absolute; top: 4px; right: 6px; margin: 0; }
  .sheetNav button.on::before { left: -6px; }
}
@media (max-width: 960px) {
  :root { --tel-w: 330px; --radar-w: 168px; }
  .tbStats .stat:nth-child(4), .tbStats .stat:nth-child(5) { display: none; }
  #telemetry .iRow.big .cell > b { font-size: 16px; }
  #actions { left: auto; right: calc(var(--gut) + var(--sar)); margin: 0; width: auto; bottom: calc(var(--gut) + var(--sab) + var(--radar-w) + 52px); max-width: calc(100vw - var(--tel-w) - 3 * var(--gut)); flex-wrap: wrap; justify-content: flex-end; }
  #ctxStack { left: calc(2 * var(--gut) + var(--tel-w)); right: calc(var(--gut) + var(--sar)); bottom: calc(var(--gut) + var(--sab) + var(--radar-w) + 120px); }
  #chatWrap { display: none; }
  .hero { grid-template-columns: 1fr; padding: var(--s5) var(--s4); }
}

/* ---------------------------------------------------------------------------------------------- touch layout (body.touch) */
body.touch { --gut: 8px; --top-h: 92px; }
body.touch input, body.touch select, body.touch textarea { font-size: 16px; } /* no iOS zoom */
body.touch button { min-height: var(--tap); }
body.touch .iconBtn { width: var(--tap); min-width: var(--tap); }
body.touch .touchOnly { display: inline-flex !important; }
body.touch #chatWrap { display: none; }
body.touch.chatOn #chatWrap { display: block; position: absolute; left: calc(var(--gut) + var(--sal)); right: calc(var(--gut) + var(--sar)); top: calc(var(--top-h) + var(--sat) + 6px); bottom: auto; width: auto; z-index: 6; }
body.touch.chatOn #chatInput { opacity: 1; min-height: var(--tap); background: var(--glass-strong); }
body.touch.chatOn #chat { max-height: 30vh; }
/* top bar on phones: two rows — ship image, credits, fuel and hull gauges; then cargo, wind, tide, clock.
   The two stat groups dissolve (display: contents) so every stat is a flex item that `order` can place. */
body.touch #topbar { top: calc(6px + var(--sat)); height: auto; flex-wrap: wrap; padding: 4px 8px 4px 4px; gap: 2px 10px; border-radius: var(--r3); justify-content: space-between; }
body.touch .tbStats, body.touch .tbEnv { display: contents; }
body.touch .tbShip { order: 1; padding-right: 0; border-right: 0; height: 40px; }
body.touch .tbThumb { width: 54px; height: 34px; }
body.touch .tbShipTxt { display: none; }
body.touch .moneyStat, body.touch .stat.gauge { order: 1; }
body.touch .wantedStat { order: 1; display: none; }
body.touch .wantedStat.wantedOn { display: flex; }
body.touch .tbBreak { display: block; order: 2; flex: 0 0 100%; height: 1px; background: var(--line); margin: 2px 0; }
body.touch .cargoStat, body.touch .windStat, body.touch .tideStat, body.touch .clockStat, body.touch #connPill { order: 3; }
body.touch .netStat { display: none; }
body.touch .cargoStat, body.touch .tideStat, body.touch .windStat, body.touch .clockStat { display: flex !important; }
body.touch .stat { gap: 4px; }
body.touch .stat small { display: none; }
body.touch .stat .si .ic { width: 15px; height: 15px; }
body.touch .stat b { font-size: 12.5px; }
body.touch .stat.gauge .sv { width: 64px; }
body.touch .cargoStat, body.touch .windStat, body.touch .tideStat, body.touch .clockStat { height: 28px; }
body.touch .cargoStat b, body.touch .windStat b, body.touch .tideStat b, body.touch .clockStat b { font-size: 12px; }
body.touch .windArrow { width: 20px; height: 20px; }
body.touch .mobileOnly { display: flex; }
body.touch #log { position: absolute; top: calc(var(--top-h) + var(--sat) + 46px); left: calc(var(--gut) + var(--sal)); width: auto; max-width: min(320px, calc(100vw - 2 * var(--gut) - var(--sal) - var(--sar))); max-height: 84px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; z-index: 12; }
body.touch #log .ev { font-size: 11.5px; line-height: 1.3; padding: 4px 9px; border-radius: var(--r2); background: rgba(7, 18, 28, 0.88); border: 1px solid rgba(255, 255, 255, 0.12); border-left: 3px solid var(--cyan); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); pointer-events: auto; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.touch #alerts { position: absolute; top: calc(var(--top-h) + var(--sat) + 46px); right: calc(var(--gut) + var(--sar)); max-width: min(280px, 46vw); left: auto; align-items: flex-end; z-index: 12; }
body.touch #alerts .alert { font-size: 12px; padding: 5px 9px; text-align: left; }
body.touch #warpBanner { font-size: 12px; padding: 5px 12px; top: calc(var(--top-h) + var(--sat) + 4px); white-space: normal; text-align: center; border-radius: var(--r2); width: max-content; z-index: 14; }
body.touch.warpOn #log, body.touch.warpOn #alerts { top: calc(var(--top-h) + var(--sat) + 52px); }

/* Mobile Navigation Pill & Drawer */
body.touch #navPill { position: absolute; top: calc(var(--top-h) + var(--sat) + 4px); left: calc(var(--gut) + var(--sal)); right: calc(var(--gut) + var(--sar)); height: 38px; min-height: 38px; display: flex !important; align-items: center; justify-content: space-between; gap: 6px; padding: 0 4px 0 10px; border-radius: 999px; background: rgba(8, 22, 34, 0.88); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid rgba(90, 214, 255, 0.28); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45); z-index: 15; pointer-events: auto; cursor: pointer; transition: border-color 0.2s ease, transform 0.2s ease; }
body.touch #navPill:active { transform: scale(0.99); border-color: var(--cyan); }
body.touch #navPill.hidden { display: none !important; }
.navPillContent { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; overflow: hidden; }
.pillItem { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pillItem.hidden { display: none !important; }
.pillItem .si { flex: none; width: 15px; height: 15px; color: var(--cyan); }
#pillBerth .si { color: var(--green); }
#pillBerthText { overflow: hidden; text-overflow: ellipsis; color: #a4ffd3; }
#pillJob .si { color: var(--accent); }
#pillJobText { overflow: hidden; text-overflow: ellipsis; }
#pillMsg .si { color: var(--cyan); }
.pillAction { flex: none; height: 26px; min-height: 26px; padding: 0 10px; font-size: 11px; font-weight: 700; border-radius: 999px; margin-left: 2px; pointer-events: auto; }
.pillAction.hidden { display: none !important; }
#navPillToggle { width: 30px; min-width: 30px; height: 30px; min-height: 30px; padding: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); color: var(--cyan); display: inline-flex; align-items: center; justify-content: center; flex: none; transition: transform 0.25s ease; }
body.touch.navDrawerOpen #navPillToggle { transform: rotate(180deg); }

body.touch #navDrawerScrim { position: fixed; inset: 0; background: rgba(3, 8, 14, 0.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); z-index: 22; display: block !important; opacity: 1; pointer-events: auto; transition: opacity 0.2s ease; }
body.touch #navDrawerScrim.hidden { opacity: 0; pointer-events: none; display: none !important; }

/* Navigation Drawer (#ctxLeft) on touch */
body.touch #ctxLeft { position: fixed !important; top: calc(var(--top-h) + var(--sat) + 6px); left: calc(var(--gut) + var(--sal)); right: calc(var(--gut) + var(--sar)); bottom: auto !important; width: auto !important; max-height: calc(82vh - var(--top-h) - var(--sat)); z-index: 25 !important; display: flex !important; flex-direction: column !important; gap: 8px; padding: 12px; border-radius: var(--r3); background: rgba(7, 18, 28, 0.95); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border: 1px solid var(--line-2); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65); overflow-y: auto; overflow-x: hidden; pointer-events: auto !important; transform: translateY(-115%); opacity: 0; transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease; }
body.touch.navDrawerOpen #ctxLeft { transform: translateY(0); opacity: 1; }
body.touch #ctxLeft .ctxCard { position: static !important; left: auto !important; right: auto !important; top: auto !important; width: 100% !important; box-sizing: border-box; }
.drawerHead { display: flex; align-items: center; justify-content: space-between; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.drawerTitle { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--cyan); }
.drawerTitle .si { width: 17px; height: 17px; }
#ctxDrawerClose { width: 32px; min-width: 32px; height: 32px; min-height: 32px; padding: 0; border-radius: 50%; }
.drawerLogs { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.drawerLogsHead { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--muted); gap: 6px; }
.drawerLogsHead .si { width: 15px; height: 15px; }
.miniBtn { height: 22px; min-height: 22px; padding: 0 8px; font-size: 11px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); color: var(--muted); }
.drawerLogsList { max-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.drawerLogItem { font-size: 11.5px; line-height: 1.35; padding: 4px 8px; border-radius: var(--r1); background: var(--card); border-left: 2px solid var(--cyan); color: var(--fg-2); }
.drawerLogItem.warn { border-left-color: var(--accent); color: var(--fg); }
/* bottom bar */
body.touch #actions { left: 0; right: 0; bottom: 0; transform: none; max-width: none; gap: 2px; padding: 4px calc(4px + var(--sar)) calc(4px + var(--sab)) calc(4px + var(--sal)); border-radius: var(--r3) var(--r3) 0 0; height: calc(var(--bar) + var(--sab)); border-bottom: 0; background: var(--glass-strong); display: flex; flex-wrap: nowrap; }
body.touch .dockBtn { flex: 1 1 0; min-width: 0; min-height: 52px; padding: 2px; }
body.touch .dockBtn .lbl { display: block; font-size: 10.5px; max-width: 100%; }
/* Autopilot, Camera, Weather and Cast off live in the More sheet on phones (moved there by hud.bindTouchLayout) */
body.touch.docked #btnInterior { display: none; }
body.touch:not(.docked) #btnWalkMore { display: none !important; }
body.touch #moreSheet { left: var(--s2); right: var(--s2); bottom: calc(var(--bar) + var(--sab) + var(--s2)); transform: translateY(8px); min-width: 0; display: none; flex-direction: row; flex-wrap: wrap; gap: 6px; padding: var(--s2); }
body.touch #moreSheet.open { display: flex; transform: none; }
body.touch .menuBtn { flex: 1 1 calc(33% - 6px); min-width: 0; flex-direction: column; gap: 3px; justify-content: center; min-height: 64px; padding: 4px; background: rgba(255, 255, 255, 0.05); border-color: var(--line); font-size: 12px; }
body.touch .menuBtn .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* instruments: compact, two rows, tap to expand */
body.touch #telemetry { left: calc(var(--gut) + var(--sal)); bottom: calc(var(--bar) + var(--sab) + 8px); width: auto; right: calc(106px + var(--sar) + var(--gut)); padding: 4px 6px 4px 8px; }
body.touch #telToggle { width: var(--tap); min-width: var(--tap); height: var(--tap); min-height: var(--tap); top: -4px; right: -4px; }
body.touch .iRow { gap: 0 6px; padding: 2px 0; }
body.touch .iRow.big { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-right: 36px; }
body.touch .iRow.big .cell:nth-child(n + 4) { display: none; }
body.touch .iRow.big .cell > b { font-size: 17px; }
body.touch .iRow.sec { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.touch .iRow.sec .cell:nth-child(n + 3) { display: none; }
body.touch #telemetry:not(.collapsed) .iRow.sec .cell { display: block; }
body.touch #telemetry:not(.collapsed) .iRow.sec { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.touch .iRow.detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.touch .iRow .cell.w2 { grid-column: span 1; }
body.touch .cell > b { font-size: 12px; }
body.touch #telemetry:not(.collapsed) { max-height: calc(100vh - var(--top-h) - var(--bar) - 40px); overflow-y: auto; z-index: 3; background: var(--glass-strong); }
/* radar: compact, sleek navigator */
body.touch #radarWrap { right: calc(6px + var(--sar)); bottom: calc(var(--bar) + var(--sab) + 6px); width: 96px; padding: 4px; border-radius: var(--r3); background: rgba(6, 18, 28, 0.88); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--line-2); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45); display: flex; flex-direction: column; align-items: center; z-index: 12; transition: width 0.2s ease, height 0.2s ease, opacity 0.2s ease; }
body.touch #radar { width: 88px; height: 88px; display: block; border-radius: 50%; }
body.touch #radarCtl { gap: 2px; margin-top: 3px; font-size: 10px; width: 100%; display: flex; align-items: center; justify-content: space-between; }
body.touch #radarCtl button { width: 20px; min-width: 20px; height: 20px; min-height: 20px; padding: 0; border-radius: 4px; font-size: 10px; }
body.touch #radarCtl button .si { width: 12px; height: 12px; }
body.touch #radarCtl #radarRange { min-width: 0; flex: 1; font-size: 10px; font-family: var(--mono); font-weight: 700; text-align: center; white-space: nowrap; color: var(--fg); }
body.touch #radarHU { position: absolute; top: 5px; right: 5px; width: 22px !important; min-width: 22px !important; height: 22px !important; border-radius: 50%; background: rgba(6, 20, 30, 0.88); border: 1px solid var(--line-2); font-size: 9.5px; font-weight: 700; padding: 0; line-height: 22px; }

/* Radar minimize toggle button */
.radarMiniBtn { display: none; }
body.touch .radarMiniBtn { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); height: 18px; padding: 0 6px; border-radius: 999px; background: rgba(6, 20, 30, 0.92); border: 1px solid var(--line-2); color: var(--cyan); font-size: 9px; font-weight: 700; font-family: var(--mono); display: inline-flex; align-items: center; gap: 3px; z-index: 14; cursor: pointer; }
body.touch .radarMiniBtn .si { width: 11px; height: 11px; }
body.touch #radarWrap.minimized { width: 38px !important; height: 38px !important; padding: 0 !important; border-radius: 50% !important; justify-content: center !important; overflow: hidden !important; cursor: pointer !important; }
body.touch #radarWrap.minimized #radar, body.touch #radarWrap.minimized #radarCtl, body.touch #radarWrap.minimized #radarHU, body.touch #radarWrap.minimized #radarOpts { display: none !important; }
body.touch #radarWrap.minimized .radarMiniBtn { position: static !important; transform: none !important; width: 100% !important; height: 100% !important; border-radius: 50% !important; border: none !important; background: transparent !important; justify-content: center !important; display: flex !important; flex-direction: column !important; gap: 0 !important; }
body.touch #radarWrap.minimized .radarMiniBtn .miniRange { font-size: 8px; line-height: 1; }

/* context stack and cards */
body.touch #ctxStack { display: contents; }
body.touch #fishPanel { position: absolute; left: calc(var(--gut) + var(--sal)); right: calc(var(--gut) + var(--sar)); width: auto; top: calc(var(--top-h) + var(--sat) + 48px); z-index: 14; }
body.touch #berthLine { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
body.touch #jobLine { padding: 6px 8px; gap: 4px; }
body.touch #jobLine .jobStep { font-size: 12px; }
body.touch #jobLine button { min-height: 36px; }
body.touch #jobLine .jobNav .iconBtn { width: 36px; min-width: 36px; height: 36px; min-height: 36px; }
body.touch #berthLine .berthInfo { flex: 1 1 100%; font-size: 12.5px; }
body.touch #berthLine .berthBtns { flex: 1 1 100%; display: flex; gap: 6px; }
body.touch #berthLine .berthBtns button { flex: 1; min-height: var(--tap); }
body.touch #warpCtl { position: absolute; left: calc(var(--gut) + var(--sal)); bottom: calc(var(--bar) + var(--sab) + 266px); padding: 2px; }
body.touch.docked #warpCtl { display: none; }
body.touch #warpCtl button { width: var(--tap); min-width: var(--tap); height: var(--tap); min-height: var(--tap); }
body.touch .sidePanel { position: fixed; inset: 0; width: auto; max-height: none; border-radius: 0; z-index: 22; display: flex; flex-direction: column; background: var(--surface); border: 0; }
body.touch .sidePanel .panelHead { padding: calc(10px + var(--sat)) calc(12px + var(--sar)) 10px calc(16px + var(--sal)); font-size: 17px; min-height: 64px; }
body.touch #weatherBody { overflow: auto; padding: var(--s4) calc(var(--s4) + var(--sar)) calc(var(--s4) + var(--sab)) calc(var(--s4) + var(--sal)); }
body.touch #interiorHud, body.touch #ashoreHud { top: calc(var(--top-h) + var(--sat) + 4px); width: calc(100vw - 2 * var(--gut)); }
body.touch.interior #log, body.touch.ashore #log { top: calc(var(--top-h) + var(--sat) + 108px); max-height: 16vh; }
body.touch #btnAshoreOffice { width: var(--tap); padding: 0; }
body.touch #btnAshoreOffice .lbl { display: none; }
body.touch #ashoreHintText, body.touch #interiorHint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.touch .hintLine { white-space: nowrap; }
body.touch .hintLine { font-size: 12.5px; }
/* sheets on touch: bottom tab bar instead of the rail */
body.touch .sheetHead { min-height: 60px; gap: var(--s2); padding: calc(8px + var(--sat)) calc(8px + var(--sar)) 8px calc(12px + var(--sal)); }
body.touch .sheetIcon { width: 36px; height: 36px; }
body.touch .sheetTitle b { font-size: 16.5px; }
body.touch .sheetTitle small { font-size: 12px; }
body.touch .headMoney { display: none; }
body.touch .headBtn { padding: 0 10px; }
body.touch .sheetBody { padding: var(--s4) calc(var(--s3) + var(--sar)) calc(var(--s5) + var(--sab)) calc(var(--s3) + var(--sal)); }
body.touch .sheetMain { flex-direction: column-reverse; }
body.touch .sheetNav { width: auto; flex-direction: row; gap: 0; padding: 2px calc(2px + var(--sar)) calc(2px + var(--sab)) calc(2px + var(--sal)); border-right: 0; border-top: 1px solid var(--line); background: rgba(8, 20, 33, 0.96); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; flex: none; }
body.touch .sheetNav::-webkit-scrollbar { display: none; }
body.touch .sheetNav button { flex: 1 0 auto; min-width: 46px; flex-direction: column; gap: 2px; min-height: 54px; padding: 4px 2px; justify-content: center; }
body.touch .sheetNav .lbl { display: none; }
body.touch .sheetNav .sl { display: block; font-size: 10.5px; }
body.touch .sheetNav .badge { position: absolute; top: 3px; right: 3px; margin: 0; min-width: 17px; height: 17px; font-size: 10px; padding: 0 4px; }
body.touch .sheetNav button.on::before { left: 12px; right: 12px; top: -3px; bottom: auto; width: auto; height: 3px; }
body.touch .cards, body.touch .cards.wide, body.touch .cards2 { grid-template-columns: minmax(0, 1fr); }
body.touch .card { padding: var(--s3); }
body.touch .compareTray { padding: var(--s2); gap: var(--s2); }
body.touch .compareTray > b { flex: 1 1 auto; }
body.touch .compareTray .slots { flex: 1 1 100%; order: 3; }
body.touch #compareWrap { padding: 0; }
body.touch .compareBox { width: 100%; height: 100%; border-radius: 0; border: 0; }
body.touch .compareBox .sheetHead { padding-top: calc(8px + var(--sat)); }
body.touch .banner { min-height: 150px; border-radius: var(--r3); }
body.touch .bannerTxt { left: var(--s3); right: var(--s3); bottom: var(--s3); }
body.touch .presets button { min-height: var(--tap); }
body.touch .shipCard, body.touch .vesselCard, body.touch .cmpCol { padding: 0; }
body.touch .headBtn { width: var(--tap); min-width: var(--tap); padding: 0; }
body.touch .headBtn .lbl { display: none; }
body.touch .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.touch .quick > :last-child:nth-child(odd) { grid-column: 1 / -1; }
body.touch .yardBar { flex-direction: column; align-items: stretch; gap: var(--s2); }
body.touch .seg { display: flex; width: 100%; }
body.touch .seg button { flex: 1 1 0; min-width: 0; padding: 0 6px; font-size: 13px; min-height: var(--tap); }
body.touch .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s3)); padding: 0 var(--s3) 2px; }
body.touch .chips::-webkit-scrollbar { display: none; }
body.touch .chipBtn { flex: none; min-height: var(--tap); }
body.touch .boardHead { gap: var(--s2); padding-left: var(--s3); }
body.touch .boardHead .goodIcon { display: none; }
body.touch .boardHead button { width: var(--tap); min-width: var(--tap); padding: 0; }
body.touch .boardHead button .lbl { display: none; }
body.touch .boardHead .chev { display: inline-flex; width: 28px; justify-content: center; }
body.touch .miniJob .t div { white-space: normal; }
body.touch .boardJobs { padding: 0 var(--s2) var(--s2); }
.seg .short { display: none; }
body.touch .seg .short { display: inline; }
body.touch .seg .long { display: none; }
body.touch .stepper { grid-template-columns: var(--tap) minmax(0, 1fr) var(--tap); }
body.touch .vesselCard { grid-template-columns: 112px minmax(0, 1fr); }
body.touch .chartHint { display: none; }
body.touch #chartTools { top: var(--s2); right: calc(var(--s2) + var(--sar)); padding: 4px; }
body.touch #chartTools .toolRow { flex-direction: column; }
body.touch #chartTools .toolBtn { width: var(--tap); min-width: var(--tap); min-height: var(--tap); padding: 0; justify-content: center; }
body.touch #chartTools .toolBtn .lbl { display: none; }
body.touch #chartTools .iconBtn { width: var(--tap); }
body.touch #chartInfo { font-size: 11px; }
body.touch #voyageLine { padding: 6px calc(8px + var(--sar)) 6px calc(8px + var(--sal)); gap: 6px; }
body.touch #voyageLine .vsum { flex: 1 1 100%; font-size: 12px; }
body.touch #voyageLine button { flex: 1 1 0; min-width: 0; padding: 0 6px; font-size: 12.5px; }
body.touch #voyageLine button .lbl { overflow: hidden; text-overflow: ellipsis; }
body.touch #prompts { top: auto; bottom: calc(var(--bar) + 300px + var(--sab)); left: var(--gut); right: var(--gut); align-items: center; }
body.touch #hail { top: 16%; font-size: 16px; }
/* welcome on phones: stacked */
body.touch .hero { grid-template-columns: minmax(0, 1fr); padding: calc(var(--s4) + var(--sat)) calc(var(--s4) + var(--sar)) calc(var(--s4) + var(--sab)) calc(var(--s4) + var(--sal)); gap: var(--s4); align-content: start; min-height: 0; }
body.touch .heroArt { aspect-ratio: 16 / 9; border-radius: var(--r3); }
body.touch .features { grid-template-columns: minmax(0, 1fr); }
body.touch .loginRow { flex-direction: column; }
body.touch .loginRow button { width: 100%; }
body.touch #welcome { align-items: flex-start; }

/* portrait phones: stack from the bottom — bar, instruments + radar, rudder row with STOP / AP, warp, throttle on the right */
@media (orientation: portrait) {
  body.touch #telemetry { right: calc(106px + var(--sar) + var(--gut)); }
}
/* landscape phones: a single row above the bar */
@media (orientation: landscape) and (max-height: 520px) {
  body.touch { --bar: 52px; --top-h: 54px; }
  body.touch .tbBreak { display: none; }
  body.touch #topbar { flex-wrap: nowrap; }
  body.touch #berthLine { right: calc(var(--gut) + var(--sar) + 190px); flex-wrap: nowrap; }
  body.touch #berthLine .berthInfo { flex: 1 1 auto; min-width: 0; }
  body.touch #berthLine .berthBtns { flex: none; }
  body.touch #berthLine .berthBtns button { flex: none; padding: 0 12px; }
  /* berthOn log override handled by pill */
  body.touch #log { width: min(250px, 30vw); max-height: 26vh; }
  body.touch #telemetry { right: auto; width: 250px; }
  body.touch #telemetry:not(.collapsed) { max-height: calc(100vh - var(--top-h) - var(--bar) - 20px); }
  body.touch #radarWrap { width: 88px; } body.touch #radar { width: 80px; height: 80px; }
  body.touch #radarCtl { display: none; }
  body.touch .touchHelm .thThr { right: calc(140px + var(--sar)); bottom: calc(var(--bar) + 8px + var(--sab)); height: 150px; }
  body.touch .touchHelm .thRud { left: calc(270px + var(--sal)); right: calc(210px + var(--sar)); bottom: calc(var(--bar) + 8px + var(--sab)); }
  body.touch .touchHelm .thBtns { left: calc(270px + var(--sal)); right: calc(210px + var(--sar)); bottom: calc(var(--bar) + 66px + var(--sab)); }
  body.touch .touchHelm .thBtn { width: 46px; height: 46px; min-height: 46px; }
  body.touch #warpCtl { left: auto; right: calc(var(--gut) + var(--sar)); bottom: auto; top: calc(var(--top-h) + var(--sat) + 4px); }
  body.touch #alerts { left: auto; right: calc(var(--gut) + var(--sar) + 150px); max-width: 40vw; }
  body.touch .menuBtn { flex: 1 1 calc(16% - 6px); }
  body.touch .touchHelm .thStick { width: 120px; height: 120px; }
  body.touch .sheetNav button { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
