/* 雾化调油助手 MixLab · 样式
   风格：极简白（大留白 / 1px 细线 / 黑白 + 一点蓝） */

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --text: #18181b;
  --muted: #6b6b73;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --primary: #18181b;
  --on-primary: #ffffff;
  --accent: #2563eb;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok-bg: #ecfdf3;
  --warn-bg: #fffbeb;
  --danger-bg: #fef2f2;
  --info-bg: #eff6ff;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(24, 24, 27, 0.06);
  --shadow-lg: 0 8px 24px rgba(24, 24, 27, 0.1);
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 17px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: 30px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --nav-h: 62px;
}

html[data-theme="dark"] {
  --bg: #0e0e10;
  --surface: #17171a;
  --surface-2: #1f1f24;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --line: #2b2b31;
  --line-strong: #3f3f46;
  --primary: #fafaf9;
  --on-primary: #18181b;
  --accent: #60a5fa;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --ok-bg: #0f2a1b;
  --warn-bg: #2a2312;
  --danger-bg: #2c1516;
  --info-bg: #14203a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #0e0e10;
    --surface: #17171a;
    --surface-2: #1f1f24;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --line: #2b2b31;
    --line-strong: #3f3f46;
    --primary: #fafaf9;
    --on-primary: #18181b;
    --accent: #60a5fa;
    --ok: #4ade80;
    --warn: #fbbf24;
    --danger: #f87171;
    --ok-bg: #0f2a1b;
    --warn-bg: #2a2312;
    --danger-bg: #2c1516;
    --info-bg: #14203a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.55);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 600;
}

h1 {
  font-size: var(--fs-xl);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--fs-md);
}

h3 {
  font-size: var(--fs-base);
}

a {
  color: var(--accent);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* —— 顶栏 + 导航 —— */

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 56px;
  padding: calc(var(--sp-2) + env(safe-area-inset-top, 0px)) var(--sp-4) var(--sp-2);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.appbar .brand {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  min-width: 0;
}

.appbar .brand strong {
  font-size: var(--fs-md);
  letter-spacing: -0.02em;
}

.appbar .brand span {
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.02em;
}

.appbar .spacer {
  flex: 1;
}

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-2) calc(var(--sp-1) + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

/* 手机上也自己让出底部横条的位置（不依赖 env() 是否生效） */
@media (max-width: 899px) {
  .tabbar {
    padding-bottom: calc(var(--sp-1) + max(env(safe-area-inset-bottom, 0px), 30px));
  }

  .appbar {
    padding-top: max(env(safe-area-inset-top, 0px), 42px);
  }

  .view {
    padding-bottom: calc(var(--nav-h) + 30px + var(--sp-6));
  }
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 56px;
  min-height: 48px;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 500;
}

.tabbar a svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.75;
}

.tabbar a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
}

.tabbar a:hover {
  color: var(--text);
}

.view {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-4) calc(var(--nav-h) + var(--sp-6) + env(safe-area-inset-bottom));
}

/* 每次渲染新建的容器：不占布局盒，事件监听随它一起销毁 */
.view-host {
  display: contents;
}

.view-host > * + * {
  margin-top: var(--sp-5);
}

@media (min-width: 900px) {
  .tabbar {
    position: static;
    justify-content: flex-start;
    gap: var(--sp-1);
    padding: 0 var(--sp-4);
    background: transparent;
    backdrop-filter: none;
    border-top: none;
    border-bottom: 1px solid var(--line);
  }

  .tabbar a {
    flex-direction: row;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
    min-height: 46px;
    padding: 0 var(--sp-3);
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .tabbar a svg {
    width: 18px;
    height: 18px;
  }

  .tabbar a[aria-current="page"] {
    background: transparent;
    box-shadow: inset 0 -2px 0 var(--text);
  }

  .view {
    padding-bottom: var(--sp-7);
  }
}

/* —— 通用块 —— */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow);
}

.card.flush {
  padding: 0;
  overflow: hidden;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-width: 0;
}

/* grid / flex 子项默认 min-width: auto 会被内容撑破，这里统一允许收缩 */
.stack > *,
.split > *,
.row > * {
  min-width: 0;
}

