/* RangeLock Ballistics — styles. Dark is the default look. */

:root {
  --bg: #0c0d0b;
  --panel: #151812;
  --panel-2: #1d211a;
  --line: #2b3125;
  --text: #f1ede3;
  --muted: #a5aa9d;
  --olive: #7f9a58;
  --green: #17211a;
  --green-line: #34472f;
  --accent: #92a662;   /* sage green, from the new mark */
  --accent-ink: #11160a;
  --danger: #d9705a;
  --ok: #93b96e;
  --display: "Bahnschrift", "DIN Alternate", "Barlow Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --tab-h: 64px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #efeadd;
  --panel: #f8f5ec;
  --panel-2: #ebe6d6;
  --line: #d4ccb8;
  --text: #1b1d18;
  --muted: #5d6256;
  --olive: #4d6a2c;
  --green: #e0e7d2;
  --green-line: #b3c39a;
  --accent: #5c6e35;   /* deepened for contrast on cream */
  --accent-ink: #fbfbf4;
  --danger: #b03b25;
  --ok: #3f6b1f;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 var(--body);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
body.sheet-open { overflow: hidden; }
h1, h2, h3 { margin: 0; font-family: var(--display); letter-spacing: .02em; }
h1 { font-size: 30px; }
h2 { font-size: 20px; }
h3 { font-size: 15px; margin: 22px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; display: flex; justify-content: space-between; align-items: baseline; }
.h3-note { font: 12px var(--body); text-transform: none; letter-spacing: 0; }
p { margin: 0 0 8px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.fine { font-size: 12px; color: var(--muted); margin-top: 14px; }

.main { max-width: 640px; margin: 0 auto; padding: 0 14px calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px); }
.view { display: flex; flex-direction: column; gap: 10px; }
.view.dope { max-width: 720px; }

/* ── buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-weight: 600; transition: transform .06s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; }
.btn-ghost-danger { background: transparent; color: var(--danger); }
.btn-small { padding: 0 12px; font-size: 14px; letter-spacing: .04em; }
.btn-block { width: 100%; }
.btn-xl { min-height: 56px; font-size: 18px; letter-spacing: .08em; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; background: transparent; border: 0; border-radius: 10px; color: var(--muted); }
.icon-btn:active { background: var(--panel-2); }
.link-btn { background: none; border: 0; color: var(--accent); min-height: 44px; text-decoration: underline; width: 100%; }

/* ── header / profile bar ────────────────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 0 2px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { height: 34px; width: auto; }
.brand-word { height: 30px; width: auto; }
.field-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; background: transparent; border: 1px solid var(--line); border-radius: 10px; color: var(--accent); font: 700 13px var(--display); letter-spacing: .1em; }
.field-btn svg { width: 20px; height: 20px; }

.profilebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--olive); border-radius: var(--radius); padding: 8px 8px 8px 12px; }
.pb-main { min-width: 0; }
.pb-l1 { font: 700 19px var(--display); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pb-l2 { font-size: 13.5px; color: var(--muted); white-space: normal; }
.badge { display: inline-block; font: 700 10.5px var(--body); letter-spacing: .08em; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); vertical-align: middle; margin-left: 6px; }
.badge-demo { color: var(--accent); border-color: var(--accent); margin-left: 0; }
.badge-active { color: var(--ok); border-color: var(--ok); }

/* ── cards ───────────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.label { font: 700 12px var(--body); letter-spacing: .14em; color: var(--muted); }

/* range */
.range-card { text-align: center; padding-bottom: 8px; }
.range-card:focus-within { border-color: var(--accent); }
.range-input {
  display: block; width: 100%; background: transparent; border: 0; outline: 0; text-align: center;
  color: var(--text); caret-color: var(--accent);
  font: 800 76px/1.05 var(--display); font-variant-numeric: tabular-nums; padding: 0; margin: 2px 0 0;
}
.range-input::placeholder { color: var(--line); opacity: 1; }
.range-unit { font: 700 13px var(--body); letter-spacing: .18em; color: var(--accent); }

/* dial */
.dial-card { background: var(--green); border-color: var(--green-line); text-align: center; padding: 10px 14px 12px; min-height: 178px; display: flex; flex-direction: column; justify-content: center; }
.dial-card .label { text-align: left; color: var(--olive); }
.dial-card[data-state="ok"] .dial-err, .dial-card[data-state="empty"] .dial-ok, .dial-card[data-state="error"] .dial-ok { display: none; }
.dial-main { display: flex; align-items: baseline; justify-content: center; gap: 10px; line-height: 1; }
.dial-num { font: 800 104px/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.dial-unit { font: 700 30px var(--display); color: var(--accent); }
.dial-arrow { font: 700 54px var(--display); color: var(--accent); min-width: 28px; }
.dial-clicks { font: 800 34px/1.15 var(--display); letter-spacing: .04em; margin-top: 2px; }
.dial-sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.dial-msg { font: 700 28px var(--display); color: var(--muted); padding: 20px 0 10px; }
.dial-card[data-state="error"] .dial-msg { font: 600 16px var(--body); color: var(--text); text-align: left; padding: 8px 0; }
.err-line { color: var(--danger); font-weight: 600; margin-bottom: 4px; }
.ok-line { color: var(--ok); font-weight: 700; }
.btn-fix { margin-top: 6px; }

.tick { animation: tick .12s ease-out; }
@keyframes tick { from { opacity: .45; } to { opacity: 1; } }

/* wind */
.wind-card { padding: 10px 12px; }
.wind-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.wind-unit { font: 700 12px var(--body); letter-spacing: .12em; color: var(--accent); }
.wind-speeds { display: grid; grid-template-columns: repeat(4, 1fr) 1.5fr; gap: 6px; }
.wbtn, .wind-custom { min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font: 700 20px var(--display); text-align: center; }
.wbtn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.wind-custom { font: 600 16px var(--body); width: 100%; min-width: 0; }
.wind-custom::placeholder { color: var(--muted); }
.wind-custom:focus { border-color: var(--accent); outline: 0; }
.wind-body { display: flex; gap: 14px; align-items: center; margin-top: 8px; }
.rose { display: grid; grid-template-columns: repeat(3, 46px); grid-auto-rows: 46px; gap: 4px; flex: none; }
.rbtn { border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font: 700 24px/1 var(--body); color: var(--text); padding: 0; }
.rbtn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rbtn-clear { font: 700 11px var(--body); letter-spacing: .08em; color: var(--muted); }
.wind-caption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.wres { flex: 1; min-width: 0; }
.wres[data-state="ok"] .wres-empty, .wres[data-state="needs"] .wres-main, .wres[data-state="needs"] .wres-dir, .wres[data-state="needs"] .wres-clicks,
.wres[data-state="needs"] .wres-sub, .wres[data-state="needs"] .wres-head, .wres[data-state="empty"] .wres-main, .wres[data-state="empty"] .wres-dir,
.wres[data-state="empty"] .wres-clicks, .wres[data-state="empty"] .wres-sub, .wres[data-state="empty"] .wres-head { display: none; }
.wres-head { font: 700 11px var(--body); letter-spacing: .14em; color: var(--muted); }
.wres-main { display: flex; align-items: baseline; gap: 6px; line-height: 1.05; }
.wres-num { font: 800 46px var(--display); font-variant-numeric: tabular-nums; }
.wres-unit { font: 700 18px var(--display); color: var(--accent); }
.wres-dir { font: 800 22px var(--display); letter-spacing: .05em; color: var(--accent); }
.wres-clicks { font: 700 17px var(--display); letter-spacing: .04em; }
.wres-sub { font-size: 12px; color: var(--muted); }
.wres-empty { font: 600 16px var(--body); color: var(--muted); }

/* secondary stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px 2px 0; }
.stats.dim { opacity: .5; }
.stat-l { font: 700 10.5px var(--body); letter-spacing: .1em; color: var(--muted); }
.stat-v { font: 700 22px var(--display); font-variant-numeric: tabular-nums; }
.stat-u { font: 600 11px var(--body); color: var(--muted); }
.notes { display: flex; flex-direction: column; gap: 6px; }
.note { font-size: 13px; color: var(--text); background: var(--panel); border-left: 3px solid var(--accent); border-radius: 8px; padding: 8px 10px; }
.note-warn { border-left-color: var(--danger); }
.condstrip { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 4px; border-top: 1px solid var(--line); }
.cond-text { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.cond-custom { color: var(--accent); font-weight: 600; }
.chip-flag { font: 700 10.5px var(--body); letter-spacing: .08em; border: 1px solid var(--accent); color: var(--accent); border-radius: 6px; padding: 2px 6px; }

/* ── tab bar ─────────────────────────────────────────────── */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; display: flex; justify-content: center;
  background: var(--panel); border-top: 1px solid var(--line); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.tabbar { display: grid; grid-template-columns: repeat(4, 1fr); justify-content: center; }
.tab { height: var(--tab-h); background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); }
.tab-label { font: 700 11px var(--body); letter-spacing: .1em; }
.tab[aria-current="page"] { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }
@media (min-width: 700px) { .tabbar { grid-template-columns: repeat(4, 160px); } }

/* ── pages ───────────────────────────────────────────────── */
.page-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 4px; }
.page-actions { display: flex; gap: 2px; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.rifle-list { display: flex; flex-direction: column; gap: 10px; }
.rifle-card.active { border-color: var(--olive); }
.rc-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.rc-top h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.rc-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0; font: 600 15px var(--display); }
.rc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* pick sheet */
.pick-list { display: flex; flex-direction: column; gap: 12px; }
.pick-rifle { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: var(--panel); }
.pick-rifle.active { border-color: var(--olive); }
.pick-name { font: 700 18px var(--display); padding: 4px 6px 6px; }
.pick-load { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 48px; text-align: left; padding: 0 10px; background: transparent; border: 0; border-radius: 8px; }
.pick-load.on { background: var(--green); box-shadow: inset 3px 0 0 var(--accent); font-weight: 700; }

