/* Quiet, natural, warm: night-forest dark, linen white, soft sage by default */
[hidden] { display: none !important; }
:root {
  --bg: #070b0a;
  --ink: #f1ede4;
  --muted: #a3aa9f;
  --faint: rgba(241, 237, 228, 0.08);
  --glass: rgba(14, 20, 18, 0.62);
  --line: rgba(241, 237, 228, 0.09);
  --accent: #a3cba4;
  --serif: 'Frank Ruhl Libre', 'Times New Roman', serif;
  --sans: Heebo, system-ui, sans-serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); font-weight: 300; overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { -webkit-user-select: text; user-select: text; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 28px; transition: opacity .8s; pointer-events: none; animation: breathe 2.4s ease-in-out infinite; }
#loading.gone { opacity: 0; }
@keyframes breathe { 50% { opacity: .3; } }

.screen { position: fixed; inset: 0; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .6s var(--ease), visibility 0s .6s; display: flex; flex-direction: column; padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); }
.screen.on { opacity: 1; visibility: visible; transition: opacity .6s var(--ease); }
.screen.on .tap { pointer-events: auto; }
.screen .sheet { transform: translateY(14px); transition: transform .7s var(--ease); }
.screen.on .sheet { transform: none; }

header.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.brand { font-family: var(--serif); font-size: 24px; font-weight: 400; letter-spacing: .01em; text-shadow: 0 1px 12px rgba(0,0,0,.6); }
.icons { display: flex; gap: 8px; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; background: var(--glass); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.pill { background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 0 18px; font-weight: 400; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font-variant-numeric: tabular-nums; min-height: 44px; display: flex; align-items: center; gap: 6px; }
.pill.quiet { color: var(--muted); }
.pill .hr { width: 15px; height: 15px; color: #e2ab9b; fill: #e2ab9b; stroke: none; }

.sheet { margin-top: auto; background: var(--glass); border: 1px solid var(--line); border-radius: 28px; padding: 24px 20px; backdrop-filter: blur(22px) saturate(1.1); -webkit-backdrop-filter: blur(22px) saturate(1.1); max-height: 56vh; overflow-y: auto; scrollbar-width: none; box-shadow: 0 -10px 40px rgba(0,0,0,.35); }
.sheet::-webkit-scrollbar { display: none; }
.sheet.tall { max-height: 84vh; }
.sheet h1 { font-family: var(--serif); font-size: 26px; margin: 0 0 16px; font-weight: 400; }
.sheet h2 { font-family: var(--serif); font-size: 28px; margin: 0; font-weight: 400; color: var(--accent); }
.role { color: var(--muted); font-size: 15px; margin: 4px 0 6px; line-height: 1.5; }
.sheet p { line-height: 1.55; }
.sub { color: var(--muted); font-size: 14px; margin: 0; }
.fine { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 14px 0 0; }

.goals { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.goal { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 6px 14px; border-radius: 20px; background: var(--faint); border: 1px solid transparent; transition: transform .2s var(--ease), border-color .3s; }
.goal:active { transform: scale(.96); }
.goal .orb { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8 0, var(--c) 35%, color-mix(in srgb, var(--c) 40%, #000) 100%); box-shadow: 0 0 22px color-mix(in srgb, var(--c) 45%, transparent); }
.goal b { font-weight: 400; font-size: 15px; }
.goal.mine { border-color: color-mix(in srgb, var(--c) 35%, transparent); }
.goal .bar { position: absolute; left: 18px; right: 18px; bottom: 6px; height: 2px; border-radius: 2px; background: var(--faint); overflow: hidden; }
.goal .bar u { display: block; height: 100%; background: var(--c); }

.label { font-size: 12px; letter-spacing: .06em; color: var(--muted); margin: 20px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 16px; border-radius: 999px; background: var(--faint); border: 1px solid transparent; font-size: 15px; min-height: 42px; transition: background .25s, border-color .25s; }
.chip.big { padding: 14px 20px; font-size: 16px; flex: 1; }
.chips.small .chip { min-width: 48px; padding: 8px 14px; font-size: 14px; min-height: 38px; }
.chip.sel { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: #fff; }
.own { display: flex; gap: 8px; margin-top: 10px; }
.field { width: 100%; flex: 1; min-width: 0; background: var(--faint); border: 1px solid transparent; border-radius: 14px; padding: 12px 14px; color: var(--ink); font: inherit; font-size: 16px; margin-top: 12px; }
.own .field { margin-top: 0; }
.field:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.own button { width: 46px; border-radius: 14px; background: var(--faint); font-size: 22px; }

/* recorder rows: one per chosen statement */
.rec-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 8px 8px 12px; border-radius: 16px; background: var(--faint); }
.rec-row .txt { flex: 1; font-size: 15px; }
.rec-row button { height: 38px; min-width: 38px; border-radius: 999px; display: grid; place-items: center; padding: 0 12px; font-size: 13px; background: rgba(255,255,255,.06); }
.rec-row button svg { width: 18px; height: 18px; }
.rec-row .mic { color: var(--accent); gap: 6px; display: flex; }
.rec-row .mic.live { background: #b5584f; color: #fff; animation: breathe 1.2s infinite; }
.rec-row .lvl { width: 40px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; }
.rec-row .lvl u { display: block; height: 100%; width: 0; background: #fff; }
.inline { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--muted); }

.toggle { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.toggle.slim { border: 0; padding: 12px 0 0; font-size: 14px; color: var(--muted); }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }

.moods { display: flex; justify-content: space-between; gap: 6px; }
.moods button { flex: 1; font-size: 24px; padding: 8px 0; border-radius: 14px; filter: grayscale(.8); opacity: .55; transition: all .25s; }
.moods button.sel { filter: none; opacity: 1; background: var(--faint); }

.dock { padding-top: 12px; }
.cta { width: 100%; margin-top: 16px; padding: 16px; border-radius: 999px; font-weight: 500; font-size: 17px; color: #0c1210; background: var(--accent); box-shadow: 0 8px 30px color-mix(in srgb, var(--accent) 28%, transparent); transition: transform .2s var(--ease); }
.dock .cta { margin: 0; }
.cta:active { transform: scale(.98); }
.cta:disabled { opacity: .35; }
.ghost { background: var(--faint) !important; color: var(--ink) !important; box-shadow: none !important; }
.danger { color: #e2a29a !important; }
.row { display: flex; gap: 10px; }
.row .cta { flex: 1; }

.dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: background .3s; }
.dots i.on { background: var(--accent); }
.step { display: none; }
.step.on { display: block; animation: rise .5s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* session */
.meter { height: 2px; border-radius: 2px; background: var(--faint); margin-top: 14px; overflow: hidden; }
.meter > div { height: 100%; width: 0; background: var(--accent); box-shadow: 0 0 10px var(--accent); transition: width .6s var(--ease); }
#affirm { margin: 7vh -18px 0; padding: 22px 18px; text-align: center; background: radial-gradient(ellipse at center, rgba(4,8,7,.55), transparent 70%); opacity: 0; transform: translateY(10px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
#affirm.show { opacity: 1; transform: none; }
#affText { font-family: var(--serif); font-size: clamp(28px, 8.5vw, 42px); line-height: 1.2; text-shadow: 0 0 26px color-mix(in srgb, var(--accent) 70%, transparent), 0 2px 8px #000; }
#ownIcon { display: block; font-style: normal; font-size: 14px; margin-top: 8px; opacity: .8; }
#roundMsg { text-align: center; color: var(--muted); margin-top: 6px; font-size: 14px; opacity: 0; transition: opacity .8s; }
#roundMsg.show { opacity: 1; }
#hint { text-align: center; color: var(--muted); font-size: 14px; transition: opacity .6s; padding-bottom: 6px; }
#hintDot { position: fixed; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 14px 4px var(--accent); opacity: 0; pointer-events: none; }
#breath { margin-top: auto; align-self: center; position: relative; width: 108px; height: 108px; display: grid; place-items: center; margin-bottom: 10px; }
#breath .ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--accent) 80%, #fff); background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 35%, transparent); transform: scale(.55); }
#breath .word { font-size: 15px; letter-spacing: .04em; text-shadow: 0 1px 6px #000; }
#breath[hidden] + #hint { margin-top: auto; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 4px; }
.stats div { background: var(--faint); border-radius: 18px; padding: 14px 8px; text-align: center; }
.stats b { display: block; font-family: var(--serif); font-weight: 400; font-size: 26px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--muted); }
#bars { margin-top: 18px; }
.barrow { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 14px; }
.barrow span { width: 64px; }
.barrow div { flex: 1; height: 6px; border-radius: 6px; background: var(--faint); overflow: hidden; }
.barrow u { display: block; height: 100%; border-radius: 6px; }
.barrow em { font-style: normal; color: var(--muted); width: 36px; text-align: left; font-variant-numeric: tabular-nums; }
#recent { margin-top: 14px; }
.rec { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rec small { color: var(--muted); }

.bigbpm { text-align: center; margin: 4px 0 6px; }
.bigbpm span { font-family: var(--serif); font-size: 60px; font-variant-numeric: tabular-nums; color: #e2ab9b; }
.bigbpm small { display: block; color: var(--muted); font-size: 13px; }
#camVideo { width: 64px; height: 48px; border-radius: 12px; object-fit: cover; display: none; margin: 6px auto; }
#camVideo.on { display: block; }

#fade { position: fixed; inset: 0; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 70%, #fff), var(--bg) 72%); opacity: 0; pointer-events: none; transition: opacity .6s var(--ease); }
#fade.on { opacity: .9; }
#hapticLbl { position: fixed; left: -100px; top: -100px; opacity: 0; }

@media (prefers-reduced-motion: reduce) { #affirm, .screen .sheet { transition: opacity .3s; transform: none; } }
