/* Treehouse participant pages: calm, soft colours, large touch targets. */
:root, [data-palette="sand"]{ --bg1:#f4ede3; --bg2:#e9dece; --ink:#4a3d30; --soft:#7a6a58; --accent:#5f8f74; --chip:#fbf7f0; --line:#e0d3c0; }
[data-palette="night"]{ --bg1:#2b303b; --bg2:#21252e; --ink:#ece8e0; --soft:#b5b0a6; --accent:#9cc5ae; --chip:#353b48; --line:#465062; }

/* Text on the white boxes (Owl's bubble, the words at the top) stays dark
   in every colour set; the night set's light ink was white on white
   (Paul, 2026-11-13). */
:root{ --on-white:#4a3d30; }

*{ box-sizing:border-box; }
html,body{ margin:0; height:100dvh; overflow:hidden; color:var(--ink);
  font-family:"Nunito",-apple-system,system-ui,"Segoe UI",Roboto,sans-serif; }
body{ background:var(--bg2); transition:background .8s ease, color .8s ease; }
.vh{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }

/* The room. Sizes and the wall line are set from the stage by the script;
   these are the same sums, so the door is the right size before it runs.
   100dvh is the screen as it is now: on a phone 100vh is taller than the
   screen (it ignores the browser's bar), so the wall line jumped when the
   script took over (Paul, 2026-11-13). */
/* The strip at the bottom for the buttons. On an upright phone it is
   thinner, so the floor and the characters sit lower (Paul, 2026-11-16).
   treehouse.js works out the same sum (STAGE_H). */
:root{ --strip:clamp(150px, 26vh, 210px); }
@media (max-aspect-ratio: 3/4) and (max-width: 599px){ :root{ --strip:clamp(130px, 16vh, 160px); } }
#room{ position:fixed; inset:0; pointer-events:none; --stage-h:calc(100vh - var(--strip));
  --stage-h:calc(100dvh - var(--strip));
  --horizon:calc(var(--strip) + 0.30 * var(--stage-h));
  --door-h:calc(0.37 * 1.053 * min(100vw, var(--stage-h))); --door-w:calc(var(--door-h) * 0.62); }
@media (max-aspect-ratio: 3/4) and (max-width: 599px){ #room{ --door-h:calc(0.30 * 1.053 * min(100vw, var(--stage-h))); } }
/* The wall and floor meet softly: the wall darkens only a little and the
   floor starts close to it, with a faint line, because the characters'
   heads stand across that line and a sharp change cut through them (Paul,
   2026-11-16, worst in Night and on a phone). */
#wall{ position:absolute; left:0; right:0; top:0; bottom:var(--horizon, 40%);
  background:linear-gradient(180deg, var(--bg1) 0%, color-mix(in srgb, var(--bg1) 55%, var(--bg2)) 100%); }
#floor{ position:absolute; left:0; right:0; bottom:0; height:var(--horizon, 40%);
  background:linear-gradient(180deg, color-mix(in srgb, var(--line) 18%, color-mix(in srgb, var(--bg1) 55%, var(--bg2))) 0%, var(--bg2) 100%);
  border-top:1px solid color-mix(in srgb, var(--line) 55%, transparent); }
#door{ position:absolute; left:50%; bottom:var(--horizon, 40%); transform:translateX(-50%);
  width:var(--door-w, 90px); height:var(--door-h, 150px); perspective:700px; }
