/* ===================================================================
   Pomodoro Timer — Tomato Hero (single theme, light only)
   Zero dependencies. Pure CSS.
   =================================================================== */

/* ============ Design tokens ============ */
:root {
  /* Surface tokens (the cream world around the card) */
  --bg:           #faf6f1;        /* warm cream */
  --bg-2:         #f3eee5;
  --surface:      #ffffff;
  --surface-2:    #faf6ed;
  --surface-3:    #eee7d8;
  --border:       #e8dfcc;
  --border-soft:  #f0e9da;
  --text:         #1f1a14;         /* warm near-black */
  --text-2:       #5c5547;
  --text-3:       #6e6557;
  --text-faint:   #b5ac9b;

  /* Accent (the tomato red itself — used outside the card too) */
  --accent:       #e85f4d;
  --accent-2:     #d44a39;
  --accent-soft:  rgba(232, 95, 77, 0.10);
  --accent-glow:  rgba(232, 95, 77, 0.30);

  /* Phase colors (used as gradient stops for the hero card) */
  --tomato-from:  #ff6b4a;
  --tomato-to:    #e85f4d;
  --sage-from:    #5eb985;
  --sage-to:      #3a9d6f;
  --azure-from:   #5b8fcc;
  --azure-to:     #3b82c4;

  --success:      #3a9d6f;
  --break:        #5eb985;
  --break-soft:   rgba(94, 185, 133, 0.12);
  --long-break:   #5b8fcc;
  --long-break-soft: rgba(91, 143, 204, 0.12);

  /* Spacing / radius / shadow */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 24px 48px rgba(0,0,0,0.12);

  /* Typography */
  --font-ui: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
             "PingFang TC", "PingFang SC", "Hiragino Sans", "Noto Sans CJK",
             sans-serif;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Transitions */
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ Reset ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
html, body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "ss01" 1;
  transition: background var(--transition-slow), color var(--transition-slow);
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-2); }
ul, ol { list-style: none; }
[hidden] { display: none !important; }

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px; top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  font-weight: 600;
  border-radius: 0 0 var(--r-sm) 0;
  z-index: 1000;
}
.skip-link:focus { left: 0; }

/* ============ App layout ============ */
.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(12px, 3vw, 24px) clamp(12px, 3vw, 24px) 80px;
}

/* ============ Top bar ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 28px;
}
.brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text-2);
}
.brand:hover { color: var(--accent); }

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
@media (max-width: 380px) {
  .nav-link { font-size: 12px; padding: 4px 8px; }
}
.nav-link:hover {
  color: var(--accent);
  background: var(--surface-2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  transition: background var(--transition), color var(--transition), transform 80ms ease-out;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.icon-btn:active { transform: scale(0.95); }
.icon-btn svg { width: 18px; height: 18px; }

.lang-switcher {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 28px 6px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%237a7973' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  transition: border-color var(--transition);
}
.lang-switcher:hover { border-color: var(--text-3); }
.lang-switcher:focus { outline: none; border-color: var(--accent); }

/* ============ Page title ============ */
.page-title {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 6px;
}
.page-sub {
  text-align: center;
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 36px;
}

/* ============ Workspace: Timer + Tasks ============ */
.workspace {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 64px;
}
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* ============ Timer panel ============ */
.timer-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: clamp(24px, 4vw, 40px) clamp(20px, 4vw, 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background var(--transition-slow), border-color var(--transition);
  position: relative;
}

/* Phase tint backgrounds (subtle) */
.timer-panel[data-phase="focus"] { box-shadow: var(--shadow-md), inset 0 0 0 1px var(--accent-soft); }
.timer-panel[data-phase="short"] { box-shadow: var(--shadow-md), inset 0 0 0 1px var(--break-soft); }
.timer-panel[data-phase="long"] { box-shadow: var(--shadow-md), inset 0 0 0 1px var(--long-break-soft); }

.phase-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 16px;
}
.phase-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
}
.timer-panel[data-phase="short"] .phase-label { color: var(--break); background: var(--break-soft); }
.timer-panel[data-phase="long"] .phase-label { color: var(--long-break); background: var(--long-break-soft); }

.round-dots {
  display: inline-flex;
  gap: 6px;
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background var(--transition), transform var(--transition);
}
.dot.dot-on {
  background: var(--accent);
}
.dot.dot-done {
  background: var(--success);
}

/* Timer display with progress ring */
.timer-display {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 8px 0 24px;
}
.progress-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
}
.ring-track {
  stroke: var(--border);
}
.ring-progress {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset 980ms linear, stroke var(--transition-slow);
}
.timer-panel[data-phase="short"] .ring-progress { stroke: var(--break); }
.timer-panel[data-phase="long"] .ring-progress { stroke: var(--long-break); }

