*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #080d14;
  --bg-2: #1e3050;
  --bg-high: #8a0c2a;
  --bg-high-2: #c8113f;
  --bg-low: #1a5c2e;
  --bg-low-2: #278d40;
  --bg-purple: #5526a8;
  --bg-purple-2: #7c3aed;
  --bg-orange: #a86507;
  --bg-orange-2: #f29609;
  --card: #1f2832;
  --card-border: #2b3743;
  --text: #f7f6f3;
  --muted: #c1c7cf;
  --accent: #ffb36b;
  --accent-deep: #ff9a4d;
  --danger: #ff7c6b;
  --danger-deep: #ff5a47;
  --phase-high-bg: rgba(255, 179, 107, 0.18);
  --phase-high-text: #ffd9b0;
  --phase-low-bg: rgba(134, 214, 195, 0.18);
  --phase-low-text: #d7f3ec;
  --ring: rgba(255, 179, 107, 0.24);
}

/* Theme: Warm Navy (default) */
.theme-navy {
  --bg: #080d14;
  --bg-2: #1e3050;
}

/* Theme: Soft Indigo */
.theme-indigo {
  --bg: #0a0a14;
  --bg-2: #252548;
}

/* Theme: Midnight Teal */
.theme-teal {
  --bg: #061212;
  --bg-2: #1a3838;
}

/* Theme: Slate (lighter) */
.theme-slate {
  --bg: #1a1f2e;
  --bg-2: #3a4560;
}

/* Theme: Storm (lightest) */
.theme-storm {
  --bg: #2a3040;
  --bg-2: #4a5570;
}

/* Theme: Dusk (colorful) */
.theme-dusk {
  --bg: #1e1a2e;
  --bg-2: #4a3a6a;
}

/* Theme: Ember (warm) */
.theme-ember {
  --bg: #1a1412;
  --bg-2: #4a3028;
}

