:root {
  --tomato: #e85d5d;
  --tomato-deep: #c74343;
  --mint: #62bfa5;
  --leaf: #4a9a74;
  --ink: #2d2a26;
  --text: #5f5852;
  --muted: #8c8179;
  --paper: #fffaf2;
  --surface: #ffffff;
  --line: #eadfd3;
  --soft: #f8eee2;
  --shadow: 0 22px 60px rgba(123, 74, 54, 0.16);
  --radius: 8px;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  background:
    radial-gradient(circle at 10% 12%, rgba(232, 93, 93, 0.12), transparent 28rem),
    linear-gradient(135deg, #fffaf2 0%, #f6fbf5 58%, #fff7ef 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.05rem;
}

.brand img {
  display: block;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem;
  border: 1px solid rgba(234, 223, 211, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
}

.nav-link {
  min-width: 4rem;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  color: var(--text);
  text-align: center;
  font-size: 0.94rem;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--tomato-deep);
  background: #fff2ec;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(360px, 1.12fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  min-height: calc(100vh - 92px);
  padding: 1rem 0 2rem;
}

.hero-copy {
  position: relative;
  padding: 2rem 0;
}

.hero-copy::after {
  content: "";
  display: block;
  width: min(320px, 72vw);
  aspect-ratio: 3 / 2;
  margin-top: 2rem;
  background: url("./assets/focus-table.svg") center / contain no-repeat;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--tomato-deep);
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 9em;
  font-size: clamp(2.55rem, 5vw, 5.35rem);
  line-height: 1.03;
  letter-spacing: 0;
}

.subtitle {
  max-width: 34rem;
  margin: 1.1rem 0 0;
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.8;
}

.timer-panel {
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid rgba(234, 223, 211, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.mode-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--tomato-deep);
  font-weight: 800;
}

.status-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--tomato);
  box-shadow: 0 0 0 0.35rem rgba(232, 93, 93, 0.13);
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1.15rem 0 1.5rem;
}

.mode-btn {
  min-height: 3.7rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fffaf6;
  cursor: pointer;
  transition: transform 140ms ease, border 140ms ease, background 140ms ease, color 140ms ease;
}

.mode-btn span {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.mode-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(232, 93, 93, 0.45);
}

.mode-btn.active {
  color: #fff;
  border-color: var(--tomato);
  background: var(--tomato);
}

.mode-btn.active span {
  color: rgba(255, 255, 255, 0.86);
}

.mode-btn:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.timer-face {
  position: relative;
  display: grid;
  place-items: center;
  width: min(380px, 88vw);
  aspect-ratio: 1;
  margin: 0 auto;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track,
.ring-progress {
  fill: none;
  stroke-width: 12;
}

.ring-track {
  stroke: #f1e5dc;
}

.ring-progress {
  stroke: var(--tomato);
  stroke-linecap: round;
  stroke-dasharray: 603.19;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 300ms linear, stroke 180ms ease;
}

.timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

#timeDisplay {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: clamp(4rem, 9vw, 6.8rem);
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

#runState {
  color: var(--muted);
  font-weight: 700;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin: 1.35rem 0;
}

.primary-btn,
.secondary-btn {
  min-height: 3rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.primary-btn {
  color: #fff;
  background: var(--tomato);
  box-shadow: 0 12px 24px rgba(232, 93, 93, 0.24);
}

.secondary-btn {
  color: var(--tomato-deep);
  background: #fff5ef;
  border-color: rgba(232, 93, 93, 0.2);
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:active,
.secondary-btn:active {
  transform: translateY(1px);
}

.task-field {
  display: grid;
  gap: 0.45rem;
  color: var(--text);
  font-weight: 800;
}

.task-field input,
.settings-form input {
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  color: var(--ink);
  background: #fffdf9;
  outline: none;
  transition: border 140ms ease, box-shadow 140ms ease;
}

.task-field input:focus,
.settings-form input:focus {
  border-color: rgba(232, 93, 93, 0.72);
  box-shadow: 0 0 0 4px rgba(232, 93, 93, 0.12);
}

.current-task,
.feedback {
  margin: 0.75rem 0 0;
  color: var(--text);
  line-height: 1.6;
}

.completion-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: #f8fff8;
  border: 1px solid #dceddf;
}

.muted {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.completion-card strong {
  display: block;
  margin-top: 0.18rem;
  color: var(--leaf);
}

.tomatoes {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
  max-width: 9rem;
}

.tomato-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--tomato);
  box-shadow: inset 0 0.18rem 0 rgba(255, 255, 255, 0.28);
}

.section {
  padding: 3.5rem 0 0;
}

.section-heading {
  margin-bottom: 1.25rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.45rem);
}

.steps-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.step-card,
.stat-card {
  min-height: 10rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
}

.step-card span {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: #fff;
  background: var(--tomato);
  font-weight: 900;
}

.step-card h3 {
  margin: 1rem 0 0.45rem;
  font-size: 1.08rem;
}

.step-card p,
.stat-card span {
  color: var(--text);
  line-height: 1.65;
}

.stat-card strong {
  display: block;
  margin-top: 0.8rem;
  font-size: 2rem;
  color: var(--ink);
}

.settings-section {
  padding-bottom: 1rem;
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.8);
}

.settings-form label {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  color: var(--text);
  font-weight: 800;
}

.settings-form em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.88rem;
}

.settings-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.settings-actions button {
  min-width: 9rem;
}

.form-message {
  grid-column: 1 / -1;
  min-height: 1.5rem;
  margin: 0;
  color: var(--leaf);
  font-weight: 800;
}

body.rest-mode .status-dot,
body.rest-mode .mode-btn.active {
  background: var(--mint);
  border-color: var(--mint);
}

body.rest-mode .ring-progress {
  stroke: var(--mint);
}

body.rest-mode .mode-status {
  color: #267c68;
}

@media (max-width: 880px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    width: 100%;
    justify-content: space-between;
    overflow-x: auto;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-copy {
    padding-bottom: 0;
  }

  .hero-copy::after {
    width: min(240px, 58vw);
    margin-top: 1rem;
  }

  .steps-grid,
  .stats-grid,
  .settings-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  main {
    padding-inline: 0.9rem;
  }

  .site-header {
    padding-inline: 0.9rem;
  }

  .brand span {
    font-size: 1rem;
  }

  .nav-link {
    min-width: 3.2rem;
    padding-inline: 0.6rem;
    font-size: 0.88rem;
  }

  .mode-tabs,
  .controls,
  .steps-grid,
  .stats-grid,
  .settings-form {
    grid-template-columns: 1fr;
  }

  .timer-panel {
    padding: 1rem;
  }

  .timer-face {
    width: min(300px, 88vw);
  }

  #timeDisplay {
    font-size: clamp(3.4rem, 19vw, 4.8rem);
  }

  .completion-card {
    align-items: flex-start;
    flex-direction: column;
  }
}
