/* ========== Base ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --font-sans: "DM Sans", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --app-max: 1320px;
  --sheet-z: 400;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-base);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  transition: background-color 0.55s var(--ease-out), color 0.4s var(--ease-out);
}

/* 暗色主题：让 body 与全页背景都保持夜间风格 */
body:has(.app[data-theme="noir"]) {
  color: #f8fafc;
  background-color: #080a10;
  background-image: radial-gradient(900px 600px at 50% -10%, rgba(88, 102, 170, 0.22), transparent),
    radial-gradient(700px 500px at 100% 100%, rgba(52, 61, 104, 0.26), transparent);
}

body:has(.app[data-theme="forest"]) {
  color: #f0fdf4;
  background-color: #07150f;
  background-image: radial-gradient(1000px 700px at 20% 0%, rgba(16, 185, 129, 0.16), transparent),
    radial-gradient(800px 500px at 100% 100%, rgba(2, 44, 34, 0.78), transparent);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 9999;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 12px;
}

/* ========== Themes（强化正文与背景对比） ========== */
.app[data-theme="fresh"] {
  --text: #0f291f;
  --text-muted: rgba(15, 41, 31, 0.58);
  --bg-base: #dfece3;
  --bg-gradient: radial-gradient(1200px 800px at 10% 0%, rgba(160, 210, 180, 0.9), transparent),
    radial-gradient(900px 600px at 90% 100%, rgba(190, 225, 200, 0.65), transparent);
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --border: rgba(15, 41, 31, 0.1);
  --accent: #1d5c45;
  --accent-soft: rgba(29, 92, 69, 0.12);
  --accent-contrast: #fff;
  --ring-track: rgba(15, 41, 31, 0.1);
  --ring-fill: #1d5c45;
  --glow: rgba(45, 130, 95, 0.35);
  --shadow: 0 20px 56px rgba(15, 41, 31, 0.09);
  --brand-dot: linear-gradient(135deg, #40916c, #1d5c45);
}

.app[data-theme="sunny"] {
  --text: #3d2918;
  --text-muted: rgba(61, 41, 24, 0.55);
  --bg-base: #fff3e0;
  --bg-gradient: radial-gradient(1000px 700px at 0% 20%, rgba(255, 200, 120, 0.65), transparent),
    radial-gradient(800px 500px at 100% 80%, rgba(255, 170, 100, 0.4), transparent);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #fffaf3;
  --border: rgba(61, 41, 24, 0.12);
  --accent: #c2410c;
  --accent-soft: rgba(194, 65, 12, 0.12);
  --accent-contrast: #fff;
  --ring-track: rgba(61, 41, 24, 0.1);
  --ring-fill: #c2410c;
  --glow: rgba(234, 120, 40, 0.4);
  --shadow: 0 24px 60px rgba(90, 50, 20, 0.1);
  --brand-dot: linear-gradient(135deg, #fb923c, #c2410c);
}

.app[data-theme="ocean"] {
  --text: #0c1e2e;
  --text-muted: rgba(12, 30, 46, 0.55);
  --bg-base: #dceef7;
  --bg-gradient: radial-gradient(1100px 750px at 100% 0%, rgba(120, 190, 230, 0.55), transparent),
    radial-gradient(900px 600px at 0% 100%, rgba(90, 170, 210, 0.35), transparent);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #f7fcff;
  --border: rgba(12, 30, 46, 0.1);
  --accent: #0369a1;
  --accent-soft: rgba(3, 105, 161, 0.12);
  --accent-contrast: #fff;
  --ring-track: rgba(12, 30, 46, 0.1);
  --ring-fill: #0369a1;
  --glow: rgba(56, 160, 210, 0.38);
  --shadow: 0 22px 58px rgba(12, 30, 46, 0.08);
  --brand-dot: linear-gradient(135deg, #38bdf8, #0369a1);
}

.app[data-theme="noir"] {
  --text: #f8fafc;
  --text-muted: rgba(248, 250, 252, 0.8);
  --bg-base: #080a10;
  --bg-gradient: radial-gradient(900px 600px at 50% -10%, rgba(88, 102, 170, 0.22), transparent),
    radial-gradient(700px 500px at 100% 100%, rgba(52, 61, 104, 0.26), transparent);
  --surface: rgba(19, 23, 34, 0.9);
  --surface-strong: rgba(24, 28, 40, 0.96);
  --border: rgba(248, 250, 252, 0.16);
  --accent: #a78bfa;
  --accent-soft: rgba(167, 139, 250, 0.18);
  --accent-contrast: #0c0e14;
  --ring-track: rgba(248, 250, 252, 0.18);
  --ring-fill: #ddd6fe;
  --glow: rgba(167, 139, 250, 0.26);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.62);
  --brand-dot: linear-gradient(135deg, #c4b5fd, #7c3aed);
}

/* 纸本：近白底 + 近黑字 */
.app[data-theme="paper"] {
  --text: #0a0a0a;
  --text-muted: rgba(10, 10, 10, 0.55);
  --bg-base: #f7f7f5;
  --bg-gradient: radial-gradient(800px 500px at 100% 0%, rgba(230, 230, 230, 0.9), transparent);
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --border: rgba(10, 10, 10, 0.12);
  --accent: #1d4ed8;
  --accent-soft: rgba(29, 78, 216, 0.1);
  --accent-contrast: #fff;
  --ring-track: rgba(10, 10, 10, 0.08);
  --ring-fill: #1d4ed8;
  --glow: rgba(37, 99, 235, 0.25);
  --shadow: 0 16px 48px rgba(10, 10, 10, 0.08);
  --brand-dot: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

/* 墨韵：浅灰底 + 深墨字 */
.app[data-theme="ink"] {
  --text: #111827;
  --text-muted: rgba(17, 24, 39, 0.55);
  --bg-base: #e5e7eb;
  --bg-gradient: radial-gradient(900px 600px at 0% 100%, rgba(180, 190, 200, 0.6), transparent);
  --surface: #f9fafb;
  --surface-strong: #ffffff;
  --border: rgba(17, 24, 39, 0.1);
  --accent: #b45309;
  --accent-soft: rgba(180, 83, 9, 0.12);
  --accent-contrast: #fff;
  --ring-track: rgba(17, 24, 39, 0.08);
  --ring-fill: #b45309;
  --glow: rgba(180, 83, 9, 0.28);
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.08);
  --brand-dot: linear-gradient(135deg, #d97706, #b45309);
}

/* 晨曦：暖白 + 深棕字 */
.app[data-theme="dawn"] {
  --text: #292524;
  --text-muted: rgba(41, 37, 36, 0.55);
  --bg-base: #fff7ed;
  --bg-gradient: linear-gradient(165deg, #ffedd5 0%, #fff7ed 45%, #fef3c7 100%);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #fffbeb;
  --border: rgba(41, 37, 36, 0.11);
  --accent: #b91c1c;
  --accent-soft: rgba(185, 28, 28, 0.1);
  --accent-contrast: #fff;
  --ring-track: rgba(41, 37, 36, 0.09);
  --ring-fill: #b91c1c;
  --glow: rgba(220, 80, 70, 0.3);
  --shadow: 0 20px 52px rgba(80, 40, 30, 0.09);
  --brand-dot: linear-gradient(135deg, #f87171, #b91c1c);
}

/* 森雾：深绿底 + 亮字 */
.app[data-theme="forest"] {
  --text: #f0fdf4;
  --text-muted: rgba(240, 253, 244, 0.82);
  --bg-base: #07150f;
  --bg-gradient: radial-gradient(1000px 700px at 20% 0%, rgba(16, 185, 129, 0.16), transparent),
    radial-gradient(800px 500px at 100% 100%, rgba(2, 44, 34, 0.78), transparent);
  --surface: rgba(10, 36, 29, 0.86);
  --surface-strong: rgba(12, 44, 35, 0.94);
  --border: rgba(240, 253, 244, 0.18);
  --accent: #34d399;
  --accent-soft: rgba(52, 211, 153, 0.15);
  --accent-contrast: #022c22;
  --ring-track: rgba(240, 253, 244, 0.18);
  --ring-fill: #6ee7b7;
  --glow: rgba(52, 211, 153, 0.26);
  --shadow: 0 28px 72px rgba(0, 0, 0, 0.52);
  --brand-dot: linear-gradient(135deg, #6ee7b7, #059669);
}

/* ========== App shell ========== */
.app {
  max-width: var(--app-max);
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 clamp(12px, 2.5vw, 20px) 28px;
  display: flex;
  flex-direction: column;
  color: var(--text);
}

.site-foot {
  margin-top: auto;
  padding-top: clamp(20px, 4vw, 32px);
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.foot-credit-line {
  margin: 0;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  position: relative;
  padding-top: 18px;
}

.foot-credit-line::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(200px, 42vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  opacity: 0.9;
}

.foot-credit-brand {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.68rem;
  transition: color 0.25s var(--ease-out), opacity 0.25s;
}

.foot-credit-brand:hover {
  color: var(--text);
  opacity: 0.92;
}

.foot-credit-brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.foot-credit-suffix {
  margin-left: 0.4em;
  font-weight: 400;
  letter-spacing: 0.14em;
  opacity: 0.88;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 10px;
  flex-wrap: wrap;
}

.top-bar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand__logo-wrap {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}

.brand__mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: block;
  object-fit: contain;
  object-position: center;
  background: var(--surface-strong);
  box-shadow: 0 6px 20px var(--glow);
}

.brand__badge {
  position: absolute;
  top: -3px;
  right: -4px;
  padding: 2px 4px;
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: var(--accent-contrast);
  background: var(--accent);
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.brand__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand__tag {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tool-dock {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-left: auto;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease-spring), border-color 0.2s, background 0.2s;
}

.tool-btn:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.tool-btn:active {
  transform: scale(0.97);
}

.tool-btn__emoji {
  font-size: 1.05rem;
  line-height: 1;
}

.tool-btn__text {
  display: none;
}

@media (min-width: 480px) {
  .tool-btn__text {
    display: inline;
  }
}

.local-banner {
  margin: 0 0 16px;
  padding: 10px 14px 12px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-muted);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.local-banner__carousel {
  position: relative;
  min-height: 2.8em;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.local-banner__quote {
  width: 100%;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text);
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out);
}

.local-banner__quote.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .local-banner__quote {
    transition: none;
    transform: none;
  }
}

/* ========== 沉浸式专注（计时进行中隐藏侧栏；须点击「退出沉浸」恢复，计时不停） ========== */
.app.immerse .immerse-target {
  display: none !important;
}

.app.immerse .workspace {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - 32px);
}

.app.immerse .column--timer {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.immerse-exit {
  display: none;
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 150;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-contrast);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 28px var(--glow);
  transition: transform 0.2s var(--ease-spring), filter 0.2s;
}

.app.immerse .immerse-exit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.immerse-exit:hover {
  filter: brightness(1.06);
}

.immerse-exit:active {
  transform: scale(0.97);
}

.immerse-enter {
  display: block;
  margin: 10px auto 0;
  padding: 5px 14px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.82;
  transition: color 0.2s, background 0.2s, border-color 0.2s, opacity 0.2s;
}

.immerse-enter:hover {
  opacity: 1;
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--border);
}

.immerse-enter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app.immerse .immerse-enter {
  display: none;
}

/* ========== Workspace 三栏 ========== */
.workspace {
  display: grid;
  gap: clamp(16px, 2.5vw, 24px);
  flex: 1;
  align-content: start;
}

/* 手机/平板：番茄钟在上，待办在下，日志再下 */
@media (max-width: 1023px) {
  .workspace {
    display: flex;
    flex-direction: column;
  }

  .column--timer {
    order: 1;
  }

  .column--todos {
    order: 2;
  }

  .column--log {
    order: 3;
  }
}

/* Pad：计时器在上，待办与日志双列 */
@media (min-width: 768px) and (max-width: 1023px) {
  .workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 16px;
  }

  .column--timer {
    grid-column: 1 / -1;
    order: 0;
  }

  .column--todos {
    grid-column: 1;
    order: 0;
  }

  .column--log {
    grid-column: 2;
    order: 0;
  }

  .column--todos .panel--todos,
  .column--log .panel--log {
    max-width: none;
  }

  .timer-card {
    max-width: 500px;
  }
}

@media (min-width: 1024px) {
  .workspace {
    grid-template-columns: minmax(300px, 1.05fr) minmax(280px, 0.85fr) minmax(240px, 0.75fr);
    align-items: start;
  }

  .column--timer,
  .column--todos,
  .column--log {
    order: 0;
  }
}

.column--todos .panel--todos {
  max-width: 560px;
}

@media (min-width: 1024px) {
  .column--todos .panel--todos {
    max-width: none;
  }
}

.column--timer {
  display: flex;
  justify-content: center;
}

.column--log .panel--log {
  min-height: 200px;
}

/* ========== Panels ========== */
.panel {
  padding: clamp(20px, 3vw, 26px) clamp(18px, 2.5vw, 24px);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.panel__title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.panel__desc {
  margin: 0 0 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.panel__desc--compact {
  margin-bottom: 10px;
  font-size: 0.76rem;
}

.panel--todos-compact.panel {
  padding: 14px 14px 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.06);
}

.panel__head-inline {
  margin-bottom: 10px;
}

.todo-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.todo-tab {
  flex: 1;
  margin: 0;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.todo-tab__count {
  margin-left: 6px;
  display: inline-flex;
  min-width: 1.45em;
  height: 1.45em;
  align-items: center;
  justify-content: center;
  padding: 0 0.35em;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}

.todo-tab:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.todo-tab[aria-selected="true"] {
  color: var(--accent-contrast);
  background: var(--accent);
  box-shadow: 0 2px 10px var(--glow);
}

.todo-tab[aria-selected="true"] .todo-tab__count {
  background: rgba(255, 255, 255, 0.25);
}

.todo-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.todo-tabpanel[hidden] {
  display: none !important;
}

.todo-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0 2px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.todo-stats__item strong {
  margin-left: 4px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.todo-stats__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border);
  opacity: 0.85;
}

.panel__title--sm {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.todo-form {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.todo-form--inline {
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.todo-input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.todo-input--sm {
  padding: 9px 12px;
  font-size: 0.88rem;
  border-radius: 8px;
}

.todo-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(48vh, 380px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.todo-list__empty {
  list-style: none;
  margin: 0;
  padding: 16px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: transparent;
}

.todo-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: start;
  padding: 8px 6px;
  margin-bottom: 2px;
  border-radius: 8px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  transition: background 0.2s;
}

.todo-item:hover {
  background: var(--accent-soft);
}

.todo-item:last-child {
  border-bottom: none;
}

.todo-item.done {
  opacity: 0.88;
}

.todo-item.done .todo-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-check {
  width: 18px;
  height: 18px;
  margin-top: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}

.todo-body {
  min-width: 0;
}

.todo-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.todo-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 2px 0;
  font-size: 0.9rem;
  font-weight: 500;
  word-break: break-word;
  cursor: text;
  outline: none;
  border-radius: 4px;
  color: var(--text);
  transition: background 0.2s;
  line-height: 1.45;
}

.todo-text:focus {
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.todo-meta {
  flex-shrink: 0;
  margin: 0;
  padding-top: 3px;
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.45;
}

.todo-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 2px;
  align-items: center;
  justify-content: flex-end;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, max-width 0.2s ease;
}

.todo-item:hover .todo-actions,
.todo-item:focus-within .todo-actions {
  max-width: 120px;
  opacity: 1;
  overflow: visible;
  pointer-events: auto;
}

/* 触屏无悬停：始终显示操作按钮 */
@media (hover: none) {
  .todo-actions {
    max-width: 120px;
    opacity: 1;
    overflow: visible;
    pointer-events: auto;
  }
}

.todo-item.done .todo-meta {
  opacity: 0.9;
}

.icon-btn {
  width: 30px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, transform 0.2s var(--ease-spring);
}

.icon-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn--reorder {
  font-size: 0.85rem;
  font-weight: 700;
}

/* ========== Log ========== */
.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.log-head .panel__title {
  margin: 0;
  color: var(--text);
}

.btn-text {
  padding: 6px 10px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.btn-text:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.log-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.45;
}

.log-item:last-child {
  border-bottom: none;
}

.log-item__time {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.log-item__text {
  color: var(--text);
}

.log-empty {
  list-style: none;
  margin: 0;
  padding: 20px 12px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* 使用说明内 SEO 段落（原侧栏文案，利于收录） */
.seo-intro {
  margin: 0 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.seo-intro strong {
  color: var(--text);
  font-weight: 600;
}

.sheet-guide__h {
  margin: 14px 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
}

.sheet-guide__p {
  margin: 0 0 10px;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.sheet-guide__p:last-child {
  margin-bottom: 0;
}

.sheet--guide {
  max-height: min(82dvh, 640px);
}

/* ========== Sheets（置于 #app-root 内以继承主题变量；勿用 HTML hidden 以免无法过渡） ========== */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--sheet-z) - 1);
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s var(--ease-out), visibility 0.28s;
}

.sheet-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  z-index: var(--sheet-z);
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  left: auto;
  width: min(400px, calc(100vw - 24px));
  max-height: min(78dvh, 600px);
  overflow-y: auto;
  padding: 16px 16px 20px;
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow), 0 24px 80px rgba(0, 0, 0, 0.18);
  transform: translateY(-10px) scale(0.98);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.32s var(--ease-out), opacity 0.28s var(--ease-out), visibility 0.28s;
  -webkit-overflow-scrolling: touch;
}

.sheet.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (max-width: 520px) {
  .sheet {
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    right: 12px;
    left: 12px;
    width: auto;
    max-height: min(70dvh, 520px);
    transform: translateY(12px) scale(0.98);
  }

  .sheet.is-open {
    transform: translateY(0) scale(1);
  }
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sheet__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet__close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.sheet__close:hover {
  background: var(--accent);
  color: var(--accent-contrast);
}

.sheet__hint {
  margin: 0 0 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 360px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label,
.field__label-inline {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.field__input {
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="range"].field__input {
  width: calc(100% - 18px);
  margin: 0 9px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="range"].field__input:focus {
  border: 0;
  box-shadow: none;
}

input[type="range"].field__input::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
}

input[type="range"].field__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 2px solid var(--accent-contrast);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

input[type="range"].field__input::-moz-range-track {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
}

input[type="range"].field__input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent-contrast);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.field--checkbox {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  margin-top: 12px;
}

.field__check {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.theme-picker,
.ring-mode-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-chip,
.ring-chip {
  padding: 12px 14px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease-spring);
}

.theme-chip:hover,
.ring-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.theme-chip[aria-checked="true"],
.ring-chip[aria-checked="true"] {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: var(--accent);
}

.theme-chip:active,
.ring-chip:active {
  transform: scale(0.99);
}

/* ========== Buttons ========== */
.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.25s, background 0.25s, border-color 0.25s;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  padding: 14px 20px;
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
  box-shadow: 0 4px 16px var(--glow);
  flex-shrink: 0;
}

.btn--icon-add {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 9px;
}

.btn--primary:hover {
  filter: brightness(1.05);
}

.btn--ghost {
  padding: 12px 16px;
  background: transparent;
  color: var(--text-muted);
}

.btn--ghost:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.btn--timer-aux {
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  box-shadow: none;
  opacity: 0.82;
}

.btn--timer-aux:hover {
  opacity: 1;
  color: var(--text);
  background: var(--accent-soft);
}

.btn--timer-aux:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn--mega {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 36px;
  font-size: 1.05rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: 999px;
  box-shadow: 0 12px 40px var(--glow);
}

.btn--mega:hover {
  filter: brightness(1.06);
  box-shadow: 0 16px 48px var(--glow);
}

.btn--mega__icon {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.btn--mega[aria-pressed="true"] .btn--mega__icon {
  clip-path: none;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* ========== Timer ========== */
.timer-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: clamp(28px, 5vw, 40px);
  text-align: center;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s;
}

.timer-card:hover {
  transform: translateY(-2px);
}

.timer-card__glow {
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 50% 30%, var(--glow), transparent 55%);
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.6s;
}

.timer-card.running .timer-card__glow {
  opacity: 0.72;
  animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%,
  100% {
    opacity: 0.62;
    transform: scale(1);
  }
  50% {
    opacity: 0.88;
    transform: scale(1.03);
  }
}

.phase-label {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ring-stage {
  position: relative;
  width: min(280px, 72vw);
  aspect-ratio: 1;
  margin: 0 auto 18px;
}

/* 多种计时造型：仅当前项显示 */
.timer-visual {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 0;
  transition: opacity 0.25s var(--ease-out), visibility 0.25s;
}

.timer-visual.is-current {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

.ring-wrap {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.ring__track {
  fill: none;
  stroke: var(--ring-track);
  stroke-width: 10;
}

.ring__progress {
  fill: none;
  stroke: var(--ring-fill);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 553.1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.35s var(--ease-out);
  filter: drop-shadow(0 0 8px var(--glow));
}

.shape-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.shape-track {
  stroke: var(--ring-track);
}

.shape-progress {
  stroke: var(--ring-fill);
  transition: stroke-dashoffset 0.35s var(--ease-out);
  filter: drop-shadow(0 0 6px var(--glow));
}

.shape-svg--arc {
  transform: translateY(-6%);
}

.pie-disk {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--ring-fill) calc(var(--pie-p, 1) * 1turn), var(--ring-track) 0);
  box-shadow: inset 0 0 0 1px var(--border);
  transition: background 0.35s var(--ease-out);
}

.radar-disk {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--ring-fill) calc(var(--pie-p, 1) * 1turn), var(--ring-track) 0);
  -webkit-mask: radial-gradient(circle, transparent 44%, black 45%);
  mask: radial-gradient(circle, transparent 44%, black 45%);
  transition: background 0.35s var(--ease-out);
  filter: drop-shadow(0 0 10px var(--glow));
}


.time-display {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2.45rem, 9vw, 3.15rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text);
  pointer-events: none;
  z-index: 2;
}

.session-meta {
  margin: 0 0 22px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.controls {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.controls__aux {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.controls__aux-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border);
  opacity: 0.85;
  flex-shrink: 0;
}

/* ========== Reduced motion ========== */
@media (prefers-reduced-motion: reduce) {
  .timer-card.running .timer-card__glow,
  .ring-wrap,
  .ring,
  .ring__progress,
  .shape-progress,
  .time-display {
    animation: none !important;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