/* Theme: Ocean (blue) */
.theme-ocean {
  --bg: #0a1620;
  --bg-2: #1a4565;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--bg-2), var(--bg));
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app.phase-high {
  --bg: var(--bg-high);
  --bg-2: var(--bg-high-2);
}

.app.phase-low {
  --bg: var(--bg-low);
  --bg-2: var(--bg-low-2);
}

.app {
  min-height: 100vh;
}

.shell {
  min-height: 100vh;
  padding: 1.5rem 1.25rem 3rem;
  padding-top: calc(1.5rem + env(safe-area-inset-top));
  padding-bottom: calc(3rem + env(safe-area-inset-bottom));
  padding-left: calc(1.25rem + env(safe-area-inset-left));
  padding-right: calc(1.25rem + env(safe-area-inset-right));
}

.card {
  max-width: 27.5rem;
  margin: 0 auto;
  padding: 1.25rem 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  display: grid;
  gap: 2.5rem;
  text-align: center;
}

.header {
  display: grid;
  gap: 0.375rem;
}

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.app-title {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0;
}

.timer {
  position: relative;
  display: grid;
  gap: 0.875rem;
  padding: 1.125rem 0 0;
  margin-bottom: -1rem;
}

.countdown {
  position: relative;
  z-index: 1;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 600;
  font-size: 7rem;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.phase {
  position: relative;
  z-index: 1;
  align-self: center;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.phase-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  padding: 0.375rem 0;
}

.step-btn {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.75rem 1.125rem;
  border-radius: 0.625rem;
  cursor: pointer;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
}

.step-btn:last-child {
  justify-self: end;
}

.step-btn svg {
  width: 2.125rem;
  height: 2.125rem;
  stroke: currentColor;
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.step-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.step-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.phase-high {
  color: var(--text);
}

.phase-low {
  color: var(--text);
}

.progress-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.interval-indicator {
  font-size: 1.2rem;
  text-transform: uppercase;
  /* letter-spacing: 0.12em; */
  color: var(--text);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.rounds {
  font-size: 1rem;
  text-transform: uppercase;
  /* letter-spacing: 0.14em; */
  color: var(--text);
  font-weight: 600;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: center;
  justify-items: center;
}

.stat {
  display: grid;
  gap: 0.375rem;
}

.stat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}


.actions {
  display: grid;
  gap: 1.5rem;
  justify-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3rem;
  height: 4rem;
  border-radius: 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: none;
  cursor: pointer;
  transition:
    transform 0.2s cubic-bezier(0.2, 0.9, 0.2, 1),
    background 0.2s cubic-bezier(0.2, 0.9, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.2, 0.9, 0.2, 1);
  position: relative;
  overflow: hidden;
  width: auto;
  color: var(--text);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

.btn-primary {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(0.875rem);
  -webkit-backdrop-filter: blur(0.875rem);
  color: var(--text);
  box-shadow: none;
}

.btn-stop {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(0.875rem);
  -webkit-backdrop-filter: blur(0.875rem);
  color: var(--text);
  box-shadow: none;
}

.btn-primary.haptic,
.btn-stop.haptic {
  box-shadow: none;
}

.btn-primary.haptic:active,
.btn-stop.haptic:active,
.btn-primary.haptic:focus-visible,
.btn-stop.haptic:focus-visible {
  box-shadow: none;
}

.btn-secondary {
  background: transparent;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: var(--text);
  box-shadow: none;
  padding: 0;
  height: auto;
}

.btn-primary:active,
.btn-stop:active,
.btn-secondary:active {
  transform: scale(0.97);
}

.btn-secondary:active {
  background: rgba(255, 255, 255, 0.15);
}

.hidden {
  display: none;
}

#reset.hidden {
  display: inline-flex;
  visibility: hidden;
}

/* ===== Countdown digit animation (roll-down tick) ===== */
.digit {
  display: inline-block;
  width: 0.62em;
  text-align: center;
  will-change: transform, opacity;
}

.digit-colon {
  display: inline-block;
  width: 0.35em;
  text-align: center;
  opacity: 0.9;
}

@keyframes tickDown {
  0% { transform: translateY(-12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.digit.animate {
  animation: tickDown 160ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

/* ===== Staggered reveal ===== */
.reveal {
  opacity: 1;
}

/* ===== Haptic-ish button feedback (CSS only) ===== */
.haptic {
  transform: translateZ(0);
  transition:
    transform 120ms cubic-bezier(0.2, 0.9, 0.2, 1),
    box-shadow 120ms cubic-bezier(0.2, 0.9, 0.2, 1),
    filter 120ms cubic-bezier(0.2, 0.9, 0.2, 1);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.haptic:active {
  transform: scale(0.985) translateY(1px);
  box-shadow:
    0 7px 18px rgba(0, 0, 0, 0.35),
    0 0 0 rgba(255, 255, 255, 0) inset;
  filter: brightness(1.04);
}

.haptic:active::after {
  content: "";
  position: absolute;
  inset: -0.125rem;
  border-radius: 1.125rem;
  box-shadow: 0 0 0 0.1875rem rgba(255, 179, 107, 0.28);
  pointer-events: none;
}

.haptic:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(255, 179, 107, 0.45),
    0 12px 26px rgba(0, 0, 0, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

@media (max-width: 30rem) {
  .card {
    padding: 1.75rem 0;
    border-radius: 1.5rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .digit.animate {
    animation: none;
  }

  .haptic {
    transition: none;
  }

  .haptic:active::after {
    display: none;
  }
}

.settings {
  position: fixed;
  inset: 0;
  display: block;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  z-index: 10;
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.2, 0.9, 0.2, 1);
  pointer-events: none;
  overflow-y: auto;
}

.settings.is-open {
  transform: translateX(0);
  pointer-events: auto;
}

.settings-card {
  width: min(27.5rem, 100%);
  margin: 0 auto;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 1.5rem 1.25rem 4.5rem;
  padding-top: calc(1.5rem + env(safe-area-inset-top));
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom));
  box-shadow: none;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.25rem;
  padding: 0;
}

.settings-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.settings-close {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 1.375rem;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(0.625rem);
  -webkit-backdrop-filter: blur(0.625rem);
  border: none;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.settings-spacer {
  width: 2.75rem;
}

.settings-close svg {
  width: 1.375rem;
  height: 1.375rem;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.settings-close:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.1);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Modern grouped sections */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-group-header {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  padding: 0 0.25rem;
}

.settings-group-content {
  background: rgba(255, 255, 255, 0.03);
  border: 0.0625rem solid rgba(255, 255, 255, 0.05);
  border-radius: 1.25rem;
  overflow: hidden;
  backdrop-filter: blur(1.25rem);
  -webkit-backdrop-filter: blur(1.25rem);
}

/* Modern cell rows */
.settings-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.75rem;
  padding: 0 1.25rem;
  position: relative;
  transition: background 0.15s ease;
}

.settings-cell:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 0;
  height: 0.0625rem;
  background: rgba(255, 255, 255, 0.06);
}

.settings-cell-label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  flex-shrink: 0;
}

.settings-cell-input {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 0.625rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  width: 4rem;
  height: 2.5rem;
  padding: 0;
  -moz-appearance: textfield;
  transition: all 0.2s ease;
}

.settings-cell-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  pointer-events: none;
}

.settings-time-input {
  background: rgba(255, 255, 255, 0.08);
  border: 0.0625rem solid rgba(255, 255, 255, 0.08);
  border-radius: 0.625rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
  text-align: center;
  width: 6.5rem;
  height: 2.5rem;
  padding: 0 0.5rem;
  appearance: auto;
  -webkit-appearance: auto;
  color-scheme: dark;
  transition: all 0.2s ease;
}

.settings-cell-input::-webkit-outer-spin-button,
.settings-cell-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.settings-time-input::-webkit-calendar-picker-indicator {
  opacity: 0.6;
}

.settings-cell-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.settings-time-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

/* Duration input group */
.settings-duration {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
  padding: 0.25rem;
}

.settings-duration-input {
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  width: 3.25rem;
  height: 2.25rem;
  padding: 0;
  -moz-appearance: textfield;
  transition: all 0.2s ease;
}

.settings-duration-input::-webkit-outer-spin-button,
.settings-duration-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.settings-duration-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
}

.settings-duration-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.settings-duration-sep {
  font-size: 1.125rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.3);
  padding: 0 0.125rem;
}

/* Interval list */
.intervals-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.interval-item {
  background: rgba(255, 255, 255, 0.04);
  border: 0.0625rem solid rgba(255, 255, 255, 0.06);
  border-radius: 1rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Phase rows (High / Low) */
.interval-phase {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
}

.interval-phase-high {
  border-bottom: 0.0625rem solid rgba(255, 255, 255, 0.06);
}

.interval-phase-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.6);
  width: 2.75rem;
  flex-shrink: 0;
}

.interval-phase-time {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.interval-time-input {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 0.625rem;
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  width: 3.5rem;
  height: 2.75rem;
  padding: 0 0.25rem;
}

.interval-time-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.14);
}

