:root {
  --bg-base: #eaf0f7;
  --grid-dot: rgba(98, 124, 158, 0.16);
  --orb-1: rgba(126, 174, 224, 0.62);
  --orb-2: rgba(236, 180, 186, 0.54);
  --orb-3: rgba(146, 202, 180, 0.56);
  --orb-4: rgba(190, 178, 232, 0.42);

  --card-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0.46) 48%, rgba(242, 248, 255, 0.64) 100%);
  --card-rim: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.42) 38%, rgba(164, 192, 224, 0.24) 72%, rgba(255, 255, 255, 0.78) 100%);
  --card-shadow:
    0 1px 2px rgba(34, 52, 78, 0.05),
    0 14px 36px -10px rgba(48, 72, 106, 0.13),
    0 34px 72px -22px rgba(48, 72, 106, 0.16),
    inset 0 1.5px 1px rgba(255, 255, 255, 0.95),
    inset 0 -1.5px 3px rgba(126, 156, 190, 0.14);
  --spotlight: rgba(255, 255, 255, 0.76);
  --noise-op: 0.032;

  --surface-bg: linear-gradient(160deg, rgba(255, 255, 255, 0.68) 0%, rgba(255, 255, 255, 0.36) 100%);
  --surface-border: rgba(255, 255, 255, 0.74);
  --surface-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 10px -4px rgba(52, 74, 108, 0.08);
  --surface-hover: linear-gradient(160deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.58) 100%);
  --well-bg: rgba(226, 235, 246, 0.44);
  --well-shadow: inset 0 2px 5px rgba(70, 94, 128, 0.09), inset 0 -1px 0 rgba(255, 255, 255, 0.88);
  --seg-bg: rgba(110, 134, 166, 0.11);
  --seg-active-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 250, 255, 0.88) 100%);
  --seg-active-shadow: 0 3px 10px -2px rgba(56, 78, 112, 0.14), inset 0 1px 0 #ffffff;

  --text-primary: #222d3d;
  --text-secondary: #586980;
  --text-muted: #8696ad;

  --num-grad: linear-gradient(180deg, #345376 0%, #648cb5 100%);
  --accent-blue: #5882ad;
  --accent-blue-soft: rgba(88, 130, 173, 0.14);
  --accent-rose: #c28388;
  --accent-rose-soft: rgba(194, 131, 136, 0.14);
  --accent-sage: #5d917d;
  --accent-sage-soft: rgba(93, 145, 125, 0.14);
  --accent-sage-border: rgba(93, 145, 125, 0.42);
  --accent-amber: #c28e52;
  --accent-amber-soft: rgba(194, 142, 82, 0.14);
  --accent-amber-border: rgba(194, 142, 82, 0.42);

  --heat-0: rgba(114, 136, 166, 0.14);
  --heat-1: rgba(93, 145, 125, 0.30);
  --heat-2: rgba(93, 145, 125, 0.54);
  --heat-3: rgba(93, 145, 125, 0.80);
  --heat-4: #4c7f6c;

  --btn-start-bg: linear-gradient(180deg, #7da4cb 0%, #5880a8 100%);
  --btn-start-shadow: 0 8px 18px -6px rgba(84, 124, 166, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  --btn-stop-bg: linear-gradient(180deg, #d68c8e 0%, #b4696d 100%);
  --btn-stop-shadow: 0 8px 18px -6px rgba(180, 105, 109, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.4);

  --divider: rgba(112, 136, 168, 0.16);
  --input-bg: rgba(255, 255, 255, 0.86);
  --input-border: rgba(88, 130, 173, 0.28);
  --toast-bg: rgba(34, 45, 61, 0.92);
  --toast-text: #f8fafc;
}

[data-theme="dark"] {
  --bg-base: #0b1019;
  --grid-dot: rgba(148, 178, 218, 0.11);
  --orb-1: rgba(76, 124, 182, 0.34);
  --orb-2: rgba(176, 108, 122, 0.25);
  --orb-3: rgba(82, 152, 126, 0.28);
  --orb-4: rgba(124, 108, 186, 0.22);

  --card-bg: linear-gradient(145deg, rgba(32, 42, 60, 0.68) 0%, rgba(19, 26, 39, 0.56) 52%, rgba(28, 38, 56, 0.66) 100%);
  --card-rim: linear-gradient(135deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.06) 42%, rgba(128, 174, 224, 0.16) 76%, rgba(255, 255, 255, 0.2) 100%);
  --card-shadow:
    0 2px 4px rgba(0, 0, 0, 0.35),
    0 24px 56px -14px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 2px rgba(0, 0, 0, 0.35);
  --spotlight: rgba(178, 212, 248, 0.14);
  --noise-op: 0.045;

  --surface-bg: linear-gradient(160deg, rgba(255, 255, 255, 0.075) 0%, rgba(255, 255, 255, 0.025) 100%);
  --surface-border: rgba(255, 255, 255, 0.1);
  --surface-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 12px -6px rgba(0, 0, 0, 0.45);
  --surface-hover: linear-gradient(160deg, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0.045) 100%);
  --well-bg: rgba(9, 13, 21, 0.48);
  --well-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.42), inset 0 -1px 0 rgba(255, 255, 255, 0.08);
  --seg-bg: rgba(8, 12, 20, 0.42);
  --seg-active-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.08) 100%);
  --seg-active-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.18);

  --text-primary: #ebf0f8;
  --text-secondary: #9aa9c0;
  --text-muted: #6c7c96;

  --num-grad: linear-gradient(180deg, #dceafb 0%, #86b0db 100%);
  --accent-blue: #90b8e0;
  --accent-blue-soft: rgba(144, 184, 224, 0.15);
  --accent-rose: #d9a0a4;
  --accent-rose-soft: rgba(217, 160, 164, 0.15);
  --accent-sage: #89bfa9;
  --accent-sage-soft: rgba(137, 191, 169, 0.14);
  --accent-sage-border: rgba(137, 191, 169, 0.42);
  --accent-amber: #e2b680;
  --accent-amber-soft: rgba(226, 182, 128, 0.15);
  --accent-amber-border: rgba(226, 182, 128, 0.42);

  --heat-0: rgba(255, 255, 255, 0.075);
  --heat-1: rgba(137, 191, 169, 0.28);
  --heat-2: rgba(137, 191, 169, 0.52);
  --heat-3: rgba(137, 191, 169, 0.78);
  --heat-4: #a2d6c1;

  --btn-start-bg: linear-gradient(180deg, #749ac0 0%, #52769c 100%);
  --btn-start-shadow: 0 8px 18px -6px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.26);
  --btn-stop-bg: linear-gradient(180deg, #c97f82 0%, #a25c61 100%);
  --btn-stop-shadow: 0 8px 18px -6px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.22);

  --divider: rgba(255, 255, 255, 0.09);
  --input-bg: rgba(11, 16, 25, 0.62);
  --input-border: rgba(144, 184, 224, 0.25);
  --toast-bg: rgba(235, 240, 248, 0.95);
  --toast-text: #141c28;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 18px 28px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text-primary);
  background-color: var(--bg-base);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.35s ease;
}

