/* Rocket Ground Station v3: muqing.ai homepage look (white / grey / black, one red accent).
   "Field" light theme for sunlight at the launch site, "Night" dark theme. */

:root {
  color-scheme: light;
  --page: #f5f5f7;
  --card: #ffffff;
  --inset: #f5f5f7;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --line: #d2d2d7;
  --hair: rgba(0, 0, 0, .08);
  --grid: #ececf0;
  --axis: #c7c7cc;
  --bar-bg: rgba(245, 245, 247, .82);
  --accent: #d4331c;
  --accent-hover: #b52a15;
  --accent-soft: rgba(212, 51, 28, .10);
  --on-accent: #ffffff;
  --series: #2a78d6;
  --series-wash: rgba(42, 120, 214, .10);
  --good: #0ca30c;
  --good-ink: #006300;
  --warning: #fab219;
  --warning-ink: #8a5a00;
  --critical: #d03b3b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .04);
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #000000;
    --card: #1c1c1e;
    --inset: #2c2c2e;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #8e8e93;
    --line: #38383a;
    --hair: rgba(255, 255, 255, .10);
    --grid: #2c2c2e;
    --axis: #48484a;
    --bar-bg: rgba(0, 0, 0, .78);
    --accent: #ff6a50;
    --accent-hover: #ff8a75;
    --accent-soft: rgba(255, 106, 80, .14);
    --on-accent: #000000;
    --series: #3987e5;
    --series-wash: rgba(57, 135, 229, .16);
    --good-ink: #30d158;
    --warning-ink: #fab219;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #000000;
  --card: #1c1c1e;
  --inset: #2c2c2e;
  --ink: #f5f5f7;
  --ink-2: #a1a1a6;
  --ink-3: #8e8e93;
  --line: #38383a;
  --hair: rgba(255, 255, 255, .10);
  --grid: #2c2c2e;
  --axis: #48484a;
  --bar-bg: rgba(0, 0, 0, .78);
  --accent: #ff6a50;
  --accent-hover: #ff8a75;
  --accent-soft: rgba(255, 106, 80, .14);
  --on-accent: #000000;
  --series: #3987e5;
  --series-wash: rgba(57, 135, 229, .16);
  --good-ink: #30d158;
  --warning-ink: #fab219;
  --shadow: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.45 var(--font);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
ol { margin: 0; padding: 0; list-style: none; }
code { font-family: var(--mono); font-size: .86em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.app { max-width: 1440px; margin: 0 auto; padding: 0 20px 28px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:disabled { opacity: .4; cursor: default; }
.btn-fill { background: var(--accent); color: var(--on-accent); }
.btn-fill:hover:not(:disabled) { background: var(--accent-hover); }
.btn-line { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-line:hover:not(:disabled) { background: var(--inset); }
.btn-danger { color: var(--critical); }
.btn-small { min-height: 30px; padding: 0 12px; font-size: 13px; }
.btn[data-active="true"] { border-color: var(--ink); }

.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; cursor: pointer;
}
.icon-btn:hover { background: var(--inset); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* The site-wide light / dark moon (assets/theme/theme-kit.js), dressed like the globe chip next to it. */
.bar-theme { display: inline-flex; }
:root[data-theme] { --st-size: 36px; --st-icon: 18px; --st-bg: var(--card); --st-fg: var(--ink); --st-hover: var(--inset); --st-ring: var(--accent); }
.bar-theme .st-btn { border: 1px solid var(--line); }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  margin: 0 -20px 14px; padding: 12px 20px;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hair);
}
.bar-title { min-width: 0; margin-right: auto; }
.bar-title h1 { font: 600 19px/1.2 var(--font-display); letter-spacing: -.02em; }
.bar-title p { font-size: 12px; color: var(--ink-2); }
.bar-actions { display: flex; align-items: center; gap: 8px; }
.home-logo { display: grid; place-items: center; flex: none; height: 36px; padding: 0 2px; border-radius: 8px; }
.home-logo img { display: block; width: 30px; height: auto; }
.bar-break { display: none; }

.link-pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px;
  border-radius: 999px; background: var(--card); border: 1px solid var(--hair);
  font-size: 13px; white-space: nowrap;
}
.link-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--axis); flex: none; }
.link-pill[data-state="live"] .dot { background: var(--good); box-shadow: 0 0 0 3px rgba(12, 163, 12, .18); }
.link-pill[data-state="demo"] .dot { background: var(--series); }
.link-pill[data-state="stale"] .dot { background: var(--warning); }
.link-pill[data-state="wait"] .dot { background: var(--warning); animation: blink 1.2s ease-in-out infinite; }
.link-word { font-weight: 600; }
.link-meta { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.link-stop { border: 0; background: var(--inset); border-radius: 999px; padding: 2px 10px; font-size: 12px; cursor: pointer; }

.btn-rec { background: var(--card); border-color: var(--line); }
.btn-rec .rec-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--accent); }
.btn-rec[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-rec[aria-pressed="true"] .rec-dot { background: var(--accent); animation: blink 1.6s ease-in-out infinite; }
.rec-count { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.btn-rec[aria-pressed="true"] .rec-count { color: inherit; }

@keyframes blink { 50% { opacity: .35; } }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--hair); }
.card h2 { font: 600 15px/1.3 var(--font-display); margin-bottom: 12px; }

