/* ============ 设计令牌 ============ */
:root {
  --bg: #fbf6f4;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --surface-2: #f4eeec;
  --glass: rgba(255, 252, 250, 0.72);
  --text: #1c1517;
  --text-2: #4f4447;
  --muted: #8f8386;
  --border: rgba(80, 30, 30, 0.08);
  --track: rgba(80, 30, 30, 0.07);
  --tick: rgba(80, 30, 30, 0.12);
  --tick-major: rgba(80, 30, 30, 0.24);
  --cell0: #f0e9e7;
  --heat: #ff5f57;
  --shadow: 0 1px 2px rgba(60, 20, 20, 0.04), 0 10px 30px -12px rgba(80, 30, 30, 0.16);
  --shadow-lg: 0 2px 4px rgba(60, 20, 20, 0.04), 0 30px 60px -24px rgba(120, 40, 30, 0.3);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Inter, Roboto, sans-serif;
  --num: "SF Pro Rounded", "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --r: 16px;
  --r-lg: 24px;
  --top-h: 60px;
  --tab-h: 64px;
  --m1: #ff5f57;
  --m2: #ff9f43;
  color-scheme: light;
}
[data-mode="short"] { --m1: #14b8a6; --m2: #38bdf8; }
[data-mode="long"] { --m1: #6366f1; --m2: #c084fc; }
[data-theme="dark"] {
  --bg: #0d0e15;
  --surface: rgba(24, 25, 36, 0.8);
  --surface-solid: #171824;
  --surface-2: #20212f;
  --glass: rgba(13, 14, 21, 0.72);
  --text: #eceaf2;
  --text-2: #b8b6c6;
  --muted: #8a89a0;
  --border: rgba(255, 255, 255, 0.07);
  --track: rgba(255, 255, 255, 0.07);
  --tick: rgba(255, 255, 255, 0.1);
  --tick-major: rgba(255, 255, 255, 0.22);
  --cell0: #1f2030;
  --heat: #ff6b63;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 12px 30px -12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 30px 60px -20px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}
[data-theme="dark"][data-mode="focus"] { --m1: #ff6b63; --m2: #ffa552; }
[data-theme="dark"][data-mode="short"] { --m1: #2dd4bf; --m2: #38bdf8; }
[data-theme="dark"][data-mode="long"] { --m1: #818cf8; --m2: #c084fc; }

/* ============ 基础 ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text);
  background:
    radial-gradient(900px 620px at 10% -12%, color-mix(in srgb, var(--m1) 20%, transparent), transparent 62%),
    radial-gradient(760px 520px at 105% 6%, color-mix(in srgb, var(--m2) 17%, transparent), transparent 60%),
    radial-gradient(700px 600px at 50% 120%, color-mix(in srgb, var(--m1) 9%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--m1); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--surface-solid); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ============ 顶栏 / 导航 ============ */
.topbar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 12px;
  background: var(--glass); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 17px; }
.brand img { border-radius: 9px; }
.tabs { margin-left: auto; display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; }
.tab { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; color: var(--text-2); font-weight: 600; font-size: 14px; transition: all 0.2s var(--ease); }
.tab svg { width: 18px; height: 18px; }
.tab[aria-current="page"] { background: var(--surface-solid); color: var(--m1); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--text-2); transition: background 0.2s, transform 0.15s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.92); }
#themeBtn .moon { display: none; }
[data-theme="dark"] #themeBtn .sun { display: none; }
[data-theme="dark"] #themeBtn .moon { display: block; }
@media (max-width: 720px) {
  /* backdrop-filter 会让内部 fixed 元素相对顶栏定位，手机上去掉它，底部导航才能贴底 */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface-solid); }
  #themeBtn { margin-left: auto; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 6px 20px env(safe-area-inset-bottom);
    border-radius: 0; justify-content: space-around;
    background: var(--glass); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-top: 1px solid var(--border);
  }
  .tab { flex: 1; flex-direction: column; gap: 2px; padding: 6px 0; font-size: 11px; background: none !important; box-shadow: none !important; }
  .tab svg { width: 22px; height: 22px; }
}

main { max-width: 960px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); outline: none; }
@media (max-width: 720px) { main { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px); } }
.view { animation: fadeUp 0.35s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.panel + .panel, .grid + .panel, .panel + .grid, .cols + .panel, .panel + .cols, .grid + .cols, .cols + .cols { margin-top: 14px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel h2 .sub { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--muted); }
.cols { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.cols > .panel + .panel { margin-top: 0; }
@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } }

