:root {
  color-scheme: light;
  --ink: #202936;
  --muted: #66717f;
  --paper: #f5f2ed;
  --panel: rgba(255, 255, 255, .82);
  --panel-strong: rgba(255, 255, 255, .94);
  --line: rgba(32, 41, 54, .13);
  --tomato: #d94f43;
  --tomato-dark: #91333c;
  --leaf: #2c7259;
  --gold: #c88c2d;
  --sky: #357f96;
  --charcoal: #263240;
  --shadow: 0 18px 46px rgba(50, 56, 66, .14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .64), rgba(255, 255, 255, 0) 34%),
    repeating-linear-gradient(135deg, rgba(32, 41, 54, .035) 0 1px, transparent 1px 22px),
    var(--paper);
}

body[data-mode="short"],
body[data-mode="long"] {
  --tomato: #3b8ea3;
  --tomato-dark: #27657a;
  --gold: #2f8f75;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  transition: transform .16s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(53, 127, 150, .26);
  outline-offset: 2px;
}

button:hover,
.home-link:hover {
  transform: translateY(-1px);
}

.app-shell {
  width: min(1220px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 352px;
  gap: 18px;
  align-items: stretch;
}

.timer-stage,
.side-panel > section {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.timer-stage {
  min-height: calc(100vh - 56px);
  padding: 34px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.timer-stage::after {
  content: none;
}

.topbar,
.panel-heading,
.primary-controls,
.mode-tabs,
.clock-layout {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.home-link {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, .66);
  font-weight: 800;
  text-decoration: none;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--leaf);
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 56px;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.today-stat {
  width: 96px;
  min-height: 78px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--charcoal);
  color: #fff;
  text-align: center;
}

.today-stat span {
  display: block;
  font-size: 34px;
  font-weight: 850;
  line-height: 1;
}

.today-stat small {
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
}

.mode-tabs {
  width: fit-content;
  max-width: 100%;
  margin: 28px 0 12px;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.mode-button {
  min-width: 82px;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
  font-weight: 750;
}

.mode-button.active {
  color: #fff;
  background: var(--charcoal);
}

.round-track {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.round-track span {
  width: 38px;
  height: 8px;
  border-radius: 999px;
  background: rgba(32, 41, 54, .12);
}

.round-track span.done {
  background: var(--leaf);
}

.round-track span.active {
  background: var(--tomato);
}

.clock-layout {
  flex: 1;
  justify-content: space-between;
  gap: 42px;
  position: relative;
  z-index: 1;
}

.dial-wrap {
  width: min(500px, 100%);
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
}

.tomato-art,
.progress-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.tomato-art {
  padding: 14%;
  filter: drop-shadow(0 22px 28px rgba(145, 51, 60, .2));
}

.progress-ring {
  transform: rotate(-90deg);
}

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

.ring-track {
  stroke: rgba(32, 41, 54, .11);
}

.ring-progress {
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-dasharray: 716.28;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .45s ease, stroke .3s ease;
}

.time-readout {
  width: 56%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(255, 255, 255, .86);
  border: 1px solid rgba(255, 255, 255, .82);
  box-shadow: inset 0 0 0 1px rgba(32, 41, 54, .07), 0 18px 42px rgba(48, 37, 34, .1);
  z-index: 2;
}

.time-readout span,
.time-readout small {
  color: var(--muted);
  font-weight: 750;
}

.time-readout strong {
  margin: 10px 0;
  font-variant-numeric: tabular-nums;
  font-size: 72px;
  line-height: 1;
  letter-spacing: 0;
}

.control-panel {
  width: min(300px, 100%);
  display: grid;
  gap: 18px;
}

.mode-card {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  align-content: center;
  gap: 8px;
  background: var(--panel-strong);
}

.mode-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mode-card strong {
  font-size: 30px;
  line-height: 1;
  color: var(--ink);
}

.primary-controls {
  justify-content: center;
  gap: 12px;
}

.icon-button,
.start-button,
.panel-heading button,
.task-form button {
  border: 0;
  color: #fff;
  background: var(--charcoal);
  box-shadow: 0 10px 24px rgba(32, 41, 54, .15);
}

.icon-button {
  width: 50px;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 22px;
}

.start-button {
  min-width: 132px;
  min-height: 58px;
  border-radius: 999px;
  font-size: 19px;
  font-weight: 850;
}

.toggles,
.side-panel {
  display: grid;
  gap: 14px;
}

.switch-row {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-weight: 650;
}

.switch-row input {
  width: 42px;
  height: 24px;
  accent-color: var(--leaf);
}

.side-panel {
  align-content: start;
}

.side-panel > section {
  border-radius: 8px;
  padding: 20px;
}

.panel-heading {
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-heading button,
.task-form button {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 14px;
  font-weight: 800;
}

.settings-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.settings-grid input,
.task-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel-strong);
  outline: none;
}

.settings-grid input:focus,
.task-form input:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(64, 142, 165, .15);
}

.task-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.task-form button {
  min-height: 44px;
  padding: 0;
  font-size: 22px;
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 8px;
}

.task-list li {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
}

.task-list input {
  accent-color: var(--tomato);
}

.task-list span {
  overflow-wrap: anywhere;
}

.task-list li.done span {
  color: var(--muted);
  text-decoration: line-through;
}

.task-list button {
  border: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(31, 35, 40, .06);
}

.stats-grid div {
  min-height: 84px;
  padding: 14px;
  border-radius: 8px;
  background: var(--charcoal);
  color: #fff;
}

.stats-grid strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}

.stats-grid span {
  color: rgba(255, 255, 255, .68);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .timer-stage {
    min-height: auto;
  }

  .clock-layout {
    flex-direction: column;
    justify-content: center;
  }

  .control-panel {
    width: 100%;
    max-width: 520px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0 18px;
  }

  .timer-stage {
    border-radius: 12px;
    padding: 18px;
  }

  h1 {
    font-size: 40px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .today-stat {
    width: 78px;
  }

  .today-stat span {
    font-size: 26px;
  }

  .mode-tabs {
    width: 100%;
    justify-content: stretch;
  }

  .mode-button {
    flex: 1;
    min-width: 0;
    padding: 0 8px;
  }

  .time-readout {
    width: 64%;
  }

  .time-readout strong {
    font-size: 46px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .round-track span {
    flex: 1;
    min-width: 20px;
  }
}