.time-text {
  font-family: var(--font-display);
  font-size: clamp(56px, 12vw, 96px);
  font-weight: 600;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--text);
}
.round-text {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
  text-align: center;
}
.round-text #round-current {
  color: var(--text);
  font-weight: 600;
  margin-left: 6px;
  margin-right: 2px;
}

/* Current task indicator */
.current-task {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  font-size: 13px;
  margin-bottom: 20px;
  max-width: 100%;
}
.current-task-label {
  color: var(--text-3);
  flex-shrink: 0;
}
.current-task-text {
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

/* Control buttons */
.control-row {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  justify-content: center;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  min-width: 140px;
  transition: background var(--transition), transform 80ms ease-out, box-shadow var(--transition);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-2); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary svg { width: 18px; height: 18px; }
.btn-primary .icon-pause { display: none; }
.btn-primary[data-state="running"] .icon-play { display: none; }
.btn-primary[data-state="running"] .icon-pause { display: inline-block; }

.timer-panel[data-phase="short"] .btn-primary { background: var(--break); box-shadow: 0 4px 12px var(--break-soft); }
.timer-panel[data-phase="long"] .btn-primary { background: var(--long-break); box-shadow: 0 4px 12px var(--long-break-soft); }

.btn-secondary {
  padding: 14px 22px;
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), transform 80ms ease-out;
}
.btn-secondary:hover { background: var(--surface-3); }
.btn-secondary:active { transform: scale(0.97); }

/* Preset selector */
.preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 360px;
}
.preset-label {
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
}
.preset-select {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 32px 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%237a7973' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  transition: border-color var(--transition);
}
.preset-select:focus { outline: none; border-color: var(--accent); }

/* ============ Task panel ============ */
.task-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 400px;
}
.task-header {
  margin-bottom: 16px;
}
.task-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.task-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.task-summary {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
}
.task-tabs {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 3px;
}
.task-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  transition: background var(--transition), color var(--transition);
}
.task-tab-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.task-tab:hover:not(.task-tab-active) { color: var(--text-2); }

/* Task list */
.task-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 12px;
  max-height: 380px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.task-list::-webkit-scrollbar { width: 6px; }
.task-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r-md);
  transition: background var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 4px;
  position: relative;
}
.task-item:hover { background: var(--surface-2); }
.task-item.task-active {
  background: var(--accent-soft);
  border-color: var(--accent-glow);
}
.task-item.task-done {
  opacity: 0.5;
}
.task-item.task-done .task-text {
  text-decoration: line-through;
}

.task-check {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  background: transparent;
}
.task-check:hover { border-color: var(--accent); }
.task-item.task-done .task-check {
  background: var(--success);
  border-color: var(--success);
}
.task-item.task-done .task-check::after {
  content: "";
  width: 5px; height: 9px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translate(-1px, -1px);
}

.task-body {
  flex: 1;
  min-width: 0;
}
.task-text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  word-break: break-word;
}
.task-text[contenteditable="true"] {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
  padding: 1px 3px;
  margin: -1px -3px;
}
.task-pomos {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.task-pomos-mark { letter-spacing: 1px; }
.task-pomos-mark .pomo-done { opacity: 1; }
.task-pomos-mark .pomo-todo { opacity: 0.3; }
.task-pomos-adjust {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
}
.task-pomos-adjust button {
  width: 18px; height: 18px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  transition: background var(--transition);
}
.task-pomos-adjust button:hover { background: var(--surface-3); color: var(--text); }

.task-actions {
  display: inline-flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}
.task-item:hover .task-actions { opacity: 1; }
.task-actions button {
  width: 24px; height: 24px;
  border-radius: 4px;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.task-actions button:hover {
  background: var(--surface-2);
  color: var(--text);
}
.task-actions svg { width: 14px; height: 14px; }

.task-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-3);
  font-size: 13px;
}

/* Task input */
.task-input-row {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.task-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  transition: border-color var(--transition);
}
.task-input::placeholder { color: var(--text-faint); }
.task-input:focus { outline: none; border-color: var(--accent); }
.task-add-btn {
  width: 38px; height: 38px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: 20px;
  line-height: 1;
  font-weight: 400;
  transition: background var(--transition), transform 80ms ease-out;
}
.task-add-btn:hover { background: var(--accent-2); }
.task-add-btn:active { transform: scale(0.95); }

