:root {
  color-scheme: dark;
  --bg: #0b1421;
  --sidebar: #0e1928;
  --card: #121f30;
  --surface: #17263a;
  --border: #283b50;
  --text: #edf4f8;
  --muted: #a1b3c6;
  --cyan: #6de2f0;
  --mint: #94efbc;
  --warning: #f4d298;
  --danger: #ffb5ac;
  --radius: 18px;
  --radius-sm: 16px;
  --sidebar-width: 224px;
  --bottom-nav-height: 68px;
  --font: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
}

.practice-app .practice-task-nav { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.practice-tabs { display: none; }
@media (max-width: 899px) {
  .practice-app .bottom-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .practice-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 12px 0; }
  .practice-tabs a { display: grid; place-items: center; min-height: 44px; padding: 8px 4px; color: var(--muted); border-radius: 10px; text-decoration: none; }
  .practice-tabs a[aria-current="page"] { color: var(--cyan); background: var(--surface); }
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 0; background: var(--bg); scroll-padding-top: 24px; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.7 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }
::selection { color: var(--bg); background: var(--cyan); }
a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: 4px; }
button, input, select, textarea { font: inherit; font-variant-numeric: tabular-nums; }
button, select { touch-action: manipulation; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:enabled, select:enabled, summary, a[href] { cursor: pointer; }
input, select, textarea { max-width: 100%; }
img, svg { max-width: 100%; }
svg { flex: 0 0 auto; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.4; font-weight: 600; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p + p { margin-top: 10px; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 4px;
}
:where(button, input, select, textarea):disabled { cursor: not-allowed; opacity: .55; }
.muted, small { color: var(--muted); }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
small { font-size: 12px; }
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: 10px;
  color: var(--bg);
  background: var(--cyan);
  transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: 30px 18px 24px;
  overflow-y: auto;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-mark { color: var(--cyan); }
.brand-copy { display: grid; gap: 2px; min-width: 0; }
.brand-copy strong { font-size: 17px; font-weight: 600; letter-spacing: .04em; }
.brand-copy > span { font-size: 12px; color: var(--muted); }
.sidebar-nav { display: grid; gap: 8px; margin-top: 42px; }
.sidebar-nav a, .sidebar-aux a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
}
:where(.sidebar-nav, .sidebar-aux, .bottom-nav, .workspace-tools) svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
:where(.sidebar-nav, .bottom-nav) a:is([aria-current="page"], .active) {
  color: var(--cyan);
  border-color: var(--border);
  background: var(--surface);
}
.sidebar-aux { display: grid; gap: 2px; margin-top: auto; padding-top: 40px; }
.sidebar-aux a { min-height: 44px; padding-inline: 12px; font-size: 13px; }
.sidebar-footer { margin: 18px 10px 0; padding-top: 18px; border-top: 1px solid var(--border); }
.sidebar-footer p { color: var(--muted); font-size: 11px; line-height: 1.8; }
.sidebar-footer p + p { margin-top: 2px; }
.bottom-nav { display: none; }

.workspace { min-width: 0; margin-left: var(--sidebar-width); padding: 0 36px 48px; }
.workspace-inner { width: 100%; max-width: 1160px; margin-inline: auto; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
  min-height: 90px;
  padding-block: 18px;
  border-bottom: 1px solid var(--border);
}
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.breadcrumb-parent, .breadcrumb-separator { color: var(--muted); font-size: 12px; }
#breadcrumb { font-size: 13px; }
.workspace-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-width: 0; }
.mode-control { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mode-control label { color: var(--muted); font-size: 12px; }
.mode-control .select { width: auto; min-width: 116px; min-height: 38px; padding-block: 6px; font-size: 13px; }
.mode-notice { margin-block: 18px 28px; font-size: 12px; }
#appContent { min-width: 0; }
#appContent > * + * { margin-top: 24px; }
#appContent:focus:not(:focus-visible) { outline: none; }
#globalError, .login-panel { margin-block: 20px; }
.login-panel > p { margin-top: 8px; }
.login-panel > .button { margin-top: 20px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 20px; margin-bottom: 28px; }
.page-heading > :first-child { min-width: 0; }
.page-heading h1 { font-size: clamp(24px, 2.2vw, 28px); letter-spacing: .01em; }
.page-heading p { max-width: 66ch; margin-top: 8px; color: var(--muted); }
.eyebrow { display: block; margin-bottom: 6px; color: var(--cyan); font-size: 11px; font-weight: 600; letter-spacing: .12em; }
.page-heading > .eyebrow, .page-heading > h1, .page-heading > p { flex-basis: 100%; }
.page-heading:has(> h1) { gap: 6px 20px; }
.page-heading > .heading-actions { flex-basis: auto; margin-top: 10px; }
.heading-actions, .inline-actions, .timer-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.heading-actions:empty { display: none; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.button.primary { color: var(--bg); border-color: var(--cyan); background: var(--cyan); }
.button.secondary { color: var(--text); background: var(--surface); }
.button.ghost { color: var(--muted); border-color: transparent; background: transparent; }
.button.danger { color: var(--danger); border-color: #704947; background: #30242c; }
.button.small { min-height: 38px; padding: 7px 12px; font-size: 12px; }
.button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.grid-2, .grid-3, .stats { display: grid; gap: 20px; min-width: 0; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 14px; align-items: stretch; }
:where(.grid-2, .grid-3, .stats, .form-grid, .comparison) > * { min-width: 0; }
.panel, .stat-card, .review-card, .mobile-record {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.panel-header, .list-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.panel-header > :first-child, .list-heading > :first-child { min-width: 0; }
.panel-header h2, .list-heading h2 { font-size: 18px; }
.panel-header p, .list-heading p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.panel > p + :is(.form-grid, .inline-actions, .comparison, .plan-list) { margin-top: 20px; }
.panel > :is(form, .choice-grid, .suggestion, .funnel, .comparison, .notice, details, .inline-actions) { margin-top: 18px; }
.panel > :is(h2, h3):not(:first-child) { margin-top: 20px; }
.panel > .eyebrow + h2 { margin-top: 0; }
.panel > :is(h2, h3) + p, .panel > form + p { margin-top: 8px; }
.panel > form > :is(.field, .form-grid, .comparison, .muted):not(:first-child) { margin-top: 16px; }
.panel > form > button[type="submit"] { margin-top: 20px; }
.stat-card { padding: 20px; }
.stat-card > :first-child:not(.stat-value) { color: var(--muted); font-size: 12px; }
.stat-value { display: block; margin-block: 8px 4px; font-size: clamp(28px, 3vw, 38px); font-weight: 600; line-height: 1.25; letter-spacing: -.03em; }
.stat-card > :last-child:not(.stat-value) { color: var(--muted); font-size: 12px; }
.badge { display: inline-flex; align-items: center; max-width: 100%; gap: 5px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 7px; color: var(--muted); background: var(--sidebar); font-size: 11px; font-weight: 500; line-height: 1.6; vertical-align: middle; }
.badge.mint { color: var(--mint); border-color: #365848; background: #1a322c; }
.badge.cyan { color: var(--cyan); border-color: #315765; background: #152e3d; }
.badge.warning { color: var(--warning); border-color: #60513d; background: #302c28; }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > label, .field > legend, label.field { color: var(--text); font-size: 13px; font-weight: 500; }
.field small, .field > .muted { font-size: 12px; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 18px; min-width: 0; }
.field.full, .form-grid > .full { grid-column: 1 / -1; }
.input, .select, .textarea, .field :where(input:not([type="checkbox"], [type="radio"], [type="range"]), select, textarea) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: var(--sidebar);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.select, .field select { padding-right: 10px; }
.select option { color: var(--text); background: var(--sidebar); }
.textarea, .field textarea { min-height: 120px; resize: vertical; }
::placeholder { color: var(--muted); opacity: .85; }
:where(.input, .select, .textarea, .field input, .field select, .field textarea):focus {
  border-color: var(--cyan);
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
:where(.input, .select, .textarea)[aria-invalid="true"], :where(.input, .select, .textarea).error, .field.error :where(input, select, textarea), .field :where(input, select, textarea)[aria-invalid="true"] { border-color: var(--danger); }
.form-error { margin-top: 4px; color: var(--danger); font-size: 12px; line-height: 1.7; }
.form-error:empty { display: none; }
.checkbox-row { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 10px; min-width: 0; color: var(--text); }
.checkbox-row > label { display: inline-flex; align-items: flex-start; gap: 10px; min-width: 0; }
.checkbox-row :where(input[type="checkbox"], input[type="radio"]) { flex: 0 0 auto; width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--cyan); }
.checkbox-row :where(input[type="checkbox"], input[type="radio"]):focus-visible { outline-offset: 3px; }
.checkbox-row > span { flex: 1; min-width: 0; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 10px; }

.table-wrap { width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
caption { padding: 14px 16px; color: var(--muted); font-size: 12px; text-align: left; }
th { color: var(--muted); background: var(--sidebar); font-size: 11px; font-weight: 500; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
td > .muted { margin-top: 3px; font-size: 12px; }
td .inline-actions { gap: 6px; }
td .button.small { padding-inline: 9px; }
.record-title { color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
a.record-title { color: var(--cyan); }
.record-title + :is(p, .muted, .badge) { margin-top: 5px; }
.mobile-record + .mobile-record { margin-top: 12px; }
.mobile-record > * + * { margin-top: 12px; }
.mobile-record .record-title + .muted { margin-top: 4px; }
.mobile-record dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 0; }
.mobile-record dl > div { min-width: 0; }
.mobile-record dt { color: var(--muted); font-size: 11px; }
.mobile-record dd { margin: 2px 0 0; font-size: 13px; }
.desktop-only { display: revert; }
.mobile-only { display: none !important; }

.empty-state { display: grid; justify-items: center; gap: 12px; min-width: 0; padding: 48px 24px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--card); text-align: center; }
.empty-state p { max-width: 46ch; color: var(--muted); }
.empty-state > .button, .empty-state > .inline-actions { margin-top: 8px; }
.notice { min-width: 0; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); background: var(--sidebar); line-height: 1.8; }
.notice strong { color: var(--text); font-weight: 600; }
.notice .inline-actions { margin-top: 10px; }
.notice.warning { color: var(--warning); border-color: #60513d; background: #282621; }
.notice.error, #globalError { color: var(--danger); border-color: #704947; background: #2c222b; }
.notice.success { color: var(--mint); border-color: #365848; background: #192d29; }
.notice + .form-grid { margin-top: 20px; }

.funnel { display: grid; min-width: 0; }
.funnel-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; color: var(--text); font-size: 13px; }
.funnel-label > span { flex: 1; min-width: 0; }
.funnel-row { display: grid; grid-template-columns: minmax(140px, .8fr) minmax(0, 1fr) minmax(40px, auto); align-items: center; gap: 8px 14px; min-width: 0; padding-block: 13px; }
.funnel-row + .funnel-row { border-top: 1px solid var(--border); }
.funnel-row > :first-child { min-width: 0; font-size: 13px; }
.funnel-track { min-width: 0; height: 10px; overflow: hidden; border-radius: 99px; background: var(--bg); }
.funnel-fill { width: var(--progress, 0%); max-width: 100%; height: 100%; border-radius: inherit; background: var(--cyan); }
.funnel-fill.mint { background: var(--mint); }
.funnel-count { min-width: 28px; color: var(--text); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.conditional-rate { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.funnel-row > .conditional-rate { text-align: right; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 12px; }
.choice-button { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-width: 0; min-height: 88px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); background: var(--sidebar); line-height: 1.6; text-align: left; overflow-wrap: anywhere; }
.choice-button > :is(p, small, .muted) { font-size: 12px; }
.choice-button[aria-pressed="true"] { border-color: var(--cyan); box-shadow: inset 0 0 0 1px var(--cyan); background: #152e3d; }
.choice-button[aria-pressed="true"] > :first-child { color: var(--cyan); }
.suggestion { min-width: 0; padding: 16px 18px; border: 1px solid #365848; border-left: 3px solid var(--mint); border-radius: 12px; background: #152b28; }
.suggestion > * + * { margin-top: 8px; }
.suggestion .muted { color: #bed0c8; }
.metric-number { color: var(--mint); font-size: clamp(28px, 3.5vw, 44px); font-weight: 600; line-height: 1.2; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.slider-row { display: grid; grid-template-columns: minmax(96px, .7fr) minmax(0, 1.3fr) minmax(46px, auto); align-items: center; gap: 10px 16px; min-width: 0; padding-block: 12px; }
.slider-row > label { min-width: 0; font-size: 13px; }
.slider-row small { display: block; font-size: 11px; }
.slider-row output { color: var(--cyan); font-variant-numeric: tabular-nums; text-align: right; }
.slider-row input[type="range"], input[type="range"].input { width: 100%; min-width: 0; min-height: 36px; margin: 0; padding: 0; border: 0; accent-color: var(--cyan); cursor: pointer; }
.slider-row input[type="number"] { min-width: 0; }
.comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; min-width: 0; }
.comparison:has(> span[aria-hidden="true"]) { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.comparison > * { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--sidebar); }
.comparison > span[aria-hidden="true"] { align-self: center; padding: 0; border: 0; color: var(--muted); background: transparent; text-align: center; }
.comparison .metric-number { display: block; margin-block: 10px 6px; }
.comparison :is(p, small, .muted) { font-size: 12px; }
.plan-list { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.plan-item { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px 18px; min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--sidebar); }
.plan-item > :first-child { flex: 1 1 180px; min-width: 0; }
.plan-item .muted { margin-top: 4px; font-size: 12px; }
.review-card > * + * { margin-top: 16px; }
.review-card + .review-card { margin-top: 14px; }
.review-card .panel-header { margin-top: 0; margin-bottom: 0; }
details { min-width: 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--sidebar); }
summary { color: var(--text); font-size: 13px; font-weight: 500; line-height: 1.7; }
summary::marker { color: var(--cyan); }
details[open] > summary { margin-bottom: 16px; }
details > :not(summary) + * { margin-top: 14px; }
.review-card details { background: var(--bg); }
.review-card :where(p, dd) { white-space: pre-wrap; }
.timer-panel { align-self: start; min-width: 0; background: var(--surface); }
.timer-face { margin-block: 24px; color: var(--text); font: 500 clamp(48px, 6vw, 80px)/1.15 var(--mono); font-variant-numeric: tabular-nums slashed-zero; letter-spacing: -.04em; text-align: center; }
.timer-controls { justify-content: center; }
.timer-controls + :is(.notice, .muted, .checkbox-row) { margin-top: 20px; }

dialog {
  width: min(680px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--card);
  box-shadow: 0 24px 80px rgb(0 0 0 / .35);
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgb(3 9 16 / .8); backdrop-filter: blur(4px); }
dialog > form { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; max-height: inherit; margin: 0; }
.dialog-header { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.dialog-header > :first-child { min-width: 0; }
.dialog-header h2, .dialog-header h3 { font-size: 20px; }
.dialog-header p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.dialog-header > button { flex: 0 0 auto; min-width: 44px; min-height: 44px; }
.dialog-body { flex: 1 1 auto; min-height: 0; padding: 24px; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; }
.dialog-body > * + * { margin-top: 20px; }
.dialog-footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 18px 24px; border-top: 1px solid var(--border); background: var(--sidebar); }
.dialog-footer .button { min-width: 96px; }
.dialog-footer > :is(.form-error, .notice) { flex-basis: 100%; margin: 0; text-align: left; }
.toast, #toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; width: max-content; max-width: min(420px, calc(100% - 48px)); padding: 13px 18px; border: 1px solid #365848; border-radius: 12px; color: var(--text); background: var(--surface); box-shadow: 0 8px 28px rgb(0 0 0 / .2); font-size: 13px; pointer-events: none; }

@media (hover: hover) {
  :where(.sidebar-nav, .sidebar-aux) a[href]:hover { color: var(--text); background: var(--surface); }
  .button:not(:disabled, [aria-disabled="true"]):hover { border-color: var(--muted); }
  .button.primary:not(:disabled, [aria-disabled="true"]):hover { color: var(--bg); border-color: #9aebf4; background: #9aebf4; }
  .button.ghost:not(:disabled, [aria-disabled="true"]):hover { color: var(--text); background: var(--surface); }
  .button.danger:not(:disabled, [aria-disabled="true"]):hover { border-color: var(--danger); background: #3a2931; }
  .choice-button:enabled:hover { border-color: var(--cyan); }
  a.record-title:hover { color: #b4f2fa; }
}

@media (min-width: 900px) and (max-width: 1100px) {
  :root { --sidebar-width: 200px; }
  .sidebar { padding-inline: 14px; }
  .workspace { padding-inline: 24px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel, .review-card { padding: 20px; }
  th, td { padding: 12px; }
}

@media (max-width: 899px) {
  html { scroll-padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 24px); }
  .sidebar { position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; width: auto; padding: 18px 24px; padding-top: max(18px, env(safe-area-inset-top, 0px)); overflow: visible; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { gap: 10px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy strong { font-size: 15px; }
  .brand-copy > span { font-size: 11px; }
  .sidebar-nav, .sidebar-footer { display: none; }
  .sidebar-aux { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px; margin: 0; padding: 0; }
  .sidebar-aux a { min-height: 44px; gap: 6px; padding: 4px 0; border-radius: 6px; font-size: 12px; }
  .sidebar-aux svg { width: 16px; height: 16px; }
  .workspace { margin-left: 0; padding: 0 24px calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 36px); }
  .topbar { min-height: 80px; }
  .bottom-nav { position: fixed; inset: auto 0 0; z-index: 40; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-height: var(--bottom-nav-height); padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); background: var(--sidebar); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 56px; padding: 6px; border: 1px solid transparent; border-radius: 11px; color: var(--muted); font-size: 11px; line-height: 1.4; text-decoration: none; }
  .bottom-nav svg { width: 21px; height: 21px; }
  .bottom-nav a:focus-visible { outline-offset: -3px; }
  .desktop-only { display: none !important; }
  .mobile-only { display: revert !important; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toast, #toast { right: 20px; bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 16px); max-width: calc(100% - 40px); }
  #appContent :where(button, input, select, textarea, a), dialog :where(button, input, select, textarea, a) { scroll-margin-block: 24px calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 24px); }
}

@media (max-width: 699px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .page-heading { gap: 16px; margin-bottom: 24px; }
  .page-heading p { font-size: 13px; }
  .panel, .review-card, .mobile-record { padding: 20px; }
  .panel-header, .list-heading { margin-bottom: 18px; }
  .panel-header h2, .list-heading h2 { font-size: 17px; }
}

@media (max-width: 539px) {
  .sidebar { padding-inline: 16px; }
  .sidebar-aux { column-gap: 10px; }
  .sidebar-aux svg { display: none; }
  .workspace { padding-inline: 16px; }
  .topbar { align-items: flex-start; gap: 12px; padding-block: 16px; }
  .breadcrumb { flex-basis: 100%; }
  .workspace-tools { flex: 1; justify-content: space-between; gap: 10px; }
  .mode-control { gap: 8px; }
  .mode-control .select { min-height: 44px; font-size: 16px; }
  .workspace-tools .button { min-height: 44px; }
  .mode-notice { margin-block: 16px 24px; }
  #appContent > * + * { margin-top: 20px; }
  .page-heading h1 { font-size: 24px; }
  .heading-actions { width: 100%; }
  .heading-actions .button.primary { flex: 1 1 auto; }
  .panel, .review-card, .mobile-record { padding: 18px; border-radius: var(--radius-sm); }
  .stats { gap: 12px; }
  .stat-card { padding: 16px; border-radius: var(--radius-sm); }
  .stat-value { font-size: 30px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .input, .select, .textarea, .field :where(input:not([type="checkbox"], [type="radio"], [type="range"]), select, textarea) { font-size: 16px; }
  .button.small { min-height: 44px; }
  .empty-state { padding: 32px 18px; }
  .empty-state .inline-actions { justify-content: center; }
  .notice { padding: 12px 14px; }
  .funnel-row { grid-template-columns: minmax(88px, .8fr) minmax(0, 1fr) minmax(36px, auto); column-gap: 10px; }
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
  .choice-button { min-height: 76px; padding: 14px 16px; }
  .slider-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .slider-row > input[type="range"] { grid-column: 1 / -1; grid-row: 2; }
  .slider-row > output { grid-column: 2; grid-row: 1; }
  .comparison { gap: 10px; }
  .comparison > * { padding: 14px; }
  .comparison .metric-number { font-size: 30px; }
  .plan-item { padding: 16px; }
  .plan-item > .inline-actions { width: 100%; }
  .timer-controls .button { flex: 1 1 90px; }
  .timer-face { margin-block: 24px; font-size: 56px; }
  details { padding: 14px; }
  dialog { width: calc(100% - 24px); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .dialog-header { padding: 18px; }
  .dialog-header h2, .dialog-header h3 { font-size: 18px; }
  .dialog-body { padding: 18px; scrollbar-gutter: auto; }
  .dialog-footer { padding: 14px 18px max(14px, env(safe-area-inset-bottom, 0px)); }
  .dialog-footer .button { flex: 1 1 96px; }
  .toast, #toast { right: 16px; max-width: calc(100% - 32px); }
}

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