/* 建筑微点阵 + 流光极光 + 光学磨砂颗粒 */
.aurora-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 24px 24px;
}

.aurora-bg::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: var(--noise-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(76px);
  will-change: transform;
  opacity: 0.95;
}

.orb-1 { width: 580px; height: 580px; top: -150px; left: -110px; background: var(--orb-1); animation: float1 24s ease-in-out infinite alternate; }
.orb-2 { width: 520px; height: 520px; top: -70px; right: -120px; background: var(--orb-2); animation: float2 28s ease-in-out infinite alternate; }
.orb-3 { width: 620px; height: 620px; bottom: -210px; left: 26%; background: var(--orb-3); animation: float3 26s ease-in-out infinite alternate; }
.orb-4 { width: 420px; height: 420px; top: 38%; left: 46%; background: var(--orb-4); animation: float2 32s ease-in-out infinite alternate-reverse; }

@keyframes float1 { 0% { transform: translate3d(0,0,0) scale(1); } 100% { transform: translate3d(80px,55px,0) scale(1.1); } }
@keyframes float2 { 0% { transform: translate3d(0,0,0) scale(1); } 100% { transform: translate3d(-70px,65px,0) scale(1.08); } }
@keyframes float3 { 0% { transform: translate3d(0,0,0) scale(1); } 100% { transform: translate3d(45px,-55px,0) scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .orb { animation: none; } }

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1060px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

/* 光学液态磨砂玻璃卡片 */
.glass {
  position: relative;
  background: var(--card-bg);
  backdrop-filter: blur(32px) saturate(185%);
  -webkit-backdrop-filter: blur(32px) saturate(185%);
  border: none;
  border-radius: 26px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: background 0.35s ease, box-shadow 0.35s ease;
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, -20%), var(--spotlight), transparent 68%);
  opacity: var(--spot-op, 0);
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 0;
}