#doorway{ position:absolute; inset:0; border:6px solid #7a5232; border-bottom:0; border-radius:50% 50% 0 0 / 28% 28% 0 0;
  background:radial-gradient(ellipse at 50% 70%, #fff4d6 0%, #f7dfa6 55%, #e9c27e 100%); }
#door-panel{ position:absolute; inset:6px 6px 0 6px; border-radius:50% 50% 0 0 / 26% 26% 0 0;
  background:
    radial-gradient(circle at 82% 58%, #3b2616 0 3px, transparent 4px),
    radial-gradient(circle at 50% 24%, #f3e2b8 0 11%, #6b4527 11% 13.5%, transparent 14%),
    repeating-linear-gradient(90deg, #9a6a40 0 22%, #8a5c36 22% 23%, #a3744a 23% 45%, #8a5c36 45% 46%);
  transform-origin:left center; transition:transform 1.4s ease-in-out; box-shadow:inset 0 0 0 2px #6b4527; }
#door.open #door-panel{ transform:rotateY(-82deg); }
/* The start screens (login, the Guides, the character, the introduction)
   stand on a round deck outside a door in the tree trunk (Paul,
   2026-11-27, designed in Design). layoutRoom() places the picture so its
   door sits where the characters walk to (DOOR_X, doorY) and is tall enough
   for them; the picture carries on below the deck (its edge, the trunk
   and the fields far below: it is up the tree). The door
   panel is the painted door itself, so the real door swings open. The
   Spaces screen keeps its plain room. The characters keep their own
   colours (the picture is made in their style). */
body:not(.in-tree) #room{ background-color:#8fbf5e; background-repeat:no-repeat; }
body:not(.in-tree) #wall, body:not(.in-tree) #floor{ display:none; }
/* Until the deck picture has fully loaded, plain sky and no door, then the
   deck fades in whole (Paul, 2026-11-27: "a weird green behind the door at
   the beginning", "the page doesnt load well"). */
body:not(.in-tree){ background:#d6ebf6; }
body:not(.in-tree) #room{ transition:opacity .5s ease; }
body:not(.in-tree) #room:not(.deck-ready){ opacity:0; }
@media (prefers-reduced-motion: reduce){ body:not(.in-tree) #room{ transition:none; } }
body.still:not(.in-tree) #room{ transition:none; }
body:not(.in-tree) #doorway{ border:0; border-radius:50% 50% 0 0 / 30% 30% 0 0; }
body:not(.in-tree) #door-panel{ inset:0; border-radius:50% 50% 0 0 / 30% 30% 0 0; box-shadow:none;
  background:var(--deck-img, url(/treehouse/deck-boards.webp)) no-repeat var(--deck-door-pos, 0 0) / var(--deck-size, auto); }
/* The painted door's hinges are on its right, so it swings from there (Paul,
   2026-11-27: "the door opens against the hinge"), and it swings into the
   tree, not out over the deck: an open door standing out on the deck was in
   the way of everyone coming and going on its side, and they walked
   straight through it (Paul, 2026-11-29: "guides walk through it rather
   than around it to enter"). Open, it stands inside against the right of
   the doorway, behind anyone in the doorway, and the doorway has the depth
   of the trunk's wall round its inside. */
body:not(.in-tree) #door-panel{ transform-origin:right center; }
body:not(.in-tree) #door.open #door-panel{ transform:rotateY(-74deg); filter:brightness(.55); }
/* Open, it is inside the trunk, in its shade, so it reads as swung in. */
body:not(.in-tree) #door-panel{ transition:transform 1.4s ease-in-out, filter 1.4s ease-in-out; }
body:not(.in-tree) #doorway{ box-shadow:inset 16px 0 16px -8px rgba(60,35,15,.7), inset -10px 0 14px -8px rgba(60,35,15,.45),
  inset 0 18px 18px -9px rgba(60,35,15,.6); }
/* Two looks, Day and Night (Paul, 2026-11-27), each with its own picture
   of the deck (set by showDeckPicture). At night a lantern hanging from
   the branch lights the scene, so the doorway glows amber from inside. */
body.deck-night:not(.in-tree){ background:#1b2444; }
body.deck-night:not(.in-tree) #room{ background-color:#33463f; }
body.deck-night:not(.in-tree) #doorway{ background:radial-gradient(ellipse at 50% 70%, #ffe7a8 0%, #f3bd62 55%, #c98a3a 100%);
  box-shadow:inset 18px 0 18px -8px rgba(40,20,5,.8), inset -12px 0 16px -8px rgba(40,20,5,.55), inset 0 20px 20px -9px rgba(40,20,5,.7); }
/* The lantern on its rope, over the night picture; it sways a very little
   from where the rope meets the branch. Still under reduced motion and
   with Less movement on. The characters' night light is their own (the
   stage's setLight), so there is no filter on them here. */
/* Inside the tree (the Spaces screen): a round wooden room, in a picture
   for Day and one for Night, placed by layoutInside() (Paul, 2026-11-27,
   designed in Design). Before the pair walk in, the open door shows the
   room, and they go through it as through every doorway (throughDoorway);
   with reduced motion or Less movement it simply changes. */
#room.inside{ background-repeat:no-repeat; background-color:#b98a55; }
#room.inside #wall, #room.inside #floor{ display:none; }
[data-palette="night"] #room.inside{ background-color:#3a2a1c; }
/* The room seen through the open door fills the doorway to its foot, so
   its floor carries on from the deck with nothing between them (Paul,
   2026-11-27: "what is the big step when entering the room?": the view
   was a little short, and the painted door showed below it). */
body:not(.in-tree) #room.has-inside #doorway{ background:#b98a55 var(--inside) center bottom / 290% auto no-repeat; }
body.deck-night:not(.in-tree) #room.has-inside #doorway{ background-color:#3a2a1c; }
/* The room's two lanterns hang apart from its picture, swaying like the
   deck's, and at night each lights the wall round it (Paul, 2026-11-27:
   "dont make it too shiny", designed in Design). */
#in-lamps{ display:none; }
#room.inside #in-lamps{ display:block; }
.in-lamp{ position:absolute; pointer-events:none; transform-origin:50% 0; animation:lantern-sway 4.5s ease-in-out infinite alternate; }
.in-lamp:last-child{ animation-delay:-2.6s; }
.in-glow{ position:absolute; pointer-events:none; border-radius:50%; display:none; mix-blend-mode:soft-light; opacity:.5;
  background:radial-gradient(closest-side, rgba(255,180,90,1), rgba(255,160,70,.55) 45%, rgba(255,160,70,0)); }
[data-palette="night"] .in-glow{ display:block; }
@media (prefers-reduced-motion: reduce){ .in-lamp{ animation:none; } }
body.still .in-lamp{ animation:none; }
#lantern{ position:absolute; pointer-events:none; transform-origin:50% 0; animation:lantern-sway 4.5s ease-in-out infinite alternate; }
#lantern[hidden], body.in-tree #lantern{ display:none; }
@keyframes lantern-sway{ from{ transform:rotate(-2.2deg); } to{ transform:rotate(2.2deg); } }
@media (prefers-reduced-motion: reduce){ #lantern{ animation:none; } }
body.still #lantern{ animation:none; }

#stage{ position:fixed; top:0; left:0; right:0; bottom:var(--strip); pointer-events:none; }
#scene{ position:absolute; inset:0; width:100%; height:100%; display:block; pointer-events:none; }
/* Owl's picture before the stage is ready, where the stage puts him: 0.72
   across, feet just above the stage's foot, sized like the stage does. */
#owl-still{ --stage-h:calc(100vh - var(--strip)); --stage-h:calc(100dvh - var(--strip)); position:fixed; left:72vw; transform:translateX(-50%);
  bottom:calc(var(--strip) + 0.05 * var(--stage-h)); height:calc(0.37 * min(100vw, var(--stage-h)));
  width:auto; pointer-events:none; }
/* On a tall phone Owl grows with the spare height, as in treehouse.js (TALL). */
@media (max-aspect-ratio: 3/4) and (max-width: 599px){ #owl-still{ height:calc(0.375 * clamp(100vw, var(--stage-h) / 1.15, 130vw)); } }
#owl-still[hidden]{ display:none; }

/* Invisible buttons over each Guide, so a child can tap the one they want. */
#pickers{ position:fixed; inset:0; pointer-events:none; }
#pickers.live{ pointer-events:auto; }
#pickers button{ position:absolute; background:transparent; border:0; cursor:pointer; }
#pickers button:focus-visible{ outline:none; }
/* The glow behind a character: faint when the mouse or keyboard is on
   them, full when picked. It sits behind the stage, so it shines around
   the character, not over them. */
#glows{ position:fixed; inset:0; pointer-events:none; }
#glows .glow{ position:absolute; border-radius:50%; opacity:0; transition:opacity .3s ease;
  background:radial-gradient(ellipse at 50% 55%, rgba(255,222,120,1) 0%, rgba(255,210,100,.7) 35%, rgba(255,210,100,.25) 55%, rgba(255,210,100,0) 70%); }
#glows .glow.near{ opacity:.45; }
#glows .glow.on{ opacity:1; }
/* Each one's name, under their feet, so it is clear they can be chosen.
   Tapping the name picks them too (Paul, 2026-11-18). */
#pickers .tag{ position:absolute; left:50%; bottom:-34px; transform:translateX(-50%); white-space:nowrap;
  padding:4px 12px; border-radius:999px; background:var(--chip); border:2px solid var(--line);
  font-weight:700; font-size:15px; color:var(--ink); cursor:pointer; }
#pickers button:hover .tag, #pickers button:focus-visible .tag{ border-color:var(--accent); }
/* The one picked (before Continue): a solid ring and a filled name tag. */
#pickers button[aria-pressed="true"] .tag{ background:var(--accent); border-color:var(--accent); color:#fff; }
@media (max-width:600px){ #pickers .tag{ font-size:14px; padding:3px 10px; } #pickers .tag.low{ bottom:-64px; } }
/* A Guide at the back on a phone: the name above the head. */
#pickers .tag.top{ bottom:auto; top:-34px; }
/* The arrows that show the other characters on a phone. */
#choices button.page{ flex:0 0 auto; width:50px; height:50px; border-radius:50%; border:2px solid var(--line); background:var(--chip); color:var(--ink);
  font-size:30px; font-weight:800; line-height:1; display:grid; place-items:center; padding:0 0 4px; }
#choices:has(.page){ flex-wrap:nowrap; align-items:center; }
#choices:has(.page) .choice{ flex:0 1 200px; }

/* The Guide's words: one calm line at a time. Tapping moves on. */
#words{ position:fixed; left:50%; top:max(76px, 12%); transform:translateX(-50%); width:max-content; max-width:min(90vw, 640px); text-align:center;
  background:#fff; color:var(--on-white); border:2px solid var(--line); border-radius:16px; padding:10px 20px; box-shadow:0 4px 14px rgba(40,30,20,.08);
  font-size:clamp(19px, 3vw, 28px); line-height:1.4; font-weight:700; opacity:0; transition:opacity .5s ease; cursor:pointer;
  text-wrap:balance; }
#words.show{ opacity:1; }
/* When its words are not showing the box is not there to be tapped: left in
   place unseen, it lay over the top of the doorway in front and took the
   taps meant for it. */
#words:not(.show){ pointer-events:none; }

button{ font:inherit; color:inherit; cursor:pointer; min-height:44px; touch-action:manipulation; }
button:focus-visible, input:focus-visible{ outline:3px solid var(--accent); outline-offset:2px; }

#always{ position:fixed; top:max(12px, env(safe-area-inset-top)); right:12px; z-index:20; display:flex; gap:8px; }
#always[hidden]{ display:none; }
#always button{ padding:8px 14px; border-radius:12px; border:2px solid var(--line); background:var(--chip); font-weight:700; }
#more-menu{ position:fixed; top:66px; right:12px; z-index:21; display:flex; flex-direction:column; gap:4px; min-width:230px;
  background:var(--chip); border:2px solid var(--line); border-radius:14px; padding:8px; }
#more-menu[hidden]{ display:none; }
#more-menu button{ text-align:left; padding:8px 14px; border:0; border-radius:10px; background:transparent; font-weight:600; }
#more-menu button:hover{ background:var(--bg1); }

/* Choices at the bottom: equal buttons, the main one a little stronger. */
/* A long tap never selects words on a phone (2026-11-17). */
body{ -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; }
input, textarea{ -webkit-user-select:text; user-select:text; }
#choices{ position:fixed; left:50%; bottom:max(20px, env(safe-area-inset-bottom)); transform:translateX(-50%); z-index:10;
  width:min(94vw, 680px); display:flex; flex-wrap:wrap; justify-content:center; gap:10px; }
