/* ============================================================
   在线番茄钟 pomodoro.css
   主题机制：默认浅色；html[data-theme="dark"] 反转本页 --gray-* 语义
   （仅本页加载，不影响其他页面），并覆盖共享组件的硬编码浅色。
   注意：不得覆盖全局 --primary / --secondary（game-zone、tool-nav 依赖）。
   ============================================================ */

:root {
  /* 页面私有色板 */
  --pd-focus: #e0503f;        /* 专注 · 番茄红 */
  --pd-focus-deep: #c74434;
  --pd-short: #0d9488;        /* 短休息 · 青 */
  --pd-long: #2563eb;         /* 长休息 · 蓝 */
  --pd-color: var(--pd-focus);/* 当前阶段色（JS 按模式切换） */
  --pd-card: #ffffff;
  --pd-soft: #f8f9fb;
  --pd-line: #e5e7eb;
  --pd-ink: #1f2937;
  --pd-mut: #6b7280;
  --pd-ink-strong: #111827;
}

/* ---------- 深色主题 ---------- */
html[data-theme="dark"] {
  --gray-50: #0b1220;
  --gray-100: #131c2e;
  --gray-200: #263350;
  --gray-300: #3a4a68;
  --gray-400: #64748b;
  --gray-500: #8ea0b8;
  --gray-600: #b3c0d2;
  --gray-700: #cbd5e1;
  --gray-800: #e2e8f0;
  --gray-900: #f1f5f9;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
  --pd-focus: #f26d5c;
  --pd-short: #2dd4bf;
  --pd-long: #60a5fa;
  --pd-card: #131c2e;
  --pd-soft: #0b1220;
  --pd-line: #263350;
  --pd-ink: #e2e8f0;
  --pd-mut: #8ea0b8;
  --pd-ink-strong: #f1f5f9;
}

/* ---------- 主题切换按钮 ---------- */
.pd-theme {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--gray-200);
  background: var(--pd-card);
  color: var(--pd-ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.pd-theme:hover {
  transform: scale(1.1) rotate(14deg);
  box-shadow: var(--shadow-lg);
}

/* ---------- 主布局：左计时 + 右侧栏 ---------- */
.pd-main {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.pd-timer-card,
.pd-card {
  background: var(--pd-card);
  border: 1px solid var(--pd-line);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.pd-timer-card {
  padding: 24px 22px 26px;
  text-align: center;
}

.pd-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pd-card {
  padding: 18px 18px 16px;
  text-align: left;
}

.pd-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--pd-ink-strong);
  margin-bottom: 14px;
}

/* ---------- 模式切换 ---------- */
.pd-modes {
  display: flex;
  gap: 6px;
  background: var(--pd-soft);
  border: 1px solid var(--pd-line);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 20px;
}

.pd-mode {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px 4px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--pd-mut);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.pd-mode small {
  display: block;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.75;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.pd-mode:hover {
  color: var(--pd-ink);
}

.pd-mode.is-active {
  background: var(--pd-card);
  color: var(--pd-color);
  box-shadow: var(--shadow);
}

/* ---------- 计时圆环 ---------- */
.pd-dial {
  position: relative;
  width: min(320px, 76vw);
  margin: 0 auto;
}

.pd-ring {
  display: block;
  width: 100%;
  height: auto;
  transform: rotate(-90deg);
}

.pd-ring-track,
.pd-ring-prog {
  fill: none;
  stroke-width: 14;
}

.pd-ring-track {
  stroke: var(--pd-line);
}

.pd-ring-prog {
  stroke: var(--pd-color);
  stroke-linecap: round;
  stroke-dasharray: 866.9; /* 2π × r(138) */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.35s linear, stroke 0.4s ease;
}

.pd-dial-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pd-time {
  font-size: clamp(52px, 13vw, 72px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 2px;
  color: var(--pd-ink-strong);
  font-variant-numeric: tabular-nums;
}

.pd-phase {
  margin-top: 6px;
  font-size: 15px;
  color: var(--pd-mut);
}

/* ---------- 番茄圆点 ---------- */
.pd-dots {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 16px 0 4px;
  min-height: 14px;
}

.pd-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--pd-line);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.pd-dot.done {
  background: var(--pd-color);
}

.pd-dot.cur {
  background: transparent;
  box-shadow: inset 0 0 0 3px var(--pd-color);
}

/* ---------- 控制按钮 ---------- */
.pd-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 16px;
}

.pd-start {
  min-width: 158px;
  padding: 14px 40px;
  border: 0;
  border-radius: 999px;
  background: var(--pd-color);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 4px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(224, 80, 63, 0.32);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.pd-start:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.pd-start:active {
  transform: translateY(1px);
  filter: brightness(0.97);
}

.pd-ctl {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--pd-line);
  background: var(--pd-card);
  color: var(--pd-mut);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.pd-ctl:hover {
  color: var(--pd-color);
  border-color: var(--pd-color);
  transform: scale(1.06);
}

/* ---------- 当前任务 ---------- */
.pd-task {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 14px;
  background: var(--pd-soft);
  border: 1px solid var(--pd-line);
  border-radius: 10px;
}

.pd-task-ico {
  font-size: 15px;
  opacity: 0.85;
}

.pd-task input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--pd-ink);
  font-size: 14px;
}

