/* Calm dark theme for the meditation timer */
:root {
  --bg: #0b1020;
  --bg-soft: #131a32;
  --fg: #e7ecf5;
  --fg-dim: #9aa6bd;
  --accent: #f0b86e;           /* soft amber */
  --accent-2: #7fd1c8;         /* calm teal */
  --danger: #e57676;
  --control-bg: #1b233e;
  --control-bg-hover: #242e4d;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(120% 120% at 50% 0%, #131a32 0%, var(--bg) 60%);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overscroll-behavior: none;
}

body {
  display: flex;
}

.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: calc(16px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  text-align: center;
}

.app__header { margin-bottom: 8px; }
.app__title {
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0;
}

.timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
  max-width: 420px;
}

.timer__display {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(4.5rem, 22vw, 7.5rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--fg);
  margin: 12px 0 4px;
  text-shadow: 0 0 24px rgba(240, 184, 110, 0.08);
  transition: color .3s ease;
}

.timer.is-running .timer__display { color: var(--accent); }
.timer.is-finished .timer__display { color: var(--accent-2); animation: pulse 1.8s ease-in-out 2; }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: .85; }
}

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

.min-btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--control-bg);
  color: var(--fg-dim);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 14px 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .1s ease, border-color .15s ease;
}
.min-btn:active { transform: scale(0.96); }
.min-btn.is-active {
  background: linear-gradient(180deg, rgba(240,184,110,0.18), rgba(240,184,110,0.08));
  color: var(--accent);
  border-color: rgba(240,184,110,0.35);
}
.timer.is-running .min-btn { opacity: .55; pointer-events: none; }

.timer__controls {
  display: flex;
  gap: 12px;
  width: 100%;
}

.control {
  flex: 1;
  appearance: none;
  border: 1px solid transparent;
  background: var(--control-bg);
  color: var(--fg);
  font-size: 1.15rem;
  font-weight: 600;
  padding: 18px 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s ease, transform .1s ease, color .15s ease;
}
.control:active { transform: scale(0.98); }
.control--primary {
  background: linear-gradient(180deg, var(--accent), #d99a4e);
  color: #1a1308;
}
.timer.is-running .control--primary {
  background: linear-gradient(180deg, var(--accent-2), #5fb3a8);
  color: #06241f;
}

#reset { flex: 0 0 96px; }

.timer__options { display: flex; justify-content: center; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--fg-dim);
  font-size: 0.95rem;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__track {
  width: 42px; height: 24px;
  background: var(--control-bg);
  border-radius: 999px;
  position: relative;
  transition: background .15s ease;
}
.toggle__track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--fg-dim);
  transition: transform .15s ease, background .15s ease;
}
.toggle input:checked + .toggle__track { background: rgba(127,209,200,0.25); }
.toggle input:checked + .toggle__track::after {
  transform: translateX(18px);
  background: var(--accent-2);
}
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--accent); outline-offset: 2px; }

.timer__status {
  margin: 0;
  min-height: 1.2em;
  color: var(--fg-dim);
  font-size: 0.9rem;
}

@media (prefers-color-scheme: light) {
  /* Keep dark theme for meditation focus regardless of OS setting */
}