:root {
  color-scheme: dark light;
  --bg: #0f1216;
  --card: #171c22;
  --card-2: #1f262e;
  --text: #eef2f6;
  --muted: #9aa7b4;
  --accent: #ff6b5a;
  --accent-2: #35c08b;
  --line: #2b333d;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100dvh;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(120% 90% at 50% 0%, #1b2430 0%, #0f1216 60%);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
}
main { width: 100%; max-width: 26rem; display: flex; flex-direction: column; gap: 1rem; }
header { text-align: center; }
h1 { font-size: clamp(1.35rem, 5vw, 1.7rem); margin: 0; letter-spacing: -0.01em; }
.tagline { margin: .25rem 0 0; color: #9aa7b4; font-size: .9rem; }

.timer-card, .settings {
  background: #171c22;
  border: 1px solid #2b333d;
  border-radius: 1rem;
  padding: 1.1rem 1rem 1.25rem;
  box-shadow: 0 10px 30px rgb(0 0 0 / .25);
}
.phase {
  margin: 0 0 .5rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .8rem;
  font-weight: 700;
  color: #ff6b5a;
}
.phase[data-phase="break"] { color: #35c08b; }

.dial { position: relative; width: min(16rem, 74vw); aspect-ratio: 1; margin: 0 auto .75rem; }
.dial-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial-track { fill: none; stroke: #2b333d; stroke-width: 6; }
.dial-progress {
  fill: none; stroke: #ff6b5a; stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: calc(339.292 * (1 - var(--progress, 0)));
  transition: stroke-dashoffset .4s linear, stroke .3s;
}
body[data-phase="break"] .dial-progress { stroke: #35c08b; }
body[data-phase="break"] .phase { color: #35c08b; }
body[data-running="true"] .clock { opacity: 1; }
.clock-wrap {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .15rem;
}
.clock {
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.6rem, 13vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sessions { color: #9aa7b4; font-size: .85rem; }
.sessions span#session-count { color: #eef2f6; font-weight: 700; }

.controls { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: .5rem; }
button {
  min-height: 44px;
  padding: .6rem .9rem;
  border-radius: .65rem;
  border: 1px solid #39434f;
  background: #232b34;
  color: #eef2f6;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: #2b343f; }
button:focus-visible, input:focus-visible { outline: 2px solid #ffb4a8; outline-offset: 2px; }
button.primary { background: #ff6b5a; border-color: #ff6b5a; color: #1a1008; }
button.primary:hover { background: #ff8577; }
body[data-phase="break"] button.primary { background: #35c08b; border-color: #35c08b; color: #04160e; }
body[data-phase="break"] button.primary:hover { background: #54d3a2; }

.status { min-height: 1.4em; margin: .75rem 0 0; text-align: center; color: #9aa7b4; font-size: .85rem; }

.settings h2 { margin: 0 0 .75rem; font-size: .95rem; text-transform: uppercase; letter-spacing: .1em; color: #9aa7b4; }
.row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .6rem; }
.row label { font-size: .95rem; }
.row input {
  width: 6.5rem;
  min-height: 44px;
  padding: .45rem .6rem;
  border-radius: .55rem;
  border: 1px solid #39434f;
  background: #0f1216;
  color: #eef2f6;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.settings button[type="submit"] { width: 100%; margin-top: .25rem; }
.hint { margin: .6rem 0 0; color: #7f8b98; font-size: .78rem; text-align: center; }

.pwa-row { display: flex; justify-content: center; }
.pwa-row button { font-size: .85rem; background: transparent; border-color: #39434f; color: #9aa7b4; }
#lab-offline-status { margin: 0; text-align: center; color: #9aa7b4; font-size: .8rem; min-height: 1em; }
dialog { max-width: min(28rem, 90vw); border-radius: .75rem; border: 1px solid #39434f; background: #171c22; color: #eef2f6; }

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