.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface-2); gap: 2px; }
.seg button { padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-2); transition: all 0.2s var(--ease); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.panel h2 .seg { margin-left: auto; padding: 3px; }
.panel h2 .seg button { padding: 4px 10px; font-size: 12.5px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; padding: 0 18px; border-radius: 12px; font-weight: 650; background: var(--surface-2); transition: transform 0.15s var(--ease); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(135deg, var(--m1), var(--m2)); color: #fff; box-shadow: 0 8px 20px -8px var(--m1); }
.btn.ghost { background: transparent; border: 1px solid var(--border); }
.btn.danger { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.input { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1.5px solid transparent; font-size: 16px; }
.input:focus { outline: none; border-color: var(--m1); background: var(--surface-solid); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; font-size: 13.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1.5px solid transparent; transition: all 0.15s; }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip[aria-pressed="true"] { border-color: var(--c); color: var(--text); background: color-mix(in srgb, var(--c) 12%, transparent); }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); font-size: 14px; }
.empty .emo { font-size: 36px; display: block; margin-bottom: 6px; }

/* ============ 计时器 ============ */
.timer-view { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.timer-top { width: 100%; display: flex; align-items: center; justify-content: center; position: relative; }
.timer-top .icon-btn { position: absolute; right: 0; }
.ring-wrap { position: relative; width: min(80vw, 340px); aspect-ratio: 1; margin: 18px auto 6px; }
.ring-wrap::before {
  content: ""; position: absolute; inset: 9%; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--m1) 22%, transparent), transparent 68%);
  opacity: 0.55; transition: opacity 0.5s; pointer-events: none;
}
.ring-wrap.running::before { animation: breathe 4s ease-in-out infinite; opacity: 1; }
@keyframes breathe { 50% { transform: scale(1.12); opacity: 0.55; } }
.ring { position: relative; width: 100%; height: 100%; display: block; overflow: visible; }
.ring .s1 { stop-color: var(--m1); }
.ring .s2 { stop-color: var(--m2); }
.ring .ticks line { stroke: var(--tick); stroke-width: 2; stroke-linecap: round; }
.ring .ticks line.major { stroke: var(--tick-major); stroke-width: 2.6; }
.ring .track { fill: none; stroke: var(--track); stroke-width: 14; }
.ring .arc { fill: none; stroke: url(#rg); stroke-width: 14; stroke-linecap: round; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--m1) 55%, transparent)); }
.ring-wrap.idle .arc { transition: stroke-dashoffset 0.7s var(--ease); }
.ring .head { fill: #fff; stroke: var(--m2); stroke-width: 4; filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--m1) 60%, transparent)); }
.ring-wrap.idle #head { transition: transform 0.7s var(--ease); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 18%; }
.mode-lbl { font-size: 14px; font-weight: 650; color: var(--m1); letter-spacing: 0.08em; }
.time { font-size: clamp(54px, 16vw, 78px); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; margin: 4px 0; }
.ring-wrap.paused .time { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
.sub-lbl { font-size: 13.5px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ring-wrap.flash { animation: pop 0.8s var(--ease); }
@keyframes pop { 30% { transform: scale(1.05); } }

.dots { display: flex; gap: 8px; justify-content: center; margin: 4px 0 18px; min-height: 12px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--track); transition: background 0.3s; }
.dots i.done { background: linear-gradient(135deg, var(--m1), var(--m2)); }
.dots i.cur { box-shadow: 0 0 0 2px color-mix(in srgb, var(--m1) 60%, transparent); }
.controls { display: flex; align-items: center; justify-content: center; gap: 26px; }
.ctl { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text-2); transition: transform 0.15s var(--ease), opacity 0.2s; }
.ctl svg { width: 22px; height: 22px; }
.ctl:active { transform: scale(0.92); }
.ctl:disabled { opacity: 0.35; }
.ctl.main { width: 82px; height: 82px; color: #fff; border: 0; background: linear-gradient(135deg, var(--m1), var(--m2)); box-shadow: 0 16px 32px -12px var(--m1); }
.ctl.main svg { width: 32px; height: 32px; }
.task-panel { width: 100%; margin-top: 24px; }
.task-in { display: flex; align-items: center; gap: 10px; }
.task-in input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; font-weight: 600; padding: 4px 0 10px; border-bottom: 1.5px dashed var(--border); }
.task-in input:focus { border-bottom-color: var(--m1); }
.task-panel .chips { margin-top: 12px; }
.today { width: 100%; }
.today-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.today-row .k { font-size: 12.5px; color: var(--muted); }
.today-row .v { font-size: 22px; font-weight: 700; }
.today-row .v small { font-size: 13px; color: var(--muted); font-weight: 500; }
.goal { height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; margin-top: 12px; }
.goal i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--m1), var(--m2)); transition: width 0.6s var(--ease); }
.goal-ok { text-align: center; font-size: 13px; color: var(--m1); font-weight: 650; margin-top: 8px; }
.kbd-hint { font-size: 12px; color: var(--muted); margin-top: 14px; text-align: center; }
@media (hover: none) { .kbd-hint { display: none; } }
.zen-exit { display: none; }

