@font-face { font-family: 'Baloo 2'; src: url('/fonts/baloo2-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('/fonts/baloo2-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --paper: #faf5ea;
  --card: #ffffff;
  --ink: #1e2235;
  --muted: #6a6f87;
  --line: #ede5d3;
  --accent: #ff6a3d;
  --accent-deep: #d4471b;
  --mint: #17a589;
  --amber: #f2a007;
  --radius: 28px;
  --tap: 64px;
  --font: 'Baloo 2', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  /* Baloo 2 只有 700/800，正文段落用系统字体，免得数字比汉字粗 */
  --font-body: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  /* Wow 官方 8 个级别色，和 server/catalog.ts 一致 */
  --levels: linear-gradient(90deg,
    #f2b705 0 12.5%, #2f7de1 0 25%, #e0454b 0 37.5%, #2e9e62 0 50%,
    #f27a1a 0 62.5%, #a86a32 0 75%, #8c96a3 0 87.5%, #c59a1b 0);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(30, 34, 53, 0.07) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, summary:focus-visible, input:focus-visible { outline: 4px solid rgba(255, 106, 61, 0.45); outline-offset: 4px; }
svg { width: 1em; height: 1em; flex: none; }

.view { min-height: 100%; }
#home, #library, #episodes, #stats { max-width: 760px; margin: 0 auto; padding: 28px 24px 120px; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 26px; font-weight: 800; }
.brand small { margin-left: 4px; font-size: 16px; font-weight: 700; color: var(--muted); }
.brand-mark {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px;
  background: var(--accent); color: #fff; font-size: 28px; box-shadow: 0 5px 0 var(--accent-deep); transform: rotate(-6deg);
}
.icon-btn {
  display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 20px;
  background: var(--card); border: 2px solid var(--line); font-size: 28px; color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
}
.icon-btn:hover { color: var(--ink); border-color: #ddd2bb; }

.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: 0 24px 48px -28px rgba(30, 34, 53, 0.35); }
.today { position: relative; overflow: hidden; padding: 44px 40px 20px; animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
/* 顶边一条级别色带：8 个 Wow 级别从黄到金，像一排蜡笔 */
.today::before { content: ''; position: absolute; inset: 0 0 auto; height: 8px; background: var(--levels); }
.eyebrow { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
.today h1 { margin: 6px 0 22px; font-size: 52px; font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; }

/* 进度点：看过 = 绿底白勾；下一集 = 季色实心 + 光圈；之后 = 季色空心圈 */
.dots { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 34px; padding: 0; list-style: none; }
.dots li { width: 34px; height: 34px; border-radius: 50%; border: 5px solid var(--c, var(--line)); background: var(--card); }
.dots li:first-child:not(.done), .dots li.done + li:not(.done) {
  background: var(--c); box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 28%, transparent);
}
.dots li.done {
  border-color: var(--mint);
  background: var(--mint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 12.5l4.2 4.2L18.5 7.5'/%3E%3C/svg%3E") center / 100% no-repeat;
}

.cta {
  display: flex; align-items: center; justify-content: center; gap: 16px; width: 100%; min-height: 104px; padding: 0 32px;
  border-radius: 30px; background: var(--accent); color: #fff; font-size: 34px; font-weight: 800;
  box-shadow: 0 10px 0 var(--accent-deep); transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
.cta svg { font-size: 40px; }
.cta:hover:not(:disabled) { filter: brightness(1.05); }
.cta:active { transform: translateY(8px); box-shadow: 0 2px 0 var(--accent-deep); }
/* 队列空（看完或没片）时不留一个按不动的大灰键，标题和打勾的点已说明一切 */
.cta:disabled { display: none; }
.cta.small { min-height: var(--tap); font-size: 22px; box-shadow: 0 6px 0 var(--accent-deep); }
.cta.small:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--accent-deep); }

.list { margin-top: 30px; border-top: 2px dashed var(--line); }
.list summary {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap);
  font-size: 18px; font-weight: 700; color: var(--muted); cursor: pointer; list-style: none;
}
.list summary::-webkit-details-marker { display: none; }
.list summary::before {
  content: ''; width: 9px; height: 9px; margin: 0 4px 0 2px;
  border: solid currentColor; border-width: 0 3px 3px 0; transform: rotate(-45deg); transition: transform 0.2s;
}
.list[open] summary::before { transform: rotate(45deg) translate(-2px, -2px); }
.list summary:hover { color: var(--ink); }
.list ol { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 16px; background: var(--paper); font-size: 17px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 2px 12px 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 18%, #fff); color: var(--ink);
  font-size: 14px; font-weight: 800; text-transform: capitalize;
}
.chip::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.kind { font-size: 14px; font-weight: 700; color: var(--muted); }

/* 我的动画 / 片库 */
.mine { margin-top: 36px; animation: rise 0.5s 0.08s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 14px; }
.sec-head h2 { margin: 0; font-size: 26px; font-weight: 800; }
.link-btn { min-height: 48px; padding: 0 8px; font-size: 19px; font-weight: 800; color: var(--accent); }
.link-btn:hover { color: var(--accent-deep); }
.series-list { display: grid; gap: 16px; }
.series-card { padding: 24px 28px; }
.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sc-head h3 { margin: 0; font-size: 26px; font-weight: 800; }
.sc-meta { margin: 0; font-size: 17px; font-weight: 700; color: var(--muted); }
.series-card > .sc-meta { margin-top: 4px; }
/* 季色条：每季一段，段宽按集数（flex-grow），--p 是已看比例 */
.sbar { display: flex; gap: 4px; height: 14px; margin: 16px 0 14px; }
.sbar span {
  flex: 1 1 0; min-width: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--c) var(--p), color-mix(in srgb, var(--c) 20%, #fff) 0);
}
.sc-next { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; font-size: 17px; font-weight: 700; color: var(--muted); }
.sc-empty { margin: 0 4px 16px; font-family: var(--font-body); font-size: 17px; color: var(--muted); }
.sub-btn {
  flex: none; min-height: 48px; padding: 0 20px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 18px; font-weight: 800; box-shadow: 0 4px 0 var(--accent-deep);
}
.sub-btn.on { background: color-mix(in srgb, var(--mint) 12%, #fff); color: var(--mint); box-shadow: inset 0 0 0 2px var(--mint); }
.sub-btn:disabled, .step-btn:disabled { opacity: 0.45; cursor: default; }
.seasons { display: grid; gap: 10px; margin: 18px 0 6px; padding: 0; list-style: none; }
.seasons li { display: grid; grid-template-columns: 96px 1fr 64px; align-items: center; gap: 14px; }
.seasons .chip { justify-self: start; }
.seasons .sbar { margin: 0; height: 12px; }
.count { text-align: right; font-size: 16px; font-weight: 700; color: var(--muted); }
.stepper {
  display: flex; align-items: center; gap: 14px; margin-top: 18px; padding-top: 16px;
  border-top: 2px dashed var(--line); font-size: 19px; font-weight: 700;
}
.stepper span { margin-right: auto; }
.stepper b { min-width: 28px; text-align: center; font-size: 24px; }
.step-btn { width: 48px; height: 48px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); font-size: 26px; font-weight: 800; }
.step-btn:hover:not(:disabled) { border-color: #ddd2bb; }
.lib-title { margin: 0 auto 0 16px; font-size: 34px; font-weight: 800; }
.lib-count { font-size: 17px; font-weight: 700; color: var(--muted); }
.group-title { margin: 28px 4px 12px; font-size: 20px; font-weight: 800; color: var(--muted); }
.lib-error { margin: 0 0 12px; padding: 12px 16px; border-radius: 16px; background: #fdecea; color: #a8312a; font-weight: 700; }
.bili-form { display: grid; grid-template-columns: 1fr 180px 120px; gap: 12px; align-items: center; padding: 20px 24px; }
.bili-form input {
  min-width: 0; min-height: var(--tap); padding: 0 16px; border: 2px solid var(--line); border-radius: 16px;
  background: var(--paper); color: var(--ink); font: 18px/1.4 var(--font-body);
}
.bili-form input:focus { outline: none; border-color: var(--accent); }
.bili-form .cta:disabled { display: flex; opacity: 0.5; }
.bili-form p { grid-column: 1 / -1; margin: 0; }
.bili-list { margin-top: 16px; padding-top: 12px; border-top: 2px dashed var(--line); }
.bili-list summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-size: 17px; font-weight: 700; color: var(--muted); }
.bili-list ul { display: grid; gap: 2px; margin: 4px 0 0; padding: 0; list-style: none; }
.bili-list li { display: flex; align-items: center; gap: 12px; font: 16px/1.5 var(--font-body); }
.bili-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* B 站系列可以改名：标题旁的 ✎ 进改名，标题那行换成输入框 */
.bili-edit { flex: none; width: 44px; height: 44px; margin: -8px auto 0 -10px; border-radius: 12px; font-size: 22px; color: var(--muted); }
.bili-edit:hover { color: var(--accent-deep); background: #fff0e8; }
.bili-rename { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 10px; }
.bili-rename input {
  flex: 1 1 200px; min-width: 0; min-height: var(--tap); padding: 0 16px; border: 2px solid var(--line); border-radius: 16px;
  background: var(--paper); color: var(--ink); font: 800 22px/1.4 var(--font);
}
.bili-rename input:focus { outline: none; border-color: var(--accent); }
.bili-rename p { flex-basis: 100%; margin: 0; }
@media (max-width: 640px) { .bili-form { grid-template-columns: 1fr; } }

/* 系列卡片可点进选集页 */
.series-card[tabindex] { cursor: pointer; transition: border-color 0.15s; }
.series-card[tabindex]:hover { border-color: #ddd2bb; }
.series-card:focus-visible { outline: 4px solid rgba(255, 106, 61, 0.45); outline-offset: 4px; }
/* 选集页：季切换 + 每集一行，✓ = 学习里看过 */
.ep-seasons { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 4px 20px; }
.ep-seasons .chip { min-height: 48px; padding: 0 20px 0 16px; font-size: 18px; }
.ep-seasons .chip[aria-pressed='true'] { background: color-mix(in srgb, var(--c) 45%, #fff); box-shadow: inset 0 0 0 3px var(--c); }
.ep-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ep-row {
  display: grid; grid-template-columns: 40px 1fr 28px; align-items: center; gap: 14px; width: 100%; min-height: var(--tap);
  padding: 10px 20px; border-radius: 20px; border: 2px solid var(--line); background: var(--card); text-align: left; font-size: 20px; font-weight: 700;
}
.ep-row:hover { border-color: #ddd2bb; }
.ep-no { text-align: right; font-size: 17px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ep-name::first-letter { text-transform: uppercase; }
.ep-seen { text-align: center; font-size: 22px; font-weight: 800; color: var(--mint); }

/* 观看统计 */
.top-actions { display: flex; gap: 12px; }
.stat-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { padding: 18px 20px; }
.stat-card small { display: block; font-size: 15px; font-weight: 700; color: var(--muted); }
.stat-card b { display: block; margin-top: 4px; font-size: 26px; font-weight: 800; white-space: nowrap; }
.stat-series { margin-bottom: 18px; }
.stat-series .group-title { margin-top: 0; }
.ss-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.ss-list li { padding: 18px 24px; }
.ss-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.ss-title { font-size: 22px; font-weight: 800; }
.ss-total { font-size: 28px; font-weight: 800; white-space: nowrap; }
.ss-meta { margin: 6px 0 0; font-size: 15px; font-weight: 700; color: var(--muted); }.stat-chart { padding: 22px 24px 16px; margin-bottom: 18px; }
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.chart-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; margin-left: 6px; border-radius: 4px; }
.lg-today { background: var(--accent); }
.lg-free { background: var(--mint); }
/* 每天一根柱：::before 今日队列在下，::after 自由在上；高度由 --t/--f（磨耳朵 --l）按 30 天里最大一天折算 */
.bars { display: flex; align-items: stretch; gap: 3px; height: 140px; margin: 0; padding: 0; list-style: none; border-bottom: 2px solid var(--line); }
.bars li { flex: 1; min-width: 0; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; }
.bars li:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.bars li::before { content: ''; height: var(--t, 0%); background: var(--accent); }
.bars li::after { content: ''; height: var(--f, 0%); background: var(--mint); border-radius: 4px 4px 0 0; }
.bars.loop { height: 90px; }
.bars.loop li::before { height: var(--l, 0%); background: var(--amber); border-radius: 4px 4px 0 0; }
.bars.loop li::after { display: none; }
.bars-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.stat-episodes { margin-top: 28px; }
#st-sort { min-height: 44px; padding: 6px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: 700 16px var(--font); }
.st-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.st-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 12px; padding: 14px 18px; border: 2px solid var(--line); border-radius: 18px; background: var(--card); }
.st-name { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.st-name::first-letter { text-transform: uppercase; }
.st-meta { grid-column: 2; font-size: 15px; font-weight: 700; color: var(--muted); }
@media (max-width: 640px) {
  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card b { font-size: 22px; }
}

.loop-bar {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 48px); padding: 14px 24px;
  border-radius: 999px; background: var(--ink); color: #fff; font-size: 18px; font-weight: 700;
  white-space: nowrap; overflow: hidden; box-shadow: 0 16px 32px -16px rgba(30, 34, 53, 0.6);
}
#loop-text { overflow: hidden; text-overflow: ellipsis; }
.loop-dot { width: 12px; height: 12px; border-radius: 50%; background: #8b90a6; flex: none; }
.loop-bar[data-state='on'] .loop-dot { background: var(--mint); animation: pulse 1.6s ease-in-out infinite; }
.loop-bar[data-state='paused'] .loop-dot { background: var(--amber); }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(23, 165, 137, 0.25); } }

#player { position: fixed; inset: 0; background: #000; }
#video { display: block; width: 100%; height: 100%; object-fit: contain; }
/* z-index 高于片尾浮层：浮层出现时仍能点退出 */
.player-top {
  position: absolute; inset: 0 0 auto; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 36px 24px 20px; background: linear-gradient(rgba(0, 0, 0, 0.55), transparent);
  color: #fff; font-size: 20px; font-weight: 700; opacity: 0; transition: opacity 0.3s;
}
#now-title::first-letter { text-transform: uppercase; }
/* 分开写：Chrome 不认 :paused，写在同一个选择器列表里会让整条规则失效 */
#player:hover .player-top { opacity: 1; }
#player:has(#ended:not([hidden])) .player-top { opacity: 1; }
#player:has(video:paused) .player-top { opacity: 1; }
/* 两条进度条常显，片尾浮层上也看得到；不接点击，点画面照样暂停 */
/* 顶条：今日队列一集一段，同首页进度点：看过绿、在看季色加高、没看季色淡色。z-index 高于标题栏，免得被它的渐变压暗 */
.queue-bar {
  position: absolute; top: 14px; left: 24px; right: 24px; z-index: 3; display: flex; align-items: center; gap: 6px;
  height: 14px; margin: 0; padding: 0; list-style: none; pointer-events: none;
}
.queue-bar li { flex: 1; height: 8px; border-radius: 4px; background: var(--c); opacity: 0.4; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.queue-bar li.now { height: 14px; border-radius: 7px; opacity: 1; }
.queue-bar li.done { background: var(--mint); opacity: 1; }
.video-bar {
  position: absolute; bottom: 16px; left: 24px; right: 24px; z-index: 2; display: flex; align-items: center; gap: 14px;
  color: #fff; font-size: 16px; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); pointer-events: none;
}
.video-track { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.3); overflow: hidden; }
#video-fill { display: block; width: calc(var(--p, 0) * 100%); height: 100%; background: #fff; }
#video-time { font-variant-numeric: tabular-nums; }
.icon-btn.dark { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.22); color: #fff; }
.icon-btn.dark:hover { background: rgba(255, 255, 255, 0.24); }
.ended {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 40px;
  background: rgba(22, 19, 14, 0.8);
}
.big-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  width: 300px; height: 220px; border-radius: 40px; font-size: 34px; font-weight: 800;
  transition: transform 0.08s, box-shadow 0.08s;
  animation: pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3) backwards;
}
.big-btn + .big-btn { animation-delay: 0.08s; }
.big-btn svg { font-size: 64px; }
.big-btn.primary { background: var(--accent); color: #fff; box-shadow: 0 12px 0 var(--accent-deep); }
.big-btn.secondary { background: #fff; color: var(--ink); box-shadow: 0 12px 0 #c9c2b2; }
.big-btn:active { transform: translateY(10px); box-shadow: 0 2px 0 transparent; }

#done { display: grid; place-items: center; padding: 24px; }
.done-card {
  position: relative; overflow: hidden; width: min(560px, 100%); padding: 56px 40px 40px; text-align: center;
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}
.done-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 8px; background: var(--levels); }
.done-badge {
  display: grid; place-items: center; width: 120px; height: 120px; margin: 0 auto 24px; border-radius: 50%;
  background: #f2b705; color: #fff; font-size: 64px; box-shadow: 0 8px 0 #c48f00, 0 0 0 12px #fdf0c4;
  animation: pop 0.5s 0.15s cubic-bezier(0.2, 0.9, 0.3, 1.4) backwards;
}
.done-card h1 { margin: 0 0 10px; font-size: 44px; }
.done-card p { margin: 0 0 32px; font-family: var(--font-body); font-size: 19px; line-height: 1.6; color: var(--muted); }

/* 家长设置使用独立的紧凑排版，不继承儿童播放按钮的立体效果。 */
#settings { --settings-surface: #fffcf8; --settings-border: #e9e1d7; width: min(820px, calc(100% - 64px)); height: min(760px, calc(100dvh - 64px)); max-height: calc(100dvh - 64px); padding: 0; border: 1px solid var(--settings-border); border-radius: 22px; background: var(--settings-surface); color: var(--ink); font: 16px/1.5 var(--font-body); overflow: hidden; box-shadow: 0 24px 80px #221c2733; }
#settings[open] { display: flex; flex-direction: column; }
#settings::backdrop { background: #211b285c; }
.settings-head { display: flex; align-items: center; justify-content: space-between; flex: none; padding: 24px 32px 18px; }
.settings-kicker { margin: 0 0 4px; color: var(--accent-deep); font-size: 11px; font-weight: 700; letter-spacing: .12em; }
#settings h2 { margin: 0; font-size: 25px; font-weight: 650; }
#settings h3 { margin: 0; font-size: 17px; font-weight: 650; }
.settings-close { width: 44px; height: 44px; border-radius: 12px; color: var(--muted); font-size: 20px; }
.settings-close:hover { background: #f1eae1; }
.settings-tabs { display: flex; flex: none; gap: 28px; padding: 0 32px; border-bottom: 1px solid var(--settings-border); }
.settings-tabs button { padding: 12px 4px; min-height: 48px; border-bottom: 3px solid transparent; font-weight: 600; color: var(--muted); }
.settings-tabs button[aria-selected='true'] { color: var(--accent-deep); border-color: var(--accent-deep); }
.settings-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 32px 32px; scrollbar-gutter: stable; }
#settings fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
#settings button { transition: background .15s, color .15s; }
#settings button:disabled, #settings input:disabled { opacity: .5; cursor: not-allowed; }
#settings :focus-visible { outline: 3px solid #d4471b80; outline-offset: 3px; }
#settings .link-btn { min-height: 44px; font: 600 14px var(--font-body); color: var(--accent-deep); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; cursor: pointer; font-weight: 600; }
.switch small { display: block; margin-top: 4px; font-size: 14px; font-weight: 400; color: var(--muted); }
.switch input { position: relative; flex: none; width: 48px; height: 28px; margin: 8px 0; border-radius: 999px; background: #b3ada5; appearance: none; cursor: pointer; transition: background .2s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #0002; transition: transform .2s; }
.switch input:checked { background: var(--accent-deep); }
.switch input:checked::after { transform: translateX(20px); }
.settings-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.win-group { margin-top: 28px; }
.win-group h3 small { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; font-weight: 400; }
.win-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.win-list:empty::after { content: '暂无时段'; padding: 12px 0; font-size: 14px; color: var(--muted); }
.win-list li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--settings-border); border-radius: 12px; background: white; color: var(--muted); }
#settings input[type='time'], #settings select, #settings textarea { min-width: 0; min-height: 44px; padding: 9px 12px; border: 1px solid var(--settings-border); border-radius: 8px; background: white; color: var(--ink); font: 16px/1.5 var(--font-body); }
.win-list input[type='time'] { flex: 1; width: 0; font-variant-numeric: tabular-nums; }
.win-del { flex: none; width: 44px; height: 44px; border-radius: 8px; font-size: 18px; }
.win-del:hover { background: #fff0e8; color: var(--accent-deep); }
.settings-help { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--settings-border); color: var(--muted); font-size: 14px; }
.settings-help summary { min-height: 44px; display: list-item; align-content: center; cursor: pointer; }
.settings-help p { margin: 4px 0 0; line-height: 1.8; }
.settings-actions { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 32px; border-top: 1px solid var(--settings-border); background: var(--settings-surface); }
#settings-draft-note { color: var(--muted); font-size: 13px; }
.dialog-actions { display: flex; gap: 10px; }
#settings .ghost-btn, .settings-primary { min-height: 44px; padding: 10px 18px; border-radius: 10px; font: 600 14px/1.5 var(--font-body); white-space: nowrap; }
#settings .ghost-btn { border: 1px solid var(--settings-border); background: white; color: var(--ink); }
.settings-primary { background: var(--accent-deep); color: white; }
.settings-primary:hover:not(:disabled) { background: #b63b16; }
.reminder-message { margin: 6px 0; font: 13px/1.7 var(--font-body); color: var(--muted); overflow-wrap: anywhere; }
.reminder-message:empty { display: none; }
.reminder-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 0; margin: 20px 0 0; list-style: none; }
.reminder-row { display: flex; align-items: center; gap: 16px; border: 1px solid var(--settings-border); border-radius: 12px; background: white; padding: 0 18px 0 0; }
.reminder-open { display: flex; flex: 1; min-width: 0; align-items: center; gap: 24px; text-align: left; padding: 18px 0 18px 20px; border-radius: 12px; }
.reminder-open:hover { background: #fff6ee; }
.reminder-clock { flex: none; font-size: 30px; font-weight: 550; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.reminder-summary { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.reminder-day { font-size: 12px; color: var(--accent-deep); }
.reminder-excerpt { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reminder-chevron { color: var(--muted); font-size: 24px; }
.reminder-toggle { flex: none; min-height: 48px; }
.reminder-form { margin-top: 20px !important; }
.reminder-form > label, .reminder-form-row > label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.reminder-form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.reminder-form textarea { width: 100%; resize: vertical; }
.reminder-form > .switch { flex-direction: row; margin: 16px 0; }
.reminder-editor-tools { display: flex; justify-content: space-between; gap: 16px; }
#settings .danger { color: #b4362c; }
.voice-status { display: flex; align-items: center; gap: 12px; }
.notices { max-width: 760px; margin: 0 auto; padding: 16px 24px 0; }
.notices:not(:has(.notice:not([hidden]))) { display: none; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; padding: 12px 16px; border-radius: 16px; background: #fff4dc; color: var(--ink); font: 15px/1.6 var(--font-body); }
.notice-close { flex: none; min-width: 40px; min-height: 40px; font-size: 18px; color: var(--muted); }
.empty-guide { margin-top: 16px; font: 16px/1.7 var(--font-body); color: var(--muted); }
.empty-guide .settings-primary { min-height: 48px; padding: 0 20px; border-radius: 999px; font-weight: 800; }
.backup-box { margin-top: 24px; padding-top: 16px; border-top: 2px solid var(--line); }
.backup-actions { display: flex; gap: 16px; }
.backup-actions label { display: inline-flex; align-items: center; cursor: pointer; }
.notice-error { background: #fdecea; color: #a8312a; font-weight: 700; }
.fatal-actions { display: flex; justify-content: center; gap: 16px; }
.busy { max-width: 28em; margin: 30vh auto 0; padding: 0 24px; font-family: var(--font-body); font-size: 20px; line-height: 1.6; color: var(--ink); text-align: center; }
.settings-empty { padding: 32px 16px; border: 1px dashed var(--settings-border); border-radius: 12px; text-align: center; color: var(--muted); font-size: 14px; }
#settings .lib-error { margin: 12px 0; padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 400; }
.hint { margin: 12px 0 24px; padding: 14px 16px; border-radius: 16px; background: var(--paper); font-family: var(--font-body); font-size: 16px; line-height: 1.6; color: var(--muted); }
@media (max-width: 600px) {
  #settings { width: calc(100% - 16px); max-width: calc(100% - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); border-radius: 16px; }
  .settings-head { padding: 20px 20px 12px; }
  .settings-tabs { padding: 0 20px; }
  .settings-body { padding: 20px 16px; }
  .settings-actions { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
  #settings-draft-note { display: none; }
  .settings-actions .dialog-actions { margin-left: auto; }
  .settings-section-head { gap: 8px; }
  .reminder-open { gap: 12px; padding-left: 12px; }
  .reminder-row { gap: 10px; padding-right: 12px; }
  .reminder-clock { font-size: 26px; }
  .reminder-form-row { gap: 12px; }
  .win-list li { padding: 6px; gap: 6px; }
  #settings .win-list input[type='time'] { padding: 8px 6px; }
  /* 窄屏为原生时分/AM-PM 字段留空间；仍可点选字段及键盘编辑。 */
  #settings .win-list input[type='time']::-webkit-calendar-picker-indicator { display: none; }
}
.reminder-playback { position: absolute; z-index: 3; bottom: 24px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 12px 20px; border-radius: 16px; background: var(--ink); color: white; text-align: center; pointer-events: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes pop { from { opacity: 0; transform: scale(0.85); } }

@media (max-width: 640px) {
  .today { padding: 36px 22px 14px; }
  .today h1 { font-size: 40px; }
  .ended { flex-direction: column; gap: 24px; }
  .big-btn { width: 240px; height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