.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.25px;
  background: var(--card-rim);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}

.glass > * { position: relative; z-index: 1; }

/* 顶部导航 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 16px;
  border-radius: 20px;
  flex-wrap: wrap;
}

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 10px;
  background: linear-gradient(135deg, #86a6c7, #83ae9c);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(107, 144, 181, 0.28);
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: 0.4px; line-height: 1.15; }
.brand-greet { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.nav-pills {
  display: inline-flex;
  background: var(--seg-bg);
  padding: 4px;
  border-radius: 14px;
  gap: 3px;
}

.nav-btn {
  border: none; background: transparent; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; padding: 6px 14px; border-radius: 10px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.2s ease;
}
.nav-btn:hover { color: var(--text-primary); }
.nav-btn.active { background: var(--seg-active-bg); color: var(--text-primary); font-weight: 600; box-shadow: var(--seg-active-shadow); }
.nav-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.nav-badge {
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  background: var(--accent-rose); color: #fff; line-height: 1.3;
}

.top-actions { display: inline-flex; align-items: center; gap: 7px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--surface-border); background: var(--surface-bg);
  color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.18s ease;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text-primary); transform: scale(1.06); }
.icon-btn.active { background: var(--accent-sage-soft); border-color: var(--accent-sage-border); color: var(--accent-sage); }
.icon-btn.muted { opacity: 0.48; }
.icon-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }

/* 视图切换 */
.view { display: none; animation: viewIn 0.28s ease; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Bento 网格 */
.bento-focus { display: grid; grid-template-columns: 420px 1fr; gap: 18px; align-items: start; }
.bento-trends { display: grid; grid-template-columns: 1.35fr 0.85fr; gap: 18px; align-items: start; }
.bento-2col { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 18px; align-items: start; }
.bento-col { display: flex; flex-direction: column; gap: 18px; }

.panel { padding: 22px 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.panel-title { font-size: 14.5px; font-weight: 600; color: var(--text-primary); display: inline-flex; align-items: center; gap: 8px; }
.inline-actions { display: inline-flex; align-items: center; gap: 10px; }

.title-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-blue); box-shadow: 0 0 0 3px var(--accent-blue-soft); }
.title-dot.sage { background: var(--accent-sage); box-shadow: 0 0 0 3px var(--accent-sage-soft); }
.title-dot.rose { background: var(--accent-rose); box-shadow: 0 0 0 3px var(--accent-rose-soft); }

/* 倒计时 */
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.time-box {
  background: var(--well-bg); border: 1px solid var(--surface-border);
  border-radius: 16px; padding: 13px 6px 10px; text-align: center;
  box-shadow: var(--well-shadow); transition: transform 0.2s ease, background 0.25s ease;
}
.time-box:hover { transform: translateY(-2px); background: var(--surface-hover); }
.num {
  display: block; font-size: 29px; font-weight: 700; line-height: 1.15;
  background: var(--num-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums; letter-spacing: -0.6px;
}
.label { margin-top: 3px; font-size: 10px; font-weight: 600; letter-spacing: 0.9px; text-transform: uppercase; color: var(--text-muted); }

.exam-meta { margin-top: 15px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.motto-pill { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; background: var(--accent-blue-soft); color: var(--accent-blue); font-size: 12px; font-weight: 500; }
.exam-pct { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.journey-track { margin-top: 10px; height: 5px; border-radius: 999px; background: var(--divider); overflow: hidden; }
.journey-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-blue), var(--accent-sage)); transition: width 0.6s ease; }