/* 沉浸模式 */
body.zen .topbar, body.zen .tabs, body.zen .timer-top, body.zen .task-panel, body.zen .today, body.zen .kbd-hint { display: none !important; }
body.zen main { padding-bottom: 24px; min-height: 100dvh; display: flex; align-items: center; }
body.zen .timer-view { justify-content: center; }
body.zen .ring-wrap { width: min(86vw, 68dvh, 520px); }
body.zen .time { font-size: clamp(64px, 18vw, 110px); }
body.zen .zen-exit { display: block; margin-top: 26px; font-size: 13px; color: var(--muted); padding: 8px 16px; border-radius: 99px; border: 1px solid var(--border); }

/* ============ 统计 ============ */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) { .grid { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k { font-size: 12.5px; color: var(--muted); }
.kpi .v { font-size: 24px; font-weight: 750; margin-top: 2px; }
.kpi .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.kpi .d { font-size: 12px; color: var(--muted); margin-top: 2px; }

.cal { --gap: 3px; }
.cal-months, .cal-grid { display: grid; gap: var(--gap); }
.cal-months { font-size: 11px; color: var(--muted); margin: 0 0 4px 24px; height: 14px; }
.cal-months span { white-space: nowrap; }
.cal-body { display: flex; gap: 6px; }
.cal-wd { display: grid; grid-template-rows: repeat(7, 1fr); gap: var(--gap); font-size: 10.5px; color: var(--muted); width: 18px; }
.cal-wd span { display: flex; align-items: center; }
.cal-grid { flex: 1; grid-auto-flow: column; grid-template-rows: repeat(7, auto); }
.cell { aspect-ratio: 1; border-radius: 3.5px; background: var(--cell0); padding: 0; transition: transform 0.1s; }
.cell:hover { transform: scale(1.25); }
.cell[data-l="1"] { background: color-mix(in srgb, var(--heat) 28%, var(--cell0)); }
.cell[data-l="2"] { background: color-mix(in srgb, var(--heat) 52%, var(--cell0)); }
.cell[data-l="3"] { background: color-mix(in srgb, var(--heat) 76%, var(--cell0)); }
.cell[data-l="4"] { background: var(--heat); }
.cell.today { outline: 1.5px solid var(--text-2); outline-offset: 1px; }
.cell.future { background: transparent; pointer-events: none; }
.heat-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend { display: inline-flex; align-items: center; gap: 3px; }
.legend .cell { width: 11px; pointer-events: none; }

.hgrid { display: grid; grid-template-columns: 26px repeat(24, minmax(0, 1fr)); gap: 3px; }
.hgrid .hl { font-size: 10.5px; color: var(--muted); display: flex; align-items: center; }
.hgrid .hh { font-size: 10px; color: var(--muted); text-align: left; white-space: nowrap; height: 14px; }
.hgrid .cell { border-radius: 3px; }
.insight { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.insight span { font-size: 13px; padding: 5px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.insight b { color: var(--text); }

.wbars { display: flex; align-items: flex-end; gap: 10px; height: 180px; }
.wbar { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.wbar .val { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.wbar i { display: block; width: 100%; max-width: 38px; min-height: 4px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--heat), color-mix(in srgb, var(--heat) 45%, transparent)); transform-origin: bottom; animation: grow 0.7s var(--ease) both; animation-delay: var(--d); }
.wbar.zero i { background: var(--track); }
.wbar.now .lbl { color: var(--heat); font-weight: 700; }
.wbar .lbl { font-size: 12px; color: var(--muted); }
@keyframes grow { from { transform: scaleY(0); } }

.tbars { display: grid; gap: 10px; }
.tbar .line { display: flex; justify-content: space-between; font-size: 14px; }
.tbar .line b { font-weight: 650; display: inline-flex; align-items: center; gap: 6px; }
.tbar .line b i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.tbar .p { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; margin-top: 5px; }
.tbar .p i { display: block; height: 100%; border-radius: 99px; background: var(--c); }

.hist-day { margin-top: 12px; }
.hist-day:first-child { margin-top: 0; }
.hist-day .dh { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; padding: 0 4px 6px; }
.hist-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.hist-row + .hist-row { margin-top: 6px; }
.hist-row .bar { width: 4px; align-self: stretch; border-radius: 99px; background: var(--c); }
.hist-row .mid { flex: 1; min-width: 0; }
.hist-row .t { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-row .m { font-size: 12.5px; color: var(--muted); }
.hist-row .d { font-weight: 700; white-space: nowrap; }
.hist-row .part { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 0 5px; margin-left: 4px; font-weight: 500; }
.hist-row .del { color: var(--muted); width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.hist-row .del:hover { background: var(--surface); color: #ef4444; }
.hist-row .del svg { width: 17px; height: 17px; }
.more { text-align: center; margin-top: 12px; }

/* ============ 设置 ============ */
.set-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.set-row:last-child { border-bottom: 0; padding-bottom: 0; }
.set-row:first-of-type { padding-top: 0; }
.set-row .lbl { flex: 1; min-width: 150px; }
.set-row .lbl b { display: block; font-weight: 650; }
.set-row .lbl span { font-size: 13px; color: var(--muted); }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.stepper button { width: 34px; height: 34px; border-radius: 9px; font-size: 18px; font-weight: 600; background: var(--surface-solid); }
.stepper button:disabled { opacity: 0.4; }
.stepper b { min-width: 3.2em; text-align: center; font-family: var(--num); font-size: 16px; }
.stepper b small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.switch { position: relative; width: 50px; height: 30px; border-radius: 99px; background: var(--border); transition: background 0.25s; flex: none; }
[data-theme="dark"] .switch { background: #343547; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.25s var(--ease); }
.switch[aria-checked="true"] { background: linear-gradient(135deg, var(--m1), var(--m2)); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag-list span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 10px; border-radius: 99px; background: var(--surface-2); font-size: 13.5px; }
.tag-list i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.tag-list button { width: 22px; height: 22px; border-radius: 50%; color: var(--muted); font-size: 15px; line-height: 1; }
.tag-list button:hover { background: var(--surface-solid); color: #ef4444; }
.colors { display: flex; gap: 6px; }
.colors button { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid transparent; }
.colors button[aria-pressed="true"] { border-color: var(--text); }
.help { font-size: 13.5px; color: var(--text-2); line-height: 1.75; }
.help ol { margin: 8px 0 0; padding-left: 20px; }

/* ============ 弹层 ============ */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(10, 5, 8, 0.45); backdrop-filter: blur(3px); animation: fade 0.25s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; z-index: 41; left: 50%; bottom: 0; transform: translateX(-50%); width: min(520px, 100%); max-height: 92dvh; overflow-y: auto; background: var(--surface-solid); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-lg); padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); animation: up 0.35s var(--ease); }
@media (min-width: 721px) { .sheet { bottom: auto; top: 50%; transform: translate(-50%, -50%); border-radius: 26px; animation: popIn 0.3s var(--ease); } }
@keyframes up { from { transform: translate(-50%, 100%); } }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, -46%) scale(0.97); } }
.grab { width: 40px; height: 5px; border-radius: 99px; background: var(--border); margin: 0 auto 10px; }
@media (min-width: 721px) { .grab { display: none; } }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; font-size: 17px; flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field.full { grid-column: 1 / -1; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .primary { flex: 1; }

/* ============ Toast ============ */
.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 60; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); transition: all 0.3s var(--ease); max-width: calc(100vw - 32px); display: flex; gap: 12px; align-items: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--m2); font-weight: 700; }
@media (max-width: 720px) { .toast { bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom)); } body.zen .toast { bottom: calc(28px + env(safe-area-inset-bottom)); } }

@media (max-width: 480px) {
  main { padding-top: 12px; }
  .panel { padding: 15px; border-radius: 20px; }
  .ring-wrap { margin-top: 12px; }
  .controls { gap: 22px; }
  .hgrid { grid-template-columns: 20px repeat(24, minmax(0, 1fr)); gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