.notice {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 10px 14px 10px 18px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--hair); font-size: 14px;
}
.notice strong { font-weight: 600; }
#restoreDetail { color: var(--ink-2); }

/* ---------- phase strip ---------- */
.phase { display: flex; align-items: center; gap: 32px; padding: 18px 24px; margin-bottom: 14px; }
.clock { display: grid; gap: 2px; min-width: 190px; }
.clock-label { font-size: 12px; color: var(--ink-2); }
.clock-value { font: 600 34px/1.05 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.clock-phase { font-size: 14px; font-weight: 600; color: var(--accent); }
.clock-phase[data-phase="standby"] { color: var(--ink-2); }

.steps { flex: 1; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.steps li { position: relative; display: grid; justify-items: center; gap: 5px; text-align: center; padding-top: 2px; }
.steps li::before {
  content: ""; position: absolute; top: 8px; left: -50%; right: 50%; height: 2px; background: var(--grid);
}
.steps li:first-child::before { display: none; }
.steps li[data-reached="true"]::before { background: var(--ink); }
.step-dot {
  position: relative; z-index: 1; width: 14px; height: 14px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--axis);
}
.steps li[data-reached="true"] .step-dot { background: var(--ink); border-color: var(--ink); }
.steps li[data-current="true"] .step-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.step-name { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.steps li[data-reached="true"] .step-name { color: var(--ink); }
.step-time { min-height: 1.3em; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.main { display: grid; gap: 14px; min-width: 0; }
.side { display: grid; gap: 14px; }

/* ---------- readouts ---------- */
.readouts { display: grid; grid-template-columns: 1.45fr 1fr 1fr 1fr; gap: 14px; }
.readouts[data-temp="true"] { grid-template-columns: 1.45fr 1fr 1fr 1fr 1fr; }
.readout { display: grid; align-content: start; gap: 4px; padding: 16px 18px; min-width: 0; }
.readout-label { font-size: 13px; color: var(--ink-2); }
.readout-value { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.readout-value b { font: 600 30px/1.1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-value i { font-style: normal; font-size: 14px; color: var(--ink-2); }
.readout--hero .readout-value b { font-size: 52px; }
.readout--hero .readout-value i { font-size: 18px; }
.readout-sub { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.readout-sub span:last-child { color: var(--ink-2); }

.tilt-rocket { width: 26px; height: 26px; margin-left: auto; align-self: center; fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linejoin: round; transition: transform .2s ease; }
.grade { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; font-weight: 600; color: var(--ink-2); }
.grade-icon { width: 10px; height: 10px; border-radius: 50%; background: var(--axis); }
.grade[data-grade="good"] { color: var(--good-ink); }
.grade[data-grade="good"] .grade-icon { background: var(--good); }
.grade[data-grade="warning"] { color: var(--warning-ink); }
.grade[data-grade="warning"] .grade-icon { background: var(--warning); border-radius: 2px; transform: rotate(45deg) scale(.85); }
.grade[data-grade="critical"] { color: var(--critical); }
.grade[data-grade="critical"] .grade-icon { background: var(--critical); border-radius: 1px; }

/* ---------- charts ---------- */
.charts { position: relative; padding: 14px 18px 12px; }
.charts-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.seg { display: inline-flex; padding: 2px; border-radius: 999px; background: var(--inset); }
.seg button { border: 0; background: none; padding: 5px 13px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.charts-key { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); }
.key-dash { width: 18px; height: 0; border-top: 2px dashed var(--series); opacity: .7; }

.chart { margin: 0; min-width: 0; }
.chart figcaption { display: flex; align-items: baseline; gap: 5px; padding: 8px 0 2px; font-size: 13px; font-weight: 600; }
.chart figcaption em { font-style: normal; font-weight: 400; color: var(--ink-3); }
.plot { position: relative; height: 150px; }
.chart--main .plot { height: 300px; }
.plot canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
.plot canvas:focus-visible { outline-offset: -2px; }
.chart-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.axis-caption { margin-top: 2px; text-align: center; font-size: 12px; color: var(--ink-3); }

/* Shown over the blank chart until the first frame arrives; the empty grid stays visible around it. */
.empty {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: grid; justify-items: center; gap: 6px; width: min(440px, calc(100% - 32px));
  padding: 16px 18px; text-align: center; border-radius: 14px; border: 1px solid var(--hair);
  background: color-mix(in srgb, var(--card) 90%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .08);
}
.empty-title { font: 600 19px/1.25 var(--font-display); }
.empty-text { max-width: 420px; font-size: 14px; color: var(--ink-2); }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

.tooltip {
  position: absolute; z-index: 5; min-width: 170px; padding: 9px 12px; pointer-events: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .14); font-size: 12px;
}
.tooltip-head { margin-bottom: 4px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tooltip-row { display: flex; justify-content: space-between; gap: 14px; line-height: 1.6; }
.tooltip-row span { color: var(--ink-2); }
.tooltip-row strong { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- side cards ---------- */
.events, .link, .attitude { padding: 16px 18px; }

/* Direction card: tilt dial + compass. Status tints mark the 5° and 15° limits; the grade
   chip below carries the same meaning with an icon and a word. */
.attitude-dials { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; align-items: end; }
.attitude figure { margin: 0; display: grid; justify-items: center; gap: 2px; }
.attitude figcaption { font-size: 12px; color: var(--ink-3); }
.dial-svg, .compass-svg { width: 100%; height: auto; display: block; overflow: visible; }
.zone--good { fill: rgba(12, 163, 12, .14); }
.zone--warning { fill: rgba(250, 178, 25, .16); }
.zone--critical { fill: rgba(208, 59, 59, .06); }
.ring { fill: none; stroke: var(--grid); stroke-width: 1; }
.ring--edge { stroke: var(--axis); stroke-width: 1.5; }
.cross { stroke: var(--grid); stroke-width: 1; }
.ring-label { font: 9px var(--font); fill: var(--ink-3); }
.axis-label { font: 600 10px var(--font); fill: var(--ink-3); text-anchor: middle; }
.trail { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; opacity: .35; }
.vector { stroke: var(--series); stroke-width: 2; stroke-linecap: round; }
.center { fill: var(--ink-3); }
.dot { fill: var(--series); stroke: var(--card); stroke-width: 2.5; }
.tick { stroke: var(--axis); stroke-width: 1.5; }
.tick--major { stroke: var(--ink-2); stroke-width: 2; }
.rose-letter { font: 600 15px var(--font); fill: var(--ink-2); text-anchor: middle; }
.rose-letter--n { fill: var(--accent); }
.pointer { fill: var(--accent); }
.compass-value { font: 600 22px var(--font-display); fill: var(--ink); text-anchor: middle; font-variant-numeric: tabular-nums; }
.compass[data-off="true"] .rose { opacity: .35; }
.compass[data-off="true"] .pointer { fill: var(--axis); }
.att-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; margin: 14px 0 0; }
.att-values dt { font-size: 12px; color: var(--ink-2); }
.att-values dd { margin: 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.att-values .att-tilt { grid-column: 1 / -1; }
.att-values .att-tilt dd { display: flex; align-items: center; gap: 10px; }
.att-values .grade { font-size: 13px; }
.att-note { margin-top: 8px; font-size: 12px; }
.timeline li { position: relative; display: grid; grid-template-columns: 16px 1fr; gap: 12px; padding-bottom: 14px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--grid); }
.timeline li:last-child::before { display: none; }
.timeline .node { width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--axis); background: var(--card); }
.timeline li[data-fired="true"] .node { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline strong { font-size: 14px; font-weight: 600; }
.timeline code { display: block; margin-top: 1px; font-size: 11px; color: var(--ink-3); }
.ev-status { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.timeline li[data-fired="true"] .ev-word { color: var(--ink); font-weight: 500; }

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
.kv div { min-width: 0; }
.kv dt { font-size: 12px; color: var(--ink-2); }
.kv dd { margin: 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kv dd[data-warn="true"] { color: var(--warning-ink); }

/* ---------- drawer ---------- */
.drawer { margin-top: 14px; padding: 10px; }
.drawer-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.drawer-tabs button {
  border: 0; background: none; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
}
.drawer-tabs button:hover { background: var(--inset); color: var(--ink); }
.drawer-tabs button[aria-expanded="true"] { background: var(--ink); color: var(--card); }
.tab-count { font-variant-numeric: tabular-nums; opacity: .7; }
.drawer-panel { padding: 12px 8px 6px; }

.monitor {
  height: 280px; overflow: auto; padding: 10px 12px; border-radius: 12px; background: var(--inset);
  font: 12px/1.6 var(--mono);
}
.log-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.log-time { color: var(--ink-3); }
.log-data { color: var(--ink-2); }
.log-event { color: var(--accent); font-weight: 600; }
.log-error { color: var(--critical); }
.log-system { color: var(--ink); }

.table-wrap { max-height: 340px; overflow: auto; border-radius: 12px; border: 1px solid var(--hair); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table caption { caption-side: top; text-align: left; padding: 8px 12px; font-size: 12px; color: var(--ink-3); }
.data-table th { position: sticky; top: 0; background: var(--card); text-align: right; font-weight: 600; font-size: 12px; color: var(--ink-2); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { text-align: right; padding: 6px 12px; border-bottom: 1px solid var(--hair); font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.fields th, .fields td { text-align: left; white-space: normal; }

.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.file-input { display: none; }
.note { margin-top: 10px; max-width: 760px; font-size: 13px; color: var(--ink-2); }

.protocol { display: grid; gap: 8px; margin: 0 0 12px; }
.protocol div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
.protocol dt { font-size: 13px; color: var(--ink-2); }
.protocol dd { margin: 0; font-size: 14px; }
.protocol code { padding: 1px 6px; border-radius: 6px; background: var(--inset); white-space: nowrap; line-height: 1.9; }

.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 4px 0; font-size: 12px; color: var(--ink-3); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: grid; gap: 8px; justify-items: end; }
.toast {
  max-width: 360px; padding: 10px 14px; border-radius: 12px; background: var(--ink); color: var(--card);
  font-size: 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, .2); transition: opacity .2s ease, transform .2s ease;
}
.toast[data-type="event"] { background: var(--accent); color: var(--on-accent); }
.toast[data-type="error"] { background: var(--critical); color: #fff; }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .side { grid-template-columns: 1fr 1fr; }
  .bar-title p { display: none; }
  .btn-rec #recLabel { display: none; }
  .btn-rec { padding: 0 12px; }
}

@media (max-width: 900px) {
  .link-meta { display: none; }
}

@media (max-width: 860px) {
  .readouts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .readouts[data-temp="true"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout--hero { grid-column: 1 / -1; }
  .chart-row { grid-template-columns: 1fr; gap: 0; }
  .plot { height: 130px; }
  .phase { flex-direction: column; align-items: stretch; gap: 16px; }
  .clock { grid-template-columns: auto 1fr; align-items: baseline; column-gap: 12px; }
  .clock-label { grid-column: 1 / -1; }
  .clock-phase { justify-self: end; }
}

@media (max-width: 720px) {
  .app { padding: 0 16px 24px; }
  /* Phone: two rows (logo, title, theme, language / link, record, connect), not sticky. */
  .bar { position: static; flex-wrap: wrap; gap: 8px; margin: 0 -16px 12px; padding: 10px 16px; }
  .bar-actions { display: contents; }
  .home-logo { order: 1; }
  .bar-title { order: 2; flex: 1 1 0; }
  .bar-title h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .empty { gap: 4px; padding: 10px 12px; }
  .empty-title { font-size: 16px; }
  .empty-text { display: none; }
  .empty-actions { margin-top: 2px; }
  .empty-actions .btn { min-height: 30px; padding: 0 12px; font-size: 13px; }
  .bar-theme { order: 3; }
  .bar-actions .lang-kit { order: 4; }
  .bar-break { display: block; order: 5; flex-basis: 100%; height: 0; }
  .link-pill { order: 6; flex: 1 1 0; min-width: 0; overflow: hidden; }
  .btn-rec { order: 7; }
  #connectBtn { order: 8; }
  .side { grid-template-columns: 1fr; }
  /* Phone: numbers, then the direction card, then the charts. */
  .main, .side { display: contents; }
  .readouts { order: 1; }
  .attitude { order: 2; }
  .charts { order: 3; }
  .events { order: 4; }
  .link { order: 5; }
  .readout { padding: 12px 14px; }
  .readout-value b { font-size: 22px; }
  .readout-value i { font-size: 12px; }
  .readout--hero .readout-value b { font-size: 44px; }
  .tilt-rocket { display: none; }
  .chart--main .plot { height: 220px; }
  .charts { padding: 12px 12px 10px; }
  .charts-key { display: none; }
  .phase { padding: 14px 16px; }
  .clock-value { font-size: 28px; }
  .step-name { font-size: 11px; }
  .step-time { font-size: 10px; }
  .protocol div { grid-template-columns: 1fr; gap: 0; }
  .foot { flex-direction: column; gap: 4px; }
}

@media (max-width: 400px) {
  .bar-actions .btn-fill { padding: 0 12px; }
  .readouts { gap: 10px; }
  .readout-value b { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