/* ============ Info / SEO section ============ */
.info {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 0;
  color: var(--text-2);
  line-height: 1.7;
}
.info h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 36px 0 12px;
}
.info h2:first-child { margin-top: 0; }
.info p { margin-bottom: 14px; font-size: 15px; }
.info ol, .info ul.preset-grid, .info ul.usecase-grid, .info ul.guide-list {
  margin-bottom: 14px;
}
.info ol { padding-left: 0; counter-reset: step; }
.info ol li {
  padding: 6px 0 6px 32px;
  position: relative;
  list-style: none;
  font-size: 15px;
}
.info ol li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0; top: 8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 22px;
}

.preset-grid, .usecase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  list-style: none;
}
.preset-grid a, .usecase-grid a {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.preset-grid a:hover, .usecase-grid a:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.preset-grid a span, .usecase-grid a span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  margin-top: 2px;
}

.guide-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.guide-list a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition);
}
.guide-list a:hover { background: var(--surface-2); color: var(--accent); }

/* ============ Modals ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modal-fade 240ms ease-out;
}
@keyframes modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modal-slide 280ms cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes modal-slide {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Settings groups */
.settings-group {
  border: none;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.settings-group:last-child { border-bottom: none; }
.settings-group legend {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-3);
  padding-bottom: 8px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  font-size: 14px;
}
.setting-row > span { color: var(--text); flex: 1; }
.setting-row input[type="number"],
.setting-row select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  width: 110px;
  transition: border-color var(--transition);
}
.setting-row input[type="number"]:focus,
.setting-row select:focus { outline: none; border-color: var(--accent); }

.setting-row input[type="range"] {
  flex: 0 0 140px;
  accent-color: var(--accent);
}

/* Toggle (checkbox styled as switch) */
.setting-toggle-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 36px; height: 20px;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}
.setting-toggle-row input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.setting-toggle-row input[type="checkbox"]:checked { background: var(--accent); }
.setting-toggle-row input[type="checkbox"]:checked::before { transform: translateX(16px); }

.settings-note {
  font-size: 12px;
  color: var(--text-3);
  padding: 6px 0 10px;
  line-height: 1.5;
}
.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
}
.btn-text {
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition);
}
.btn-text:hover { background: var(--surface-3); }
.btn-text-danger { color: #e85f4d; }
.btn-text-danger:hover { background: rgba(232, 95, 77, 0.10); }

/* Stats */
.stats-today, .stats-week, .stats-all {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-soft);
}
.stats-today:last-child, .stats-week:last-child, .stats-all:last-child { border-bottom: none; }
.stats-today h3, .stats-week h3, .stats-all h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}
.stats-today-row, .stats-all-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.stats-tile {
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 14px 16px;
  text-align: center;
}
.stats-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}
.stats-label {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  font-weight: 500;
}

.week-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  height: 100px;
}
.week-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 100%;
}
.week-bar-fill {
  width: 100%;
  background: var(--accent);
  border-radius: 4px 4px 2px 2px;
  min-height: 2px;
  transition: height var(--transition-slow);
}
.week-bar-fill.is-today { background: var(--accent-2); box-shadow: 0 0 0 2px var(--accent-soft); }
.week-bar-label {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 500;
}
.week-bar-count {
  font-size: 10px;
  color: var(--text-2);
  font-weight: 600;
}

/* ============ Footer ============ */
.site-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}
.site-footer-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 6px;
}
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--accent); }
.site-footer .sub {
  font-size: 11px;
  color: var(--text-faint);
}

/* ===================================================================
   Tomato Hero — the timer panel becomes a vivid gradient card
   that swaps color by phase.
   =================================================================== */

/* Page-level: subtle radial warmth from top */
body {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 235, 220, 0.55) 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

