/* ═══════════════════════════════════════════════════════════════════════
   Respira: meditação. Visual calmo, muito ar, sem fontes de terceiros (pilha do sistema, que também abre sem internet).
   Tema: claro por padrão, escuro quando o sistema pede (prefers-color-scheme) e as duas escolhas manuais (html[data-theme]).
   Os tokens de cada tema ficam nos três blocos marcados com `@theme`: test/respira-page.test.js confere o contraste de cada par e que
   os três declaram as mesmas variáveis. A tela da meditação é sempre escura (menos luz no rosto de quem fecha os olhos).
   Movimento: o script do <head> põe data-motion="reduced" no <html> quando a pessoa pede menos movimento.
   ═══════════════════════════════════════════════════════════════════════ */

/* @theme light */
:root {
	color-scheme: light;
	--bg: #f5f3ee;
	--surface: #fcfbf8;
	--surface-2: #ebe9e1;
	--ink: #16222b;
	--ink-2: #43515b;
	--ink-3: #566470;
	--line: #dcd9ce;
	--line-2: #bfbbad;
	--btn: #2b6f6a;
	--btn-hover: #235c58;
	--btn-ink: #ffffff;
	--accent-text: #1f6b65;
	--danger: #a63a32;
	--danger-ink: #ffffff;
	--bar: #3e8f86;
	--bar-soft: #cfe6e1;
	--logo-1: #5fc4b0;
	--logo-2: #a99bf5;
	--shadow: 0 1px 2px rgb(22 34 43 / .05), 0 10px 28px -14px rgb(22 34 43 / .16);
}
@media (prefers-color-scheme: dark) {
	/* @theme dark */
	:root:where(:not([data-theme="light"])) {
		color-scheme: dark;
		--bg: #0c1420;
		--surface: #131e2c;
		--surface-2: #1b2838;
		--ink: #eaf0f2;
		--ink-2: #b9c6cd;
		--ink-3: #93a3ac;
		--line: #243448;
		--line-2: #33465d;
		--btn: #7fd1c3;
		--btn-hover: #98dccf;
		--btn-ink: #08201d;
		--accent-text: #8fd8cb;
		--danger: #f08a82;
		--danger-ink: #1a0705;
		--bar: #7fd1c3;
		--bar-soft: #1e3b3b;
		--logo-1: #5fc4b0;
		--logo-2: #a99bf5;
		--shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 28px -14px rgb(0 0 0 / .6);
	}
}
/* @theme dark */
:root[data-theme="dark"] {
	color-scheme: dark;
	--bg: #0c1420;
	--surface: #131e2c;
	--surface-2: #1b2838;
	--ink: #eaf0f2;
	--ink-2: #b9c6cd;
	--ink-3: #93a3ac;
	--line: #243448;
	--line-2: #33465d;
	--btn: #7fd1c3;
	--btn-hover: #98dccf;
	--btn-ink: #08201d;
	--accent-text: #8fd8cb;
	--danger: #f08a82;
	--danger-ink: #1a0705;
	--bar: #7fd1c3;
	--bar-soft: #1e3b3b;
	--logo-1: #5fc4b0;
	--logo-2: #a99bf5;
	--shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 28px -14px rgb(0 0 0 / .6);
}

:root {
	--radius: 18px;
	--ease: cubic-bezier(.2, .8, .2, 1);
	--font: ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
	--serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
	--nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	min-height: 100vh;
	min-height: 100dvh;
	margin: 0;
	display: flex;
	flex-direction: column;
	overflow-x: hidden;
	background: var(--bg);
	color: var(--ink);
	font: 400 1rem/1.55 var(--font);
	-webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; } /* o display dos componentes não pode vencer o atributo hidden */
h1, h2, h3, p, ul, figure, blockquote { margin: 0; }
h2 { font-size: 1.35rem; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; line-height: 1.3; font-weight: 650; }
a { color: var(--accent-text); text-underline-offset: .18em; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.flip { transform: scaleX(-1); }
.muted { color: var(--ink-2); }
.fine { font-size: .875rem; color: var(--ink-3); }
.nojs, .banner { padding: .85rem 1rem; border-radius: 12px; background: var(--surface-2); color: var(--ink); font-size: .95rem; }
.banner { margin-block: .75rem; border: 1px solid var(--line-2); }
.error { color: var(--danger); font-size: .9rem; margin-top: .4rem; }

/* ───────── cabeçalho e abas ───────── */
.top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: max(.75rem, env(safe-area-inset-top)) 1rem .5rem; max-width: 760px; width: 100%; margin: 0 auto; }
.top__space { min-width: 1px; }
.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-size: .9rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
.brand__logo { width: 1.75rem; height: 1.75rem; stroke: none; }

