:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-soft: #111931;
  --surface: rgba(22, 31, 56, 0.72);
  --surface-solid: #161f38;
  --surface-hover: rgba(38, 51, 86, 0.7);
  --border: rgba(148, 169, 220, 0.16);
  --border-strong: rgba(148, 169, 220, 0.3);
  --text: #eef2ff;
  --text-muted: #a7b2d0;
  --text-dim: #7d89aa;
  --accent: #6ee7d4;
  --accent-2: #8b9dff;
  --accent-soft: rgba(110, 231, 212, 0.14);
  --glow: rgba(110, 231, 212, 0.28);
  --orb-core: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.35), rgba(110, 231, 212, 0.24) 42%, rgba(139, 157, 255, 0.3) 100%);
  --shadow: 0 24px 70px rgba(2, 6, 23, 0.45);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f5fc;
  --bg-soft: #e8eefb;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-hover: rgba(237, 242, 255, 0.9);
  --border: rgba(63, 85, 145, 0.14);
  --border-strong: rgba(63, 85, 145, 0.28);
  --text: #17213d;
  --text-muted: #556382;
  --text-dim: #7d89a5;
  --accent: #0f9f92;
  --accent-2: #5a6ee8;
  --accent-soft: rgba(15, 159, 146, 0.12);
  --glow: rgba(15, 159, 146, 0.22);
  --orb-core: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.95), rgba(143, 226, 216, 0.66) 46%, rgba(148, 166, 246, 0.72) 100%);
  --shadow: 0 24px 70px rgba(45, 65, 120, 0.12);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 600px at 12% -10%, var(--accent-soft), transparent 70%),
    radial-gradient(800px 600px at 90% 10%, rgba(139, 157, 255, 0.14), transparent 70%),
    var(--bg);
  transition: background-color 0.35s ease, color 0.35s ease;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border);
}

.brand-mark svg { width: 24px; height: 24px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 20px; letter-spacing: -0.4px; }
.brand-dot { color: var(--accent); }
.brand-text small { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.icon-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); transform: translateY(-1px); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn .icon-sun { display: none; }
html[data-theme="light"] .icon-btn .icon-moon { display: none; }
html[data-theme="light"] .icon-btn .icon-sun { display: block; }

.hero { text-align: center; margin: 56px auto 30px; max-width: 680px; }
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.12;
  letter-spacing: -1.6px;
  font-weight: 700;
}
.hero p { margin: 0; color: var(--text-muted); font-size: 16px; line-height: 1.65; }

.breather-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 30px 34px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.orb-stage {
  position: relative;
  width: 300px;
  height: 300px;
  display: grid;
  place-items: center;
  margin: 4px 0 18px;
}

.orb-halo {
  position: absolute;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: var(--glow);
  filter: blur(38px);
  opacity: 0.8;
  transition: width 0.15s linear, height 0.15s linear, opacity 0.15s linear;
}

.orb {
  position: relative;
  width: 186px;
  height: 186px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--orb-core);
  box-shadow: inset 0 0 32px rgba(255, 255, 255, 0.16), 0 0 60px var(--glow);
  transform: scale(var(--scale));
  transition: transform 0.08s linear;
  will-change: transform;
}

.orb-ring {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--accent) calc(var(--progress) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  opacity: 0.95;
}

.orb-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  padding: 0 16px;
}

.orb-phase {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.orb-count {
  font-size: 52px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
}

.orb-hint { font-size: 11px; color: var(--text-muted); }

.phases {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.phase-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(127, 145, 200, 0.07);
  color: var(--text-dim);
  font-size: 12px;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.25s;
}

.phase-chip b { font-weight: 600; color: inherit; }
.phase-chip span { opacity: 0.75; font-variant-numeric: tabular-nums; }
.phase-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
}

.progress-track {
  width: min(420px, 100%);
  height: 5px;
  border-radius: 99px;
  background: rgba(127, 145, 200, 0.16);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.08s linear;
}

.session-info {
  width: min(420px, 100%);
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.controls { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; justify-content: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 148px;
  padding: 13px 24px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 18px; height: 18px; }

.btn-primary {
  color: #071a1c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 30px var(--glow);
}
html[data-theme="light"] .btn-primary { color: #fff; }
.btn-primary:hover { box-shadow: 0 16px 36px var(--glow); }

.btn-secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-hover); }