.pd-task input::placeholder {
  color: var(--pd-mut);
  opacity: 0.8;
}

/* ---------- 背景音 ---------- */
.pd-sounds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pd-sound {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px 8px;
  border: 1px solid var(--pd-line);
  border-radius: 10px;
  background: var(--pd-soft);
  color: var(--pd-mut);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.pd-sound span {
  font-size: 22px;
  line-height: 1.2;
}

.pd-sound:hover {
  color: var(--pd-ink);
  border-color: var(--pd-mut);
}

.pd-sound.on {
  border-color: var(--pd-color);
  color: var(--pd-color);
  background: color-mix(in srgb, var(--pd-color) 9%, transparent);
}

.pd-sound.playing span {
  animation: pdPulse 2.2s ease-in-out infinite;
}

@keyframes pdPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.16); opacity: 0.72; }
}

.pd-volrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--pd-mut);
  font-size: 13px;
}

.pd-volrow input[type="range"] {
  flex: 1;
  accent-color: var(--pd-color);
}

.pd-volval {
  min-width: 26px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--pd-mut);
}

/* ---------- 复选与设置 ---------- */
.pd-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--pd-mut);
  cursor: pointer;
  user-select: none;
}

.pd-check input {
  accent-color: var(--pd-color);
  width: 15px;
  height: 15px;
  flex: none;
}

.pd-setgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}

.pd-setgrid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--pd-mut);
  white-space: nowrap;
}

.pd-setgrid input {
  width: 56px;
  padding: 7px 6px;
  border: 1px solid var(--pd-line);
  border-radius: 8px;
  background: var(--pd-soft);
  color: var(--pd-ink);
  font-size: 14px;
  text-align: center;
}

.pd-setgrid input:focus {
  outline: none;
  border-color: var(--pd-color);
}

.pd-ghost {
  width: 100%;
  margin-top: 14px;
  padding: 9px;
  border: 1px dashed var(--pd-line);
  border-radius: 8px;
  background: transparent;
  color: var(--pd-mut);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.pd-ghost:hover {
  color: var(--pd-color);
  border-color: var(--pd-color);
}

.pd-note {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--pd-mut);
  opacity: 0.9;
}

/* ---------- 统计 ---------- */
.pd-statrow {
  display: flex;
  gap: 12px;
}

.pd-stat {
  flex: 1;
  padding: 12px 8px;
  background: var(--pd-soft);
  border: 1px solid var(--pd-line);
  border-radius: 10px;
  text-align: center;
}

