/* Fonts: IM Fell English (titles) and EB Garamond (text), bundled for offline use. SIL Open Font License; see assets/fonts/LICENSE.txt */
@font-face { font-family: "IM Fell English"; font-weight: 400; font-style: normal; font-display: swap; src: url("../assets/fonts/im-fell-english-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IM Fell English"; font-weight: 400; font-style: italic; font-display: swap; src: url("../assets/fonts/im-fell-english-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 400; font-style: normal; font-display: swap; src: url("../assets/fonts/eb-garamond-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 400; font-style: italic; font-display: swap; src: url("../assets/fonts/eb-garamond-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 600; font-style: normal; font-display: swap; src: url("../assets/fonts/eb-garamond-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 700; font-style: normal; font-display: swap; src: url("../assets/fonts/eb-garamond-latin-700-normal.woff2") format("woff2"); }

/* Venture Forth — Stage 1 prototype styles
   Warm, low-glare palette; 44px minimum touch targets; respects reduced motion. */

:root {
  --bg: #1b1410;
  --bg-2: #241a14;
  --panel: #2c211a;
  --panel-2: #362920;
  --line: #4a382b;
  --text: #f3e9dc;
  --text-2: #c9b8a3;
  --muted: #9a8670;
  --accent: #e0a458;
  --accent-ink: #1b1410;
  --good: #8fb98a;
  --sos: #c8553d;
  --sos-ink: #fff8f2;
  --danger: #d4573f;
  --app-note: #8fb3c9;
  --radius: 14px;
  --serif: "IM Fell English", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "EB Garamond", "Iowan Old Style", Palatino, Georgia, serif;
  --fs: 18px;
  --top: calc(56px + env(safe-area-inset-top));
  --bottom: calc(64px + env(safe-area-inset-bottom));
  color-scheme: dark;
}

html.large-text { --fs: 21px; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: var(--fs)/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.2; margin: 0 0 .5em; font-synthesis: none; }
h1 { font-size: 1.6em; }
h2 { font-size: 1.3em; }
h3 { font-size: 1.1em; }
p { margin: 0 0 .9em; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.skip-link { position: absolute; left: -999px; top: 0; }
.skip-link:focus { left: 8px; top: 8px; z-index: 100; background: var(--panel); padding: 8px 12px; }

/* ---------- chrome ---------- */
#topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: var(--top); padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(var(--bg) 70%, rgba(27,20,16,0));
}
#title { flex: 1; text-align: center; font-family: var(--serif); font-size: 1.05em; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--text-2); }
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }
#sos-btn {
  min-width: 64px; height: 44px; padding: 0 16px; border-radius: 22px;
  background: var(--sos); color: var(--sos-ink); font-weight: 700; letter-spacing: .06em;
  display: grid; place-items: center; text-decoration: none;
  box-shadow: 0 2px 10px rgba(200, 85, 61, .35);
}
body[data-route="sos"] #sos-btn { outline: 2px solid var(--sos-ink); }

#view {
  padding: calc(var(--top) + 8px) 16px calc(var(--bottom) + 24px);
  max-width: 640px; margin: 0 auto; outline: none;
}
body[data-route="cottage"] #view, body[data-route="map"] #view, body[data-route="innerspace"] #view, body[data-route="hearth"] #view { padding-left: 0; padding-right: 0; max-width: none; }

#tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  height: var(--bottom); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: rgba(27, 20, 16, .96); border-top: 1px solid var(--line);
}
#tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); text-decoration: none; font-size: 12px; min-height: 44px;
}
#tabbar a .tab-ico { font-size: 20px; line-height: 1.1; }
#tabbar a[aria-current="page"] { color: var(--accent); }
body.no-chrome #tabbar, body.no-chrome #settings-link { visibility: hidden; }

/* ---------- building blocks ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.panel.quiet { background: var(--bg-2); }
.lede { color: var(--text-2); }
.small { font-size: .85em; color: var(--text-2); }
.muted { color: var(--muted); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.split { justify-content: space-between; }
.grow { flex: 1; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 24px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); text-decoration: none; cursor: pointer;
  font-weight: 600;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: var(--danger); color: #ffb7a8; }
.btn.sos { background: var(--sos); color: var(--sos-ink); border-color: var(--sos); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: default; }
.linkish { background: none; border: 0; color: var(--accent); text-decoration: underline; padding: 8px 0; min-height: 44px; cursor: pointer; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .9em; color: var(--text-2); margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=password], input[type=time], input[type=search], textarea, select {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.hint { font-size: .85em; color: var(--muted); margin-top: 6px; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle input { width: 26px; height: 26px; accent-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 24px; overflow: hidden; }
.seg button { flex: 1; min-height: 44px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); font-weight: 600; }

/* rating slider */
.rating { margin: 12px 0 18px; }
.rating .rating-head { display: flex; justify-content: space-between; align-items: baseline; }
.rating output { font-family: var(--serif); font-size: 2em; color: var(--accent); }
.rating input[type=range] { width: 100%; height: 44px; accent-color: var(--accent); }
.rating .ends { display: flex; justify-content: space-between; font-size: .8em; color: var(--muted); }

/* author marking: app-written text is always visibly distinct from John's own words */
.app-note { border-left: 3px solid var(--app-note); padding: 8px 12px; background: rgba(143, 179, 201, .08); border-radius: 0 10px 10px 0; }
.app-tag { display: inline-block; font-size: .72em; letter-spacing: .04em; text-transform: uppercase; color: var(--app-note); margin-bottom: 4px; }
.user-text { white-space: pre-wrap; }

/* progress */
.steps { display: flex; gap: 6px; margin: 0 0 18px; flex-wrap: wrap; }
.steps span { font-size: .78em; padding: 4px 10px; border-radius: 12px; background: var(--bg-2); color: var(--muted); }
.steps span.on { background: var(--panel-2); color: var(--accent); font-weight: 600; }
.steps span.done { color: var(--text-2); }

/* ---------- breathing visuals ---------- */
.breather { text-align: center; margin: 8px 0 18px; }
.breath-stage { height: 240px; display: grid; place-items: center; position: relative; }
.breath-shape { --s: 0; transition-property: transform, height, opacity, box-shadow; transition-timing-function: ease-in-out; }
.breath-label { font-family: var(--serif); font-size: 1.4em; min-height: 1.5em; }
.breath-count { color: var(--muted); min-height: 1.5em; font-variant-numeric: tabular-nums; }

.v-circle .breath-shape {
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(224,164,88,.55), rgba(224,164,88,.12) 70%);
  border: 2px solid rgba(224,164,88,.6);
  transform: scale(calc(.42 + var(--s) * .58));
}
.v-tide .breath-stage { align-items: end; }
.v-tide .breath-shape {
  width: 120px; height: calc(18% + var(--s) * 78%); border-radius: 16px 16px 6px 6px;
  background: linear-gradient(to top, rgba(143,179,201,.75), rgba(143,179,201,.15));
}
.v-lantern .breath-shape {
  width: 90px; height: 130px; border-radius: 30px;
  background: #ffd38a; opacity: calc(.35 + var(--s) * .65);
  box-shadow: 0 0 calc(20px + var(--s) * 90px) calc(4px + var(--s) * 40px) rgba(255, 190, 110, .55);
}
.v-simple .breath-stage { height: 90px; }
.v-simple .breath-shape { width: 70%; height: 10px; border-radius: 5px; background: var(--line); transform-origin: left; transform: scaleX(calc(.1 + var(--s) * .9)); }

