/* BreathWork v1.1 – colourful aurora theme. Text colours meet WCAG AA on their panels. */
:root {
  --bg: #060A18; --on: #F4F7FF; --muted: #C9D3E6; --panel: rgba(9, 13, 32, .78); --panel-line: rgba(255, 255, 255, .1);
  --brand1: #67E8F9; --brand2: #C4B5FD; --brand3: #FDA4AF; --link: #7DD3FC; --err: #FFB4AB;
  --btn-on: #0A0F24; --radius: 20px; color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme=dark]) { --bg: #EEF1FB; --on: #101528; --muted: #3C4558; --panel: rgba(255, 255, 255, .86); --panel-line: rgba(16, 21, 40, .1);
    --brand1: #0E7490; --brand2: #6D28D9; --brand3: #BE123C; --link: #0B5D8A; --err: #B3261E; color-scheme: light; }
}
:root[data-theme=light] { --bg: #EEF1FB; --on: #101528; --muted: #3C4558; --panel: rgba(255, 255, 255, .86); --panel-line: rgba(16, 21, 40, .1);
  --brand1: #0E7490; --brand2: #6D28D9; --brand3: #BE123C; --link: #0B5D8A; --err: #B3261E; color-scheme: light; }
/* Low-light: dimmer, warmer text and darker panels, colours stay saturated */
:root[data-night=on] { --on: #E2E6F0; --muted: #B4BDD0; --panel: rgba(4, 6, 16, .86); }
@media (prefers-color-scheme: light) { :root[data-night=on]:not([data-theme=dark]) { --on: #101528; --muted: #3C4558; --panel: rgba(236, 239, 248, .9); } }
:root[data-night=on][data-theme=light] { --on: #101528; --muted: #3C4558; --panel: rgba(236, 239, 248, .9); }

[data-tech="cyclic_sigh"] { --from: #0F766E; --to: #1E40AF; --accent: #5EEAD4; }
[data-tech="box"] { --from: #6D28D9; --to: #1E3A8A; --accent: #C4B5FD; }
[data-tech="extended_exhale"] { --from: #BE123C; --to: #9A3412; --accent: #FDBA74; }
[data-tech="resonance"] { --from: #0E7490; --to: #047857; --accent: #67E8F9; }
[data-tech="478"] { --from: #4338CA; --to: #312E81; --accent: #A5B4FC; }
[data-tech="sigh_reset"] { --from: #0369A1; --to: #6D28D9; --accent: #7DD3FC; }
[data-tech="cyclic_hyper"] { --from: #C2410C; --to: #B91C1C; --accent: #FDBA74; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; color: var(--on); font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100dvh; background: transparent; }
#bg { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; display: block; }
a { color: var(--link); }
:focus-visible { outline: 3px solid var(--brand1); outline-offset: 3px; border-radius: 10px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand1); color: var(--btn-on); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.hidden { display: none !important; }
#app { max-width: 760px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

.bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 4px; padding: calc(env(safe-area-inset-top) + 10px) 8px 10px 16px;
  background: linear-gradient(var(--bg) 40%, transparent); }
.bar h1 { flex: 1; font-size: 1.4rem; margin: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar h1.brand { font-size: 1.75rem; letter-spacing: -.01em; background: linear-gradient(90deg, var(--brand1), var(--brand2), var(--brand3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bar h1:focus { outline: none; }
.bar .actions { display: flex; gap: 2px; }
.icon-btn { width: 48px; height: 48px; display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: var(--on); cursor: pointer; }
.icon-btn:hover { background: var(--panel); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg .fill { fill: currentColor; stroke: none; }
.icon-btn[aria-pressed=true] { background: rgba(250, 204, 21, .18); color: #FDE68A; }
:root[data-theme=light] .icon-btn[aria-pressed=true] { color: #854D0E; }
.bar .icon-btn:first-child { margin-left: -8px; }

.content { padding: 0 16px calc(env(safe-area-inset-bottom) + 28px); display: flex; flex-direction: column; gap: 14px; }
.lead { font-size: 1.1rem; margin: 2px 0 0; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { color: var(--on); font-weight: 700; margin: 0; padding: 6px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--panel-line); }
.stat.big { font-size: 1.2rem; display: inline-block; }
.fine, .src { font-size: .88rem; color: var(--muted); }
.fine { padding: 12px 14px; border-radius: 14px; background: var(--panel); margin: 4px 0 0; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 18px 0 4px; }
.panel { background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 16px; }
.panel > p:first-child { margin-top: 0; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: var(--radius); color: #fff; text-decoration: none; min-height: 48px;
  background: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .12), transparent 55%), linear-gradient(135deg, var(--from), var(--to));
  box-shadow: 0 10px 30px -12px var(--from), inset 0 0 0 1px rgba(255, 255, 255, .14); transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -12px var(--from), inset 0 0 0 1px rgba(255, 255, 255, .3); }
.card:focus-visible { outline-color: var(--accent); }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(0, 0, 0, .22); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.card-icon.big { width: 64px; height: 64px; border-radius: 18px; }
.card-icon.sm { width: 34px; height: 34px; border-radius: 10px; }
.ticon { width: 60%; height: 60%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ticon .dot { fill: currentColor; }
.card-title { flex: 1; font-size: 1.15rem; font-weight: 700; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.card-sum { font-size: .97rem; }
.card-timing { font-size: .92rem; font-weight: 600; color: #fff; opacity: .95; }
.chip { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; color: #fff; background: rgba(0, 0, 0, .3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }

.hero { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: var(--radius); color: #fff;
  background: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .12), transparent 55%), linear-gradient(135deg, var(--from), var(--to)); box-shadow: 0 12px 34px -14px var(--from); }
.hero .row { margin: 0 0 6px; }
.hero-sum { margin: 0; font-size: 1rem; }
.timing { font-weight: 700; margin: 14px 0 0; }
.summary { font-weight: 800; margin: 16px 0 0; font-size: 1.05rem; color: var(--on); padding: 10px 14px; border-radius: 12px; border-left: 4px solid var(--accent); background: rgba(127, 127, 127, .08); }
fieldset.chips { border: 0; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.chips:first-child { margin-top: 0; }
fieldset.chips legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.chip-opt { position: relative; }
.chip-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip-opt span { display: inline-flex; align-items: center; min-height: 46px; padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--muted); font-weight: 600; }
.chip-opt input:checked + span { background: linear-gradient(135deg, var(--from), var(--to)); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.chip-opt input:checked + span::before { content: "✓"; margin-right: 6px; }
.chip-opt input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.custom { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; max-width: 220px; }
.custom input { font: inherit; padding: 12px; border-radius: 12px; border: 1.5px solid var(--muted); background: transparent; color: var(--on); min-height: 48px; }
.custom input[aria-invalid=true] { border-color: var(--err); }
.err { color: var(--err); font-size: .9rem; min-height: 1.2em; }

.toggle, .eyes-card { display: flex; align-items: center; gap: 12px; min-height: 56px; cursor: pointer; position: relative; }
.toggle > span:first-child { flex: 1; }
.toggle small, .eyes-card small { display: block; color: var(--muted); font-size: .85rem; line-height: 1.35; }
.toggle input, .eyes-card input { position: absolute; opacity: 0; width: 56px; height: 34px; right: 0; margin: 0; cursor: pointer; }
.track { width: 56px; height: 34px; border-radius: 17px; background: rgba(127, 127, 127, .25); border: 2px solid var(--muted); position: relative; flex: none; transition: background .15s; }
.track::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); top: 5px; left: 5px; transition: transform .18s; }
input:checked + .track { background: linear-gradient(135deg, var(--accent, var(--brand1)), var(--brand2)); border-color: transparent; }
input:checked + .track::after { transform: translateX(22px); background: #0A0F24; }
input:focus-visible + .track { outline: 3px solid var(--accent, var(--brand1)); outline-offset: 2px; }
.toggle.disabled { opacity: .5; cursor: default; }
.eyes-card { padding: 16px; border-radius: var(--radius); background: var(--panel); border: 2px solid var(--accent); box-shadow: 0 0 24px -8px var(--accent); }
.eyes-card .eyes-text { flex: 1; } .eyes-card strong { font-size: 1.15rem; }
.eyes-icon { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--from), var(--to)); }
.eyes-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.slider { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.slider input { width: 100%; min-height: 44px; accent-color: var(--accent, var(--brand1)); }
.slider output { color: var(--muted); font-weight: 600; }
.test-btn, .text-btn { font: inherit; font-weight: 700; background: transparent; color: var(--on); border: 0; min-height: 48px; padding: 0 16px; border-radius: 24px; cursor: pointer; }
.test-btn { border: 1.5px solid var(--accent); margin-top: 10px; }

.start-bar { position: sticky; bottom: 0; padding: 14px 16px calc(env(safe-area-inset-bottom) + 14px); background: linear-gradient(transparent, var(--bg) 35%); max-width: 760px; width: 100%; margin: 0 auto; }
button.big { min-height: 64px; font-size: 1.15rem; }
button.primary, button.tonal, button.outlined { font: inherit; font-weight: 800; border-radius: 32px; padding: 0 24px; cursor: pointer; min-height: 48px; }
button.primary { color: #fff; border: 0; text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  background: linear-gradient(135deg, var(--from, #0E7490), var(--to, #6D28D9)); box-shadow: 0 10px 28px -10px var(--from, #0E7490), inset 0 0 0 1px rgba(255, 255, 255, .25); }
button.primary:disabled { opacity: .4; cursor: not-allowed; }
.start-bar .primary { width: 100%; }
button.tonal { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .25); }
button.outlined { background: rgba(0, 0, 0, .25); color: #fff; border: 1.5px solid rgba(255, 255, 255, .45); }
.wide { width: 100%; }

/* ---------- Session (always immersive dark, high contrast) ---------- */
.session { --on: #F7F9FF; --muted: #D6DDEC; color: var(--on); flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: calc(env(safe-area-inset-top) + 10px) 22px calc(env(safe-area-inset-bottom) + 22px); min-height: 100dvh; }
:root[data-night=on] .session { --on: #DCE2EE; --muted: #AEB8CC; }
.session[data-phase=ready] { --p: var(--accent); --s1: #FFFFFF; --s2: var(--accent); --s3: var(--from); }
.session[data-phase=in] { --p: #67E8F9; --s1: #ECFEFF; --s2: #22D3EE; --s3: #0E7490; }
.session[data-phase=hold] { --p: #C4B5FD; --s1: #F5F3FF; --s2: #A78BFA; --s3: #5B21B6; }
.session[data-phase=out] { --p: #FDBA74; --s1: #FFF7ED; --s2: #FB923C; --s3: #BE123C; }
.s-top { width: 100%; display: flex; align-items: center; gap: 8px; }
.s-title { color: var(--muted); margin: 0; font-weight: 700; font-size: .95rem; line-height: 1.25; flex: 1; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.ec-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .2); }
.ec-pill svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.session .icon-btn { color: var(--on); }
.pacer-wrap { flex: 1; width: 100%; display: grid; place-items: center; position: relative; min-height: 300px; }
.pacer { width: min(92vw, 60dvh, 480px); height: auto; aspect-ratio: 1; grid-area: 1 / 1; overflow: visible; }
.pacer stop { transition: stop-color .7s ease; }
.pacer .s1 { stop-color: var(--s1); } .pacer .s2 { stop-color: var(--s2); } .pacer .s3 { stop-color: var(--s3); }
.pacer .h1 { stop-color: var(--s2); stop-opacity: .45; } .pacer .h2 { stop-color: var(--s2); stop-opacity: 0; }
.pacer .e1 { stop-color: var(--s1); } .pacer .e2 { stop-color: var(--p); }
.pacer .track { stroke: rgba(255, 255, 255, .22); }
.pacer .faint { stroke: rgba(255, 255, 255, .14); }
.pacer .ring-mid { stroke: #C4B5FD; opacity: .7; }
.pacer .side-hi { stroke: var(--p); transition: stroke 1s; }
.pacer .corner { fill: rgba(255, 255, 255, .55); }
.pacer .dot { fill: #fff; } .pacer .dot-halo { fill: var(--p); opacity: .45; transition: fill 1s; }
.pacer .orb { opacity: .96; }
.pacer .ripple { fill: none; stroke: var(--p); stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: ripple 1.9s cubic-bezier(.2, .6, .3, 1) forwards; }
@keyframes ripple { from { transform: scale(1); opacity: .75; } to { transform: scale(1.75); opacity: 0; } }
:root[data-night=on] .pacer .orb, :root[data-night=on] .pacer #halo { opacity: .78; }
.paused .pacer { opacity: .6; }
.phase { grid-area: 1 / 1; text-align: center; pointer-events: none; text-shadow: 0 2px 12px rgba(0, 0, 0, .75), 0 0 2px rgba(0, 0, 0, .9); }
.phase-label { font-size: 2rem; font-weight: 800; line-height: 1.15; max-width: 72vw; color: #fff; }
.phase-count { font-size: 4.2rem; font-weight: 300; line-height: 1.05; font-variant-numeric: tabular-nums; color: #fff; }
:root[data-night=on] .phase-label, :root[data-night=on] .phase-count { color: var(--on); }
.counter { font-size: 1.15rem; font-weight: 800; margin: 6px 0; min-height: 1.6em; text-align: center; color: var(--p); text-shadow: 0 1px 8px rgba(0, 0, 0, .7); padding: 2px 12px; border-radius: 999px; background: rgba(0, 0, 0, .35); }
.progress { width: 100%; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, #22D3EE, #A78BFA, #FB7185); transform-origin: left; transform: scaleX(0); }
.left { margin: 8px 0 16px; font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.controls { display: flex; gap: 12px; width: 100%; }
.controls button { flex: 1; }
.session.done { justify-content: center; gap: 10px; text-align: center; }
.session.done h1 { font-size: 2.1rem; margin: 0; text-shadow: 0 2px 14px rgba(0, 0, 0, .6); }
.session.done h1:focus { outline: none; }
.session.done .lead { color: var(--on); }
.session.done .s-title { flex: none; }
.session.done .wide { max-width: 420px; margin-top: 18px; }

.dialog { border: 0; border-radius: 24px; padding: 24px; max-width: min(92vw, 480px); background: #101530; color: #F4F7FF; box-shadow: 0 0 0 2px #FDBA74, 0 20px 60px rgba(0, 0, 0, .6); }
.dialog::backdrop { background: rgb(0 0 0 / .65); }
.dialog h2 { margin-top: 0; font-size: 1.35rem; color: #FDBA74; }
.dialog ul { padding-left: 20px; }
.dialog .text-btn { color: #F4F7FF; }
.dialog .primary { --from: #C2410C; --to: #B91C1C; }
.check { display: flex; align-items: center; gap: 12px; min-height: 52px; cursor: pointer; font-weight: 700; }
.check input { width: 26px; height: 26px; accent-color: #FB923C; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.hist { list-style: none; padding: 0; margin: 8px 0 0; }
.hist li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--panel-line); }
.hist li .card-icon { background: linear-gradient(135deg, var(--from), var(--to)); color: #fff; }
.hist li > span:last-child { display: flex; flex-direction: column; }
.hist li > span:last-child > span { color: var(--muted); font-size: .95rem; }
.about .sources li { margin-bottom: 8px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; font-size: .9rem; min-width: 640px; }
th, td { text-align: left; vertical-align: top; padding: 8px; border-bottom: 1px solid var(--panel-line); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; } }
:root[data-night=on] .card, :root[data-night=on] .hero, :root[data-night=on] button.primary { filter: brightness(.82) saturate(1.1); }
.lang-link { display: inline-grid; place-items: center; min-width: 48px; height: 48px; padding: 0 10px; border-radius: 24px; font-weight: 800; font-size: .95rem; color: var(--on); text-decoration: none; border: 1.5px solid var(--panel-line); font-family: "Noto Sans Devanagari", "Nirmala UI", "Kohinoor Devanagari", "Mangal", system-ui, sans-serif; }
.lang-link:hover { background: var(--panel); }
@media (max-width: 420px) { .bar .actions .icon-btn, .bar .actions .lang-link { width: 44px; min-width: 44px; height: 44px; } .bar .actions .lang-link { width: auto; padding: 0 8px; } .bar h1.brand { font-size: 1.45rem; flex: none; } .bar .actions { margin-left: auto; gap: 0; } }
@media (max-width: 380px) { .bar { padding-left: 12px; padding-right: 4px; } .bar .actions .icon-btn { width: 40px; min-width: 40px; } .bar h1.brand { font-size: 1.3rem; } }