.pd-stat b {
  display: block;
  font-size: 26px;
  color: var(--pd-color);
  font-variant-numeric: tabular-nums;
}

.pd-stat span {
  font-size: 12.5px;
  color: var(--pd-mut);
}

.pd-week {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 68px;
  margin-top: 14px;
}

.pd-wcol {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.pd-wbar {
  width: 100%;
  max-width: 28px;
  min-height: 3px;
  border-radius: 4px 4px 2px 2px;
  background: var(--pd-line);
}

.pd-wbar.has {
  background: var(--pd-color);
}

.pd-wd {
  font-size: 10.5px;
  color: var(--pd-mut);
  white-space: nowrap;
}

/* ---------- 使用方法序号 ---------- */
.pd-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--pd-focus);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  vertical-align: middle;
}

/* ---------- 简介与 FAQ（全站各页私有同款） ---------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
  gap: 14px;
}

.info-item {
  background: var(--pd-card);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px 16px;
}

.info-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.info-item p {
  font-size: 0.86rem;
  color: var(--gray-500);
  line-height: 1.7;
}

.faq-item {
  background: var(--pd-card);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.faq-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.faq-item p {
  font-size: 0.86rem;
  color: var(--gray-500);
  line-height: 1.75;
}

.info-section p {
  color: var(--gray-600);
  line-height: 1.8;
  margin-bottom: 10px;
}

.info-section p:last-child {
  margin-bottom: 0;
}

/* ---------- 深色：共享组件硬编码浅色覆盖 ---------- */
html[data-theme="dark"] header span a,
html[data-theme="dark"] footer .copyright a {
  color: #9aa8ff;
}

html[data-theme="dark"] header span a:hover {
  color: #b7c1ff;
}

/* 当前页在工具导航中的高亮为内联 --primary，深色下提亮 */
html[data-theme="dark"] a.tool-link[style*="font-weight"] {
  color: #a5b4fc !important;
}

html[data-theme="dark"] .info-section,
html[data-theme="dark"] .links-section {
  background: var(--pd-card);
}

html[data-theme="dark"] .links-grid a {
  background: var(--pd-soft);
  border-color: var(--pd-line);
  color: var(--gray-700);
}

html[data-theme="dark"] .links-grid a:hover {
  background: rgba(79, 70, 229, 0.22);
  border-color: var(--primary);
  color: #a5b4fc;
}

html[data-theme="dark"] .tool-link.on {
  background: rgba(79, 70, 229, 0.22) !important;
}

html[data-theme="dark"] .game-zone {
  background: var(--pd-card);
}

html[data-theme="dark"] .game-switch-btn {
  background: var(--pd-card);
}

html[data-theme="dark"] .donate-btn {
  background: var(--pd-card);
}

html[data-theme="dark"] .donate-modal .donate-dialog {
  background: var(--pd-card);
}

html[data-theme="dark"] .donate-modal .donate-close,
html[data-theme="dark"] .donate-modal h3 {
  color: var(--gray-900);
}

html[data-theme="dark"] .donate-modal p {
  color: var(--gray-500);
}

/* ---------- 响应式 ---------- */
@media (max-width: 920px) {
  .pd-main {
    grid-template-columns: 1fr;
  }

  .pd-theme {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 17px;
  }
}

@media (max-width: 480px) {
  .pd-timer-card {
    padding: 18px 14px 20px;
  }

  .pd-mode {
    font-size: 13px;
    padding: 7px 2px;
  }

  .pd-controls {
    gap: 14px;
  }

  .pd-start {
    min-width: 132px;
    padding: 13px 30px;
    font-size: 16px;
    letter-spacing: 3px;
  }

  .pd-setgrid {
    grid-template-columns: 1fr 1fr;
  }

  .pd-sounds {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  .pd-ring-prog,
  .pd-theme,
  .pd-start,
  .pd-ctl,
  .pd-sound.playing span {
    transition: none;
    animation: none;
  }
}
