.pomodoro-app,
.pomodoro-overlay {
  --pom-bg: var(--card);
  --pom-surface: var(--surface);
  --pom-fg: var(--fg);
  --pom-muted: var(--muted);
  --pom-border: var(--border);
  --pom-accent: var(--accent);
  --pom-break: #1fa58a;
  --pom-long: #d97706;
  --pom-danger: #d93025;
  --pom-shadow: var(--shadow);
}

.pomodoro-app[data-theme="dark"],
.pomodoro-overlay[data-theme="dark"] {
  --pom-bg: rgba(11, 31, 51, 0.72);
  --pom-surface: rgba(11, 31, 51, 0.92);
  --pom-fg: #e6edf3;
  --pom-muted: #94a3c1;
  --pom-border: #1e2d45;
  --pom-accent: #5ea0ff;
  --pom-break: #29c4a0;
  --pom-long: #fbbf24;
  --pom-danger: #ff8a80;
  --pom-shadow: 0 14px 36px rgba(4, 10, 25, 0.55);
}

.pomodoro-app[data-theme="light"],
.pomodoro-overlay[data-theme="light"] {
  --pom-bg: #ffffff;
  --pom-surface: #f6f8fa;
  --pom-fg: #111827;
  --pom-muted: #64748b;
  --pom-border: #d0d7de;
  --pom-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.pomodoro-app {
  display: grid;
  gap: 16px;
}

.pomodoro-shell {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.pomodoro-panel {
  background: var(--pom-bg);
  border: 1px solid var(--pom-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--pom-shadow);
}

.pomodoro-phase-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--pom-border);
  background: var(--pom-surface);
  color: var(--pom-fg);
}

.pomodoro-phase-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--pom-accent);
}

.pomodoro-dial {
  position: relative;
  width: min(320px, 80vw);
  margin: 14px auto 8px;
  aspect-ratio: 1 / 1;
}

.pomodoro-dial svg {
  width: 100%;
  height: 100%;
  display: block;
  color: var(--pom-fg);
}

.pomodoro-dial #tickGroup line {
  stroke: var(--pom-border);
  stroke-linecap: round;
}

.pomodoro-ring-track {
  fill: none;
  stroke: var(--pom-border);
  stroke-width: 12;
}

.pomodoro-ring {
  fill: none;
  stroke: var(--pom-accent);
  stroke-width: 12;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 120px 120px;
}

.pomodoro-hand {
  stroke: var(--pom-fg);
  stroke-width: 3.6;
  stroke-linecap: round;
}

.pomodoro-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px;
}

.pomodoro-center-label {
  font-size: 0.85rem;
  color: var(--pom-muted);
}

.pomodoro-center-time {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pomodoro-meta {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.pomodoro-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--pom-border);
  background: var(--pom-surface);
}

.pomodoro-meta-key {
  color: var(--pom-muted);
  font-size: 0.85rem;
}

.pomodoro-meta-val {
  font-size: 0.95rem;
}

.pomodoro-cycle-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  vertical-align: middle;
}

.pomodoro-cycle-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid var(--pom-border);
  background: transparent;
  box-sizing: border-box;
}

.pomodoro-cycle-dot.is-done {
  background: var(--pom-accent);
  border-color: var(--pom-accent);
}

.pomodoro-cycle-dot.is-active {
  border-color: var(--pom-accent);
}

.pomodoro-time-big {
  font-size: clamp(54px, 7vw, 86px);
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.pomodoro-time-sub {
  color: var(--pom-muted);
  font-size: 0.9rem;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.pomodoro-controls {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.pomodoro-controls .button {
  min-height: 44px;
}

.pomodoro-controls .button.primary {
  font-size: 1rem;
  padding: 12px 14px;
}

.pomodoro-controls .row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pomodoro-stats {
  margin-top: 14px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.pomodoro-stat {
  border: 1px solid var(--pom-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--pom-surface);
}

.pomodoro-stat-label {
  color: var(--pom-muted);
  font-size: 0.85rem;
}

.pomodoro-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.pomodoro-details {
  border: 1px solid var(--pom-border);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  margin-top: 14px;
  background: var(--pom-surface);
}

.pomodoro-details summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pomodoro-details.always-open > summary {
  cursor: default;
  pointer-events: none;
}

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

.pomodoro-panel-body {
  padding: 12px;
  display: grid;
  gap: 12px;
}

.pomodoro-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.pomodoro-field span {
  display: block;
  color: var(--pom-muted);
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.pomodoro-field input,
.pomodoro-field select {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid var(--pom-border);
  background: var(--pom-bg);
  color: var(--pom-fg);
  padding: 10px 12px;
  font-size: 0.95rem;
}

.pomodoro-field input[type="range"] {
  padding: 0;
  height: 32px;
  background: transparent;
  border: 0;
}

.pomodoro-toggles {
  display: grid;
  gap: 8px;
}

.pomodoro-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
}

.pomodoro-note {
  color: var(--pom-muted);
  font-size: 0.85rem;
}

.pomodoro-history {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.pomodoro-history-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--pom-border);
  background: var(--pom-bg);
}

.pomodoro-history-item .left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pomodoro-history-item .right {
  font-variant-numeric: tabular-nums;
}

.pomodoro-help {
  border: 1px solid var(--pom-border);
  border-radius: 14px;
  padding: 0;
  max-width: 560px;
  width: calc(100% - 28px);
  background: var(--pom-bg);
  color: var(--pom-fg);
  box-shadow: var(--pom-shadow);
}

.pomodoro-help::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.pomodoro-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px;
  border-bottom: 1px solid var(--pom-border);
  gap: 10px;
}

.pomodoro-help-title {
  font-weight: 700;
}

.pomodoro-help-close {
  min-height: 36px;
  padding: 6px 10px;
  line-height: 1;
}

.pomodoro-help-body {
  padding: 12px 12px;
  color: var(--pom-muted);
  line-height: 1.5;
}

.pomodoro-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 40;
}

.pomodoro-toast.show {
  opacity: 1;
}

.pomodoro-overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
  z-index: 45;
}

.pomodoro-overlay.show {
  display: grid;
}

.pomodoro-overlay-card {
  background: var(--pom-bg);
  border: 1px solid var(--pom-border);
  border-radius: 14px;
  padding: 18px;
  max-width: 320px;
  width: calc(100% - 32px);
  box-shadow: var(--pom-shadow);
  text-align: center;
}

.pomodoro-overlay-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.pomodoro-overlay-actions {
  display: grid;
  gap: 8px;
}

@media (max-width: 540px) {
  .pomodoro-controls .row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
