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

body[data-phase="focus"] {
  --phase: #364a32;
  --phase-ink: #faf7f2;
  --phase-soft: rgba(54, 74, 50, 0.09);
  --phase-glow: rgba(54, 74, 50, 0.20);
}

body[data-phase="short"] {
  --phase: #9c4a2d;
  --phase-ink: #faf7f2;
  --phase-soft: rgba(156, 74, 45, 0.09);
  --phase-glow: rgba(156, 74, 45, 0.20);
}

body[data-phase="long"] {
  --phase: #2e4c66;
  --phase-ink: #faf7f2;
  --phase-soft: rgba(46, 76, 102, 0.09);
  --phase-glow: rgba(46, 76, 102, 0.20);
}

:root[data-theme="dark"] body[data-phase="focus"] {
  --phase: #b9cca1;
  --phase-ink: #161816;
  --phase-soft: rgba(185, 204, 161, 0.12);
  --phase-glow: rgba(185, 204, 161, 0.24);
}

:root[data-theme="dark"] body[data-phase="short"] {
  --phase: #e1ae90;
  --phase-ink: #161816;
  --phase-soft: rgba(225, 174, 144, 0.12);
  --phase-glow: rgba(225, 174, 144, 0.24);
}

:root[data-theme="dark"] body[data-phase="long"] {
  --phase: #9ec0dc;
  --phase-ink: #161816;
  --phase-soft: rgba(158, 192, 220, 0.12);
  --phase-glow: rgba(158, 192, 220, 0.24);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body[data-phase="focus"] {
    --phase: #b9cca1;
    --phase-ink: #161816;
    --phase-soft: rgba(185, 204, 161, 0.12);
    --phase-glow: rgba(185, 204, 161, 0.24);
  }

  :root:not([data-theme="light"]) body[data-phase="short"] {
    --phase: #e1ae90;
    --phase-ink: #161816;
    --phase-soft: rgba(225, 174, 144, 0.12);
    --phase-glow: rgba(225, 174, 144, 0.24);
  }

  :root:not([data-theme="light"]) body[data-phase="long"] {
    --phase: #9ec0dc;
    --phase-ink: #161816;
    --phase-soft: rgba(158, 192, 220, 0.12);
    --phase-glow: rgba(158, 192, 220, 0.24);
  }
}

.pomo-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 16px;
}

.pomo-topbar {
  margin-bottom: 24px;
}

.phase-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, auto);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.phase-tabs button {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 500 13px/1 var(--sans);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.phase-tabs button:hover {
  color: var(--ink);
}

.phase-tabs button[aria-selected="true"] {
  background: var(--phase);
  color: var(--phase-ink);
}

.dial-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

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

.dial-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  display: block;
}

.dial-bezel-outer {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
  opacity: 0.65;
}

.dial-bezel-inner {
  fill: var(--surface-raised);
  fill-opacity: 0.45;
  stroke: var(--line);
  stroke-width: 1;
  opacity: 0.85;
}

.dial-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 3;
}

.dial-ticks line {
  stroke: var(--line-strong);
  stroke-width: 1;
  stroke-linecap: round;
  transition: stroke 0.25s ease, opacity 0.25s ease;
}

.dial-ticks line.major {
  stroke-width: 1.75;
  stroke: var(--muted);
  opacity: 0.55;
}

.dial-ticks line.passed {
  stroke: var(--phase);
  opacity: 0.85;
}

.dial-progress {
  fill: none;
  stroke: var(--phase);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke 0.35s ease;
}

body[data-state="running"] .dial-progress {
  filter: drop-shadow(0 0 8px var(--phase-glow));
}

.dial-hand-halo {
  fill: var(--phase-glow);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.35s ease;
}

body[data-state="running"] .dial-hand-halo {
  opacity: 1;
  animation: pulse-halo 2.8s ease-in-out infinite;
}

.dial-hand {
  fill: var(--paper);
  stroke: var(--phase);
  stroke-width: 2.75;
  transition: stroke 0.35s ease;
}

@keyframes pulse-halo {
  0%, 100% {
    transform: scale(1);
    opacity: 0.65;
  }
  50% {
    transform: scale(1.28);
    opacity: 0.25;
  }
}

@keyframes dial-done-ring {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

body[data-state="complete"] .dial-progress {
  animation: dial-done-ring 1.6s ease-in-out 2;
}

.dial-readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  padding: 36px;
}

