:root {
  color-scheme: light dark;
  --paper: #f3e8d8;
  --ink: #2a221b;
  --muted: #5c5146;
  --line: #d7c7b2;
  --moss: #2f513d;
  --moss-ink: #f6eee3;
  --bloom: #9d3b2e;
  --petal: #e7c9b4;
  --dial: #efe3d2;
  --ring-track: #d9c8b0;
  --ring-fill: #2f513d;
  --shadow: 0 18px 40px color-mix(in srgb, #2a221b 12%, transparent);
  --radius: 22px;
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", serif;
  --font-ui: "IBM Plex Sans", "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1a1612;
    --ink: #f0e6d8;
    --muted: #c3b4a4;
    --line: #3a322a;
    --moss: #8fbf9a;
    --moss-ink: #152018;
    --bloom: #e08a78;
    --petal: #4a372e;
    --dial: #241f1a;
    --ring-track: #3d342c;
    --ring-fill: #8fbf9a;
    --shadow: 0 18px 40px color-mix(in srgb, #000 45%, transparent);
  }
}

:root[data-theme="dark"] {
  --paper: #1a1612;
  --ink: #f0e6d8;
  --muted: #c3b4a4;
  --line: #3a322a;
  --moss: #8fbf9a;
  --moss-ink: #152018;
  --bloom: #e08a78;
  --petal: #4a372e;
  --dial: #241f1a;
  --ring-track: #3d342c;
  --ring-fill: #8fbf9a;
  --shadow: 0 18px 40px color-mix(in srgb, #000 45%, transparent);
}

:root[data-theme="light"] {
  --paper: #f3e8d8;
  --ink: #2a221b;
  --muted: #5c5146;
  --line: #d7c7b2;
  --moss: #2f513d;
  --moss-ink: #f6eee3;
  --bloom: #9d3b2e;
  --petal: #e7c9b4;
  --dial: #efe3d2;
  --ring-track: #d9c8b0;
  --ring-fill: #2f513d;
  --shadow: 0 18px 40px color-mix(in srgb, #2a221b 12%, transparent);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -40px;
  z-index: 10;
  background: var(--moss);
  color: var(--moss-ink);
  padding: 0.4rem 0.7rem;
}

.skip-link:focus {
  top: 0.75rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.topbar,
.colophon,
.desk {
  width: min(1080px, calc(100% - 2rem));
  margin-inline: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 0 0.5rem;
}

.mark {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.topbar-actions,
.controls,
.modes,
.task-form,
.list-head,
.task-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: color-mix(in srgb, var(--moss) 18%, transparent);
}

.ghost,
.mode,
.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
}

.primary {
  background: var(--moss);
  color: var(--moss-ink);
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.3rem;
  font-weight: 600;
}

.primary.compact {
  padding: 0.55rem 0.95rem;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 3px;
}

.desk {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(280px, 1.05fr);
  gap: 1.25rem;
  padding: 1rem 0 2.5rem;
}

.clock-panel,
.list-panel {
  background: color-mix(in srgb, var(--dial) 70%, var(--paper));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem;
}

.eyebrow {
  margin: 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.dial {
  position: relative;
  width: min(280px, 100%);
  margin: 0.8rem auto 0.4rem;
}

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

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

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

.ring-progress {
  stroke: var(--ring-fill);
  stroke-linecap: round;
  stroke-dasharray: 603.2;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.4s linear;
}

.time {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: clamp(3.2rem, 9vw, 4.4rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.active-task {
  min-height: 1.5em;
  margin: 0 0 1rem;
  text-align: center;
  color: var(--muted);
}

.modes {
  justify-content: center;
  flex-wrap: wrap;
}

.mode.is-active {
  background: var(--petal);
  border-color: transparent;
}

.controls {
  justify-content: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.status,
.tally,
.colophon,
.empty,
#list-meta {
  color: var(--muted);
}

.status,
.tally {
  text-align: center;
  margin: 0.85rem 0 0;
}

.tally strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 650;
}

.list-head {
  justify-content: space-between;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.task-form {
  margin: 1rem 0;
}

.task-form input {
  flex: 1;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
}

.tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.task-row {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.55rem 0.65rem;
}

.task-row.is-done .task-title {
  text-decoration: line-through;
  color: var(--muted);
}

.task-row.is-active {
  border-color: var(--moss);
}

.task-title {
  flex: 1;
  min-width: 0;
}

.task-title button {
  width: 100%;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: 0;
  padding: 0.2rem 0;
}

.icon-btn {
  padding: 0.3rem 0.55rem;
  flex: 0 0 auto;
}

.empty {
  display: none;
  margin: 1.4rem 0 0;
}

.list-panel.is-empty .empty {
  display: block;
}

.list-panel.is-empty .tasks {
  display: none;
}

.colophon {
  padding-bottom: 2rem;
  font-size: 0.92rem;
}

@media (max-width: 820px) {
  .desk {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ring-progress {
    transition: none;
  }
}
