:root {
  --bg: #0b1424;
  --bg-2: #101d33;
  --text: #e6eef7;
  --muted: #93a4ba;
  --panel: rgba(18, 30, 52, 0.72);
  --panel-border: rgba(147, 164, 186, 0.16);
  --field: rgba(255, 255, 255, 0.06);
  --field-border: rgba(147, 164, 186, 0.25);
  --accent: #63c7c0;
  --accent-ink: #062022;
  /* Updated from JS: hue follows the breath (teal when full, indigo when empty). */
  --hue: 200;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: radial-gradient(ellipse at 50% 30%, var(--bg-2), var(--bg) 70%) fixed, var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
  overflow-x: hidden;
}

/* Slowly drifting coloured light in the background */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob {
  position: absolute;
  width: 60vmax; height: 60vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.22;
  animation: drift 60s ease-in-out infinite alternate;
}
.b1 { background: hsl(calc(var(--hue) - 20) 60% 40%); top: -20vmax; left: -15vmax; }
.b2 { background: hsl(calc(var(--hue) + 40) 50% 35%); bottom: -25vmax; right: -20vmax; animation-duration: 80s; }
.b3 { background: hsl(calc(var(--hue) + 10) 45% 30%); top: 30%; left: 40%; width: 40vmax; height: 40vmax; animation-duration: 100s; opacity: 0.15; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(8vmax, 6vmax) scale(1.15); }
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  min-height: 100vh;
}

/* ---------------------------------------------------------------- stage */

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-width: 0;
}

.title {
  margin: 0;
  font-weight: 300;
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.breather {
  --size: min(68vmin, 480px);
  position: relative;
  width: var(--size);
  height: var(--size);
  display: grid;
  place-items: center;
  margin: 12px 0;
}

.orb, .halo {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  will-change: transform;
  transform: scale(0.45);
}

.orb {
  background:
    radial-gradient(circle at 35% 30%, hsl(var(--hue) 80% 82% / 0.95), transparent 55%),
    radial-gradient(circle at 50% 55%, hsl(var(--hue) 60% 55%), hsl(calc(var(--hue) + 25) 55% 30%) 75%);
  box-shadow:
    0 0 60px hsl(var(--hue) 70% 60% / 0.45),
    inset 0 0 40px hsl(calc(var(--hue) + 30) 60% 20% / 0.6);
}

.halo {
  border: 1px solid hsl(var(--hue) 70% 70% / 0.25);
  background: radial-gradient(circle, transparent 60%, hsl(var(--hue) 70% 60% / 0.08));
}

.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(147, 164, 186, 0.12); stroke-width: 1.5; }
.ring-progress {
  fill: none;
  stroke: hsl(var(--hue) 70% 72%);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 603.2;
  stroke-dashoffset: 603.2;
  opacity: 0.8;
}

.readout { position: relative; text-align: center; pointer-events: none; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5); }
.phase-label { font-size: clamp(1.4rem, 4vmin, 2.2rem); font-weight: 400; letter-spacing: 0.04em; }
.phase-count { font-size: clamp(1rem, 2.6vmin, 1.4rem); color: rgba(230, 238, 247, 0.75); font-variant-numeric: tabular-nums; min-height: 1.5em; }

.session-info { color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.5em; }

button { font: inherit; color: inherit; cursor: pointer; }

.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 999px;
  padding: 14px 44px;
  font-size: 1.1rem;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(99, 199, 192, 0.25);
  transition: transform 0.15s ease, background 0.2s ease;
}
.primary:hover { transform: translateY(-1px); }
.primary.running { background: transparent; color: var(--text); border: 1px solid var(--field-border); box-shadow: none; }

.hint { margin: 0; font-size: 0.8rem; color: var(--muted); opacity: 0.7; }

/* ---------------------------------------------------------------- panel */

.panel {
  align-self: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 8px 20px;
  backdrop-filter: blur(12px);
}

.group { padding: 14px 0; }
.group + .group { border-top: 1px solid var(--panel-border); }
.group h2 { margin: 0 0 10px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--field-border);
  background: var(--field);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
}
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.rate { margin: 10px 0 0; font-size: 0.85rem; color: var(--muted); }

.phase-row { padding: 8px 0; }
.phase-name { font-size: 0.95rem; margin-bottom: 6px; }
.phase-controls { display: flex; gap: 10px; align-items: center; }

.stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--field-border);
  background: var(--field);
  border-radius: 10px;
  overflow: hidden;
  flex: none;
}
.stepper input {
  width: 3.4em;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: right;
  padding: 6px 0;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .unit { color: var(--muted); padding: 0 6px 0 2px; }
.step { border: 0; background: transparent; width: 32px; height: 34px; font-size: 1.1rem; color: var(--muted); }
.step:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.sound { display: flex; gap: 6px; flex: 1; min-width: 0; }

select {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--field-border);
  border-radius: 10px;
  padding: 6px 8px;
}
select option { background: var(--bg-2); color: var(--text); }

.preview {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--field-border);
  background: var(--field);
  display: grid;
  place-items: center;
}
.preview svg { width: 16px; height: 16px; fill: currentColor; }
.preview:disabled { opacity: 0.35; cursor: default; }
.preview.playing { color: var(--accent); border-color: var(--accent); }

.field { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.field > span { width: 5em; flex: none; color: var(--text); font-size: 0.95rem; }
.field input[type="range"] { flex: 1; accent-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: center; margin: 10px 0; font-size: 0.95rem; }
.check input { accent-color: var(--accent); width: 18px; height: 18px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 20px 16px; gap: 20px; }
  .breather { --size: min(82vw, 420px); }
  .panel { padding: 4px 16px; }
}