.choice{ flex:1 1 150px; max-width:240px; padding:12px 16px; border-radius:14px; border:2px solid var(--line);
  background:var(--chip); font-weight:700; font-size:17px; }
.choice.primary, button.primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.choice.quiet{ font-weight:600; color:var(--soft); }
.choice:disabled{ opacity:.45; cursor:default; filter:none; }
.choice:disabled::before, .choice:disabled::after{ animation:none !important; }
.swatch{ flex:0 0 auto; width:76px; height:76px; border-radius:50%; border:3px solid var(--line); padding:0; font:inherit; font-weight:800; font-size:16px; cursor:pointer; }
.swatch[aria-pressed="true"]{ border-color:var(--accent); box-shadow:0 0 0 3px var(--accent); }
#choices input{ font:inherit; font-size:18px; padding:10px 14px; border-radius:12px; border:2px solid var(--line);
  background:var(--chip); color:var(--ink); flex:1 1 200px; max-width:280px; }

/* Cards: login and panels. */
.card-screen{ position:fixed; inset:0; z-index:30; display:flex; align-items:center; justify-content:center; padding:20px; }
.card-screen[hidden]{ display:none; }
/* Phone keyboard open: the login box at the top of the space above it. */
body.keyboard #login{ bottom:auto; align-items:flex-start; padding-top:12px; }
body.keyboard #owl-says{ visibility:hidden; }
/* The start screen: the room and one inviting button. The login box and
   Owl come after the click. */
body.starting #login, body.starting #stage, body.starting #owl-still{ visibility:hidden; }
body:not(.starting) #start{ display:none; }
/* Owl first, then the login box fades in (Paul, 2026-11-16). */
#login .card{ transition:opacity .6s ease; }
body.owl-first #login .card{ visibility:hidden; opacity:0; }
#start{ align-items:flex-end; padding-bottom:max(18vh, 90px); }
.start-btn{ padding:22px 44px; border:0; border-radius:999px; background:var(--accent); color:#fff;
  font-size:clamp(22px, 3vw, 28px); font-weight:800; box-shadow:0 8px 24px rgba(40,30,20,.18); max-width:90vw; }
