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

:root {
  --bg: #080808;
  --surface: rgba(255,255,255,0.05);
  --surface-hover: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.1);
  --text: #f5f5f7;
  --text-secondary: rgba(245,245,247,0.45);
  --accent: #4fc3f7;
  --accent-glow: rgba(79,195,247,0.25);
  --modal-bg: #1c1c1e;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ─────────────────────────────────── */

#app {
  width: 100%;
  max-width: 420px;
  padding: 3rem 2rem;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
}

.screen.active {
  display: flex;
  animation: fadeUp 0.5s cubic-bezier(0.4,0,0.2,1) both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Select Screen ───────────────────────────── */

header {
  text-align: center;
  margin-bottom: 3.5rem;
}

header h1 {
  font-size: 3rem;
  font-weight: 200;
  letter-spacing: 0.22em;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.mode-list {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.mode-row {
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  transition: background 0.2s;
}

.mode-row:hover {
  background: var(--surface-hover);
}

.mode-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-align: left;
  padding: 1.2rem 0;
  cursor: pointer;
}

.info-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  transition: color 0.2s;
  flex-shrink: 0;
}

.info-btn svg {
  width: 18px;
  height: 18px;
}

.info-btn:hover {
  color: var(--accent);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 0 1.25rem;
}

/* ── Breathe Screen ──────────────────────────── */

#breathe-screen {
  gap: 2rem;
  position: relative;
  min-height: 60vh;
  justify-content: center;
}

#breathe-screen #mode-label {
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 0.12em;
  margin-top: 2rem;
}

#back-btn {
  position: absolute;
  top: 0;
  left: 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}

#back-btn svg {
  width: 24px;
  height: 24px;
}

#back-btn:hover {
  color: var(--text);
}

.orb-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#orb {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(79,195,247,0.18), rgba(79,195,247,0.04) 60%, transparent 80%);
  border: 1px solid rgba(79,195,247,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 60px rgba(79,195,247,0.08), inset 0 0 40px rgba(79,195,247,0.05);
}

#orb-inner {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #7dd8f8, #4fc3f7 45%, #1a8fc4);
  box-shadow: 0 0 40px rgba(79,195,247,0.5), 0 0 80px rgba(79,195,247,0.2);
}

.orb-labels {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  pointer-events: none;
}

#phase-text {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
}

#count-text {
  font-size: 2.8rem;
  font-weight: 100;
  color: #ffffff;
  line-height: 1;
  letter-spacing: -0.02em;
}

#mode-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
}

/* Orb breathing animations */
@keyframes orb-inhale {
  from { transform: scale(1); box-shadow: 0 0 60px rgba(79,195,247,0.08), inset 0 0 40px rgba(79,195,247,0.05); }
  to   { transform: scale(1.35); box-shadow: 0 0 100px rgba(79,195,247,0.18), inset 0 0 60px rgba(79,195,247,0.1); }
}
@keyframes orb-exhale {
  from { transform: scale(1.35); box-shadow: 0 0 100px rgba(79,195,247,0.18), inset 0 0 60px rgba(79,195,247,0.1); }
  to   { transform: scale(1); box-shadow: 0 0 60px rgba(79,195,247,0.08), inset 0 0 40px rgba(79,195,247,0.05); }
}
@keyframes orb-hold {
  from { transform: scale(1.35); }
  to   { transform: scale(1.35); }
}

#orb.inhaling {
  animation: orb-inhale var(--phase-dur) cubic-bezier(0.4,0,0.2,1) forwards;
}
#orb.exhaling {
  animation: orb-exhale var(--phase-dur) cubic-bezier(0.4,0,0.2,1) forwards;
}
#orb.holding {
  animation: orb-hold var(--phase-dur) linear forwards;
}

/* ── Info Modal ──────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 100;
}

.overlay.open {
  opacity: 1;
  pointer-events: all;
}

#info-modal {
  background: var(--modal-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2rem 1.75rem 2.5rem;
  width: 100%;
  max-width: 420px;
  position: relative;
  transform: translateY(24px);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}

.overlay.open #info-modal {
  transform: translateY(0);
}

#info-close {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text-secondary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

#info-close svg {
  width: 14px;
  height: 14px;
}

#info-close:hover {
  background: rgba(255,255,255,0.14);
  color: var(--text);
}

#info-title {
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  padding-right: 2rem;
}

#info-body {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

#info-phases {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.phase-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
}

.phase-row .phase-name {
  font-size: 0.88rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.phase-row .phase-dur {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent);
}

@media (max-width: 380px) {
  #orb { width: 220px; height: 220px; }
  #orb-inner { width: 136px; height: 136px; }
  header h1 { font-size: 2.4rem; }
}
