:root {
  --bg: #f4f1ec;
  --card: #fffdf9;
  --ink: #2b2a28;
  --muted: #8a867e;
  --line: #e6e1d8;
  --accent: #5f7f6b;
  --accent-ink: #ffffff;
  --chip: #f1ede6;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121413;
    --card: #1b1e1c;
    --ink: #e8e6e1;
    --muted: #8d918e;
    --line: #2b302d;
    --accent: #8fb39b;
    --accent-ink: #121413;
    --chip: #242826;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }

.card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 20px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.phase {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: .04em;
}

.dial { position: relative; width: 220px; margin: -6px auto 0; aspect-ratio: 1; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial circle { fill: none; stroke-width: 3; }
.dial .track { stroke: var(--line); }
.dial .progress {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
  transition: stroke-dashoffset .3s linear;
}
.time {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 56px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }

.settings, .ambience { display: flex; flex-direction: column; gap: 14px; }
.ambience { border-top: 1px solid var(--line); padding-top: 16px; }

.row { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid transparent;
  background: var(--chip);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
}
.chip[aria-pressed="true"], .chip[aria-checked="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}
#durationChips { justify-content: space-between; }
#durationChips .chip { flex: 1; padding: 6px 0; }

.mixer { display: flex; flex-direction: column; gap: 8px; }
.mixer:empty { display: none; }
.mixer label { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 10px; font-size: 14px; }

.actions { display: flex; gap: 10px; }
.actions button {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 14px;
  font-size: 16px;
  font-weight: 500;
}
.primary { background: var(--accent); color: var(--accent-ink); }
.secondary { background: var(--chip); }

/* While a session runs or has ended, only the dial, the ambience and the buttons stay. */
.card:not([data-state="idle"]) .settings { display: none; }
.card[data-state="idle"] #stop { display: none; }

footer { max-width: 440px; width: 100%; font-size: 12px; color: var(--muted); }
footer summary { cursor: pointer; text-align: center; list-style: none; }
footer summary::-webkit-details-marker { display: none; }
footer ul { padding-left: 18px; }
footer a { color: inherit; }