/* Buttons sparkle under the mouse (Paul, 2026-11-06), only once the mouse
   has moved onto them (body.pointing): buttons that appear under a still
   mouse after a click do not flash.: a soft shine sweeps
   across once and a few tiny glints twinkle. Only where there is a mouse;
   with reduced motion they just brighten a little. The button stays put. */
.start-btn, .choice, .card button.primary, #always button{ position:relative; overflow:hidden; transition:filter .15s ease; }
.start-btn::after, .choice::after, .card button.primary::after, #always button::after{ content:''; position:absolute;
  top:0; bottom:0; left:-60%; width:45%; pointer-events:none; opacity:0;
  background:linear-gradient(105deg, transparent 0%, rgba(255,255,255,.55) 50%, transparent 100%); }
.start-btn::before, .choice::before, .card button.primary::before, #always button::before{ content:''; position:absolute;
  inset:0; pointer-events:none; opacity:0;
  background:
    radial-gradient(circle at 18% 30%, #fff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 72% 22%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 86% 70%, #fff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 40% 78%, #fff 0 1.5px, transparent 2.5px); }
@keyframes shine{ from{ left:-60%; opacity:1; } to{ left:120%; opacity:1; } }
@keyframes twinkle{ 0%, 100%{ opacity:0; } 30%, 70%{ opacity:.9; } }
@media (hover: hover){
  body.pointing .start-btn:hover, body.pointing .choice:hover, body.pointing .card button.primary:hover:not(:disabled), body.pointing #always button:hover{ filter:brightness(1.07); }
  body.pointing .start-btn:hover::after, body.pointing .choice:hover::after, body.pointing .card button.primary:hover:not(:disabled)::after, body.pointing #always button:hover::after{
    animation:shine .9s ease-out 1; }
  body.pointing .start-btn:hover::before, body.pointing .choice:hover::before, body.pointing .card button.primary:hover:not(:disabled)::before, body.pointing #always button:hover::before{
    animation:twinkle 1.2s ease-in-out 2; }
}
@media (prefers-reduced-motion: reduce){
  .start-btn::after, .choice::after, .card button.primary::after, #always button::after,
  .start-btn::before, .choice::before, .card button.primary::before, #always button::before{ animation:none !important; }
}
body.still .start-btn::after, body.still .choice::after, body.still .card button.primary::after, body.still #always button::after,
body.still .start-btn::before, body.still .choice::before, body.still .card button.primary::before, body.still #always button::before{ animation:none !important; }
.overlay{ position:fixed; inset:0; z-index:40; display:flex; align-items:center; justify-content:center; padding:20px;
  background:rgba(40,36,30,.35); }
.overlay[hidden]{ display:none; }
.card{ width:min(100%, 440px); background:var(--chip); border:2px solid var(--line); border-radius:20px; padding:24px;
  box-shadow:0 10px 30px rgba(40,30,20,.12); font-size:18px; line-height:1.5; max-height:90dvh; overflow:auto; }
.card h2{ margin:0 0 14px; font-size:24px; }
/* Windows (Paul, 2026-11-16): each kind has its own small picture and a
   coloured top edge, so a break, a question, an ending and information
   never look alike. Colours follow the chosen look. */
#ov-panel .card{ border-top-width:8px; text-align:left; }
#ov-panel .card-icon{ display:flex; width:48px; height:48px; border-radius:50%; align-items:center; justify-content:center;
  margin:0 0 10px; background:color-mix(in srgb, var(--k) 16%, var(--chip)); color:var(--k); }
#ov-panel .card-icon:empty{ display:none; }
#ov-panel .card-icon svg{ width:26px; height:26px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
#ov-panel .card{ --k:var(--accent); border-top-color:var(--k); }
#ov-panel .card.kind-break{ --k:#6f9fb5; background:color-mix(in srgb, #6f9fb5 7%, var(--chip)); }
#ov-panel .card.kind-ask{ --k:#c79a4a; }
#ov-panel .card.kind-bye{ --k:#8a86b8; text-align:center; }
#ov-panel .card.kind-bye .card-icon{ margin:0 auto 10px; }
#ov-panel .row{ align-items:center; }
#ov-panel .row button.link{ flex:0 0 auto; margin:0 auto; border:0; background:none; color:var(--soft); text-decoration:underline;
  font-weight:600; padding:6px 10px; border-radius:8px; }