/* ---------- wheels and body map ---------- */
.wheel svg { width: 100%; max-width: 320px; display: block; margin: 0 auto; }
.wheel path { cursor: pointer; stroke: var(--bg); stroke-width: 3; }
.wheel path.on { stroke: var(--text); stroke-width: 4; }
.wheel text { pointer-events: none; font-size: 13px; font-weight: 600; fill: #1b1410; }
.wheel .hub { fill: var(--panel); }
.wheel text.hub-text { fill: var(--text-2); font-weight: 400; }
.wheel .picked { margin-top: 10px; min-height: 1.5em; }
.bodymap svg { width: 100%; max-width: 240px; display: block; margin: 0 auto; }
.bodymap .region { fill: #4a382b; stroke: #6d5643; stroke-width: 2; cursor: pointer; }
.bodymap .region.on { fill: var(--accent); stroke: #fff2dd; }

/* ---------- SOS ---------- */
.sos .sos-body { min-height: 50vh; }
.sos h1 { font-size: 1.5em; }
.contact-strip { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.contact-strip h2 { font-family: var(--sans); font-size: .9em; color: var(--text-2); font-weight: 600; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.contact-grid .btn { min-height: 52px; font-size: .95em; }
.contact-grid .full { grid-column: 1 / -1; }
.emergency { border-color: var(--danger) !important; color: #ffd2c8 !important; }
.prompt-big { font-family: var(--serif); font-size: 1.35em; line-height: 1.35; min-height: 3.2em; }
.timer { font-family: var(--serif); font-size: 2.6em; text-align: center; font-variant-numeric: tabular-nums; }
.wave { height: 90px; position: relative; overflow: hidden; border-radius: 12px; background: var(--bg-2); margin: 10px 0 16px; }
.wave::before {
  content: ""; position: absolute; left: -50%; width: 200%; height: 200%; top: 45%;
  background: radial-gradient(ellipse at 50% 0, rgba(143,179,201,.5), rgba(143,179,201,.05) 60%);
  animation: swell 9s ease-in-out infinite;
}
@keyframes swell { 0%,100% { transform: translateY(18px); } 50% { transform: translateY(-22px); } }

/* ---------- world ---------- */
.world { position: relative; }
.scene-wrap {
  --sceneH: calc(100dvh - var(--top) - var(--bottom) - 8px);
  height: var(--sceneH); overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior-x: contain;
}
.scene-wrap::-webkit-scrollbar { display: none; }
/* 'fit' scenes show the whole painting with no sideways panning (used where every corner holds a place) */
.scene-wrap.fit { height: auto; overflow: hidden; }
.scene-wrap.fit .scene { width: min(100%, calc(var(--sceneH) * var(--ratio))); height: auto; aspect-ratio: var(--ratio); }
.scene { position: relative; height: var(--sceneH); width: calc(var(--sceneH) * var(--ratio, .4614)); margin: 0 auto; overflow: hidden; }
.scene > img.scene-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; user-select: none; -webkit-user-drag: none; }
.scene .tod { position: absolute; inset: 0; pointer-events: none; }
.tod-morning { background: linear-gradient(rgba(255, 220, 170, .06), rgba(0,0,0,0)); }
.tod-day { background: transparent; }
.tod-evening { background: linear-gradient(rgba(60, 20, 0, .14), rgba(30, 10, 0, .22)); }
.tod-night { background: linear-gradient(rgba(5, 5, 25, .34), rgba(10, 5, 0, .30)); }
.hotspot {
  position: absolute; border: 0; background: transparent; cursor: pointer; padding: 0; text-decoration: none;
  display: flex; align-items: flex-end; justify-content: center; border-radius: 18px; z-index: 2;
}
.hotspot:focus-visible { outline: 3px solid var(--accent); }
.hotspot .tag {
  --tok-bg: rgba(27, 20, 16, .8); --tok-edge: #e0a458; --tok-ink: #fff3df; --tok-glow: rgba(224, 164, 88, .4);
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px;
  font-size: 14px; font-weight: 600; letter-spacing: .01em; padding: 5px 12px 5px 9px; border-radius: 15px;
  background: var(--tok-bg); color: var(--tok-ink); border: 1.5px solid var(--tok-edge);
  box-shadow: 0 0 12px 2px var(--tok-glow); white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease;
}
.hotspot .tag svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--tok-edge); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.hotspot:active .tag, .hotspot:focus-visible .tag { transform: scale(1.06); box-shadow: 0 0 18px 5px var(--tok-glow); }
html.lowstim .hotspot .tag { box-shadow: none; }
.theme-hearth { --tok-bg: rgba(58, 24, 10, .86); --tok-edge: #f08a3c; --tok-ink: #ffe6cc; --tok-glow: rgba(240, 138, 60, .45); }
.theme-journal { --tok-bg: rgba(52, 33, 20, .86); --tok-edge: #d4a26a; --tok-ink: #fbe9d2; --tok-glow: rgba(212, 162, 106, .38); }
.theme-stillroom { --tok-bg: rgba(28, 44, 32, .86); --tok-edge: #9ccc8f; --tok-ink: #e4f3df; --tok-glow: rgba(156, 204, 143, .38); }
.theme-map { --tok-bg: rgba(236, 222, 186, .92); --tok-edge: #8a6630; --tok-ink: #3a2614; --tok-glow: rgba(236, 222, 186, .40); }
.theme-garden { --tok-bg: rgba(30, 50, 24, .86); --tok-edge: #b5d870; --tok-ink: #eef8dc; --tok-glow: rgba(181, 216, 112, .38); }
.theme-library { --tok-bg: rgba(40, 28, 58, .86); --tok-edge: #c3aef0; --tok-ink: #efe8ff; --tok-glow: rgba(195, 174, 240, .40); }
.theme-forest { --tok-bg: rgba(16, 36, 24, .88); --tok-edge: #7fbf8c; --tok-ink: #ddf2e2; --tok-glow: rgba(127, 191, 140, .38); }
.theme-armory { --tok-bg: rgba(34, 38, 46, .88); --tok-edge: #c4ced8; --tok-ink: #eef2f6; --tok-glow: rgba(196, 206, 216, .36); }
.theme-cottage { --tok-bg: rgba(58, 40, 18, .86); --tok-edge: #e8b45c; --tok-ink: #fff0d4; --tok-glow: rgba(232, 180, 92, .45); }
.theme-village { --tok-bg: rgba(58, 30, 34, .86); --tok-edge: #eba08f; --tok-ink: #ffe6e0; --tok-glow: rgba(235, 160, 143, .38); }
.theme-stone { --tok-bg: rgba(48, 36, 12, .88); --tok-edge: #f2c862; --tok-ink: #fff3d2; --tok-glow: rgba(242, 200, 98, .48); }
.theme-notice { --tok-bg: rgba(26, 30, 58, .88); --tok-edge: #a9b8f2; --tok-ink: #e9edff; --tok-glow: rgba(169, 184, 242, .40); }
.theme-create { --tok-bg: rgba(60, 44, 20, .88); --tok-edge: #f0d08a; --tok-ink: #fff4dc; --tok-glow: rgba(240, 208, 138, .40); }
.theme-wayfinder { --tok-bg: rgba(18, 38, 50, .88); --tok-edge: #8fb3c9; --tok-ink: #e3f1fa; --tok-glow: rgba(143, 179, 201, .45); }
.theme-worlds { --tok-bg: rgba(42, 26, 56, .88); --tok-edge: #d2a8f0; --tok-ink: #f6eaff; --tok-glow: rgba(210, 168, 240, .40); }
.theme-party { --tok-bg: rgba(60, 26, 22, .88); --tok-edge: #f0a283; --tok-ink: #ffe8de; --tok-glow: rgba(240, 162, 131, .42); }
.action-list a .tok-ico { display: inline-flex; align-items: center; gap: 10px; }
.action-list a .tok-ico svg { width: 20px; height: 20px; fill: none; stroke: var(--tok-edge, var(--accent)); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.scene.no-tags .hotspot .tag { display: none; }
.scene-card {
  position: absolute; left: 8px; right: 8px; top: 8px; z-index: 3; display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 14px; border-radius: 26px; background: rgba(27,20,16,.88); border: 1px solid var(--line);
}
.scene-card span { flex: 1; font-size: .9em; }
.scene-card .btn { min-height: 44px; padding: 0 16px; }
.action-list { display: grid; gap: 10px; }
.action-list a { display: flex; justify-content: space-between; align-items: center; min-height: 56px; padding: 0 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.action-list a::after { content: "\203A"; color: var(--muted); font-size: 1.4em; }
.vignette { position: relative; width: 100%; aspect-ratio: 3 / 2; border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; background: var(--panel); }
.vignette > img.vignette-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.backdrop-art-wrap { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.backdrop-art-wrap img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 70%; opacity: .55; }
.backdrop-art-wrap::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(27,20,16,.82) 0%, rgba(27,20,16,.62) 45%, rgba(27,20,16,.25) 100%); }
.welcome-content { position: relative; z-index: 1; }
.welcome-content .panel, .welcome-content .quiet { background: rgba(36, 26, 20, .78); }
.welcome-content input { background: rgba(27, 20, 16, .85); }

/* ---------- animation layers (separate from the artwork) ---------- */
.fx-layer { position: absolute; inset: 0; pointer-events: none; }
.fx { position: absolute; pointer-events: none; will-change: opacity, transform; }
.fx-flicker {
  background: radial-gradient(ellipse at 50% 60%, rgba(255, 176, 84, .55), rgba(255, 120, 40, .18) 45%, rgba(255, 120, 40, 0) 70%);
  mix-blend-mode: screen; animation: fx-flicker 3.2s steps(1, end) infinite, fx-flicker-soft 2.1s ease-in-out infinite;
}
@keyframes fx-flicker { 0% { opacity: .75; } 13% { opacity: .95; } 27% { opacity: .7; } 41% { opacity: 1; } 58% { opacity: .78; } 72% { opacity: .92; } 86% { opacity: .72; } }
@keyframes fx-flicker-soft { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06) translateY(-1.5%); } }
.fx-glow {
  background: radial-gradient(circle, rgba(255, 214, 140, .62), rgba(255, 190, 100, .18) 45%, rgba(255, 190, 100, 0) 70%);
  mix-blend-mode: screen; transform: scale(1.8); animation: fx-glow 6s ease-in-out infinite;
}
.fx-glow.fx-small { transform: scale(1.3); }
@keyframes fx-glow { 0%, 100% { opacity: .45; } 50% { opacity: .85; } }
.fx-shimmer {
  background: linear-gradient(115deg, rgba(255,255,255,0) 35%, rgba(235, 248, 255, .55) 50%, rgba(255,255,255,0) 65%);
  background-size: 250% 100%; mix-blend-mode: soft-light; border-radius: 40%;
  animation: fx-shimmer 4.5s ease-in-out infinite;
}
@keyframes fx-shimmer { 0% { background-position: 120% 0; opacity: 0; } 30% { opacity: 1; } 70% { opacity: 1; } 100% { background-position: -20% 0; opacity: 0; } }
.fx-daylight { mix-blend-mode: screen; animation: fx-ambient 40s ease-in-out infinite; }
.tod-morning .fx-daylight { background: radial-gradient(ellipse at 50% 40%, rgba(255, 236, 200, .28), rgba(255,236,200,0) 70%); }
.tod-day .fx-daylight { background: radial-gradient(ellipse at 50% 40%, rgba(255, 250, 230, .32), rgba(255,250,230,0) 70%); }
.tod-evening .fx-daylight { background: radial-gradient(ellipse at 50% 40%, rgba(255, 170, 110, .22), rgba(255,170,110,0) 70%); }
.tod-night .fx-daylight { background: radial-gradient(ellipse at 50% 40%, rgba(120, 140, 220, .16), rgba(120,140,220,0) 70%); }
.fx-ambient { inset: 0; background: radial-gradient(ellipse at 25% 55%, rgba(255, 160, 80, .10), rgba(0,0,0,0) 60%); mix-blend-mode: screen; animation: fx-ambient 40s ease-in-out infinite; }
@keyframes fx-ambient { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* character layers for later stages */
.sprite { position: absolute; object-fit: contain; pointer-events: none; transform-origin: 50% 100%; }
.idle-breathe { animation: idle-breathe 5.5s ease-in-out infinite; }
.idle-sway { animation: idle-sway 7s ease-in-out infinite; }
@keyframes idle-breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.012); } }
@keyframes idle-sway { 0%, 100% { transform: rotate(-.5deg); } 50% { transform: rotate(.5deg); } }

/* level-up effect for later stages */
.levelup { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.levelup .mote { position: absolute; bottom: 10%; width: 6px; height: 6px; border-radius: 50%; background: #ffd890; box-shadow: 0 0 10px 3px rgba(255, 200, 110, .7); opacity: 0; animation: mote-rise 2s ease-out forwards; }
@keyframes mote-rise { 0% { opacity: 0; transform: translateY(0) scale(.6); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-120px) scale(1); } }
.levelup-ring { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px; border-radius: 50%; border: 2px solid rgba(255, 210, 130, .8); animation: ring-out 1.4s ease-out forwards; }
@keyframes ring-out { 0% { opacity: .9; transform: scale(.4); } 100% { opacity: 0; transform: scale(4); } }
.levelup-static { box-shadow: 0 0 0 3px rgba(255, 210, 130, .8) !important; transition: box-shadow .3s; }

/* gentle scene transitions */
#view.enter { animation: view-in .32s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* hearth within */
.hearth { position: relative; overflow: hidden; min-height: calc(100dvh - var(--top) - var(--bottom)); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; text-align: center; background: #120a06; }
.hearth > img.hearth-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .5; }
.hearth > .fx-hearth { left: 20%; top: 42%; width: 60%; height: 34%; opacity: .7; }
.hearth > *:not(img):not(.fx) { position: relative; }

/* journal */
.entry-card { display: block; text-decoration: none; color: var(--text); }
.entry-card .meta { display: flex; justify-content: space-between; font-size: .82em; color: var(--muted); }
.entry-card .first { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.badge { display: inline-block; font-size: .72em; padding: 2px 8px; border-radius: 10px; background: var(--panel-2); color: var(--text-2); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 12px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

.closing { font-family: var(--serif); font-size: 1.6em; text-align: center; color: var(--accent); margin: 28px 0; line-height: 1.3; }

/* modal + toast */
#modal-root .backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
#modal-root .dialog { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
#toast { position: fixed; left: 50%; bottom: calc(var(--bottom) + 16px); transform: translateX(-50%); z-index: 95; background: var(--panel-2); color: var(--text); padding: 10px 18px; border-radius: 20px; border: 1px solid var(--line); opacity: 0; pointer-events: none; transition: opacity .25s; max-width: 90vw; }
#toast.show { opacity: 1; }

/* ---------- low-stimulation mode ---------- */
html.lowstim { --bg: #151515; --bg-2: #1c1c1c; --panel: #1f1f1f; --panel-2: #262626; --line: #333; --accent: #c9a77a; --sos: #a85a48; }
html.lowstim .scene-wrap, html.lowstim .vignette, html.lowstim .hearth img, html.lowstim .wave::before { display: none; }
html.lowstim *, html.lowstim *::before, html.lowstim *::after { animation: none !important; box-shadow: none !important; }
html.lowstim #sos-btn { box-shadow: none; }
html.lowstim .hearth { background: var(--bg); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .fx { opacity: .6; }
  .fx-shimmer, .levelup { display: none; }
  .breath-shape { transition-duration: 0s !important; }
}
.night-watch { display: flex; align-items: center; gap: 12px; }
.night-watch span { flex: 1; }
.preview-bar { position: fixed; left: 8px; right: 8px; bottom: calc(var(--bottom) + 8px); z-index: 80; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 16px; background: #3a2c1f; border: 1px solid var(--accent); font-size: .85em; }
.preview-bar .linkish { min-height: 36px; padding: 0 8px; }
.form-alert { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--danger); background: rgba(212, 87, 63, .16); color: #ffd9cf; font-weight: 600; }
.form-alert.busy { border-color: var(--accent); background: rgba(224, 164, 88, .14); color: var(--text); font-weight: 400; }
.needs-fix, input.needs-fix { outline: 2px solid var(--danger); outline-offset: 2px; border-radius: 12px; }

/* ---------- spacing and fit pass (v0.4) ---------- */
section > h2 { margin: 30px 0 12px; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 4px; font-size: .95em; text-decoration: none; }
.panel h3 { margin-top: 22px; }
.panel h2 + .toggle, .panel h2 + p { margin-top: 4px; }
.panel p.small + .seg { margin-top: 2px; }
.panel .seg { margin-bottom: 16px; }
.panel .toggle { padding: 8px 0; }
.panel .row { margin: 10px 0; }

/* progress: one line, never wraps */
.progress { margin: 0 0 22px; }
.progress-text { display: flex; justify-content: space-between; font-size: .9em; color: var(--accent); margin-bottom: 6px; }
.progress-track { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width .3s ease; }

/* list items: title, one-line summary, time below; chevron never squeezes the text */
.action-list a { position: relative; padding: 14px 40px 14px 18px; min-height: 64px; }
.action-list a::after { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }
.action-list .item { display: flex; flex-direction: column; gap: 2px; }
.action-list .item-sub { color: var(--text-2); font-size: .92em; line-height: 1.35; }
.action-list .item-meta { color: var(--muted); font-size: .8em; }

/* check-in suggestions: text first, actions beneath */
.suggestion { padding: 10px 0; border-bottom: 1px solid rgba(143, 179, 201, .18); }
.suggestion:last-child { border-bottom: 0; }
.suggestion-text { margin-bottom: 8px; }
.suggestion-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.suggestion-actions .chip { min-height: 40px; }
.app-note + .field, .app-note + label.field { margin-top: 18px; }

/* wheel: comfortable size, no hard frame; the chosen colour stays bright and the rest dim */
.wheel svg { max-width: 290px; margin: 8px auto 4px; }
.wheel path { stroke: var(--bg); stroke-width: 2; transition: opacity .2s ease; }
.wheel path.on { stroke: var(--bg); stroke-width: 2; }
.wheel svg.has-open path:not(.on) { opacity: .45; }
.wheel text { font-family: var(--serif); font-size: 15px; font-weight: 400; fill: #1b1410; }
.wheel text.hub-text { font-family: var(--sans); font-size: 11px; fill: var(--text-2); }
.wheel h3 { margin-top: 14px; }

/* breathing: the painted lantern */
.v-lantern .breath-stage { height: 270px; }
.v-lantern .breath-shape {
  position: relative; width: 230px; height: 230px; background: none; box-shadow: none; opacity: 1;
  transform: scale(calc(.94 + var(--s) * .06));
  transition-property: transform;
}
.v-lantern .lantern-art {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 52%, transparent 71%);
  mask-image: radial-gradient(circle at 50% 50%, #000 52%, transparent 71%);
  filter: brightness(calc(.62 + var(--s) * .45)) saturate(calc(.9 + var(--s) * .2));
  transition: filter var(--dur, 4s) ease-in-out;
}
.v-lantern .lantern-halo {
  position: absolute; inset: -30%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 176, 84, .45), rgba(255, 150, 60, .12) 45%, rgba(255, 150, 60, 0) 68%);
  opacity: calc(.25 + var(--s) * .75);
  transition: opacity var(--dur, 4s) ease-in-out;
}
.v-lantern .lantern-flame-glow {
  position: absolute; left: 34%; top: 40%; width: 32%; height: 34%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 170, .9), rgba(255, 190, 90, .35) 45%, rgba(255, 190, 90, 0) 70%);
  mix-blend-mode: screen; opacity: calc(.2 + var(--s) * .8); transform: scale(calc(.8 + var(--s) * .45));
  transition: opacity var(--dur, 4s) ease-in-out, transform var(--dur, 4s) ease-in-out;
}
.hearth .breather .breath-label, .hearth .breather .breath-count { text-shadow: 0 1px 8px rgba(0,0,0,.8); }

/* low stimulation: a small, soft light that brightens and dims, no bar */
.v-simple .breath-stage { height: 110px; }
.v-simple .breath-shape {
  width: 70px; height: 70px; border-radius: 50%; transform: none;
  background: radial-gradient(circle, rgba(201, 167, 122, .9), rgba(201, 167, 122, .15) 70%);
  opacity: calc(.3 + var(--s) * .7); transition-property: opacity;
}
/* breathing room between the last field of a step and its Back / Continue row */
.flow .row.split { margin-top: 22px; }
.wheel + .row.split, .wheel + .rating { margin-top: 22px; }
.wheel .row { margin-top: 8px; }
/* check-in suggestions: compact choice buttons, a bridge line for cravings, SOS emphasised when strong */
.suggestion-actions .chip { min-height: 38px; padding: 0 14px; font-size: .88em; }
.app-note .bridge { margin: 4px 0 10px; color: var(--text); font-style: italic; }
.suggestion.strong .suggestion-text { color: #ffd2c8; }

/* ---------- Library ---------- */
.tabs-scroll { overflow-x: auto; scrollbar-width: none; margin-bottom: 4px; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.tabs-scroll .seg { min-width: 470px; }
.lib-card h3 { margin: 6px 0 2px; }
.lib-card .byline { margin-bottom: 8px; }
.lib-meta { font-size: .8em; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge.free { background: rgba(143, 185, 138, .18); color: var(--good); }
.content-note { font-size: .88em; color: #ecd2ad; border-left: 3px solid var(--accent); padding: 6px 12px; background: rgba(224, 164, 88, .08); border-radius: 0 8px 8px 0; }
.content-note.heavy { border-color: var(--danger); color: #ffd2c6; background: rgba(212, 87, 63, .10); }
.need-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.need-tag { font-size: .75em; padding: 2px 10px; border-radius: 10px; border: 1px solid var(--line); color: var(--text-2); }
.shelf-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.shelf-actions .chip { min-height: 36px; padding: 0 12px; font-size: .85em; }
.evidence { display: inline-block; font-size: .75em; padding: 3px 10px; border-radius: 10px; margin-bottom: 8px; border: 1px solid; }
.ev-established { color: #a9d7a4; border-color: rgba(143, 185, 138, .6); background: rgba(143, 185, 138, .12); }
.ev-moderate { color: #b8d3e4; border-color: rgba(143, 179, 201, .6); background: rgba(143, 179, 201, .12); }
.ev-early { color: #f0c98c; border-color: rgba(224, 164, 88, .6); background: rgba(224, 164, 88, .12); }
.ev-preliminary { color: #cfc6bb; border-color: rgba(168, 163, 154, .6); background: rgba(168, 163, 154, .12); }
.research .meaning { color: var(--text); }
.checked { margin-top: 24px; }

/* ---------- Garden ---------- */
.section-nav { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; margin: 8px 0 12px; }
.section-nav::-webkit-scrollbar { display: none; }
.section-nav .chip { white-space: nowrap; flex: none; }
.day-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.day-name { width: 44px; color: var(--text-2); font-weight: 600; }
.day-row select { flex: 1; }
.grocery-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.grocery-row input { width: 24px; height: 24px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.grocery-row .uses { display: block; }
.grocery-row.got strong { text-decoration: line-through; color: var(--muted); }
.grocery-row .badge { margin-left: 8px; }
.plot { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; background: rgba(74, 56, 43, .35); border-radius: 14px; padding: 10px; }
.plant { width: 100%; height: auto; }
.plant .soil { fill: #5a4030; }
.plant.today .soil { fill: #8a6448; }
.plant .stem { stroke: #7fa36a; stroke-width: 2.2; fill: none; stroke-linecap: round; }
.plant .leaf { fill: #8fb98a; }
.plant .bloom { fill: #e8b4c0; }
.plant .bloom-centre { fill: #e8c36a; }
.ingredients { padding-left: 20px; }
.ingredients li, .pantry li { margin-bottom: 4px; }
.steps-list { padding-left: 22px; }
.steps-list li { margin-bottom: 10px; }
.panel.toddler { border-color: rgba(143, 179, 201, .5); }

/* ---------- practice focus mode ---------- */
.setup-line { margin: 14px 0 16px; line-height: 1.5; }
.setup-line .linkish { padding: 0 4px; min-height: 36px; }
.practice-focus { position: relative; min-height: calc(100dvh - var(--top) - var(--bottom) - 16px); display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; margin: 0 -8px; }
.practice-scene-holder { position: absolute; inset: 0; z-index: 0; }
.practice-scene { width: 100%; height: 100%; object-fit: cover; }
.practice-scene-shade { position: absolute; inset: 0; background: linear-gradient(rgba(20, 14, 10, .55), rgba(20, 14, 10, .35) 40%, rgba(20, 14, 10, .7)); }
.practice-inner { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 18px 16px; text-align: center; }
.practice-title { font-family: var(--serif); color: var(--text-2); margin: 0 0 8px; }
.practice-words { margin: 6px 0 12px; }
.practice-words .row.split { justify-content: space-between; margin-top: 18px; }
.practice-controls-row { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: auto; padding-top: 16px; }
.has-scene .practice-inner { text-shadow: 0 1px 10px rgba(0, 0, 0, .85); }
.has-scene .btn.ghost { background: rgba(27, 20, 16, .55); }

/* bottom sheet */
.sheet-backdrop { align-items: end !important; padding: 0 !important; }
.sheet { width: 100%; max-width: 640px; max-height: 82dvh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); }
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet h2 { margin: 0; }
.ps-group { margin-top: 16px; }
.ps-group > p { margin-bottom: 6px; }
.scene-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.scene-option { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; border: 2px solid var(--line); padding: 0; background: var(--bg-2); cursor: pointer; }
.scene-option img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scene-option .scene-none { position: absolute; inset: 0; background: var(--bg-2); }
.scene-option .scene-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 4px; font-size: .78em; background: rgba(20, 14, 10, .72); color: var(--text); }
.scene-option[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

/* breathing guide: Tide, water rising and falling in a round window */
.v-tide .breath-stage { height: 250px; }
.v-tide .breath-shape {
  position: relative; width: 220px; height: 220px; border-radius: 50%; overflow: hidden; transform: none;
  border: 2px solid rgba(160, 196, 216, .45);
  background: radial-gradient(circle at 50% 30%, rgba(40, 52, 72, .55), rgba(12, 16, 26, .85));
}
.v-tide .water { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; transform: translateY(calc((1 - var(--s)) * 58% + 12%)); transition: transform var(--dur, 4s) ease-in-out; }
.v-tide .wave-surface { position: absolute; left: 0; width: 200%; height: 26px; top: -13px; background-repeat: repeat-x; background-size: 50% 100%; animation: tide-drift 8s linear infinite; }
.v-tide .wave-surface.w1 { background-image: radial-gradient(ellipse 60% 100% at 50% 100%, rgba(120, 168, 196, .85) 60%, transparent 62%); }
.v-tide .wave-surface.w2 { top: -8px; opacity: .7; animation-duration: 12s; animation-direction: reverse; background-image: radial-gradient(ellipse 60% 100% at 50% 100%, rgba(150, 196, 220, .75) 60%, transparent 62%); }
.v-tide .water-body { position: absolute; left: 0; right: 0; top: 10px; bottom: 0; background: linear-gradient(rgba(120, 168, 196, .85), rgba(60, 100, 130, .9)); }
@keyframes tide-drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* breathing guide: Moon, brightening and dimming */
.v-moon .breath-stage { height: 260px; }
.v-moon .breath-shape { position: relative; width: 200px; height: 200px; transform: scale(calc(.92 + var(--s) * .08)); transition-property: transform; }
.v-moon .moon-halo { position: absolute; inset: -40%; border-radius: 50%; background: radial-gradient(circle, rgba(225, 232, 255, .38), rgba(225, 232, 255, .08) 45%, rgba(225, 232, 255, 0) 66%); opacity: calc(.2 + var(--s) * .8); transition: opacity var(--dur, 4s) ease-in-out; }
.v-moon .moon-disc { position: absolute; inset: 14%; border-radius: 50%; background: radial-gradient(circle at 38% 34%, #fbf6e8, #e4dcc8 55%, #b7ae9a); box-shadow: inset -12px -10px 22px rgba(0, 0, 0, .28); filter: brightness(calc(.62 + var(--s) * .45)); transition: filter var(--dur, 4s) ease-in-out; }
.v-moon .crater { position: absolute; border-radius: 50%; background: rgba(150, 140, 120, .35); }
.v-moon .c1 { width: 22%; height: 22%; left: 52%; top: 24%; }
.v-moon .c2 { width: 14%; height: 14%; left: 26%; top: 56%; }
.v-moon .c3 { width: 10%; height: 10%; left: 60%; top: 62%; }

/* legibility over painted scenes */
.has-scene .practice-inner::before { content: ""; position: absolute; left: 50%; top: 50%; width: 120%; height: 70%; transform: translate(-50%, -50%); background: radial-gradient(ellipse at center, rgba(15, 10, 8, .5), rgba(15, 10, 8, 0) 70%); z-index: -1; pointer-events: none; }
.has-scene .breath-count { color: var(--text); font-size: 1.15em; }

/* ---------- painted breathing guides (v0.7): Orb, Moon, Bloom, Tide frame ---------- */
.v-circle .breath-stage, .v-moon .breath-stage, .v-bloom .breath-stage { height: 270px; }
.v-circle .breath-shape, .v-moon .breath-shape, .v-bloom .breath-shape {
  position: relative; width: 230px; height: 230px; border: 0; border-radius: 0; background: none; box-shadow: none; opacity: 1;
  transform: scale(calc(.9 + var(--s) * .1)); transition-property: transform;
}
.v-bloom .breath-shape { transform: scale(calc(.95 + var(--s) * .05)); }
.guide-art {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 54%, transparent 71%);
  mask-image: radial-gradient(circle at 50% 50%, #000 54%, transparent 71%);
  filter: brightness(calc(.6 + var(--s) * .45));
  transition: filter var(--dur, 4s) ease-in-out, opacity var(--dur, 4s) ease-in-out;
}
/* light on black: screen blending lets the dark square vanish into any scene */
.v-moon .guide-art, .v-circle .guide-art { mix-blend-mode: screen; }
.v-moon .guide-art { -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 58%, transparent 71%); mask-image: radial-gradient(circle at 50% 50%, #000 58%, transparent 71%); }
.v-bloom .guide-art { -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 60%, transparent 71%); mask-image: radial-gradient(circle at 50% 50%, #000 60%, transparent 71%); filter: brightness(calc(.75 + var(--s) * .3)); }
.v-bloom .bloom-open { opacity: var(--s); }
.v-bloom .bloom-closed { opacity: calc(1 - var(--s) * .85); }
.guide-halo {
  position: absolute; inset: -28%; border-radius: 50%; opacity: calc(.15 + var(--s) * .85);
  transition: opacity var(--dur, 4s) ease-in-out;
}
.v-circle .guide-halo { background: radial-gradient(circle, rgba(255, 184, 90, .4), rgba(255, 160, 60, .1) 45%, rgba(255, 160, 60, 0) 68%); }
.v-moon .guide-halo { background: radial-gradient(circle, rgba(236, 228, 205, .32), rgba(236, 228, 205, .08) 45%, rgba(236, 228, 205, 0) 68%); }
.v-bloom .guide-halo { background: radial-gradient(circle, rgba(255, 238, 190, .28), rgba(255, 238, 190, .06) 45%, rgba(255, 238, 190, 0) 66%); }

/* Tide: the painted stone window sits over the moving water */
.v-tide .breath-stage { height: 270px; align-items: center; }
.v-tide .breath-shape { position: relative; width: 250px; height: 250px; border: 0; border-radius: 0; background: none; overflow: visible; }
.v-tide .tide-window { position: absolute; inset: 13.6%; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 30%, rgba(40, 52, 72, .7), rgba(12, 16, 26, .92)); }
.v-tide .tide-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  /* keep the gentle light and crossfade, drop the swelling */
  .v-circle .breath-shape, .v-moon .breath-shape, .v-bloom .breath-shape, .v-lantern .breath-shape { transform: none; }
}

/* v0.7.1: the guide art now carries its own transparency, so no masks or blending */
.guide-art, .v-moon .guide-art, .v-bloom .guide-art { -webkit-mask-image: none; mask-image: none; border-radius: 0; mix-blend-mode: normal; }
/* Tide water, repainted in deeper, softer tones to sit inside the stone window */
.v-tide .tide-window { background: radial-gradient(circle at 50% 28%, #2b3a4a, #121820 75%); }
.v-tide .water-body { top: 8px; background: linear-gradient(#5f8fa6 0%, #3d6a82 22%, #24475c 60%, #16303f 100%); }
.v-tide .water-body::after { content: ""; position: absolute; left: 12%; right: 12%; top: 6%; height: 16%; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(255, 226, 170, .28), rgba(255, 226, 170, 0) 70%); }
.v-tide .wave-surface.w1 { background-image: radial-gradient(ellipse 60% 100% at 50% 100%, rgba(108, 152, 172, .9) 60%, transparent 63%); }
.v-tide .wave-surface.w2 { background-image: radial-gradient(ellipse 60% 100% at 50% 100%, rgba(150, 186, 196, .55) 60%, transparent 63%); }

/* ---------- SOS art (v0.8): a quiet window onto each painting ---------- */
.sos-art { position: relative; width: 100%; aspect-ratio: 3 / 1; overflow: hidden; border-radius: var(--radius); margin: 0 0 12px; background: var(--panel); --fy: .5; }
.sos-art.tall { aspect-ratio: 2 / 1; }
.sos-art > .vignette {
  position: absolute; left: 0; width: 100%; height: 200%; aspect-ratio: auto; margin: 0; border-radius: 0; background: none;
  top: calc(var(--fy) * -100%);
  opacity: 0; filter: brightness(.82) saturate(.92);
  transition: opacity 1.2s ease, top 1s linear;
}
.sos-art.tall > .vignette { height: 133.33%; top: calc(var(--fy) * -33.33%); }
.sos-art.ready > .vignette { opacity: 1; }
.sos .steadier { margin-top: 6px; }
.sos .contact-grid + .sos-art { margin-top: 16px; }
html.lowstim .sos-art { display: none; }
html.still-scenes .sos-art.tall > .vignette { top: -16.67%; transition: opacity 1.2s ease; }
@media (prefers-reduced-motion: reduce) {
  .sos-art > .vignette { transition: none; }
  .sos-art.tall > .vignette { top: -16.67%; }
}
.sos .row.split .steadier { flex-basis: 100%; }

/* ---------- v0.9: practice cards, sense tokens and painted practice tools ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* cards: list thumbnails and intro headers */
.action-list a.has-thumb { gap: 14px; justify-content: flex-start; padding-left: 10px; }
.skill-thumb { flex: none; width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); }
.card-header-wrap { width: 100%; aspect-ratio: 2 / 1; border-radius: var(--radius); overflow: hidden; margin: 0 0 14px; background: var(--panel); }
.card-header { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(.9); }

/* sense tokens */
.sense-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 4px 0 14px; }
.sense-token { display: flex; flex-direction: column; align-items: center; gap: 2px; opacity: .32; filter: grayscale(.6) brightness(.8); transition: opacity .8s ease, filter .8s ease, transform .8s ease; }
.sense-token.been { opacity: .7; filter: none; }
.sense-token.now { opacity: 1; filter: drop-shadow(0 0 10px rgba(255, 200, 120, .55)); transform: translateY(-2px); }
.sense-art { width: 100%; max-width: 64px; aspect-ratio: 1; object-fit: contain; }
.sense-name { font-size: .72em; color: var(--text-2); }
.sense-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); margin: 8px 0; }
.has-scene .sense-name { color: var(--text); }

/* TIPP tokens */
.tipp-token { height: 132px; display: grid; place-items: center; margin-bottom: 4px; }
.tipp-art { width: 128px; height: 128px; object-fit: contain; filter: drop-shadow(0 0 16px rgba(255, 196, 120, .35)); }
.tipp-letter { font-family: var(--serif); font-size: 3em; color: var(--accent); }

/* body scan: light rising through the tree */
.tree-scan { position: relative; width: min(100%, 280px); aspect-ratio: 1; margin: 0 auto 10px; border-radius: 50%; overflow: hidden; background: radial-gradient(circle, #2a2219, var(--bg)); --y: 86%; }
.tree-art { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(.72) saturate(.85); }
.scan-glow { position: absolute; left: 50%; top: var(--y); width: 70%; height: 34%; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 214, 140, .62), rgba(255, 190, 110, .22) 45%, rgba(255, 190, 110, 0) 72%);
  mix-blend-mode: screen; transition: top 2.4s ease-in-out, width 2.4s ease, height 2.4s ease, opacity 2.4s ease; }
.tree-scan.whole .scan-glow { top: 50%; width: 120%; height: 120%; opacity: .75; }

/* evening wind-down: the nook dims, the lamp stays lit */
.nook { position: relative; width: 100%; aspect-ratio: 3 / 2; border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; background: #1a130e; --dim: 0; }
.nook-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.nook-shade { position: absolute; inset: 0; background: #07050a; opacity: var(--dim); transition: opacity 3s ease; }
.nook-lamp { position: absolute; left: 83%; top: 46%; width: 34%; height: 50%; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 120, .5), rgba(255, 180, 90, 0) 65%); mix-blend-mode: screen; }

/* ten-minute walk: a small light travels up the lane */
.lane-wrap { margin-bottom: 8px; }
.lane { position: relative; width: 100%; aspect-ratio: 3 / 2; border-radius: var(--radius); overflow: hidden; background: #2b2a1d; }
.lane-art { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(.9); }
.lane-marker { position: absolute; left: var(--x); top: var(--y); width: 18px; height: 18px; border-radius: 50%; transform: translate(-50%, -50%) scale(var(--s, 1));
  background: radial-gradient(circle, #fff3d0, #ffc86e 45%, rgba(255, 200, 110, 0) 72%); box-shadow: 0 0 18px 6px rgba(255, 200, 120, .45);
  transition: left 1s linear, top 1s linear, transform 1s linear; }
.lane-row { justify-content: space-between; align-items: center; margin-top: 10px; }
.lane-clock { font-family: var(--serif); font-size: 1.3em; font-variant-numeric: tabular-nums; }

/* leaves on a stream */
.stream-wrap { margin-bottom: 8px; }
.stream { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: linear-gradient(#24323a, #182227); }
.stream-art { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(.88); }
.drift-leaf { position: absolute; left: var(--x); top: -4%; width: 34%; display: flex; flex-direction: column; align-items: center; transform: rotate(var(--r)); opacity: 0;
  transition: top 14s linear, opacity 1.2s ease, transform 14s ease-in-out; pointer-events: none; }
.drift-leaf.away { top: 104%; opacity: 1; transform: rotate(calc(var(--r) * -1.6)) translateX(10%); }
.leaf-art { width: 58%; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .45)); }
.leaf-dot { width: 26px; height: 18px; border-radius: 60% 0; background: var(--accent); }
.leaf-words { margin-top: -6px; max-width: 150%; padding: 2px 8px; border-radius: 10px; background: rgba(27, 20, 16, .72); color: var(--text); font-size: .82em; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
.stream-form { display: flex; gap: 8px; margin-top: 10px; }
.stream-form input { flex: 1; min-width: 0; }
.stream-note { margin-top: 6px; }

/* square guide: a light travels the frame; the centre fills on the in-breath */
.v-square .breath-stage { height: 270px; }
.v-square .breath-shape { position: relative; width: 240px; height: 240px; background: none; border: 0; box-shadow: none; transform: none; }
.square-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.square-glow { position: absolute; inset: 16%; border-radius: 6px; background: radial-gradient(circle, rgba(255, 210, 140, .45), rgba(255, 190, 110, .08) 70%); opacity: calc(.15 + var(--s) * .85); transition: opacity var(--dur, 4s) ease-in-out; }
.square-dot { position: absolute; left: 9%; top: 9%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%;
  background: radial-gradient(circle, #fffbe8, #ffd27a 45%, rgba(255, 200, 110, 0) 72%); box-shadow: 0 0 16px 6px rgba(255, 210, 130, .55);
  transition-property: left, top; transition-timing-function: linear; }

/* a guide picker with six choices wraps into two neat rows */
.seg.many { display: grid; grid-template-columns: repeat(3, 1fr); border-radius: 16px; }
.seg.many button + button { border-left: 0; }

/* reduced motion and low stimulation */
@media (prefers-reduced-motion: reduce) {
  /* no drifting: the leaf appears where it is and slowly fades away */
  .drift-leaf { top: 38%; opacity: 1; transform: rotate(var(--r)); transition: opacity 7s ease 3s; }
  .drift-leaf.away { top: 38%; opacity: 0; transform: rotate(var(--r)); }
  .square-dot, .lane-marker { transition: none; }
  .sense-token.now { transform: none; }
}
html.lowstim .card-header-wrap, html.lowstim .skill-thumb, html.lowstim .tree-art, html.lowstim .nook-art, html.lowstim .lane-art, html.lowstim .stream-art { display: none; }
html.lowstim .tree-scan { border-radius: var(--radius); }
/* v0.9 tuning after review */
.tree-art { filter: brightness(.5) saturate(.7); transition: filter 2.4s ease; }
.tree-scan.whole .tree-art { filter: brightness(.78) saturate(.9); }
.scan-glow { width: 80%; height: 40%; background: radial-gradient(ellipse at center, rgba(255, 222, 150, .95), rgba(255, 196, 110, .4) 42%, rgba(255, 190, 110, 0) 72%); }
.tree-scan.whole .scan-glow { opacity: .6; }
.sense-token { opacity: .42; }


/* ---------- InnerSpace (Stage 2) ---------- */
.world.innerspace { position: relative; }
.teleport-flash { position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(circle at 18% 82%, rgba(255, 220, 140, .95), rgba(255, 200, 110, .55) 35%, rgba(27, 20, 16, 0) 75%);
  animation: teleport 1.1s ease-out forwards; }
@keyframes teleport { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .teleport-flash { display: none; } }
.center { text-align: center; }
.prompt-q { font-size: 1.2em; line-height: 1.35; margin: 14px 0 6px; }
.thinking { color: var(--muted); font-style: italic; }

/* Who is speaking is always clear: John's words, the WayFinder (AI), or an Aspect's imagined voice (AI). */
.msg { margin: 10px 0; padding: 10px 12px; border-radius: 12px; }
.msg .who { display: block; font-size: .72em; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 4px; }
.msg.john { background: var(--panel-2); border: 1px solid var(--line); margin-left: 28px; }
.msg.john .who { color: var(--text-2); }
.msg.wayfinder { border-left: 3px solid var(--app-note); background: rgba(143, 179, 201, .09); border-radius: 0 12px 12px 0; margin-right: 18px; }
.msg.wayfinder .who { color: var(--app-note); }
.msg.wayfinder.written { border-left: 3px dotted var(--muted); background: rgba(201, 184, 163, .06); }
.msg.wayfinder.written .who { color: var(--text-2); }
.msg.aspect { border-left: 3px dashed #d2a8f0; background: rgba(210, 168, 240, .08); border-radius: 0 12px 12px 0; margin-right: 18px; font-style: italic; }
.msg.aspect .who { color: #d2a8f0; font-style: normal; }
.msg.note { margin-left: 0; margin-right: 0; }
.msg.link { display: block; color: var(--text); text-decoration: none; }
.talk-log { margin: 8px 0 12px; }
.talk textarea { margin-top: 8px; }

.safety { border: 1px solid var(--line); }
.safety-crisis { border-color: var(--sos); }
.safety .btn.block { margin-top: 8px; }
.safety .vignette { margin-bottom: 12px; }

.aspect-frame { position: relative; width: min(78%, 300px); margin: 6px auto 4px; aspect-ratio: 1 / 1; }
.aspect-frame .vignette { position: absolute; inset: 0; aspect-ratio: 1 / 1; margin: 0; background: none; }
.frame-name { position: absolute; left: 22%; right: 22%; top: 50%; transform: translateY(-50%); text-align: center;
  font-family: var(--serif); font-size: 1.35em; line-height: 1.2; color: #3a2614; z-index: 1; }
html.lowstim .aspect-frame { aspect-ratio: auto; }
html.lowstim .frame-name { position: static; transform: none; color: var(--text); font-size: 1.6em; }
.ideas .idea { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid rgba(143, 179, 201, .2); }
.ideas .idea:first-of-type { border-top: 0; }
.world-door { display: block; color: var(--text); text-decoration: none; }
.world-door h2 { margin-top: 0; }

.innerspace-foot { padding: 14px 18px 4px; }
.innerspace-foot p { margin: 0 0 6px; }
[hidden] { display: none !important; }

/* ---------- Round 2: Aspects come to life ---------- */
.aspect-frame .portrait { position: absolute; left: 24%; top: 14%; width: 52%; height: 70%; object-fit: cover; border-radius: 50%; z-index: 1;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, .5); }
.aspect-frame.small-frame { width: min(52%, 200px); }
html.lowstim .aspect-frame.has-portrait { aspect-ratio: 1 / 1; }
html.lowstim .aspect-frame .portrait { left: 0; top: 0; width: 100%; height: 100%; }

.aspect-token { position: absolute; width: 11%; aspect-ratio: 1 / 1; transform: translate(-50%, -50%); z-index: 4; border-radius: 50%;
  border: 2px solid #f2c862; box-shadow: 0 0 0 2px rgba(27, 20, 16, .7), 0 0 14px rgba(242, 200, 98, .55); overflow: hidden;
  display: flex; align-items: center; justify-content: center; text-decoration: none; background: rgba(40, 28, 16, .85); }
.aspect-token img { width: 100%; height: 100%; object-fit: cover; }
.aspect-token.initial span { font-family: var(--serif); color: #fff3d2; font-size: 1.15em; }
.aspect-token.arriving { animation: arrive 1.6s ease-out 1.2s both; }
@keyframes arrive { from { opacity: 0; transform: translate(-50%, -50%) scale(.4); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

.mirror-shimmer { position: absolute; z-index: 3; pointer-events: none; border-radius: 40% 40% 12% 12%;
  background: radial-gradient(ellipse at 50% 45%, rgba(255, 246, 214, .95), rgba(214, 196, 255, .55) 40%, rgba(255, 255, 255, 0) 72%);
  animation: shimmer-in 2.4s ease-in-out both; }
@keyframes shimmer-in { 0% { opacity: 0; } 35% { opacity: 1; } 70% { opacity: .85; } 100% { opacity: 0; } }

.reveal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(10, 8, 14, .55); padding: 16px; animation: reveal-in .6s ease-out 1.6s both; }
.reveal.calm { animation: none; }
@keyframes reveal-in { from { opacity: 0; } to { opacity: 1; } }
.reveal-card { width: min(100%, 440px); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; text-align: center;
  margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); }
.reveal-card .aspect-frame { width: min(62%, 220px); }
.reveal-card h2 { margin: 8px 0 4px; }
.reveal-card .row { justify-content: center; }
@media (prefers-reduced-motion: reduce) { .reveal, .aspect-token.arriving, .mirror-shimmer { animation: none; } .mirror-shimmer { display: none; } }

.world-art { aspect-ratio: 3 / 2; }
.world-art img { width: 100%; height: 100%; object-fit: cover; }
.reveal-card .frame-name, .small-frame .frame-name { font-size: .9em; left: 24%; right: 24%; }
.reveal-card .aspect-frame { width: min(70%, 250px); }