.quote-text {
  margin-top: 13px; font-size: 12px; color: var(--text-secondary); line-height: 1.5;
  cursor: pointer; user-select: none; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 12px; background: var(--surface-bg); border: 1px solid var(--surface-border);
}
.quote-text:hover { background: var(--surface-hover); }
.quote-refresh { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

/* 统计与热力图 */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 13px; }
.stat-tile { background: var(--surface-bg); border: 1px solid var(--surface-border); box-shadow: var(--surface-shadow); border-radius: 15px; padding: 11px 10px; text-align: center; }
.stat-val { font-size: 17px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.stat-val.sage { color: var(--accent-sage); }
.stat-val.blue { color: var(--accent-blue); }
.stat-lbl { margin-top: 3px; font-size: 11px; color: var(--text-muted); }

.ratio-bar { display: flex; width: 100%; height: 6px; border-radius: 999px; overflow: hidden; background: var(--divider); gap: 2px; margin-bottom: 12px; }
.ratio-seg { height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.seg-math { background: var(--accent-blue); }
.seg-english { background: var(--accent-rose); }
.seg-comm { background: var(--accent-sage); }

.imbalance-mini {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  padding: 8px 11px; border-radius: 12px; cursor: pointer;
  background: var(--accent-amber-soft); border: 1px solid var(--accent-amber-border);
  font-size: 12px; color: var(--text-primary); line-height: 1.45;
  transition: transform 0.15s ease;
}
.imbalance-mini:hover { transform: translateY(-1px); }
.imbalance-mini.balanced { background: var(--accent-sage-soft); border-color: var(--accent-sage-border); }
.imbalance-tag {
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--accent-amber); color: #fff; flex-shrink: 0;
}
.imbalance-mini.balanced .imbalance-tag { background: var(--accent-sage); }

.heat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.heat-label { font-size: 11.5px; color: var(--text-secondary); font-weight: 500; }
.heat-legend { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--text-muted); }
.legend-sq { width: 9px; height: 9px; border-radius: 2.5px; display: inline-block; }

.heat-grid { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; }
.heat-dot { aspect-ratio: 1; border-radius: 4px; background: var(--heat-0); transition: transform 0.15s ease, background 0.3s ease; }
.heat-dot:hover { transform: scale(1.22); }
.heat-dot.l1 { background: var(--heat-1); }
.heat-dot.l2 { background: var(--heat-2); }
.heat-dot.l3 { background: var(--heat-3); }
.heat-dot.l4 { background: var(--heat-4); }
.heat-dot.today { box-shadow: 0 0 0 1.5px var(--accent-sage); }

/* ECharts 容器与偏科诊断报告 */
.chart-box { width: 100%; height: 340px; }
.chart-box-sm { height: 220px; }
.imbalance-report {
  margin-top: 12px; padding: 13px 15px; border-radius: 16px;
  background: var(--surface-bg); border: 1px solid var(--surface-border);
  font-size: 12.5px; line-height: 1.65; color: var(--text-secondary);
}
.imbalance-report strong { color: var(--text-primary); }
.imbalance-report .warn-line { color: var(--accent-rose); font-weight: 600; margin-bottom: 4px; }