/* Every button in a window answers the mouse, not only the main one. */
@media (hover: hover){
  body.pointing .card .row button:not(.primary):not(.link):hover{ background:color-mix(in srgb, var(--accent) 12%, var(--bg1)); border-color:var(--accent); }
  body.pointing .card button.link:hover{ background:color-mix(in srgb, var(--accent) 10%, transparent); color:var(--ink); }
  body.pointing .card .row button{ transition:background .15s ease, border-color .15s ease, color .15s ease; }
}
.card p{ margin:0 0 12px; }
.card ul{ margin:0 0 12px; padding-left:22px; }
.card label{ display:block; font-weight:700; margin:12px 0 6px; font-size:16px; }
.card input{ width:100%; font:inherit; font-size:18px; padding:12px 14px; border-radius:12px; border:2px solid var(--line);
  background:#fff; color:#2b2b2b; }
.pass-row{ position:relative; }
/* The password box is an ordinary box whose letters are drawn as dots, so a
   browser does not offer a saved password over it; the eye shows them. */
#f-code.dots{ color:transparent; caret-color:#2b2b2b; }
#f-dots{ position:absolute; left:16px; right:52px; top:50%; transform:translateY(-50%); overflow:hidden; white-space:nowrap; pointer-events:none;
  font-size:18px; letter-spacing:2px; color:#2b2b2b; }
.pass-row input{ padding-right:52px; }
.eye{ position:absolute; right:6px; top:50%; transform:translateY(-50%); width:40px; height:40px; min-height:0; padding:0;
  display:grid; place-items:center; border:0; border-radius:10px; background:transparent; color:var(--soft); }
.eye:hover, .eye[aria-pressed="true"]{ color:var(--accent); }
.card .row{ display:flex; flex-wrap:wrap; gap:10px; margin-top:16px; }
.card .row button{ flex:1 1 160px; padding:10px 16px; border-radius:12px; border:2px solid var(--line); background:var(--bg1); font-weight:700; }
.card .row button.primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.card button.primary{ width:100%; margin-top:16px; padding:12px; border-radius:12px; border:0; font-weight:800; font-size:18px; }
.card button.link{ margin-top:12px; background:none; border:0; color:var(--accent); font-weight:700; text-decoration:underline; padding:4px 0; }
.msg{ min-height:1.2em; color:#8a3b2a; font-size:16px; margin-top:12px !important; }
/* On an upright phone the login box cannot go beside Owl or above him, so
   it is made shorter and sits lower, and he looks over the top of it
   (Paul, 2026-11-14). The heading is kept for screen readers only: Owl
   says the same words aloud. */
#login .card.compact{ padding:12px 16px 10px; }
#login .card.compact h2{ position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
#login .card.compact label{ margin:6px 0 3px; }
#login .card.compact label:first-of-type{ margin-top:0; }
#login .card.compact input{ padding:9px 12px; }
#login .card.compact .pass-row input{ padding-right:52px; }
#login .card.compact .msg{ min-height:0; margin:6px 0 0 !important; }
#login .card.compact button.primary{ margin-top:8px; padding:10px; }
#login .card.compact button.link{ margin-top:4px; }
.toggle{ display:flex; align-items:center; gap:12px; margin:10px 0; font-weight:600; }
.toggle input{ width:26px; height:26px; }
.swatches{ display:flex; gap:10px; flex-wrap:wrap; margin:6px 0 14px; }

/* Owl's speech bubble on the login screen: a cartoon bubble, thick
   outline and a pointed tail down to him. It pops up gently. */
.bubble{ position:fixed; z-index:31; margin:0; width:max-content; max-width:min(80vw, 300px); padding:14px 24px;
  border-radius:30px; background:#fff; border:3px solid var(--on-white); color:var(--on-white); font-weight:800;
  font-size:clamp(20px, 2.6vw, 26px); line-height:1.25; text-align:center; box-shadow:4px 5px 0 rgba(40,30,20,.18);
  opacity:0; transform:scale(.6); transform-origin:var(--tail, 50%) 100%;
  transition:opacity .5s ease, transform .7s cubic-bezier(.3,1.5,.6,1); }
.bubble.show{ opacity:1; transform:none; }
.bubble[hidden]{ display:none; }
.bubble::before, .bubble::after{ content:''; position:absolute; top:100%; left:var(--tail-left, calc(var(--tail, 50%) - 14px));
  width:var(--tail-wide, 28px); height:var(--tail-drop, 29px); }
/* The tail's base always lies flat along the bubble's bottom edge, over
   its outline, and only its point leans towards the speaker, so the two
   can never come apart (Paul, 2026-11-27: "sometimes, the little arrow on
   the speech bubble isn't connected to the bubble"). Before, the whole
   tail was turned about one point and its base lifted off the bubble. The
   white inside starts on the outline, so the bubble opens into its tail. */
.bubble::before{ background:var(--on-white); clip-path:var(--tail-out, polygon(0 0, 28px 0, 14px 100%)); }
.bubble::after{ background:#fff; clip-path:var(--tail-in, polygon(4.5px 0, 23.5px 0, 14px calc(100% - 9px))); }
/* Each word appears as Owl says it. */
/* The whole sentence shows at once in light grey; each word darkens as it
   is said. */
.bubble .w{ opacity:.3; transition:opacity .25s ease; }
.bubble .w.on{ opacity:1; }

@media (prefers-reduced-motion: reduce){ body, #words, #door-panel, .bubble, .bubble .w, #glows .glow{ transition:none; } .bubble{ transform:none; } }
body.still #door-panel, body.still #words, body.still .bubble, body.still .bubble .w{ transition:none; }
body.still .bubble{ transform:none; }

/* 4.2 Choose a Space: five open spaces round the trunk, turning like a
   carousel (Paul, 2026-11-16). Each is an open wooden arch with its own
   floor and its things inside: no roof, no door. Same wood as the door. */
body.in-tree #door{ display:none; }
#tree-room[hidden]{ display:none; }
#tree{ position:fixed; left:50%; transform:translateX(-50%); perspective:1400px; touch-action:pan-y; }
/* No little tree: the room is built round the deck tree's own trunk, which
   rises through it floor to ceiling in the room's pictures, and the Spaces
   turn round its foot (Paul, 2026-11-27: "the treehouse is built around the
   trunk!", designed in Design). */
#ring{ position:absolute; left:0; right:0; bottom:0; transform-style:preserve-3d; }
.house{ position:absolute; left:50%; bottom:0; transform-origin:50% 50%; backface-visibility:hidden; -webkit-backface-visibility:hidden;
  border:0; padding:0; background:transparent; cursor:pointer; transition:filter .6s ease, opacity .4s; color:inherit; }
.house:focus{ outline:none; }
.house:focus-visible .bay{ outline:3px solid var(--accent); outline-offset:3px; }
.house.side{ filter:brightness(.88); }
.house{ will-change:opacity; }
.bay{ position:absolute; inset:0; border:7px solid #a2723f; border-bottom:0; border-radius:50% 50% 0 0 / 24% 24% 0 0; overflow:hidden;
  background:#b98a55 center bottom / cover no-repeat;
  box-shadow:inset 0 14px 22px -6px rgba(50,30,12,.55), inset 0 0 0 2px #7a5232, 0 6px 14px rgba(60,35,15,.25); }
/* Each Space is a picture of its alcove in the room's own 3D look (Paul,
   2026-11-27, designed in Design); at night it is in the lanterns' shade. */
[data-palette="night"] .bay{ filter:brightness(.6) saturate(.85); }
.house .tag{ position:absolute; left:50%; transform:translateX(-50%); top:calc(100% + 10px); white-space:nowrap;
  padding:4px 12px; border-radius:999px; background:var(--chip); border:2px solid var(--line); font-weight:700; font-size:15px; color:var(--ink); }
.house.front-now .tag{ border-color:var(--accent); }
.turn{ position:fixed; z-index:5; width:52px; height:52px; border-radius:50%; border:2px solid var(--line); background:var(--chip); color:var(--ink);
  font-size:24px; font-weight:800; line-height:1; display:grid; place-items:center; padding:0; }
@media (max-width:600px){ .house .tag{ font-size:14px; padding:3px 10px; } }
/* The "?" for how to choose: top left, across from Quiet, More and Stop. */
#tree-help{ top:max(12px, env(safe-area-inset-top)); left:12px; width:46px; height:46px; font-size:24px;
  border-color:var(--accent); color:var(--accent); }
#tree-help[aria-expanded="true"]{ background:var(--accent); color:#fff; }

/* Into a Space: the tree zooms so the Space in front fills the screen
   (Paul, 2026-11-17); the rest of the room fades away. */
#tree{ transition:transform .9s ease-in-out; }
#tree-room .turn, .house .tag{ transition:opacity .4s; }
#tree-room.zoomed .turn, #tree-room.zoomed .house .tag{ opacity:0; pointer-events:none; }
#tree-room.zoomed .house:not(.front-now){ opacity:0; }
#tree-room.zoomed #ring{ pointer-events:none; }
@media (prefers-reduced-motion: reduce){ #ring, .house, #tree, #tree-room .turn, .house .tag{ transition:none; } }
body.still #ring, body.still .house, body.still #tree, body.still #tree-room .turn, body.still .house .tag{ transition:none; }

/* The Learning Space (Paul, 2026-11-17): a 3D room in three corners, in
   through Learning's arch. It fills the stage; the characters (on the
   stage's canvas) stand in it. */
#learning-room{ position:fixed; top:0; left:0; right:0; bottom:var(--strip); background:#e7d8c2; opacity:0; transition:opacity .45s ease;
  box-shadow:0 0 0 100vh #a3744a; }   /* the strip below is the threshold's boards */
#learning-room[hidden]{ display:none; }
#learning-room.on{ opacity:1; }
#learning-room .lr-svg{ display:block; width:100%; height:100%; }
#learning-room [data-corner], #learning-room [data-act]{ cursor:pointer; }
.lr-glow{ animation:lr-twinkle 3.2s ease-in-out infinite alternate; }
@keyframes lr-twinkle{ from{ opacity:.75; } to{ opacity:1; } }
.lr-tag{ position:absolute; transform:translate(-50%, -100%); white-space:nowrap; padding:6px 14px; border-radius:999px; background:var(--chip);
  border:2px solid var(--accent); font:inherit; font-weight:700; font-size:15px; color:var(--ink); cursor:pointer; transition:opacity .5s; }
.lr-tag.off{ opacity:0; pointer-events:none; }
@media (max-width:600px){ .lr-tag{ font-size:13px; padding:4px 10px; } }
@media (prefers-reduced-motion: reduce){ #learning-room, .lr-tag{ transition:none; } .lr-glow{ animation:none; } }
body.still #learning-room, body.still .lr-tag{ transition:none; }
/* The painted room (learning-room-b.js; the drawn room is at /treehouse/?room=old):
   one painting, slid and zoomed for each place. The places are buttons with
   their names spoken, nothing drawn on them; an outline only from the keyboard. */
#learning-room.painted{ overflow:hidden; }
.lb-pic{ position:absolute; left:0; top:0; width:2016px; height:864px; max-width:none; transform-origin:0 0; will-change:transform; user-select:none; pointer-events:none; }
.lb-place{ position:absolute; padding:0; margin:0; border:0; background:transparent; cursor:pointer; border-radius:18px; -webkit-tap-highlight-color:transparent; }
.lb-place:focus-visible{ outline:3px dashed var(--accent); outline-offset:-3px; }
body.still .lr-glow{ animation:none; }

/* Saying an answer: a soft dot while listening (no timer). */
.rec-on { display: flex; align-items: center; gap: 10px; }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: #C0533F; flex: none; animation: rec-pulse 1.6s ease-in-out infinite; }
@keyframes rec-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
body.still .rec-dot { animation: none; }

/* Questions in the Spaces (2026-11-18): the ways to answer, in a window. */
#ov-panel .q-how{ margin:0 0 10px; color:var(--soft); font-size:16px; }
#ov-panel .q-opts{ display:flex; flex-wrap:wrap; gap:8px; }
#ov-panel .q-opt{ border:2px solid var(--line); background:var(--chip); color:inherit; border-radius:12px; padding:10px 14px;
  font:inherit; font-size:17px; cursor:pointer; min-height:44px; }
#ov-panel .q-opt.small{ padding:6px 10px; font-size:15px; min-height:38px; }
#ov-panel .q-opt[aria-pressed="true"]{ border-color:var(--k); background:color-mix(in srgb, var(--k) 22%, var(--chip)); font-weight:700; }
#ov-panel .q-rate{ display:flex; flex-direction:column; gap:10px; }
#ov-panel .q-row{ display:flex; flex-direction:column; gap:4px; }
#ov-panel .q-row > span{ font-weight:600; font-size:16px; }
#ov-panel .q-slider input{ width:100%; accent-color:var(--k); height:36px; }
#ov-panel .q-ends{ display:flex; justify-content:space-between; font-size:15px; color:var(--soft); }
#ov-panel .q-starter{ margin:0 0 6px; font-weight:600; }
#ov-panel .q-text{ width:100%; min-height:96px; box-sizing:border-box; border:2px solid var(--line); border-radius:12px; padding:10px;
  font:inherit; font-size:17px; background:#fff; color:#2b2622; resize:vertical; }
#ov-panel .card button:disabled{ opacity:.45; cursor:default; }
/* A window never covers Quiet, More and Stop at the top (Stop is always
   visible), and a question's title is a little smaller. */
#ov-panel{ padding-top:72px; }
#ov-panel .card{ max-height:calc(100dvh - 92px); }
#ov-panel .card:has(.q-area) h2{ font-size:20px; line-height:1.35; }
/* Stop, Quiet and More stay tappable above any open window. */
#always{ z-index:45; }
#more-menu{ z-index:46; }
/* Space names on the tree (Paul, 2026-11-18): flat on the screen, following
   each Space as the tree turns, so every name is always showing. */
.house .tag{ display:none; }
#space-tags .stag{ position:fixed; z-index:6; transform:translateX(-50%); white-space:nowrap; padding:4px 12px; border-radius:999px;
  background:var(--chip); border:2px solid var(--line); font:inherit; font-weight:700; font-size:15px; color:var(--ink); cursor:pointer; }
#space-tags .stag.front{ border-color:var(--accent); }
#space-tags .stag.back{ opacity:.85; }
@media (max-width:600px){ #space-tags .stag{ font-size:14px; padding:3px 10px; } }
#space-tags .stag{ transition:opacity .4s, visibility 0s; }
/* Only the name of the Space in front shows (Paul, 2026-11-27). */
#space-tags .stag:not(.front){ opacity:0; visibility:hidden; pointer-events:none; transition:opacity .4s, visibility 0s .4s; }
#tree-room.zoomed #space-tags .stag{ opacity:0; pointer-events:none; }
@media (prefers-reduced-motion: reduce){ #space-tags .stag{ transition:none; } }
body.still #space-tags .stag{ transition:none; }


/* Room-matched answers (Paul, 2026-11-18): the same choices, looking like
   the things in the corner. Each is still a plain button. */
/* Nook: books standing on a shelf; a chosen book is pulled out (lifted). */
#ov-panel .q-books{ gap:6px 4px; align-items:flex-end; padding:0 4px 10px; border-bottom:10px solid #9a6a40; border-radius:0 0 4px 4px; }
#ov-panel .q-book{ border-radius:5px 5px 2px 2px; border:2px solid rgba(0,0,0,.15); color:#2b2622; min-height:64px; max-width:150px;
  padding:10px 10px 8px; font-size:15px; line-height:1.25; box-shadow:inset 6px 0 0 rgba(0,0,0,.08); transition:transform .2s ease; }
#ov-panel .q-book:nth-child(5n+1){ background:#e9c8b4; } #ov-panel .q-book:nth-child(5n+2){ background:#b9d0c0; }
#ov-panel .q-book:nth-child(5n+3){ background:#f3dfaa; } #ov-panel .q-book:nth-child(5n+4){ background:#c9d6e6; }
#ov-panel .q-book:nth-child(5n){ background:#e2c9e0; }
#ov-panel .q-book[aria-pressed="true"]{ transform:translateY(-10px); border-color:var(--k); box-shadow:0 6px 0 -2px var(--k), inset 6px 0 0 rgba(0,0,0,.08); }
/* Den: smooth stones; chosen ones go in the bag. */
#ov-panel .q-stone{ border-radius:48% 52% 45% 55% / 55% 50% 50% 45%; background:radial-gradient(circle at 35% 30%, #eceae4, #c9c4b8 70%);
  border:2px solid #b2ab9c; color:#3a352e; }
#ov-panel .q-stone[aria-pressed="true"]{ background:radial-gradient(circle at 35% 30%, #f5ead2, #d9c08e 70%); border-color:var(--k); }
#ov-panel .q-bag{ margin:12px auto 0; width:92px; height:70px; border-radius:18px 18px 34px 34px; background:#c9a676; border:3px solid #a8814f;
  position:relative; display:flex; align-items:flex-end; justify-content:center; }
#ov-panel .q-bag::before{ content:''; position:absolute; top:-10px; left:22px; right:22px; height:12px; border:3px solid #a8814f; border-bottom:0; border-radius:12px 12px 0 0; }
#ov-panel .q-bag-in{ display:flex; flex-wrap:wrap-reverse; justify-content:center; gap:2px; padding:6px; }
#ov-panel .q-bag-in i{ width:14px; height:11px; border-radius:50%; background:#e6e1d6; border:1px solid #9d968a; }
/* Table: each rating a jar, fuller to the right; writing on paper. */
#ov-panel .q-jarbtn{ display:inline-flex; align-items:center; gap:6px; }
#ov-panel .q-jar{ width:18px; height:26px; border:2px solid #7a8f95; border-top-width:4px; border-radius:3px 3px 5px 5px; position:relative; overflow:hidden; background:#eef6f7; }
#ov-panel .q-jar i{ position:absolute; left:0; right:0; bottom:0; background:#f2c94c; }
#ov-panel .q-paper{ background:repeating-linear-gradient(#fffdf8 0 27px, #d9e3ec 27px 28px); line-height:28px; }
/* Swipe: one card at a time. */
#ov-panel .q-swipe{ display:flex; flex-direction:column; gap:10px; }
#ov-panel .q-card{ min-height:96px; display:flex; align-items:center; justify-content:center; text-align:center; padding:16px; border-radius:16px;
  background:#fff; border:2px solid var(--line); font-size:20px; font-weight:700; touch-action:none; user-select:none; position:relative; }
#ov-panel .q-card[data-got]:not([data-got=""])::after{ content:attr(data-got); position:absolute; right:10px; bottom:6px; font-size:13px; font-weight:600; color:var(--soft); }
#ov-panel .q-ways{ justify-content:center; }
#ov-panel .q-cardnav{ display:flex; justify-content:space-between; }
#ov-panel .q-cardnav .link, #ov-panel .q-how.small{ font-size:15px; }
#ov-panel .q-cardnav .link{ border:0; background:none; color:var(--soft); text-decoration:underline; font:inherit; font-size:15px; padding:4px; cursor:pointer; }
/* Sorting: tap a thing, then where it goes. */
#ov-panel .q-sort{ display:flex; flex-direction:column; gap:10px; }
#ov-panel .q-targets{ display:grid; grid-template-columns:repeat(auto-fit, minmax(130px, 1fr)); gap:8px; }
#ov-panel .q-target{ min-height:84px; border:2px dashed var(--line); border-radius:14px; background:color-mix(in srgb, var(--k) 6%, var(--chip));
  font:inherit; color:inherit; padding:8px; display:flex; flex-direction:column; gap:6px; align-items:flex-start; text-align:left; cursor:pointer; }
#ov-panel .q-bagt{ border-style:solid; border-color:#a8814f; background:#efe0c4; border-radius:14px 14px 26px 26px; }
#ov-panel .q-in{ display:flex; flex-wrap:wrap; gap:4px; }
#ov-panel .q-chip{ padding:3px 8px; border-radius:999px; background:var(--chip); border:1px solid var(--line); font-size:14px; cursor:pointer; }
#ov-panel .q-chip::after{ content:' \00d7'; color:var(--soft); }
@media (prefers-reduced-motion: reduce){ #ov-panel .q-book{ transition:none; } }
body.still #ov-panel .q-book{ transition:none; }
@media (max-width:600px){ #ov-panel .q-book{ flex:1 1 calc(50% - 4px); max-width:none; min-height:56px; } }

/* The branch walkway to a Space (Paul, 2026-11-29, designed in Design with
   the map): it fades in over the room; the little house's door opens onto
   the Space, and the view goes in through it. The buttons for the tree
   are put away while it shows; Quiet, More and Stop stay. */
#walkway{ position:fixed; inset:0; background-repeat:no-repeat; background-color:#9cc7e6; opacity:0; transition:opacity .5s ease, transform 1.5s cubic-bezier(.5,0,.6,1); }
#walkway.on{ opacity:1; }
#walkway-door{ position:absolute; border-radius:999px 999px 0 0; opacity:0;
  background:radial-gradient(ellipse at 50% 72%, #fff1cf 0%, #f3d595 45%, #d9a55f 78%, #a8743f 100%);
  box-shadow:inset 0 0 0 3px rgba(50,30,14,.55), inset 0 6px 10px rgba(50,30,14,.35); transition:opacity .7s ease; }
#walkway-door.open{ opacity:1; }
body[data-palette="night"] #walkway{ background-color:#1d2236; }
body[data-palette="night"] #walkway-door{ filter:brightness(.7); }
body.on-walkway #tree-room .turn, body.on-walkway #space-tags, body.on-walkway #choices{ visibility:hidden; }
@media (prefers-reduced-motion: reduce){ #walkway, #walkway-door{ transition:none; } }
body.still #walkway, body.still #walkway-door{ transition:none; }

/* The doorways a step up in the hollow room's wall, with wooden steps
   up to each (Paul, 2026-11-29: "Doorways a step up"). */
.house.raised::after{ content:''; position:absolute; left:-6%; right:-6%; top:100%; height:calc(var(--step, 0px) + var(--bmax, 0px));
  /* Three wooden steps in the deck's own boards and edge planks (one step
     is door-steps.webp, made by tools/door_view.mjs), the sides in shadow
     (Paul, 2026-11-30, of the doorway and its flat striped steps: "this
     is not what it would look like if they were looking out from the
     inside"). */
  background:
    linear-gradient(90deg, rgba(40,24,10,.35), rgba(40,24,10,0) 14%, rgba(40,24,10,0) 86%, rgba(40,24,10,.35)),
    url(/treehouse/door-steps.webp) 0 0 / 100% calc(var(--step, 0px) / 3) repeat-y,
    #8e6743;
  clip-path:polygon(12% 0, 88% 0, 100% calc(100% - var(--bmax, 0px) + var(--b4, 0px)), 75% calc(100% - var(--bmax, 0px) + var(--b3, 0px)),
    50% calc(100% - var(--bmax, 0px) + var(--b2, 0px)), 25% calc(100% - var(--bmax, 0px) + var(--b1, 0px)), 0 calc(100% - var(--bmax, 0px) + var(--b0, 0px)));
  filter:drop-shadow(0 2px 2px rgba(30,18,8,.35)); }
body[data-palette="night"] .house.raised::after{ filter:brightness(.55) saturate(.8); }

/* The door back outside shows the night deck at night. */
body[data-palette="night"] .house[data-i="5"] .bay{ background-image:url(/treehouse/door-outside-night.webp) !important; filter:none !important; }
/* The picker for changing the Guide or the character where the child is. */
#ov-panel .pick-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(96px, 1fr)); gap:8px; }
#ov-panel .pick-one{ display:flex; flex-direction:column; align-items:center; gap:4px; padding:8px 6px; }
#ov-panel .pick-one img{ height:84px; width:auto; max-width:100%; object-fit:contain; }

/* Microphone on or off: a sign at the top, above every window, for as long
   as the microphone is live, and for a moment after it closes. */
#mic-sign{ position:fixed; top:max(12px, env(safe-area-inset-top)); left:50%; transform:translateX(-50%); z-index:60;
  display:flex; align-items:center; gap:10px; padding:10px 18px; border-radius:999px; font-weight:700; font-size:17px;
  background:#FFF6F3; color:#7A2E1F; border:2px solid #C0533F; box-shadow:0 4px 14px rgba(0,0,0,.18); pointer-events:none; white-space:nowrap; }
#mic-sign[hidden]{ display:none; }
#mic-sign svg{ width:24px; height:24px; flex:none; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
#mic-sign.on{ animation:mic-pulse 1.8s ease-in-out infinite; }
#mic-sign.off{ background:#F3F1EC; color:#4A463F; border-color:#B9B3A6; }
@keyframes mic-pulse{ 0%,100%{ box-shadow:0 4px 14px rgba(0,0,0,.18), 0 0 0 0 rgba(192,83,63,.45); } 50%{ box-shadow:0 4px 14px rgba(0,0,0,.18), 0 0 0 9px rgba(192,83,63,0); } }
@media (prefers-reduced-motion: reduce){ #mic-sign.on{ animation:none; } }
body.still #mic-sign.on{ animation:none; }