.dial-eyebrow {
  margin: 0 0 8px;
  color: var(--phase);
  font: 500 11px/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.dial-time {
  margin: 0;
  color: var(--ink);
  font: 300 clamp(50px, 12vw, 68px)/1 var(--sans);
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.dial-schedule {
  margin: 12px 0 0;
  color: var(--muted);
  font: 400 12px/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
  min-height: 17px;
}

.intention-row {
  width: min(360px, 90vw);
  margin-top: 22px;
}

.intention-input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: center;
  font: 400 17px/1.4 var(--serif);
  transition: border-color 0.2s ease;
}

.intention-input::placeholder {
  color: var(--muted);
  opacity: 0.72;
  font-style: italic;
}

.intention-input:focus {
  border-bottom-color: var(--phase);
  outline: none;
}

.intention-input:focus-visible {
  outline: 2px solid var(--phase);
  outline-offset: 4px;
  border-radius: 4px;
}

.controls-primary {
  margin-top: 24px;
}

.btn-primary {
  min-height: 48px;
  min-width: 168px;
  padding: 0 32px;
  border: 1px solid var(--phase);
  border-radius: 999px;
  background: var(--phase);
  color: var(--phase-ink);
  font: 550 14px/1 var(--sans);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary.btn-sm {
  min-height: 40px;
  min-width: 96px;
  padding: 0 20px;
  font-size: 13px;
}

.controls-secondary {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
}

.btn-ghost {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 450 12px/1 var(--mono);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--phase-soft);
}

.btn-ghost[aria-pressed="false"] {
  opacity: 0.7;
}

.pomo-meta {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 16px;
}

.cycle-dots {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.cycle-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.cycle-dot.done {
  border-color: var(--phase);
  background: var(--phase);
}

.cycle-dot.current {
  border-color: var(--phase);
  transform: scale(1.15);
}

.today-summary {
  margin: 0;
  color: var(--muted);
  font: 400 12px/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
}

.history-drawer {
  width: min(460px, 100%);
  margin-top: 28px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.history-drawer summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 8px 2px;
  color: var(--muted);
  font: 450 12px/1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.history-drawer summary::-webkit-details-marker {
  display: none;
}

.history-drawer summary:hover {
  color: var(--ink);
}

.history-count {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.history-body {
  padding: 4px 0 18px;
}

.history-empty {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.history-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.history-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.history-list li:first-child {
  border-top: 0;
}

.history-time {
  color: var(--muted);
  font: 400 11px/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
}

.history-note {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-note.empty-note {
  color: var(--muted);
  font-style: italic;
}

.history-dur {
  color: var(--muted);
  font: 400 11px/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
}

.history-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.btn-text {
  min-height: 36px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 400 12px var(--mono);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.btn-text:hover {
  color: var(--ink);
}

.shortcut-bar {
  margin: 28px 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  color: var(--muted);
  font: 400 11px/1.5 var(--mono);
}

.shortcut-bar kbd,
.zen-exit kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: 500 10px/1.3 var(--mono);
}

/* Zen Mode */
.zen-exit {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 40;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font: 450 12px/1 var(--mono);
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.2s ease, color 0.15s ease, border-color 0.15s ease;
}

.zen-exit:hover,
.zen-exit:focus-visible {
  opacity: 1;
  color: var(--ink);
  border-color: var(--line-strong);
}

body[data-zen="true"] .site-header,
body[data-zen="true"] .site-footer,
body[data-zen="true"] .history-drawer,
body[data-zen="true"] .shortcut-bar {
  display: none;
}

body[data-zen="true"] .pomo-main {
  min-height: 100dvh;
  justify-content: center;
  padding-block: 32px;
}

body[data-zen="true"] #zen-btn {
  display: none;
}

/* Settings Dialog */
.settings-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
}

.settings-dialog::backdrop {
  background: rgba(20, 22, 18, 0.48);
  backdrop-filter: blur(4px);
}

.settings-card {
  display: flex;
  flex-direction: column;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.settings-header h2 {
  margin: 0;
  font: 450 22px/1.2 var(--serif);
}

.icon-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 400 24px/1 var(--sans);
  cursor: pointer;
}

.icon-close:hover {
  color: var(--ink);
  background: var(--surface);
}

.settings-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 70dvh;
  overflow-y: auto;
}

.settings-group {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-group legend {
  margin-bottom: 4px;
  color: var(--muted);
  font: 500 11px/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.settings-grid-4 label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-grid-4 span {
  font-size: 12px;
  color: var(--muted);
}

.settings-grid-4 input,
.settings-row select {
  width: 100%;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--ink);
  font: 450 14px/1.2 var(--mono);
  font-variant-numeric: tabular-nums;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}

.settings-row select {
  width: auto;
  min-width: 140px;
  font-family: var(--sans);
}

.settings-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-inline input[type="range"] {
  width: 120px;
  accent-color: var(--phase);
}

.mono-val {
  min-width: 38px;
  text-align: right;
  color: var(--muted);
  font: 400 12px var(--mono);
  font-variant-numeric: tabular-nums;
}

.btn-outline {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: 450 12px/1 var(--mono);
  cursor: pointer;
}

.btn-outline:hover {
  border-color: var(--phase);
  color: var(--phase);
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  font-size: 14px;
  cursor: pointer;
}

.settings-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--phase);
  cursor: pointer;
}

.settings-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

@media (max-width: 560px) {
  .phase-tabs button {
    padding: 0 13px;
    font-size: 12px;
  }

  .settings-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .shortcut-bar {
    display: none;
  }
}