/* 计时器与焦点横幅 */
.active-banner { display: none; margin-bottom: 14px; padding: 14px 16px; border-radius: 18px; background: var(--accent-sage-soft); border: 1px solid var(--accent-sage-border); }
.active-banner.visible { display: block; }
.active-banner.warning { background: var(--accent-amber-soft); border-color: var(--accent-amber-border); }
.active-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.active-info { min-width: 0; }
.active-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--accent-sage); }
.active-banner.warning .active-label { color: var(--accent-amber); }
.active-clock { margin-top: 3px; font-size: 24px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.active-sub { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.active-btns { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; }

.zen-trigger {
  width: 33px; height: 33px; border-radius: 50%; border: 1px solid var(--accent-sage-border);
  background: var(--surface-bg); color: var(--accent-sage); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.zen-trigger:hover { background: var(--surface-hover); transform: scale(1.06); }
.zen-trigger svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.active-prog-track { margin-top: 10px; height: 4px; border-radius: 999px; background: rgba(93, 145, 125, 0.18); overflow: hidden; display: none; }
.active-prog-track.show { display: block; }
.active-prog-fill { height: 100%; border-radius: 999px; background: var(--accent-sage); transition: width 0.8s linear; }

.guard-box { display: none; margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--accent-amber-border); justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.guard-box.show { display: flex; }
.guard-msg { font-size: 12px; color: var(--accent-amber); font-weight: 500; }
.guard-actions { display: inline-flex; gap: 6px; }
.mini-btn { border: 1px solid var(--accent-amber-border); background: var(--surface-bg); color: var(--text-primary); font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.mini-btn:hover { background: var(--surface-hover); }

.preset-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; flex-wrap: wrap; }
.preset-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.seg-group { display: inline-flex; background: var(--seg-bg); padding: 3px; border-radius: 11px; gap: 2px; flex-wrap: wrap; }
.seg-btn { border: none; background: transparent; color: var(--text-secondary); font-size: 11.5px; font-weight: 500; padding: 4px 9px; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; }
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.active { background: var(--seg-active-bg); color: var(--text-primary); font-weight: 600; box-shadow: var(--seg-active-shadow); }

.login-box { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.login-row { display: flex; gap: 10px; }

.text-input, .tag-select, .mini-area, .note-area {
  background: var(--input-bg); border: 1.25px solid var(--input-border);
  border-radius: 13px; color: var(--text-primary); font-family: inherit;
  outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* 未登录态清晰门禁卡片 */
body.is-locked .auth-only,
body.is-locked .nav-pills,
body.is-locked #view-trends,
body.is-locked #view-plan,
body.is-locked #view-study {
  display: none !important;
}

body.is-locked .bento-focus {
  grid-template-columns: minmax(0, 520px);
  justify-content: center;
}

.auth-gate {
  display: flex;
  justify-content: center;
  width: 100%;
}

.auth-card {
  width: 100%;
  max-width: 520px;
  text-align: center;
  padding: 28px 28px 24px;
}

.auth-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-icon svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-desc {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.auth-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.auth-input {
  padding: 11px 14px;
  font-size: 14px;
}

.auth-submit {
  padding: 11px 22px;
  font-size: 13.5px;
}

.auth-card .login-msg {
  margin-top: 10px;
  text-align: center;
}
.text-input { flex: 1; min-width: 0; padding: 9.5px 13px; font-size: 13.5px; }
.tag-select { padding: 0 10px; font-size: 12.5px; cursor: pointer; }
.text-input::placeholder, .mini-area::placeholder, .note-area::placeholder { color: var(--text-muted); }
.text-input:focus, .mini-area:focus, .note-area:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px var(--accent-blue-soft); }
.login-msg { font-size: 12px; color: var(--accent-rose); min-height: 16px; }

.subject-list { display: flex; flex-direction: column; gap: 10px; }
.subject {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface-bg); border: 1px solid var(--surface-border);
  box-shadow: var(--surface-shadow); border-radius: 17px; padding: 13px 15px;
  transition: all 0.22s ease;
}
.subject:hover { background: var(--surface-hover); transform: translateY(-1px); }
.subject.running { background: var(--accent-sage-soft); border-color: var(--accent-sage-border); box-shadow: 0 10px 24px -12px rgba(93, 145, 125, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.subject-left { min-width: 0; flex: 1; }
.subject-title-row { display: flex; align-items: center; gap: 8px; }
.subj-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-math { background: var(--accent-blue); }
.dot-english { background: var(--accent-rose); }
.dot-comm { background: var(--accent-sage); }
.subject-name { font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subject-status { margin-top: 3px; padding-left: 16px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; min-height: 17px; }
.subject.running .subject-status { color: var(--accent-sage); font-weight: 500; }

.pulse-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; animation: pulse 1.8s ease-in-out infinite; }
.subject:not(.running) .pulse-dot { display: none; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.8); } }

.subject-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.subject-total { font-size: 15px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }

.btn {
  border: none; border-radius: 999px; padding: 7.5px 16px;
  font-size: 12.5px; font-weight: 600; color: #fff;
  background: var(--btn-start-bg); box-shadow: var(--btn-start-shadow);
  cursor: pointer; white-space: nowrap; transition: opacity 0.2s ease, transform 0.15s ease;
}
.btn:hover:not(:disabled) { opacity: 0.94; transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.stop { background: var(--btn-stop-bg); box-shadow: var(--btn-stop-shadow); }
.btn-sq { border-radius: 13px; padding: 9.5px 18px; }

.tracker-foot { margin-top: 13px; display: flex; justify-content: space-between; align-items: center; padding: 0 2px; gap: 8px; }
.sync-hint { font-size: 11.5px; color: var(--text-muted); }
.link-btn { background: none; border: none; color: var(--text-secondary); font-size: 12px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.link-btn:hover { color: var(--text-primary); background: var(--surface-bg); }
.preview-badge { display: none; font-size: 10.5px; padding: 2px 7px; border-radius: 999px; background: var(--accent-blue-soft); color: var(--accent-blue); }

/* Todos */
.todo-add { display: flex; gap: 8px; margin-bottom: 12px; }
.todo-list { display: flex; flex-direction: column; gap: 8px; }
.todo-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 13px; border-radius: 14px; background: var(--surface-bg);
  border: 1px solid var(--surface-border); transition: background 0.2s ease, opacity 0.2s ease;
}
.todo-item:hover { background: var(--surface-hover); }
.todo-item.done { opacity: 0.56; }
.todo-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; cursor: pointer; }
.todo-check {
  width: 18px; height: 18px; border-radius: 6px; border: 1.8px solid var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.todo-item.done .todo-check { background: var(--accent-sage); border-color: var(--accent-sage); color: #fff; }
.todo-check svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; display: none; }
.todo-item.done .todo-check svg { display: block; }
.todo-text { font-size: 13.5px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--text-muted); }

.todo-tag { font-size: 10.5px; padding: 2px 7px; border-radius: 999px; font-weight: 500; flex-shrink: 0; }
.tag-math { background: var(--accent-blue-soft); color: var(--accent-blue); }
.tag-english { background: var(--accent-rose-soft); color: var(--accent-rose); }
.tag-comm { background: var(--accent-sage-soft); color: var(--accent-sage); }
.tag-other { background: var(--accent-amber-soft); color: var(--accent-amber); }

.todo-del { border: none; background: none; color: var(--text-muted); font-size: 15px; cursor: pointer; padding: 0 4px; opacity: 0; }
.todo-item:hover .todo-del { opacity: 1; }
.todo-del:hover { color: var(--accent-rose); }
.empty-hint { text-align: center; font-size: 12.5px; color: var(--text-muted); padding: 18px 8px; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.stage { position: relative; padding: 13px 15px 13px 38px; border-radius: 16px; background: var(--surface-bg); border: 1px solid var(--surface-border); }
.stage.current { background: var(--accent-blue-soft); border-color: rgba(88, 130, 173, 0.36); }
.stage-dot { position: absolute; left: 15px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); }
.stage.current .stage-dot { background: var(--accent-blue); box-shadow: 0 0 0 4px var(--accent-blue-soft); }
.stage-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stage-name { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.stage-date { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.stage-desc { margin-top: 4px; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* KaTeX 公式便签 */
.formula-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.chip-btn {
  border: 1px solid var(--surface-border); background: var(--surface-bg);
  color: var(--text-secondary); font-size: 11.5px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px; cursor: pointer; transition: all 0.18s ease;
}
.chip-btn:hover { background: var(--surface-hover); color: var(--accent-blue); border-color: var(--accent-blue); }

.katex-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.note-area {
  width: 100%; min-height: 240px; resize: vertical; padding: 14px 15px;
  font-size: 13px; line-height: 1.7; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang SC", monospace;
}
.note-preview {
  min-height: 240px; max-height: 420px; overflow-y: auto;
  padding: 14px 16px; border-radius: 14px;
  background: var(--well-bg); border: 1px solid var(--surface-border);
  box-shadow: var(--well-shadow); font-size: 13.5px; line-height: 1.75; color: var(--text-primary);
}
.note-preview h3 { font-size: 14.5px; margin: 4px 0 8px; color: var(--accent-blue); }
.note-preview p { margin-bottom: 8px; }
.note-preview .katex-display { margin: 8px 0; overflow-x: auto; overflow-y: hidden; }

/* 艾宾浩斯错题本 */
.mistake-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--divider); }
.mistake-form-row { display: flex; gap: 8px; }
.mini-area { width: 100%; min-height: 58px; resize: vertical; padding: 8px 12px; font-size: 12.5px; line-height: 1.55; }
.mistake-form-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

.mistake-list { display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow-y: auto; padding-right: 2px; }
.mistake-card {
  padding: 13px 15px; border-radius: 16px;
  background: var(--surface-bg); border: 1px solid var(--surface-border);
  box-shadow: var(--surface-shadow);
}
.mistake-card.due { border-color: var(--accent-amber-border); background: var(--accent-amber-soft); }
.mistake-card.mastered { opacity: 0.65; }
.mistake-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.mistake-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); display: inline-flex; align-items: center; gap: 7px; }
.mistake-stage { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.mistake-body { font-size: 12.5px; line-height: 1.65; color: var(--text-secondary); margin-bottom: 6px; }
.mistake-ans {
  font-size: 12.5px; line-height: 1.65; color: var(--text-primary);
  padding: 8px 11px; border-radius: 11px; background: var(--well-bg); margin-bottom: 9px;
}
.mistake-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-btns { display: inline-flex; gap: 6px; }
.rev-btn {
  border: 1px solid var(--surface-border); background: var(--surface-bg); color: var(--text-primary);
  font-size: 11.5px; font-weight: 600; padding: 4px 11px; border-radius: 999px; cursor: pointer;
}
.rev-btn.ok { background: var(--accent-sage-soft); border-color: var(--accent-sage-border); color: var(--accent-sage); }
.rev-btn.no { background: var(--accent-rose-soft); border-color: rgba(194, 131, 136, 0.4); color: var(--accent-rose); }

/* 快捷传送门 */
.links-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.portal-card {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 12px 13px;
  border-radius: 15px; background: var(--surface-bg); border: 1px solid var(--surface-border);
  box-shadow: var(--surface-shadow); text-decoration: none; color: var(--text-primary);
  transition: transform 0.18s ease, background 0.2s ease;
}
.portal-card:hover { transform: translateY(-2px); background: var(--surface-hover); }
.portal-ico {
  width: 34px; height: 34px; border-radius: 11px; background: var(--accent-blue-soft); color: var(--accent-blue);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.portal-meta { min-width: 0; flex: 1; }
.portal-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-del { position: absolute; top: 6px; right: 7px; border: none; background: none; color: var(--text-muted); font-size: 14px; cursor: pointer; opacity: 0; }
.portal-card:hover .portal-del { opacity: 1; }
.portal-del:hover { color: var(--accent-rose); }
.add-link-row { display: flex; gap: 8px; flex-wrap: wrap; }

.footer { position: relative; z-index: 1; margin-top: 22px; font-size: 11.5px; text-align: center; }
.footer a { color: var(--text-muted); text-decoration: none; }
.footer a:hover { color: var(--accent-blue); }

/* Zen Mode */
.zen-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 28px 20px;
  background: rgba(234, 240, 247, 0.86); backdrop-filter: blur(36px) saturate(160%); -webkit-backdrop-filter: blur(36px) saturate(160%);
  opacity: 0; pointer-events: none; transform: scale(1.03); transition: opacity 0.36s ease, transform 0.36s ease;
}
[data-theme="dark"] .zen-overlay { background: rgba(11, 16, 25, 0.88); }
.zen-overlay.open { opacity: 1; pointer-events: auto; transform: scale(1); }
.zen-close { position: absolute; top: 24px; right: 24px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--surface-border); background: var(--surface-bg); color: var(--text-secondary); font-size: 12px; cursor: pointer; }
.zen-ring-wrap { position: relative; width: 272px; height: 272px; display: flex; justify-content: center; align-items: center; }
.zen-breath { position: absolute; inset: 14px; border-radius: 50%; background: radial-gradient(circle, var(--accent-sage-soft) 0%, transparent 70%); animation: zenBreath 5.2s ease-in-out infinite; }
@keyframes zenBreath { 0%, 100% { transform: scale(0.94); opacity: 0.55; } 50% { transform: scale(1.08); opacity: 1; } }
.zen-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.zen-track { fill: none; stroke: var(--divider); stroke-width: 5; }
.zen-progress { fill: none; stroke: var(--accent-sage); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 722.57; stroke-dashoffset: 0; transition: stroke-dashoffset 0.8s linear; }
.zen-center { position: relative; text-align: center; }
.zen-subj { font-size: 13px; font-weight: 600; color: var(--accent-sage); letter-spacing: 0.8px; }
.zen-time { margin-top: 8px; font-size: 42px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.zen-sub { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.zen-quote { margin-top: 28px; font-size: 13px; color: var(--text-secondary); text-align: center; }
.zen-actions { margin-top: 24px; display: inline-flex; gap: 10px; }

#sparkCanvas { position: fixed; inset: 0; pointer-events: none; z-index: 90; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(16px);
  background: var(--toast-bg); color: var(--toast-text); padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 500; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: calc(100vw - 32px); text-align: center; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .bento-focus, .bento-trends, .bento-2col, .katex-split { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body { padding: 14px 12px 22px; }
  .topbar { padding: 10px 12px; }
  .nav-pills { order: 3; width: 100%; justify-content: space-between; }
  .nav-btn { flex: 1; justify-content: center; padding: 6px 6px; font-size: 12px; }
  .panel { padding: 18px 16px; }
  .num { font-size: 24px; }
  .links-grid { grid-template-columns: 1fr; }
  .login-row, .todo-add, .mistake-form-row { flex-wrap: wrap; }
}