.interval-time-sep {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.3);
  padding: 0 0.125rem;
}

/* Color picker */
.color-picker {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
}

.color-swatches {
  display: flex;
  gap: 0.5rem;
}

.color-swatch {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
  padding: 0;
  display: none;
  flex-shrink: 0;
}

.color-swatch.selected {
  display: block;
  border-color: #fff;
}

.color-picker.open .color-swatches {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  z-index: 10;
  flex-direction: column;
  background: rgba(30, 35, 45, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0.5rem;
  border-radius: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.color-picker.open .color-swatch {
  display: block;
}

.color-picker.open .color-swatch.selected {
  border-color: #fff;
}

.color-swatch:focus {
  outline: none;
}

/* Footer row (Repeat + Delete) */
.interval-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  border-top: 0.0625rem solid rgba(255, 255, 255, 0.06);
}

.interval-repeat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.interval-repeat-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.6);
}

.interval-repeat-input {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 0.625rem;
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  text-align: center;
  width: 3.5rem;
  height: 2.75rem;
  padding: 0 0.25rem;
}

.interval-repeat-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.14);
}

.interval-repeat-suffix {
  font-size: 0.9375rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
}

.interval-delete {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.625rem;
  background: rgba(255, 100, 100, 0.1);
  border: none;
  color: rgba(255, 100, 100, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.interval-delete:active {
  transform: scale(0.9);
  background: rgba(255, 100, 100, 0.2);
}

.interval-delete svg {
  width: 1.125rem;
  height: 1.125rem;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.add-interval-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 3rem;
  margin-top: 0.5rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 0.0625rem dashed rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.add-interval-btn:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.08);
}

.add-interval-btn svg {
  width: 1.125rem;
  height: 1.125rem;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Footer with save button */
.settings-footer {
  padding: 1rem 0 0;
}

.settings-btn-primary {
  width: 100%;
  height: 3.25rem;
  border-radius: 1.625rem;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(0.625rem);
  -webkit-backdrop-filter: blur(0.625rem);
  border: none;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.settings-btn-primary:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.1);
}

.btn-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 1.375rem;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(0.625rem);
  -webkit-backdrop-filter: blur(0.625rem);
  border: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.btn-icon svg {
  width: 1.375rem;
  height: 1.375rem;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.btn-icon:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.1);
}

