:root {
  /* Default look "Slate" = dark instrument palette (mockup A) */
  --bg: #0d1418; --panel: #151f25; --panel2: #1c2830; --line: #27343c; --text: #e8eef1; --muted: #8b9ba3;
  --accent: #37c964; --accent2: #e6b969; --danger: #e5484d;
  /* plot colours, read by app.js */
  --plot-bg: #111a1f; --grid: #223038; --axis: #8fa0a8; --trace: #37c964; --hold: #e6b969; --marker: #ff5c8a; --wf-bg: #0b1114; --overlay-text: #7f96a3;
  --radius: 8px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Roboto Mono", monospace;
  /* shell geometry: bottom tab bar on phones, left rail on wide screens */
  --bar-h: calc(62px + env(safe-area-inset-bottom)); --rail-w: 0px; --peek: 76px;
  color-scheme: dark;
}
@media (min-width: 900px) { :root { --bar-h: 0px; --rail-w: 88px; } }
@media (orientation: landscape) and (max-height: 560px) { :root { --bar-h: 0px; --rail-w: calc(72px + env(safe-area-inset-left)); } }

/* ---- Look: Studio (SDR#-style instrument) ---- */
body[data-ui=studio] {
  --bg: #0a0c10; --panel: #11151b; --panel2: #1a2029; --line: #252d38; --text: #dfe7ef; --muted: #8190a0; --accent: #36c5f4;
  --plot-bg: #000; --grid: #1c232c; --axis: #7c8b9a; --trace: #ffe14d; --hold: #ff6b3d; --marker: #36c5f4; --wf-bg: #000; --overlay-text: #5f7385; --radius: 3px;
}
body[data-ui=studio] .vfo span { color: var(--accent); letter-spacing: .02em; text-shadow: 0 0 12px #36c5f455; }
body[data-ui=studio] .tabs button.active { background: var(--accent); color: #000; }
body[data-ui=studio] button.primary { background: #0e4f66; border-color: #36c5f4; }
/* ---- Look: Pocket (light instrument) ---- */
body[data-ui=pocket] {
  --bg: #eef1f5; --panel: #fff; --panel2: #f3f5f8; --line: #dde3ea; --text: #17202a; --muted: #5e6b78; --accent: #3b5bdb;
  --plot-bg: #fff; --grid: #e6ebf0; --axis: #6b7886; --trace: #3b5bdb; --hold: #e8590c; --marker: #d6336c; --wf-bg: #f3f5f8; --overlay-text: #8793a0; --radius: 14px;
  color-scheme: light;
}
body[data-ui=pocket] .chart { box-shadow: 0 1px 3px #0001, 0 4px 14px #0000000d; border: 0; }
body[data-ui=pocket] button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
body[data-ui=pocket] #light.on { background: #2f9e44; box-shadow: none; }
body[data-ui=pocket] .vfo span { color: var(--accent); }
body[data-ui=pocket] #error { background: #fde8ea; } body[data-ui=pocket] #warn { background: #fff4e0; color: #7a4b00; border-color: #f5c77e; }
/* ---- Look: Phosphor (oscilloscope) ---- */
body[data-ui=phosphor] {
  --bg: #020603; --panel: #06110a; --panel2: #0b1d11; --line: #12361f; --text: #8dffb0; --muted: #3f9a5c; --accent: #39ff7a;
  --plot-bg: #010502; --grid: #0d2a16; --axis: #2f8a4c; --trace: #39ff7a; --hold: #c6ff3d; --marker: #ffd23d; --wf-bg: #000; --overlay-text: #2f7a45; --radius: 2px;
  --font: ui-monospace, "Cascadia Mono", Consolas, "Roboto Mono", monospace;
}
body[data-ui=phosphor] .vfo span, body[data-ui=phosphor] .brand h1 { text-shadow: 0 0 8px #39ff7a99; }
body[data-ui=phosphor] canvas { filter: drop-shadow(0 0 2px #39ff7a55); }
body[data-ui=phosphor] button.primary { background: #0b3a1b; border-color: #39ff7a; }

/* ---- base components ---- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); -webkit-tap-highlight-color: transparent; overflow: hidden; }
.mono { font-family: var(--mono); font-size: 12px; }
.chip { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 2px 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
details { border-bottom: 1px solid var(--line); padding: 4px 0 8px; }
summary { cursor: pointer; padding: 10px 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '▾'; float: right; transition: transform .15s; }
details:not([open]) summary::after { transform: rotate(-90deg); }
label { display: block; margin: 7px 0; color: var(--muted); font-size: 12px; }
label output { float: right; color: var(--text); }
.unit { float: right; }
input, select, button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; }
input[type=number], input[type=text], input[type=password], select { width: 100%; padding: 7px 10px; margin-top: 3px; min-height: 38px; }
input[type=range] { width: 100%; accent-color: var(--accent); background: none; border: 0; min-height: 28px; }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
button { padding: 7px 12px; cursor: pointer; min-height: 38px; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled, input:disabled, select:disabled { opacity: .45; cursor: default; }
button.primary { background: #1f5f36; border-color: #2d8a4e; font-weight: 600; }
.tune { display: flex; gap: 3px; margin-top: 3px; }
.tune input { text-align: center; font-size: 18px; font-weight: 600; margin: 0; }
.tune button { padding: 4px 9px; min-width: 40px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair label { margin: 4px 0; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; min-height: 36px; }
.actions { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.actions button { flex: 1; }
.note { color: var(--muted); font-size: 12px; margin: 4px 0; }
.note.support span { display: block; margin-bottom: 6px; }
.note.support .tip { display: inline-block; margin: 0 6px 4px 0; padding: 6px 12px; border-radius: 999px; color: #fff; font-weight: 600; text-decoration: none; }
.note.support .kofi { background: #ff5e5b; } .note.support .paypal { background: #00457c; }
.badge { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: var(--radius); margin-left: 4px; }
.badge.ok { background: #1f5f36; color: #d3f9d8; } .badge.exp { background: #6b4c1c; color: #ffe8c2; } .badge.no { background: #5c1f22; color: #ffd8da; }
.peaks { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.peaks th { text-align: right; color: var(--muted); font-weight: 500; padding: 3px 4px; }
.peaks td { text-align: right; padding: 6px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.peaks tr:hover td { background: var(--panel2); }
.peaks:has(tbody:empty) thead { display: none; }
.peaks tr.pad td { border-top-color: transparent; cursor: default; }
.peaks tr.pad:hover td { background: none; }
.modal { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 30; }
.modal .sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; width: min(92vw, 380px); display: flex; flex-direction: column; gap: 8px; }
.modal .sheet h3 { margin: 0 0 4px; font-size: 16px; }
.modal .sheet button { text-align: left; }
.icon-btn { width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; border-radius: 50%; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }

/* ================= INSTRUMENT (Spectrum + Decode tabs, mockup A) ================= */
.view { position: fixed; top: 0; bottom: var(--bar-h); left: var(--rail-w); right: 0; }
#instrument { display: flex; flex-direction: column; background: var(--bg); overflow: hidden; z-index: 1;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 0; }
/* On Home/Settings the instrument stays laid out (canvases keep their size and waterfall history) but invisible. */
body[data-tab=home] #instrument, body[data-tab=settings] #instrument { visibility: hidden; pointer-events: none; }

#instrument > header { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 14px 4px; min-height: 50px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--accent); min-width: 0; }
.brand svg { flex: none; }
@media (min-width: 900px) { .brand svg { display: none; } }
.brand h1 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; }
.brand span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.connection { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.pill { display: flex; gap: 7px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px; font-size: 12px; color: var(--muted); min-width: 0; white-space: nowrap; }
.pill .chip { background: none; border: 0; padding: 0 0 0 7px; border-left: 1px solid var(--line); border-radius: 0; overflow: hidden; text-overflow: ellipsis; }
#light { width: 8px; height: 8px; border-radius: 50%; background: #5d6d74; flex: none; }
#light.on { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
#connect { min-height: 34px; padding: 5px 14px; border-radius: 17px; }

#instrument > main { flex: 1; min-height: 0; position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.display { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 4px 12px 10px; gap: 8px; }
.readout { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; }
.vfo { display: flex; align-items: baseline; gap: 6px; }
.vfo span { font: 700 40px/1 var(--mono); letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.vfo small { color: var(--muted); font-size: 17px; }
.vfo .step { min-height: 34px; min-width: 34px; padding: 0; border-radius: 50%; align-self: center; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; }
.meta { display: flex; gap: 4px 12px; color: var(--muted); flex-wrap: wrap; align-items: baseline; font-size: 13px; }
.band-sub { color: var(--muted); font-size: 13px; min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bandchips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; flex: none; }
.bandchips::-webkit-scrollbar { display: none; }
.bandchips button { white-space: nowrap; padding: 6px 13px; min-height: 34px; border-radius: 18px; background: var(--panel2); border: 1px solid var(--line); font-size: 13px; flex: none; }
.bandchips button.on { background: color-mix(in srgb, var(--accent) 20%, var(--panel2)); border-color: var(--accent); color: var(--accent); }
.tabs { display: flex; gap: 2px; background: var(--panel2); border-radius: 12px; padding: 3px; flex: none; }
.tabs button { flex: 1; border: 0; background: transparent; border-radius: 9px; font-weight: 600; color: var(--muted); min-height: 34px; padding: 5px 8px; }
.tabs button.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px #0004; }
.chart { position: relative; background: var(--plot-bg); border: 1px solid var(--line); border-radius: 14px; flex: 1 1 42%; display: flex; min-height: 90px; overflow: hidden; }
.chart.water { flex: 1 1 58%; background: var(--wf-bg); }
canvas { flex: 1; width: 100%; min-height: 0; display: block; cursor: crosshair; touch-action: none; }
#empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); pointer-events: none; text-align: center; padding: 12px; }
#empty .big { font-size: 44px; color: var(--accent); }
#empty h2 { margin: 6px 0; color: var(--text); font-size: 18px; }
#error { background: #3b1518; border: 1px solid var(--danger); padding: 8px 12px; border-radius: 10px; flex: none; }
#warn { background: #3a2a12; border: 1px solid #6b4c1c; padding: 4px 4px 4px 10px; border-radius: 10px; color: #f3d19a; font-size: 12px; line-height: 1.3; flex: none; }
#warn:not([hidden]) { display: flex; align-items: center; gap: 6px; }
#warn > span { flex: 1; min-width: 0; }
#warn .warn-x { flex: none; width: 32px; height: 32px; padding: 0; border: 0; background: none; color: inherit; font-size: 20px; line-height: 1; opacity: .8; }
.display > footer { display: flex; gap: 14px; color: var(--muted); font-size: 12px; padding: 0 4px; flex: none; white-space: nowrap; overflow: hidden; }
.display > footer b { color: var(--text); font-variant-numeric: tabular-nums; }
.display > footer > div { flex: none; }
.display > footer > div:has(#marker), .display > footer > div:has(#peak), #crc { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }   /* long peak/marker/CRC text ends in "…", not cut */

/* control panel: side panel (desktop) / bottom sheet (phone) */
#side { overflow-y: auto; padding: 0 14px 24px; border-left: 1px solid var(--line); background: var(--panel); min-height: 0; }
.bs-head { display: none; }
#decodeSide { display: none; overflow-y: auto; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); padding: 0 14px 24px; }
body[data-inst=decode] #side { display: none; }
body[data-inst=decode] #decodeSide { display: block; }
body[data-inst=decode] #instrument > main { grid-template-columns: minmax(0, 1fr) 440px; }
body[data-inst=decode] .bandchips { display: none; }
body[data-ui=studio] #instrument > main { grid-template-columns: 320px minmax(0, 1fr); }
body[data-ui=studio] #side, body[data-ui=studio] #decodeSide { order: -1; border-left: 0; border-right: 1px solid var(--line); }

/* Decoder panel + results as live cards (mockup A, screen 2) */
#decodeSide summary { font-size: 13px; color: var(--text); padding-top: 14px; }
#decodeSide details { border: 0; }
.dec-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.dec-row .check { margin: 7px 0; min-height: 38px; }
#decTable { border-collapse: separate; border-spacing: 0; margin-top: 6px; }
#decTable thead { display: none; }
#decTable tbody { display: flex; flex-direction: column; gap: 9px; }
#decTable tr { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 3px; background: var(--panel2); border: 1px solid var(--line); border-radius: 16px; padding: 11px 12px 11px 66px; min-height: 66px; animation: decIn .35s ease-out; }
#decTable tr::before { content: var(--dec-ic, '📡'); position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 12px; background: var(--dec-bg, #1d2f45); display: flex; align-items: center; justify-content: center; font-size: 21px; }
#decTable td { border: 0; padding: 0; text-align: left; cursor: default; background: none !important; }
#decTable td:empty { display: none; }
#decTable td:nth-child(1) { order: 0; flex: 1 1 0; min-width: 0; font-size: 15px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#decTable td:nth-child(5) { order: 1; flex: none; color: var(--accent); font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--accent) 14%, transparent) !important; border-radius: 8px; padding: 1px 7px; }
#decTable:not([data-kind=lte]) td:nth-child(5)::before { content: '×'; opacity: .7; }
/* LTE: "Operator · cell PCI" as the card title */
#decTable[data-kind=lte] td:nth-child(3) { order: -1; flex: none; font-size: 15px; font-weight: 700; color: var(--text); }
#decTable[data-kind=lte] td:nth-child(3)::before { content: none; }
#decTable[data-kind=lte] td:nth-child(1)::before { content: '· cell '; font-weight: 600; color: var(--muted); }
#decTable[data-kind=lte] td:nth-child(4)::before { content: none; }
#decTable[data-kind=lte] td:nth-child(2)::after { content: ' ·'; opacity: .7; }
#decTable td:nth-child(2), #decTable td:nth-child(3), #decTable td:nth-child(4) { order: 2; color: var(--muted); font-size: 12.5px; }
#decTable td:nth-child(3)::before, #decTable td:nth-child(4)::before { content: '· '; opacity: .7; }
#decTable tr::after { content: ''; order: 1; flex-basis: 100%; height: 0; }
#decTable[data-kind=ble] { --dec-ic: '🔵'; --dec-bg: #16303a; }
#decTable[data-kind=adsb] { --dec-ic: '✈'; --dec-bg: #1d2f45; }
#decTable[data-kind=zigbee] { --dec-ic: '🏠'; --dec-bg: #1e3326; }
#decTable[data-kind=nrf24] { --dec-ic: '⚡'; --dec-bg: #3a3217; }
#decTable[data-kind=fpv] { --dec-ic: '🎥'; --dec-bg: #3a1c2c; }
#decTable[data-kind=classify] { --dec-ic: '🎮'; --dec-bg: #2c1f3d; }
#decTable[data-kind=lte] { --dec-ic: '📶'; --dec-bg: #1d2f45; }
#decTable[data-kind=rid] { --dec-ic: '🛸'; --dec-bg: #16352c; }
#decTable[data-kind=mw] { --dec-ic: '🍲'; --dec-bg: #3a2a14; }
#decTable[data-kind=cam] { --dec-ic: '📹'; --dec-bg: #2a2140; }
#decTable[data-kind=wifib] { --dec-ic: '📡'; --dec-bg: #1a2d45; }
#decTable[data-kind=dect] { --dec-ic: '☎'; --dec-bg: #1a2c42; }
#decTable[data-kind=ant] { --dec-ic: '❤'; --dec-bg: #3a1a1e; }
#decTable[data-kind=gnss], #decTable[data-kind=iridium] { --dec-ic: '🛰'; --dec-bg: #262d33; }
#decTable[data-kind=qo100] { --dec-ic: '📻'; --dec-bg: #2f1d3a; }body[data-ui=pocket] #decTable tr::before { filter: saturate(.8) brightness(1.6); }
.dec-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 22px 12px; border: 1px dashed var(--line); border-radius: 16px; margin: 10px 0; }
@keyframes decIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------- phones (portrait) ---------------- */
@media (max-width: 899px) and (orientation: portrait), (max-width: 899px) and (min-height: 561px) {
  #instrument > header { padding: 8px 12px 2px; }
  .brand span { display: none; }
  .brand h1 { font-size: 15px; }
  #help { display: none; }
  #connect { min-height: 32px; padding: 4px 12px; font-size: 13px; }
  .connection { gap: 6px; }
  #instrument > main { display: block; }
  .display { position: absolute; inset: 0; padding: 2px 10px calc(var(--peek) + 8px); gap: 7px; }
  .vfo span { font-size: 38px; }
  .readout { gap: 2px 10px; }
  .chart { min-height: 70px; border-radius: 14px; }
  .display > footer { gap: 10px; font-size: 11px; }
  #crc { display: none; }
  .peaks td, .peaks th { padding: 10px 4px; }
  input[type=range] { min-height: 40px; }
  .check { min-height: 40px; }

  /* bottom sheet with the controls */
  #side { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; height: min(64%, 540px); display: flex; flex-direction: column; overflow: hidden;
    padding: 0; border: 0; border-top: 1px solid var(--line); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 30px #0008;
    transform: translateY(calc(100% - var(--peek))); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
  #side.open { transform: none; }
  #side.dragging { transition: none; }
  .bs-head { display: block; flex: none; padding: 7px 14px 10px; touch-action: none; cursor: grab; }
  .bs-handle { width: 42px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 45%, transparent); margin: 0 auto 9px; }
  .bs-seg { display: flex; background: var(--panel2); border-radius: 12px; padding: 3px; gap: 2px; }
  .bs-seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; font-weight: 600; color: var(--muted); min-height: 38px; padding: 6px 4px; font-size: 13px; }
  .bs-seg button.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px #0004; }
  .bs-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 20px; }
  #side[data-seg] .bs-body > details { border: 0; }
  #side[data-seg] .bs-body > details > summary { pointer-events: none; }
  #side[data-seg] .bs-body > details > summary::after { display: none; }
  #side[data-seg=tune] .bs-body > details:not([data-seg=tune]),
  #side[data-seg=rx] .bs-body > details:not([data-seg=rx]),
  #side[data-seg=view] .bs-body > details:not([data-seg=view]),
  #side[data-seg=tools] .bs-body > details:not([data-seg=tools]) { display: none; }

  /* Decode tab: compact spectrum on top, decoder cards below (mockup A screen 2) */
  body[data-inst=decode] #instrument > main { display: flex; flex-direction: column; }
  body[data-inst=decode] #decodeSide details { padding-top: 10px; }
  body[data-inst=decode] .display { position: static; flex: none; padding: 2px 10px 10px; gap: 6px; }
  body[data-inst=decode] .tabs, body[data-inst=decode] .display > footer { display: none; }
  body[data-inst=decode] .vfo span { font-size: 26px; }
  body[data-inst=decode] .vfo .step { display: none; }
  body[data-inst=decode] .chart { flex: none; height: 132px; min-height: 0; }
  body[data-inst=decode] .chart.water { height: 54px; }
  body[data-inst=decode] #empty h2 { font-size: 14px; } body[data-inst=decode] #empty .big, body[data-inst=decode] #empty p { display: none; }
  body[data-inst=decode] #decodeSide summary { display: none; }
  body[data-inst=decode] #decodeSide { flex: 1; border: 0; border-top: 1px solid var(--line); border-radius: 24px 24px 0 0; padding: 4px 16px 20px; box-shadow: 0 -10px 30px #0006; }
}
@media (max-width: 479px) { .pill .chip { display: none; } }

/* ---------------- landscape phones: rail + side by side ---------------- */
@media (orientation: landscape) and (max-height: 560px) {
  #instrument > header { padding: 4px 12px; min-height: 42px; }
  .brand span, #crc { display: none; }
  #instrument > main { grid-template-columns: minmax(0, 1fr) 300px; }
  body[data-inst=decode] #instrument > main { grid-template-columns: minmax(0, 1fr) 340px; }
  .vfo span { font-size: 26px; }
  .display { padding: 2px 8px 6px; gap: 5px; }
  .bandchips { display: none; }
  .chart { min-height: 0; }
}

/* ---- Onboarding overlay + Flasher modal (additive) ---- */
.ob-modal, .fl-modal { position: fixed; inset: 0; z-index: 40; background: #000b; display: flex; align-items: center; justify-content: center; padding: 12px; }
.ob-sheet, .fl-sheet { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; width: min(100%, 560px); max-height: 92vh; max-height: 92svh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 40px #0007; }

/* Onboarding */
.ob-dots { display: flex; gap: 8px; justify-content: center; padding: 16px 0 4px; }
.ob-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.ob-dot.on { background: var(--accent); }
.ob-scroll { overflow-y: auto; padding: 8px 18px 4px; -webkit-overflow-scrolling: touch; }
.ob-content { display: flex; flex-direction: column; gap: 10px; }
.ob-badge { align-self: center; font-size: 30px; line-height: 1; background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; }
.ob-badge img { display: block; width: 44px; height: 44px; margin: -4px -6px; }
.ob-title { margin: 4px 0 0; text-align: center; font-size: 20px; color: var(--text); }
.ob-lead { margin: 0 0 4px; text-align: center; color: var(--muted); font-size: 14px; }
.ob-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.ob-card h4 { margin: 0 0 6px; font-size: 13px; color: var(--text); }
.ob-list, .fl-steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.ob-list li, .fl-steps li { margin: 4px 0; }
.ob-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0; }
.ob-actions .primary, .ob-flash { flex: 0 0 auto; }
.ob-official, .fl-official { color: var(--accent); font-size: 13px; text-decoration: underline; }
.ob-foot, .fl-foot { border-top: 1px solid var(--line); padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ob-dontshow { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin: 0; }
.ob-dontshow input { width: 18px; height: 18px; accent-color: var(--accent); }
.ob-nav { display: flex; gap: 8px; margin-left: auto; }
.ob-nav button, .ob-skip, .ob-back, .ob-next { min-height: 42px; padding: 8px 16px; }
.ob-skip, .ob-back { background: transparent; }

/* Flasher */
.fl-sheet { width: min(100%, 640px); }
.fl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 16px 18px 0; flex-wrap: wrap; }
.fl-head h3 { margin: 0; font-size: 18px; }
.fl-attrib { color: var(--accent2); font-size: 12px; font-weight: 600; }
.fl-sheet > .note { padding: 4px 18px 0; }
#flDesktop, #flMobile { overflow-y: auto; padding: 8px 18px 4px; display: flex; flex-direction: column; gap: 12px; }
.fl-field { display: flex; flex-direction: column; gap: 6px; }
.fl-lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.fl-radio { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; margin: 2px 0; }
.fl-radio input { width: 18px; height: 18px; accent-color: var(--accent); }
.fl-private { color: var(--danger, #e5484d); font-weight: 650; white-space: nowrap; }   /* private optimised build: do not share */
.fl-filerow { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.fl-device { color: var(--text); font-size: 13px; margin: 0; }
.fl-progress { width: 100%; height: 12px; accent-color: var(--accent); }
.fl-status { min-height: 18px; margin: 0; font-size: 13px; color: var(--muted); }
.fl-error { border: 1px solid var(--danger, #e5484d); background: color-mix(in srgb, var(--danger, #e5484d) 12%, var(--panel)); color: var(--text); border-radius: 10px; padding: 8px 12px; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.fl-error b { color: var(--danger, #e5484d); }
.fl-error small { display: block; margin-top: 4px; color: var(--muted); font-size: 11.5px; }
.fl-status[data-error=true] { color: var(--danger); }
.fl-log { max-height: 30vh; overflow: auto; background: var(--wf-bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin: 0; font-family: var(--mono); font-size: 11px; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 480px) {
  .ob-modal, .fl-modal { padding: 0; }
  .ob-sheet, .fl-sheet { width: 100%; height: 100%; max-height: 100%; border: 0; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .ob-scroll, #flDesktop, #flMobile { flex: 1 1 auto; min-height: 0; }   /* full-screen sheet: footer stays at the bottom */
  .ob-nav { width: 100%; }
  .ob-nav .ob-next { margin-left: auto; }
  .fl-log { max-height: 26vh; }
}