.app { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: .5rem 1rem calc(var(--nav-h) + 2rem); }
.tabs { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; color: var(--ink-3); text-decoration: none; font-size: .78rem; font-weight: 600; }
.tab[aria-current="page"] { color: var(--accent-text); }
.tab[aria-current="page"] .i { stroke-width: 2.4; }
.view { animation: rise .45s var(--ease) both; }
.view[hidden] { display: none; }
.view > * + *, .view > .usage, #practiceBody > * + * { margin-top: 1.1rem; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

@media (min-width: 760px) {
	.app { padding-bottom: 3rem; }
	.tabs { position: static; height: auto; display: flex; gap: .25rem; padding: .3rem; margin-bottom: 1.25rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); width: fit-content; }
	.tab { flex-direction: row; gap: .45rem; padding: .5rem 1rem; border-radius: 999px; font-size: .95rem; }
	.tab[aria-current="page"] { background: var(--surface-2); }
}

/* ───────── cartões, botões, campos ───────── */
.card { padding: 1.25rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.card > * + * { margin-top: .9rem; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; }
.row--center { align-items: center; }
.row--end { justify-content: flex-end; }
.stack { display: grid; gap: .6rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; min-height: 46px; padding: .6rem 1.15rem; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; cursor: pointer; transition: background .2s, transform .15s var(--ease), border-color .2s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--btn); color: var(--btn-ink); border-color: transparent; }
.btn--primary:hover { background: var(--btn-hover); }
.btn--ghost { background: transparent; }
.btn--danger { background: var(--danger); color: var(--danger-ink); border-color: transparent; }
.btn--danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn--danger-text { color: var(--danger); }
.btn--sm { min-height: 38px; padding: .35rem .85rem; border-radius: 12px; font-size: .9rem; }
.btn--xl { width: 100%; min-height: 60px; font-size: 1.15rem; border-radius: 18px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }

.chips, .choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { min-height: 40px; padding: .35rem .95rem; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: .92rem; cursor: pointer; transition: background .2s, color .2s, border-color .2s, transform .15s var(--ease); }
.chip:hover { background: var(--surface-2); }
.chip[aria-checked="true"] { background: var(--btn); color: var(--btn-ink); border-color: transparent; }
.chip--big { min-height: 52px; padding-inline: .5rem; font-size: 1rem; white-space: nowrap; }
.chip--day { min-height: 38px; padding-inline: .8rem; text-transform: capitalize; }
.choices { display: grid; grid-template-columns: repeat(4, 1fr); }
.choices .chip--big:last-child { grid-column: 1 / -1; }