.stack.tight {
  gap: var(--sp-2);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.row.between {
  justify-content: space-between;
}

.row.nowrap {
  flex-wrap: nowrap;
}

.muted {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.tiny {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.section-title h2 {
  font-size: var(--fs-md);
}

hr.sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--sp-4) 0;
}

/* —— 按钮 —— */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms cubic-bezier(0.2, 0.8, 0.2, 1), border-color 160ms;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.btn.primary:hover {
  opacity: 0.9;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.ghost:hover {
  background: var(--surface-2);
}

.btn.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
}

.btn.small {
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--sp-3);
  font-size: var(--fs-sm);
}

@media (max-width: 899px) {
  .item-row .move button {
    width: 44px;
    height: 44px;
  }

  .item-row .sub select {
    min-height: 44px;
  }

  .item-row .sub .conc input {
    min-height: 44px;
  }
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
}

/* —— 表单 —— */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-width: 0;
}

.field > label,
.label {
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 500;
}

.grid-2 > *,
.grid-3 > * {
  min-width: 0;
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--fs-base);
}

textarea {
  min-height: 84px;
  padding: var(--sp-2) var(--sp-3);
  line-height: 1.6;
  resize: vertical;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible,
.icon-btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[type="number"] {
  text-align: right;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}

@media (max-width: 520px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

.quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
  gap: var(--sp-2);
}

.quick .chip {
  min-width: 0;
  border-radius: var(--radius);
}

.chip {
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-sm);
  cursor: pointer;
}

.chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.chip.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

/* 分段控件 */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  gap: 2px;
}

/* 占满一行、按钮等分：设备切换、主题、默认溶剂这类"二选一/三选一" */
.segmented.block {
  display: flex;
  width: 100%;
}

.segmented.block button {
  flex: 1 1 auto;
  padding: 0 var(--sp-2);
}

.segmented button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* 滑条 */
.slider-block {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.slider-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.slider-value {
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: -0.01em;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -10px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* —— 徽章 —— */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.draft {
  color: var(--muted);
}

.badge.pending {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: var(--info-bg);
}

.badge.steeping {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 32%, var(--line));
  background: var(--warn-bg);
}

.badge.ready {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 32%, var(--line));
  background: var(--ok-bg);
}

.badge.plain::before {
  display: none;
}

/* —— 配方卡片 —— */

.recipe-list {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .recipe-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

.recipe-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 160ms;
}

.recipe-card:hover {
  border-color: var(--line-strong);
}

.recipe-card .top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
}

.recipe-card h3 {
  font-size: var(--fs-md);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.recipe-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.recipe-card .actions {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
  margin-top: var(--sp-1);
}

/* —— 警告条 —— */

.warn-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.warn {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.warn .dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: currentColor;
}

.warn .body {
  min-width: 0;
}

.warn strong {
  display: block;
  font-weight: 600;
}

.warn .why {
  color: var(--muted);
}

.warn.red {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
}

.warn.yellow {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: color-mix(in srgb, var(--warn) 28%, var(--line));
}

.warn.info {
  color: var(--accent);
  background: var(--info-bg);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
}

.warn.ok {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: color-mix(in srgb, var(--ok) 26%, var(--line));
}

.warn.red .why,
.warn.yellow .why,
.warn.info .why,
.warn.ok .why {
  color: color-mix(in srgb, currentColor 78%, var(--text));
}

/* 信息提示折叠成一行，避免把结果表挤出屏幕 */
.warn-more > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  cursor: pointer;
  list-style: none;
}

.warn-more > summary::-webkit-details-marker {
  display: none;
}

.warn-more > summary::after {
  content: '展开';
  margin-left: auto;
  font-size: var(--fs-xs);
}

.warn-more[open] > summary::after {
  content: '收起';
}

.warn-more > .warn-list {
  margin-top: var(--sp-2);
}

.banner {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: var(--sp-2) var(--sp-4) 0;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid color-mix(in srgb, var(--ok) 30%, var(--line));
  border-radius: var(--radius);
  background: var(--ok-bg);
  color: var(--ok);
  font-size: var(--fs-sm);
}