/* ── forms ───────────────────────────────────────────────── */
.editor, .adv, .onboard { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field-row { display: flex; align-items: center; gap: 8px; }
.field input[type="text"], .field select {
  width: 100%; min-height: 48px; padding: 0 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; font-size: 17px;
}
.field input:focus { border-color: var(--accent); outline: 0; }
.field-unit { color: var(--muted); font-size: 14px; white-space: nowrap; min-width: 24px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field-error { color: var(--danger); font-size: 13px; font-weight: 600; }
.field-error:empty { display: none; }
.has-error input { border-color: var(--danger) !important; }
.segmented { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.seg-btn { flex: 1; min-height: 44px; background: transparent; border: 0; font-weight: 600; padding: 0 8px; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 22px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 600; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.switch-text { display: flex; flex-direction: column; }
.switch-label { font-weight: 600; }
.switch-input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-ui { flex: none; width: 50px; height: 30px; border-radius: 15px; background: var(--panel-2); border: 1px solid var(--line); position: relative; transition: background .12s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .12s, background .12s; }
.switch-input:checked + .switch-ui { background: var(--accent); border-color: var(--accent); }
.switch-input:checked + .switch-ui::after { transform: translateX(20px); background: var(--accent-ink); }
.switch-input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.adv-details, .options { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; }
.adv-details[open], .options[open] { padding-bottom: 12px; }
.adv-details summary, .options summary { min-height: 48px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.adv-details > * + *, .options > * + * { margin-top: 10px; }
.section-card h2, .card > h2 { margin-bottom: 10px; }
.settings .card > .field { margin-bottom: 14px; }
.readout { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.readout > div { display: flex; flex-direction: column; font-size: 13px; }
.readout b { font: 700 20px var(--display); }
.unavail-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.unavail-row p { margin: 2px 0 0; }
.load-row { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 2px 2px 2px 4px; margin-bottom: 8px; background: var(--panel); }
.load-row.on { border-color: var(--olive); }
.load-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 52px; background: none; border: 0; text-align: left; }
.load-text { display: flex; flex-direction: column; min-width: 0; }
.radio { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted); }
.load-row.on .radio { border-color: var(--accent); background: radial-gradient(var(--accent) 45%, transparent 50%); }

/* ── sheets ──────────────────────────────────────────────── */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0); display: flex; align-items: flex-end; justify-content: center; transition: background .16s; }
.sheet-backdrop.in { background: rgba(0,0,0,.62); }
.sheet { width: 100%; max-width: 640px; background: var(--bg); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; max-height: 94dvh; transform: translateY(24px); opacity: 0; transition: transform .16s ease-out, opacity .16s; }
.sheet-full { height: 94dvh; }
.sheet-backdrop.in .sheet { transform: none; opacity: 1; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 6px 18px; }
.sheet-sub { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.sheet-body { flex: 1; overflow-y: auto; padding: 8px 18px 20px; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; gap: 10px; padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.sheet-foot .btn { flex: 1; }
.confirm-msg { font-size: 16px; }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 18px; border-bottom: 1px solid var(--line); } .sheet-full { height: min(860px, 92dvh); } }

/* ── onboarding ──────────────────────────────────────────── */
.onboard { max-width: 520px; margin: 0 auto; padding: 24px 16px calc(32px + env(safe-area-inset-bottom)); }
.ob-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 4px; }
.ob-mark { width: min(78%, 300px); height: auto; }
.ob-word { width: min(78%, 300px); height: auto; }
.tagline { font: 600 13px var(--body); letter-spacing: .3em; color: var(--muted); text-transform: uppercase; margin: 6px 0 0; }
.onboard h1 { margin-top: 10px; }

/* ── field mode ──────────────────────────────────────────── */
.field-mode { position: fixed; inset: 0; z-index: 300; background: #000; color: #fff; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 14px) calc(env(safe-area-inset-bottom) + 14px) calc(env(safe-area-inset-left) + 14px); }
:root[data-theme="light"] .field-mode { background: #f6f2e6; color: #111; }
.field-top { display: flex; justify-content: space-between; gap: 10px; }
.field-mode .card { background: transparent; border: 0; padding: 4px 0; }
.field-mode .range-input { font-size: clamp(90px, 30vw, 170px); color: inherit; }
.field-mode .dial-card { min-height: 0; background: transparent; }
.field-mode .dial-num { font-size: clamp(96px, 32vw, 190px); }
.field-mode .dial-unit { font-size: clamp(28px, 8vw, 48px); }
.field-mode .dial-arrow { font-size: clamp(56px, 18vw, 110px); }
.field-mode .dial-clicks { font-size: clamp(38px, 12vw, 68px); }
.field-mode .dial-sub { font-size: 15px; }
.field-mode .field-wind { border-top: 1px solid var(--line); border-radius: 0; padding-top: 10px; }
.field-mode .wres-num { font-size: clamp(60px, 18vw, 110px); }
.field-mode .wres-unit { font-size: 26px; }
.field-mode .wres-dir { font-size: clamp(30px, 9vw, 52px); }
.field-mode .wres-clicks { font-size: clamp(26px, 8vw, 44px); }
.field-mode .wres-empty { font-size: 24px; }
.field-mode .wres-sub { font-size: 14px; }
.field-mode .wres-head { font-size: 12px; }
.field-mode .dial-card[data-state="error"] .dial-msg, .field-mode .dial-msg { color: #fff; }
.field-drawer { display: none; }
.field-drawer.open { display: block; }
.field-drawer .wind-card { background: var(--panel); border: 1px solid var(--line); padding: 10px 12px; }

/* ── dope ────────────────────────────────────────────────── */
.dope-summary { padding: 0 2px; font-size: 18px; }
.dope-table-wrap { display: flex; flex-direction: column; gap: 8px; }
.dope-table { width: 100%; border-collapse: collapse; font: 700 24px var(--display); font-variant-numeric: tabular-nums; }
.dope-table[data-cols="5"], .dope-table[data-cols="6"] { font-size: 20px; }
.dope-table[data-cols="7"], .dope-table[data-cols="8"] { font-size: 16px; }
.dope-table th, .dope-table td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.dope-table thead th { position: sticky; top: env(safe-area-inset-top); background: var(--bg); font: 700 11px var(--body); letter-spacing: .08em; color: var(--muted); border-bottom: 2px solid var(--line); z-index: 1; }
.dope-table .c-range { text-align: left; color: var(--accent); }
.dope-table tr.major td, .dope-table tr.major th { border-bottom-color: var(--muted); }
.dope-table tr.zero td, .dope-table tr.zero th { background: var(--green); }
.dope-table tr.zero th { box-shadow: inset 3px 0 0 var(--olive); }
.err-card { display: flex; flex-direction: column; gap: 8px; }
.perf h2 { margin-bottom: 4px; }
.perf .field { margin-top: 10px; }
.perf-out { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.perf-row { border-top: 1px solid var(--line); padding-top: 8px; }
.perf-thr, .perf-rng { font: 700 26px var(--display); }
.perf-rng { color: var(--accent); }
.col-chips { margin: 4px 0; }

/* ── self test / toast ───────────────────────────────────── */
.test { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.test b { flex: none; width: 42px; font-size: 12px; letter-spacing: .06em; }
.test.pass b { color: var(--ok); } .test.fail b { color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px); transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; z-index: 500; display: flex; gap: 14px; align-items: center; transition: opacity .15s, transform .15s; max-width: 92vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-action { background: none; border: 0; color: var(--accent); font-weight: 700; min-height: 36px; }
.boot-error { white-space: pre-wrap; color: var(--danger); padding: 20px; }

/* the logo art is drawn for dark backgrounds — give it a dark plate in the light theme */
:root[data-theme="light"] .brand, :root[data-theme="light"] .ob-logo { background: #0c0d0b; border-radius: 12px; padding: 4px 12px 4px 8px; }
:root[data-theme="light"] .ob-logo { padding: 16px; }

/* small phones */
@media (max-width: 360px) {
  .dial-num { font-size: 88px; } .range-input { font-size: 64px; }
  .rose { grid-template-columns: repeat(3, 42px); grid-auto-rows: 42px; }
  .brand-word { height: 26px; }
}
@media (min-width: 700px) { .dial-num { font-size: 120px; } .range-input { font-size: 88px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
/* range card */
.rc-body { display: flex; flex-direction: column; gap: 12px; }
.rc-preview { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; line-height: 0; }
.rc-preview svg { width: 100%; height: auto; display: block; }
.rc-preview[data-size="page"] { max-width: 340px; margin: 0 auto; }
.rc-preview[data-size="phone"] { max-width: 260px; margin: 0 auto; }
.rc-preview .err-card { line-height: 1.4; }
.rc-info { display: flex; flex-direction: column; gap: 6px; }
.rc-info:empty { display: none; }
.sheet-foot .btn:disabled { opacity: .45; }
#print-card { display: none; }

@media print {
  html.printing-card body > *:not(#print-card) { display: none !important; }
  html.printing-card body { background: #fff; padding: 0; }
  html.printing-card #print-card { display: block; line-height: 0; }
  html.printing-card #print-card svg { display: block; }
  body { background: #fff; color: #000; padding: 0; }
  .tabbar, .options, .perf, .page-actions, .toast, .note { display: none !important; }
  .view[data-view]:not([data-view="dope"]) { display: none !important; }
  .dope-table { color: #000; } .dope-table thead th { background: #fff; color: #000; position: static; }
  .dope-table .c-range { color: #000; } .dope-table tr.zero td, .dope-table tr.zero th { background: #ddd; box-shadow: none; }
}

/* ── range card ──────────────────────────────────────────── */
.mode-seg { margin: 4px 0 2px; }
.mode-seg .field-label, .mode-seg > label:empty { display: none; }
.rc-view { display: flex; flex-direction: column; gap: 10px; }
.rc-actions { display: flex; gap: 8px; } .rc-actions .btn { flex: 1; }
.rc-preview { display: flex; justify-content: center; padding: 4px 0; }
/* The card is always "paper": dark ink on warm white, whatever the app theme. Sizes scale with the card's width. */
.rc-card { container-type: inline-size; width: min(100%, 360px); background: #f7f4ea; color: #141410; border-radius: 8px; padding: 6cqw 6cqw 5cqw;
  font-family: var(--body); box-shadow: 0 2px 14px rgba(0,0,0,.35); }
.rc-brand { display: flex; justify-content: space-between; font: 700 3cqw var(--body); letter-spacing: .1em; color: #5c6e35; }
.rc-brand span:last-child { letter-spacing: 0; font-weight: 500; color: #5c5f52; }
.rc-title { font: 800 8.6cqw/1.05 var(--display); margin: 3cqw 0 0; color: #141410; letter-spacing: 0; }
.rc-sub { font-size: 3.7cqw; color: #5c5f52; margin-top: 1cqw; }
.rc-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.4cqw 3cqw; margin: 4cqw 0 3cqw; }
.rc-meta div { min-width: 0; }
.rc-meta dt { font: 700 2.5cqw var(--body); letter-spacing: .08em; color: #5c5f52; }
.rc-meta dd { margin: 0; font: 700 4.1cqw var(--display); overflow-wrap: anywhere; }
.rc-table { width: 100%; border-collapse: collapse; font: 800 4.9cqw var(--display); font-variant-numeric: tabular-nums; }
.rc-table[data-cols="6"] { font-size: 4.3cqw; }
.rc-table[data-cols="7"], .rc-table[data-cols="8"] { font-size: 3.7cqw; }
.rc-table th, .rc-table td { text-align: right; padding: 1.5cqw 1cqw; border-bottom: 1px solid #cfcabb; }
.rc-table thead th { font: 700 2.5cqw var(--body); letter-spacing: .04em; color: #5c5f52; border-bottom: 2px solid #141410; vertical-align: bottom; }
.rc-table .first { text-align: left; color: #5c6e35; }
.rc-table tr.major th, .rc-table tr.major td { border-bottom-color: #5c5f52; }
.rc-table tr.zero th, .rc-table tr.zero td { background: #e8e1cd; }
.rc-table tr.zero th { box-shadow: inset 1.2cqw 0 0 #5c6e35; padding-left: 2.4cqw; }
.rc-notes { margin: 3cqw 0 0; padding: 0; list-style: none; font-size: 2.7cqw; line-height: 1.35; color: #5c5f52; }
.rc-notes li { margin-bottom: .6cqw; }
.rc-print-root { display: none; }
@media print {
  body.printing-card > *:not(.rc-print-root) { display: none !important; }
  body.printing-card .rc-print-root { display: block !important; }
  body.printing-card { background: #fff; }
  .rc-print-root .rc-card { box-shadow: none; border-radius: 0; background: #fff; margin: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── elevation "Use Current" ─────────────────────────────── */
.use-current-btn { flex: none; white-space: nowrap; }
.use-current-msg:empty { display: none; }
.use-current-msg.field-error-text { color: var(--danger); }

/* Elevation's field-row needs input + unit + a button; give it its own line
   and let the row wrap on narrow phones rather than clipping the button. */
.field:has(.use-current-btn) .field-row { flex-wrap: wrap; }
.field:has(.use-current-btn) .field-row input { min-width: 0; flex: 1 1 90px; }

/* ── standalone legal pages (privacy, etc.) ─────────────────*/
.legal { padding-top: 4px; padding-bottom: 48px; }
.legal .topbar { padding-bottom: 6px; }
.legal h1 { margin-top: 6px; }
.legal section.card { margin-bottom: 14px; }
.legal section.card h2 { margin: 0 0 8px; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 18px; }
.legal p { line-height: 1.55; }
.legal p:last-child { margin-bottom: 0; }
.legal a { color: var(--accent); }