/* The hero card — large gradient, soft layered shadow, inner highlight */
.timer-panel {
  background: linear-gradient(155deg, var(--tomato-from) 0%, var(--tomato-to) 100%);
  border: none;
  border-radius: 28px;
  padding: clamp(36px, 5vw, 56px) clamp(28px, 5vw, 48px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 8px 24px rgba(232, 95, 77, 0.22),
    0 32px 64px rgba(232, 95, 77, 0.14);
  position: relative;
  overflow: hidden;
  transition:
    background 500ms cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Inner top-half highlight (very subtle plastic gloss) */
.timer-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 50% 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 28px 28px 0 0;
}

/* Phase color swaps */
.timer-panel[data-phase="short"] {
  background: linear-gradient(155deg, var(--sage-from) 0%, var(--sage-to) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 8px 24px rgba(58, 157, 111, 0.22),
    0 32px 64px rgba(58, 157, 111, 0.14);
}
.timer-panel[data-phase="long"] {
  background: linear-gradient(155deg, var(--azure-from) 0%, var(--azure-to) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 8px 24px rgba(59, 130, 196, 0.22),
    0 32px 64px rgba(59, 130, 196, 0.14);
}

/* Phase label pill */
.phase-label {
  background: rgba(255, 255, 255, 0.20);
  color: #ffffff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-weight: 700;
  letter-spacing: 0.14em;
}
.timer-panel[data-phase="short"] .phase-label,
.timer-panel[data-phase="long"] .phase-label {
  background: rgba(255, 255, 255, 0.20);
  color: #ffffff;
}

/* Round dots */
.timer-panel .dot {
  background: rgba(255, 255, 255, 0.32);
}
.timer-panel .dot.dot-on {
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}
.timer-panel .dot.dot-done {
  background: #ffffff;
  opacity: 0.78;
}

/* Big timer numbers — bigger, tighter, with subtle shadow */
.time-text {
  color: #ffffff;
  font-size: clamp(72px, 14vw, 128px);
  font-weight: 600;
  letter-spacing: -0.05em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.round-text {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
}
.round-text #round-current {
  color: #ffffff;
}

/* Progress ring — white track + bright progress with glow */
.ring-track {
  stroke: rgba(255, 255, 255, 0.18);
}
.ring-progress {
  stroke: #ffffff;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.4));
}

/* Current task pill — glassy translucent on card */
.current-task {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.current-task-label {
  color: rgba(255, 255, 255, 0.75);
}
.current-task-text {
  color: #ffffff;
  font-weight: 600;
}

/* Primary button — solid white pill, accent-colored text */
.timer-panel .btn-primary {
  background: #ffffff;
  color: var(--tomato-to);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  font-weight: 700;
}
.timer-panel .btn-primary:hover {
  background: #ffffff;
  color: var(--tomato-to);
  transform: translateY(-2px);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.timer-panel[data-phase="short"] .btn-primary { color: var(--sage-to); }
.timer-panel[data-phase="short"] .btn-primary:hover { color: var(--sage-to); }
.timer-panel[data-phase="long"] .btn-primary { color: var(--azure-to); }
.timer-panel[data-phase="long"] .btn-primary:hover { color: var(--azure-to); }

/* Secondary buttons on card — translucent white pills */
.timer-panel .btn-secondary {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-weight: 600;
}
.timer-panel .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Preset selector on card */
.timer-panel .preset-label {
  color: rgba(255, 255, 255, 0.78);
}
.timer-panel .preset-select {
  background-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%23ffffff' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.timer-panel .preset-select option {
  color: var(--text);
  background: #ffffff;
}

/* Task panel: clean white card on cream background */
.task-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.02),
    0 4px 16px rgba(60, 40, 20, 0.06);
}

/* Smooth phase-change tint on background too (very subtle) */
body {
  transition: background 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Page title & subtitle */
.page-title { color: var(--text); }
.page-sub { color: var(--text-3); }

/* Topbar buttons */
.icon-btn { color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* Info section — already uses surface tokens, just ensure good contrast */
.info h2 { color: var(--text); }
.info p,
.info li { color: var(--text-2); }

/* Preset grid / use-case grid hover with tomato accent */
.preset-grid a:hover,
.usecase-grid a:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ============ Responsive ============ */
@media (max-width: 600px) {
  .app { padding: 8px 12px 60px; }
  .topbar { padding: 4px 0 20px; }
  .icon-btn { width: 32px; height: 32px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .lang-switcher { padding: 4px 22px 4px 8px; font-size: 12px; max-width: 140px; text-overflow: ellipsis; }
  .page-title { margin-bottom: 4px; }
  .page-sub { margin-bottom: 24px; }
  .timer-panel { padding: 20px 16px; }
  .task-panel { padding: 18px; min-height: 280px; }
  .control-row { gap: 8px; }
  .btn-primary { padding: 12px 24px; min-width: 120px; font-size: 14px; }
  .btn-secondary { padding: 12px 16px; font-size: 13px; }
  .info { padding: 16px 4px; }
  .info h2 { font-size: 20px; margin-top: 28px; }
  .preset-grid, .usecase-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* Phone width — hide "All tools" nav-link (brand still clickable to /) */
@media (max-width: 420px) {
  .topbar-right .nav-link { display: none; }
  .topbar-right { gap: 6px; }
  .lang-switcher { max-width: 130px; }
}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============ Focus visible ============ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus:not(:focus-visible),
select:focus:not(:focus-visible),
input:focus:not(:focus-visible) { outline: none; }

/* High contrast support */
@media (prefers-contrast: more) {
  :root { --border: #555; --border-soft: #444; --text-3: #ccc; }
}