.keyboard-tip { margin: 14px 0 0; font-size: 11px; color: var(--text-dim); }

.settings {
  margin-top: 20px;
  display: grid;
  gap: 16px;
}

.settings-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px 24px;
  backdrop-filter: blur(14px);
}

.settings-block h2, .howto h2 {
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.techniques { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.technique {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(127, 145, 200, 0.05);
  color: var(--text);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.technique:hover { background: var(--surface-hover); transform: translateY(-2px); }
.technique strong { font-size: 15px; }
.technique span { font-size: 11px; color: var(--text-dim); line-height: 1.5; }
.technique.is-active { border-color: var(--accent); background: var(--accent-soft); }
.technique.is-active span { color: var(--text-muted); }

.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.setting-line { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  overflow: hidden;
}
.stepper button {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  transition: background 0.2s;
}
.stepper button:hover { background: var(--surface-hover); }
.stepper button:disabled { opacity: 0.35; cursor: not-allowed; }
.stepper span {
  min-width: 40px;
  text-align: center;
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.setting-label { color: var(--text-muted); font-size: 13px; }

.switch-line, .volume-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
}
.switch-line { cursor: pointer; padding: 6px 0; }
.switch-text { color: var(--text); }

.switch { position: relative; width: 44px; height: 25px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: rgba(127, 145, 200, 0.25);
  border: 1px solid var(--border-strong);
  transition: background 0.25s, border-color 0.25s;
  pointer-events: none;
}
.switch-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s;
}
.switch input:checked + .switch-slider { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.switch input:checked + .switch-slider::after { transform: translateX(19px); }
.switch input:focus-visible + .switch-slider { outline: 2px solid var(--accent); outline-offset: 3px; }

.volume-line { margin-top: 14px; flex-direction: column; align-items: stretch; gap: 8px; }
.volume-line input {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.sound-note { margin: 12px 0 0; font-size: 11px; line-height: 1.55; color: var(--text-dim); }

.progress-block { padding: 18px 24px; }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.progress-head h2 { margin-bottom: 14px; }
.progress-head h2 span { text-transform: none; letter-spacing: 0; font-size: 11px; color: var(--text-dim); margin-left: 8px; }
.streak-label { font-size: 11px; color: var(--text-dim); margin-bottom: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stats-grid div { display: flex; flex-direction: column; gap: 3px; align-items: center; padding: 10px 4px; border-radius: 12px; background: rgba(127, 145, 200, 0.06); }
.stats-grid b { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.4px; }
.stats-grid span { font-size: 10px; color: var(--text-dim); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.badge {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(127, 145, 200, 0.06);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
}
.badge::after { content: "?"; color: var(--text-dim); }
.badge.is-unlocked { border-color: var(--accent); background: var(--accent-soft); }
.badge.is-unlocked::after { content: "✓"; color: var(--accent); }
.badge.is-new { animation: badge-pop 1.6s ease; }
@keyframes badge-pop {
  0% { transform: scale(1); box-shadow: 0 0 0 0 var(--glow); }
  35% { transform: scale(1.3); box-shadow: 0 0 0 8px transparent; }
  100% { transform: scale(1); box-shadow: none; }
}

.howto {
  margin: 20px 0 0;
  padding: 24px 28px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.howto ol { margin: 0; padding-left: 20px; color: var(--text-muted); font-size: 14px; line-height: 1.9; }
.howto strong { color: var(--text); }
.disclaimer { margin: 14px 0 0; font-size: 11px; color: var(--text-dim); }

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 30px;
  padding: 0 4px;
  font-size: 11px;
  color: var(--text-dim);
}

@media (max-width: 700px) {
  .app-shell { width: min(100% - 24px, 560px); padding-top: 18px; }
  .hero { margin: 34px auto 24px; }
  .hero h1 { letter-spacing: -1px; }
  .breather-card { padding: 22px 16px 20px; border-radius: 24px; }
  .orb-stage { width: 260px; height: 260px; }
  .orb { width: 162px; height: 162px; }
  .orb-count { font-size: 46px; }
  .techniques { grid-template-columns: 1fr; }
  .settings-row { grid-template-columns: 1fr; }
  .settings-block, .howto { padding: 20px; }
  .progress-block { padding: 18px 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  footer { flex-direction: column; text-align: center; align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