/* ===== Timer Index ===== */
.timer-index {
  min-height: 100vh;
  position: relative;
  padding: 1.5rem 1.25rem 3rem;
  padding-top: calc(1.5rem + env(safe-area-inset-top));
  padding-bottom: calc(3rem + env(safe-area-inset-bottom));
  padding-left: calc(1.25rem + env(safe-area-inset-left));
  padding-right: calc(1.25rem + env(safe-area-inset-right));
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
}

.version {
  position: absolute;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.5;
}

.timer-index.hidden {
  display: none;
}

.index-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 27.5rem;
  margin: 0 auto 1.5rem;
  padding: 0;
}

.index-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.index-spacer {
  width: 2.75rem;
}

.theme-btn {
  position: relative;
}

.settings-cell-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-btn svg {
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.timer-list {
  list-style: none;
  padding: 0;
  margin: 0 auto 1.5rem;
  max-width: 27.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.timer-list-item {
  display: flex;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.04);
  border: 0.0625rem solid rgba(255, 255, 255, 0.06);
  border-radius: 1rem;
  overflow: hidden;
}

.timer-list-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.timer-list-btn:active {
  background: rgba(255, 255, 255, 0.06);
}

.task-list-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.task-list-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.task-color {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
  flex: 0 0 auto;
}

.task-list-item {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  align-items: stretch;
  gap: 0.5rem;
}

.task-time-column {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.75rem 0.5rem 0.75rem 1rem;
  font-variant-numeric: tabular-nums;
}

.task-time-start {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.task-time-end {
  font-size: 0.85rem;
  color: var(--muted);
}

.task-gap {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.task-gap-line {
  height: 0.0625rem;
  background: rgba(255, 255, 255, 0.12);
  justify-self: stretch;
  border-radius: 999px;
}

.task-gap-time {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  justify-self: start;
  margin-left: 1em;
}

/* ===== History Panel ===== */
.history-panel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem;
  background: rgba(8, 13, 20, 1);
  z-index: 20;
}

.history-panel.hidden {
  display: none;
}

.history-card {
  width: 100%;
  max-width: 26rem;
  background: rgba(255, 255, 255, 0.04);
  border: 0.0625rem solid rgba(255, 255, 255, 0.06);
  border-radius: 1.25rem;
  padding: 1.25rem;
  box-shadow: 0 1rem 2.25rem rgba(0, 0, 0, 0.25);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.history-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.history-item {
  display: grid;
  grid-template-columns: 1rem 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 0.0625rem solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.history-item:active {
  background: rgba(255, 255, 255, 0.08);
}

.history-color {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.history-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.history-duration {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.history-empty {
  text-align: center;
  color: var(--muted);
  padding: 1rem 0;
}

.task-marker-item {
  background: transparent;
  border: none;
  justify-content: center;
}

.task-marker-item .task-time-column {
  justify-content: center;
}

.task-marker-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 0.0625rem solid rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  width: fit-content;
}

.timer-list-name {
  font-size: 1.0625rem;
  font-weight: 600;
}

.timer-list-duration {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}

.timer-list-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  background: transparent;
  border: none;
  border-left: 0.0625rem solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 100, 100, 0.7);
  cursor: pointer;
  transition: all 0.15s ease;
}

.timer-list-delete:active {
  background: rgba(255, 100, 100, 0.1);
}

.timer-list-delete svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.timer-list-empty {
  text-align: center;
  color: var(--muted);
  font-size: 1.125rem;
  padding: 2rem 1rem;
}

.new-timer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 27.5rem;
  height: 3.25rem;
  margin: 0 auto;
  border-radius: 1.625rem;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.new-timer-btn:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.12);
}

.new-timer-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ===== Task Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem;
  background: rgba(8, 13, 20, 1);
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 26rem;
  background: rgba(255, 255, 255, 0.04);
  border: 0.0625rem solid rgba(255, 255, 255, 0.06);
  border-radius: 1.25rem;
  padding: 1.25rem;
  box-shadow: 0 1rem 2.25rem rgba(0, 0, 0, 0.25);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.modal-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.modal-close svg {
  stroke-width: 2;
}

.modal-form {
  display: grid;
  gap: 1rem;
}

.modal-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-input {
  height: 3rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border: 0.0625rem solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0 0.95rem;
  font-size: 1rem;
  font-family: inherit;
}

.modal-row .modal-input {
  flex: 1;
  min-width: 0;
}

.modal-time-input {
  width: 7rem;
  height: 2.75rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border: 0.0625rem solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
  text-align: center;
  padding: 0 0.5rem;
  appearance: auto;
  -webkit-appearance: auto;
  color-scheme: dark;
}

.modal-time-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 0.125rem rgba(255, 179, 107, 0.25);
}