.banner button {
  margin-left: auto;
}

/* —— 结果表 —— */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

table.data th,
table.data td {
  padding: var(--sp-2) var(--sp-2);
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

table.data th {
  color: var(--muted);
  font-weight: 500;
  font-size: var(--fs-xs);
  text-transform: none;
}

table.data th:first-child {
  text-align: left;
  white-space: normal;
}

table.data td:first-child {
  text-align: left;
  white-space: nowrap;
}

table.data tbody tr:last-child td {
  border-bottom: 0;
}

table.data tfoot td {
  border-top: 1px solid var(--line-strong);
  border-bottom: 0;
  font-weight: 600;
}

table.data tr.total-bad td {
  color: var(--danger);
}

.carrier-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  line-height: 16px;
  vertical-align: 1px;
}

.calc-line {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.calc-line b {
  color: var(--text);
  font-weight: 600;
}

/* —— 添加剂行 —— */

.items {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.item-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-2) var(--sp-3) var(--sp-2);
  background: var(--surface);
}

.item-row.dragging {
  opacity: 0.5;
}

.item-row .main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 44px;
  gap: var(--sp-1);
  align-items: center;
}

.item-row .main .pct-wrap {
  position: relative;
}

.item-row .main .pct-wrap input {
  padding-right: 22px;
}

.item-row .main .pct-wrap .unit {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: var(--fs-sm);
  pointer-events: none;
}

.item-row .sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.item-row .sub select {
  width: auto;
  min-height: 34px;
  padding: 0 var(--sp-2);
  font-size: var(--fs-sm);
}

.item-row .sub .conc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.item-row .sub .conc input {
  width: 62px;
  min-height: 34px;
  padding: 0 6px;
  font-size: var(--fs-sm);
}

.item-row .move {
  display: inline-flex;
  gap: 2px;
  margin-left: auto;
}

.item-row .move button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-sm);
  line-height: 1;
}

.item-row .move button:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.item-row .calc-line {
  margin-top: var(--sp-2);
}

/* 吸顶结果摘要（手机） */
.sticky-summary {
  position: sticky;
  top: 56px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  font-size: var(--fs-sm);
}

.sticky-summary .k {
  color: var(--muted);
}

.sticky-summary .v {
  font-weight: 600;
}

@media (min-width: 900px) {
  .sticky-summary {
    display: none;
  }
}

/* 双栏 */
.split {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: 1fr;
}

@media (min-width: 1000px) {
  .split {
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
    align-items: start;
  }

  .split .side {
    position: sticky;
    top: 120px;
  }
}