.field { display: block; margin-top: 1rem; font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.card > .field:first-child { margin-top: 0; }
.input { width: 100%; min-height: 48px; padding: .5rem .9rem; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); }
.input--time { width: auto; min-width: 8.5rem; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.switch { display: flex; align-items: center; gap: .75rem; min-height: 44px; cursor: pointer; }
.switch input { appearance: none; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; transition: background .2s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); transition: transform .25s var(--ease); box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.switch input:checked { background: var(--btn); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }
.range { flex: 1 1 10rem; accent-color: var(--btn); min-height: 32px; }

/* ───────── Respirar ───────── */
.quote { position: relative; padding: 1.4rem 3rem 1.2rem 1.4rem; border-radius: var(--radius); background: linear-gradient(135deg, color-mix(in srgb, var(--logo-1) 16%, var(--surface)), color-mix(in srgb, var(--logo-2) 16%, var(--surface))); border: 1px solid var(--line); }
.quote__text { font: italic 400 1.3rem/1.45 var(--serif); text-wrap: balance; min-height: 2.9em; }
.quote__by { margin-top: .6rem; color: var(--ink-2); font-size: .92rem; }
.quote__by::before { content: '— '; }
.quote__by:empty::before { content: none; }
.quote__other { position: absolute; top: .6rem; right: .6rem; }
.quote[data-state="ready"] .quote__text { animation: rise .5s var(--ease) both; }
.sk { display: block; height: 1em; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.sk + .sk { margin-top: .5rem; }
.sk--short { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.start { text-align: center; }
.start h2 { margin-bottom: 1rem; }
.start .choices { justify-content: center; }
.custom { text-align: left; }
.setup { font-size: .9rem; }
.today { text-align: center; font-size: .95rem; }

/* ───────── Guiadas ───────── */
.vids { list-style: none; padding: 0; display: grid; gap: .6rem; }
.vid { display: flex; align-items: center; justify-content: space-between; gap: .9rem; padding: .9rem 1rem; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.vid[aria-current="true"] { border-color: var(--btn); }
.vid__title { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.vid__by { color: var(--ink-3); font-size: .85rem; margin-top: .2rem; }
.player__box { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; }
.player__box:empty { display: none; }
.player__box lite-youtube { width: 100%; max-width: none; height: 100%; }
.player__error { padding: 1rem; border-radius: 12px; background: var(--surface-2); display: grid; gap: .6rem; justify-items: start; }
.player__title { overflow-wrap: anywhere; }

/* ───────── Prática ───────── */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.tile { padding: .9rem .8rem; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.tile__label { font-size: .8rem; font-weight: 600; color: var(--ink-3); }
.tile__n { font: 300 2.4rem/1.1 var(--font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile__s { font-size: .8rem; color: var(--ink-2); }
.empty { text-align: center; padding: 2rem 1rem; display: grid; justify-items: center; gap: .6rem; }
.empty__art { width: 84px; height: 84px; fill: none; stroke: var(--bar); stroke-width: 2; }
.empty__title { font-size: 1.15rem; font-weight: 650; }
.empty__text { color: var(--ink-2); max-width: 36ch; }
.chart__svg { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; }
.axis { stroke: var(--line); stroke-width: 1; }
.axis__text, .axis__label { fill: var(--ink-3); font: 500 12px var(--font); }
.bar__fill { fill: var(--bar); }
.bar__none { fill: var(--line); }
.bar--today .bar__fill { fill: var(--logo-2); }
.bar__val { fill: var(--ink); font: 650 13px var(--font); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table caption { text-align: left; color: var(--ink-2); padding-bottom: .5rem; }
.table th, .table td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); text-align: left; }
.table thead th { color: var(--ink-3); font-weight: 600; }
.hists { list-style: none; padding: 0; }
.hist { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.hist__main { display: grid; min-width: 0; }
.hist__main span { color: var(--ink-3); font-size: .85rem; }

/* ───────── Ajustes ───────── */
.times { list-style: none; padding: 0; display: grid; gap: .5rem; margin-block: .75rem; }
.time { display: flex; align-items: center; gap: .5rem; }
#instBox[data-state="unsupported"] #instText { color: var(--ink-3); }

.foot { text-align: center; padding: 1.5rem 1rem calc(var(--nav-h) + 1.5rem); color: var(--ink-3); font-size: .85rem; }
@media (min-width: 760px) { .foot { padding-bottom: 2rem; } }

/* ───────── a meditação, em tela cheia (sempre escura) ───────── */
.session { --s-bg: #070c14; --s-ink: #eaf0f2; --s-ink-2: #b4c3cc; --s-line: rgb(255 255 255 / .16); --s-accent: #7fd1c3; --s-accent-2: #a99bf5;
	position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: var(--s-bg); color: var(--s-ink); overflow: hidden; }
.session:not([open]) { display: none; }
.session::backdrop { background: #000; }
.session__sky { position: absolute; inset: 0; background: radial-gradient(120% 80% at 50% 0%, #14233a 0%, transparent 60%), radial-gradient(90% 60% at 50% 110%, #1b1840 0%, transparent 65%); }
.session__main, .session__done { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: max(1.5rem, env(safe-area-inset-top)) 1.5rem max(1.5rem, env(safe-area-inset-bottom)); text-align: center; }
.session__main[hidden], .session__done[hidden] { display: none; }
.orb { --size: .5; position: relative; width: min(72vw, 46vh, 420px); aspect-ratio: 1; display: grid; place-items: center; margin-bottom: .5rem; }
.orb i { position: absolute; border-radius: 50%; }
.orb__halo { inset: -18%; background: radial-gradient(circle, rgb(127 209 195 / .32), rgb(169 155 245 / .12) 55%, transparent 70%); transform: scale(calc(.78 + var(--size) * .5)); opacity: calc(.55 + var(--size) * .45); }
.orb__ring { inset: 4%; border: 2px solid rgb(127 209 195 / .55); transform: scale(calc(.6 + var(--size) * .4)); }
.orb__core { inset: 22%; background: radial-gradient(circle at 35% 30%, #d9fff6, var(--s-accent) 45%, var(--s-accent-2) 100%); box-shadow: 0 0 60px rgb(127 209 195 / .35); transform: scale(calc(.3 + var(--size) * .7)); }
.session[data-phase="paused"] .orb { opacity: .55; }
.cue { font: 300 1.7rem/1.2 var(--font); letter-spacing: .02em; color: var(--s-ink-2); min-height: 1.2em; }
.clock { font: 200 clamp(3.6rem, 19vw, 7rem)/1 var(--font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sub { color: var(--s-ink-2); font-size: .95rem; min-height: 1.5em; }
.sub--note { color: #ffd9a0; }
.session__controls { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 1rem; }
.btn--glass { background: rgb(255 255 255 / .08); color: var(--s-ink); border-color: var(--s-line); }
.btn--glass:hover { background: rgb(255 255 255 / .14); }
.btn--quiet { background: transparent; color: var(--s-ink-2); }
.session .btn--primary { background: var(--s-accent); color: #08201d; }
.done__title { font: 300 2rem/1.2 var(--font); }
.done__text { color: var(--s-ink-2); max-width: 34ch; }
.orb--done .orb__halo { animation: bloom 3.2s var(--ease) both; }
@keyframes bloom { from { transform: scale(.7); opacity: 0; } }

/* ───────── diálogos e aviso ───────── */
.dlg { width: min(92vw, 560px); max-height: 92dvh; padding: 1.25rem; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .5); overflow: auto; }
.dlg::backdrop { background: rgb(5 10 18 / .6); backdrop-filter: blur(3px); }
.dlg--confirm { width: min(92vw, 420px); }
.dlg--confirm p { margin: .6rem 0 1.2rem; color: var(--ink-2); }
.dlg__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.dlg--share { width: min(94vw, 760px); }
.share { display: grid; gap: 1rem; }
.share__canvas { display: block; width: auto; max-width: 100%; max-height: 40dvh; margin: 0 auto; border-radius: 14px; box-shadow: var(--shadow); background: var(--surface-2); aspect-ratio: var(--ratio, 9 / 16); }
.share__side .field:first-child { margin-top: 0; }
.share__side .stack { margin-top: 1rem; }
.picks { display: flex; flex-wrap: wrap; gap: .5rem; }
.pick { padding: 3px; border-radius: 14px; border: 2px solid transparent; background: transparent; cursor: pointer; }
.pick[aria-checked="true"] { border-color: var(--btn); }
.swatch { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 11px; }
.swatch i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid; opacity: .8; }
@media (min-width: 700px) {
	.share { grid-template-columns: minmax(0, 300px) 1fr; align-items: start; }
	.share__canvas { max-height: 62dvh; }
}
/* O aviso é um popover (fica na camada de cima, por cima da meditação em tela cheia e dos diálogos) */
.toast { position: fixed; inset: auto auto calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom)) 50%; margin: 0; transform: translateX(-50%); align-items: center; gap: 1rem; width: max-content; max-width: min(92vw, 520px); padding: .75rem 1rem; border: 0; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: 0 12px 30px -10px rgb(0 0 0 / .5); font-size: .95rem; overflow: visible; }
.toast:popover-open { display: flex; }
.toast[hidden] { display: none; }
.toast.is-in { animation: toast-in .35s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } } /* mantém o -50% do centro (com o rise o aviso entrava deslizando de lado) */
.toast__btn { border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: .25rem; }
@media (min-width: 760px) { .toast { bottom: 1.5rem; } }

/* ───────── menos movimento ───────── */
html[data-motion="reduced"] *, html[data-motion="reduced"] *::before, html[data-motion="reduced"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
