:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  background: #101613;
  color: #f2f4ec;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --background: #101613;
  --panel: #19211d;
  --panel-border: #2d3932;
  --muted: #929d95;
  --lime: #d6f36a;
  --work: #62e879;
  --rest: #ff626b;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { min-height: 100dvh; background: var(--background); }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse at 90% 5%, rgb(214 243 106 / 8%), transparent 34%), radial-gradient(ellipse at 0% 75%, rgb(133 217 202 / 5%), transparent 36%);
  content: "";
}

.app-shell {
  display: flex;
  width: min(100%, 520px);
  min-height: 100dvh;
  flex-direction: column;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 24px calc(env(safe-area-inset-bottom) + 24px);
}
.setup-view { display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 18px; }

.setup-card { overflow: hidden; border: 1px solid var(--panel-border); border-radius: 20px; background: linear-gradient(145deg, rgb(255 255 255 / 3%), transparent 54%), var(--panel); box-shadow: 0 20px 55px rgb(0 0 0 / 13%); }
.setting-row { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; }
.setting-row + .setting-row { border-top: 1px solid rgb(255 255 255 / 6%); }
.setting-name { display: flex; align-items: center; gap: 11px; color: #e7ebe2; font-size: 15px; font-weight: 560; }
.phase-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 16px currentColor; }
.work-dot { color: var(--work); background: var(--work); }
.rest-dot { color: var(--rest); background: var(--rest); }
.round-dot { color: var(--lime); background: var(--lime); }
.setting-input-wrap { display: flex; align-items: center; gap: 8px; color: #7f8b82; font-size: 12px; }
.setting-input-wrap input { width: 84px; padding: 9px 8px; border: 1px solid transparent; border-radius: 9px; outline: none; background: #111915; color: #f4f7ec; font-size: 18px; font-variant-numeric: tabular-nums; text-align: center; }
.setting-input-wrap input::placeholder { color: #627067; font-size: 14px; }
.setting-input-wrap input:focus { border-color: rgb(214 243 106 / 55%); box-shadow: 0 0 0 3px rgb(214 243 106 / 9%); }
.setting-input-wrap input[name="rounds"] { width: 72px; }
.duration-inputs { display: flex; align-items: center; gap: 10px; }
.time-field { display: flex; align-items: center; gap: 4px; color: #7f8b82; font-size: 12px; }
.time-field input { width: 48px; padding: 9px 3px; border: 1px solid transparent; border-radius: 9px; outline: none; background: #111915; color: #f4f7ec; font-size: 18px; font-variant-numeric: tabular-nums; text-align: center; }
.time-field input:focus { border-color: rgb(214 243 106 / 55%); box-shadow: 0 0 0 3px rgb(214 243 106 / 9%); }

.form-error { margin: 0 2px; color: #ff9d83; font-size: 12px; }
.form-error:empty { display: none; }
.sound-player { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.primary-button { display: flex; min-height: 58px; align-items: center; justify-content: center; padding: 0 20px; border: 0; border-radius: 15px; cursor: pointer; font-size: 16px; font-weight: 700; transition: transform 120ms ease, opacity 120ms ease, background-color 180ms ease; }
.primary-button { background: var(--lime); color: #182015; box-shadow: 0 10px 24px rgb(214 243 106 / 12%); }
.primary-button:active { transform: scale(.985); }
.primary-button:disabled { cursor: wait; opacity: .65; }
.session-view { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: clamp(34px, 9vh, 72px); }
.session-info { display: flex; width: 100%; align-items: center; justify-content: space-between; }
.phase-label { color: var(--work); font-size: 18px; font-weight: 670; letter-spacing: .08em; }
.session-round { color: #c5cec4; font-size: 14px; font-variant-numeric: tabular-nums; }
.time-display { margin: 0; color: #f3f6eb; font-size: clamp(96px, 27vw, 156px); font-variant-numeric: tabular-nums; font-weight: 620; letter-spacing: -.075em; line-height: 1; white-space: nowrap; }
.session-view[data-phase="work"] .time-display, .session-view[data-phase="work"] .phase-label { color: var(--work); }
.session-view[data-phase="rest"] .time-display, .session-view[data-phase="rest"] .phase-label { color: var(--rest); }
.session-view[data-phase="finished"] .phase-label { color: var(--lime); }
.session-view .primary-button { width: 100%; }

@media (max-height: 700px) {
  .setup-view { padding: 16px 0 20px; }
  .setting-row { min-height: 62px; }
  .time-display { font-size: clamp(88px, 23vw, 132px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