/* 手风琴 */
details.acc {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

details.acc + details.acc {
  margin-top: var(--sp-3);
}

details.acc > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-height: 52px;
  padding: 0 var(--sp-4);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

details.acc > summary::-webkit-details-marker {
  display: none;
}

details.acc > summary::after {
  content: "＋";
  color: var(--muted);
  font-weight: 400;
}

details.acc[open] > summary::after {
  content: "−";
}

details.acc > summary .hint {
  margin-left: auto;
  color: var(--muted);
  font-weight: 400;
  font-size: var(--fs-sm);
}

details.acc .body {
  padding: 0 var(--sp-4) var(--sp-4);
  border-top: 1px solid var(--line);
  padding-top: var(--sp-4);
}

@media (min-width: 900px) {
  details.acc > summary {
    cursor: default;
  }

  details.acc > summary::after {
    display: none;
  }

  details.acc {
    overflow: visible;
  }
}

/* —— 图表 —— */

.chart-block {
  display: grid;
  gap: var(--sp-3);
}

/* 毛玻璃饼图：底层是模糊的彩色光斑，上层是玻璃面板 + 半透明扇区 */
.chart-glass {
  position: relative;
  isolation: isolate;
  padding: var(--sp-4);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--text) 9%, var(--line));
  background: linear-gradient(
    155deg,
    color-mix(in srgb, var(--surface) 74%, transparent),
    color-mix(in srgb, var(--surface) 26%, transparent)
  );
  backdrop-filter: blur(16px) saturate(1.35);
  -webkit-backdrop-filter: blur(16px) saturate(1.35);
  box-shadow: 0 10px 30px rgba(24, 24, 27, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.chart-aura {
  position: absolute;
  inset: -30%;
  z-index: -1;
  pointer-events: none;
  filter: blur(34px);
  opacity: 0.3;
  background:
    radial-gradient(circle at 26% 28%, #38bdf8, transparent 58%),
    radial-gradient(circle at 74% 70%, #818cf8, transparent 60%),
    radial-gradient(circle at 62% 18%, #22d3ee, transparent 55%);
}

html[data-theme="dark"] .chart-aura {
  opacity: 0.22;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .chart-aura {
    opacity: 0.22;
  }
}

.chart-glass .chart-svg {
  position: relative;
  z-index: 1;
}

/* 悬停时那一块提亮一点，桌面上有"摸得到"的感觉 */
.chart-glass .slice {
  transition: filter 160ms ease;
}

.chart-glass .slice:hover {
  filter: brightness(1.1) saturate(1.08);
}

@supports not (backdrop-filter: blur(4px)) {
  .chart-glass {
    background: var(--surface);
  }

  .chart-aura {
    opacity: 0.35;
  }
}

.chart-svg {
  max-width: 240px;
  margin: 0 auto;
}

.legend {
  display: grid;
  gap: 6px;
  font-size: var(--fs-sm);
}

.legend .li {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.legend .sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.legend .nm {
  flex: 1;
  min-width: 0;
}

.legend .nm-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 图例里的占比条：一眼看出各块相对大小 */
.legend .bar {
  display: block;
  max-width: 120px;
  height: 3px;
  margin-top: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.legend .bar > i {
  display: block;
  height: 100%;
  border-radius: 2px;
}

.legend .pc {
  color: var(--muted);
}

/* —— 空状态 —— */

.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-6) var(--sp-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.empty h3 {
  font-size: var(--fs-md);
}

/* —— 弹窗 / toast —— */

dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(9, 9, 11, 0.45);
  backdrop-filter: blur(2px);
}

dialog .dlg-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-5);
}

dialog .dlg-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

dialog .dlg-actions .row {
  gap: var(--sp-2);
}

dialog .dlg-actions .btn {
  flex: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom));
  z-index: 60;
  transform: translateX(-50%) translateY(8px);
  max-width: min(420px, calc(100vw - 32px));
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--bg);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms, transform 180ms;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 900px) {
  .toast {
    bottom: 28px;
  }
}

/* —— 醒油 —— */

.countdown {
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.countdown.small {
  font-size: var(--fs-lg);
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 300ms ease;
}

/* —— 手册 —— */

.manual-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  margin: var(--sp-3) 0;
}

.manual-table th,
.manual-table td {
  padding: var(--sp-2);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.manual-table td:first-child,
.manual-table td:nth-child(2),
.manual-table th {
  white-space: nowrap;
}

.manual-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: var(--fs-xs);
}

.manual-table td.num {
  text-align: right;
  white-space: nowrap;
}

.manual p {
  margin: 0 0 var(--sp-3);
  max-width: 36em;
}

.manual ul {
  margin: 0 0 var(--sp-3);
  padding-left: 1.2em;
  max-width: 36em;
}

.manual li {
  margin-bottom: var(--sp-1);
}

.manual h3 {
  margin: var(--sp-4) 0 var(--sp-2);
}

/* —— 首次启动的安全门禁 —— */

.safety-gate {
  max-width: 620px;
  margin: 0 auto;
  padding: var(--sp-5);
}

.safety-gate h1 {
  font-size: var(--fs-lg);
}

.safety-gate ul {
  margin: var(--sp-3) 0 var(--sp-4);
  padding-left: 1.2em;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.safety-gate li {
  margin-bottom: var(--sp-2);
}

.safety-gate .muted {
  margin: 0 0 var(--sp-4);
}

/* 工具类 */
.hide {
  display: none !important;
}

.right {
  text-align: right;
}

.nowrap {
  white-space: nowrap;
}

.grow {
  flex: 1;
}

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