.modal-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 0.125rem rgba(255, 179, 107, 0.25);
}

.duration-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.duration-option {
  position: relative;
  display: inline-flex;
}

.duration-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.duration-pill {
  height: 2.75rem;
  padding: 0 1rem;
  border-radius: 1.4rem;
  border: 0.0625rem solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.duration-input:checked + .duration-pill {
  border-color: rgba(255, 179, 107, 0.8);
  background: rgba(255, 179, 107, 0.2);
  color: var(--text);
}

.duration-option:active .duration-pill {
  transform: scale(0.97);
}
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.modal-btn {
  height: 2.75rem;
  padding: 0 1.5rem;
  border-radius: 1.4rem;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.modal-btn-secondary {
  background: transparent;
  border: 0.0625rem solid rgba(255, 255, 255, 0.2);
  color: var(--muted);
}

.modal-btn-danger {
  margin-right: auto;
  background: rgba(212, 48, 74, 0.2);
  border: 0.0625rem solid rgba(212, 48, 74, 0.5);
  color: rgba(255, 214, 220, 0.95);
}

.modal-btn:active {
  transform: scale(0.97);
}

/* Timer view header */
.timer-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 27.5rem;
  margin: 0 auto 1.5rem;
  padding: 0;
}

.timer-view-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}


/* Timer name input in settings */
.timer-name-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 0.75rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.875rem 1rem;
  transition: background 0.15s ease;
}

.timer-name-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
}

.timer-name-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}
