/* Scenes: designed full-screen templates (an illustrated world, a character, music) with parts the teacher edits in place.
   Colours come from one palette per season; the drawing in js/scenes/*.js only names its parts.
   Only transform and opacity animate (cheap on school laptops); no filters, no animated shadows. */

/* ---------- palettes ---------- */
.scene { --dawn: 0;
  --s1: #22305C; --s2: #4F4A8A; --s3: #A9719F; --s4: #EE9C7D; --s5: #FFD6A3;
  --d1: #78AEDB; --d2: #BCD8EE; --d3: #FFE5C2; --sun: #FFC97A; --sun2: #FF9F5A;
  --fa1: #7B6AA6; --fa2: #A487B4; --bl1: #56739C; --bl2: #6C88AA; --mi1: #406B7E; --mi2: #2F5868; --ne1: #2C5258; --ne2: #1C373D;
  --pine: #284A55; --wall: #E9D3B0; --roof: #9C4A3A; --cloud: #FFE3D6; --mote: #FFE6B0;
  --b1: #6E4A33; --b2: #563725; --b3: #3B2418; --o1: #B98A63; --o2: #7C573C; --belly: #F4E4CB; --scallop: #D6B993;
  --k0: #E8743B; --k1: #F2A541; --k2: #C8553D; --k3: #F6C453; --k4: #A84F2E;
  --scarf: #C8553D; --stripe: #F6C453; --book: #3F7FC4; --mug: #F4F1E8; --accent: #FFC86B; --ink: #2B2140;
  --title: #FFF8EC; --card: rgba(255,250,242,.95); --card-ink: #2B2140; --chip: rgba(255,255,255,.16); --chip-line: rgba(255,255,255,.34);
}
.sc-morning[data-variant="winter"] {
  --s1: #1A2A52; --s2: #3B4D8A; --s3: #8A8CC2; --s4: #E5B5C4; --s5: #FCE4D8;
  --d1: #9CC6E6; --d2: #D6E8F4; --d3: #FFF1E6; --sun: #FFD9A8; --sun2: #FFB37E;
  --fa1: #8E9DCB; --fa2: #B8C3E2; --bl1: #7C92BE; --bl2: #95A9CE; --mi1: #DCE6F3; --mi2: #BCCBE2; --ne1: #F2F6FB; --ne2: #CFDCEC;
  --pine: #3D5A78; --wall: #C9A67C; --roof: #7A3B32; --cloud: #F4E8F0; --mote: #FFFFFF;
  --b1: #5E4637; --b2: #4A3529; --b3: #33231A; --o1: #C7C3D6; --o2: #8F89A6; --belly: #F7F3EE; --scallop: #D5CEDC;
  --scarf: #3F7FC4; --stripe: #FFFFFF; --book: #C8553D; --accent: #FFD9A8;
}
.sc-morning[data-variant="spring"] {
  --s1: #2E3A6E; --s2: #6A64A8; --s3: #D08DB8; --s4: #F6B5A2; --s5: #FFE3B8;
  --d1: #8FC7EA; --d2: #CFE8F5; --d3: #FFF0D6; --sun: #FFD48A; --sun2: #FFAE6B;
  --fa1: #8A86C0; --fa2: #B39FD0; --bl1: #6E8DB8; --bl2: #87A6C6; --mi1: #5E9A84; --mi2: #4A846F; --ne1: #3E7A5E; --ne2: #2B5C45;
  --pine: #2F6150; --wall: #F2E2C4; --roof: #C0584B; --cloud: #FFE6EE; --mote: #FFF3C4;
  --b1: #6E4A33; --b2: #563725; --b3: #3B2418; --o1: #C49A6C; --o2: #8A6342;
  --k0: #F4A3C1; --k1: #FBCFE0; --k2: #E57BA2; --k3: #FFFFFF; --k4: #F7B8CF;
  --book: #2E9E62; --accent: #FFD48A;
}
.sc-morning[data-variant="summer"] {
  --s1: #1E3F73; --s2: #3E77B4; --s3: #8BB6DA; --s4: #F4C69A; --s5: #FFE7B5;
  --d1: #6FB4E6; --d2: #B8DDF4; --d3: #FFF3D6; --sun: #FFD27A; --sun2: #FFAA4D;
  --fa1: #6C8FBF; --fa2: #91AFD3; --bl1: #5B87A6; --bl2: #6F9AB5; --mi1: #4F9068; --mi2: #3C7A55; --ne1: #2F6B45; --ne2: #214F33;
  --pine: #24533A; --wall: #F2E4C8; --roof: #B5543F; --cloud: #FFFFFF; --mote: #FFF6C4;
  --o1: #B98A63; --o2: #7C573C;
  --k0: #5E9E4A; --k1: #7FBF5A; --k2: #3F7F3A; --k3: #A6D46B; --k4: #2F6B2F;
  --book: #E8743B; --accent: #FFD27A;
}

/* ---------- the scene view: the template is the whole page, and its bar floats over it ---------- */
body[data-view="scene"] { overflow: hidden; }
body[data-view="scene"] :is(.top, .cb-dock, .cb-main, .sky, .cb-bg) { display: none; }
body.presenting .sc-bar { display: none; }
.scene-view { position: fixed; inset: 0; z-index: 20; background: #0F1A1D; }
.sc-stage { position: absolute; inset: 0; }
.scene { position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--s1); color: var(--title); container-type: size; isolation: isolate; }
.scene > svg, .sc-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene .m-tree { left: auto; width: auto; aspect-ratio: 760 / 1000; height: 100%; right: 0; }

/* sky and light */
.m-land .s1 { stop-color: var(--s1); } .m-land .s2 { stop-color: var(--s2); } .m-land .s3 { stop-color: var(--s3); } .m-land .s4 { stop-color: var(--s4); } .m-land .s5 { stop-color: var(--s5); }
.m-land .d1 { stop-color: var(--d1); } .m-land .d2 { stop-color: var(--d2); } .m-land .d3 { stop-color: var(--d3); }
.m-land .g0 { stop-color: var(--sun); stop-opacity: .78; } .m-land .g1 { stop-color: var(--sun); stop-opacity: .3; } .m-land .g2 { stop-color: var(--sun); stop-opacity: 0; }
.m-land .sun1 { stop-color: var(--sun); } .m-land .sun2 { stop-color: var(--sun2); }
.m-land .fa1 { stop-color: var(--fa1); } .m-land .fa2 { stop-color: var(--fa2); } .m-land .bl1 { stop-color: var(--bl1); } .m-land .bl2 { stop-color: var(--bl2); }
.m-land .mi1 { stop-color: var(--mi1); } .m-land .mi2 { stop-color: var(--mi2); } .m-land .ne1 { stop-color: var(--ne1); } .m-land .ne2 { stop-color: var(--ne2); }
.m-day { opacity: calc(var(--dawn) * .9); transition: opacity 1.2s linear; }
.m-stars { fill: #FFF6DE; opacity: calc(1 - var(--dawn) * 1.6); transition: opacity 1.2s linear; }
.m-stars .tw { animation: twinkle 3.4s ease-in-out infinite; animation-delay: var(--d); }
@keyframes twinkle { 50% { opacity: .25; } }
.m-moon { fill: #FFF3D2; opacity: calc(.9 - var(--dawn) * 1.2); transition: opacity 1.2s linear; }
.m-sun { transform: translate(820px, calc(610px - var(--dawn) * 270px)); transition: transform 1.2s linear; }
.m-sun-ring { fill: none; stroke: var(--sun); stroke-opacity: .35; stroke-width: 2; animation: sunpulse 7s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes sunpulse { 50% { transform: scale(1.12); stroke-opacity: .12; } }
.m-cloud { fill: var(--cloud); }
.m-cloud-in { opacity: .55; animation: drift 120s linear infinite; }
.c2 .m-cloud-in { animation-duration: 160s; animation-delay: -60s; opacity: .45; }
.c3 .m-cloud-in { animation-duration: 95s; animation-delay: -20s; opacity: .4; }
.c4 .m-cloud-in { animation-duration: 140s; animation-delay: -90s; opacity: .5; }
@keyframes drift { 0% { transform: translateX(-300px); } 50% { transform: translateX(300px); } 100% { transform: translateX(-300px); } }
.m-birds { fill: none; stroke: #3A3150; stroke-width: 2.4; stroke-linecap: round; opacity: .55; animation: birds 48s linear infinite; }
@keyframes birds { 0% { transform: translate(-120px, 230px); } 100% { transform: translate(1720px, 120px); } }
.m-snowpeak { fill: #FFFFFF; opacity: .85; }
.m-mist { animation: mist 80s linear infinite; }
.m-mist2 { animation-duration: 110s; animation-direction: reverse; opacity: .7; }
@keyframes mist { to { transform: translateX(1600px); } }
.m-pine { fill: var(--pine); }
.m-snowcap { fill: #FFFFFF; }
.m-wall { fill: var(--wall); } .m-roof { fill: var(--roof); }
.m-glow { animation: flicker 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes flicker { 50% { opacity: .7; transform: scale(.92); } }
.m-smoke circle { fill: #FFFFFF; opacity: 0; animation: smoke 6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.m-smoke circle:nth-child(2) { animation-delay: -2s; } .m-smoke circle:nth-child(3) { animation-delay: -4s; }
@keyframes smoke { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 15% { opacity: .55; } 100% { transform: translate(26px, -70px) scale(2.6); opacity: 0; } }
.m-grass { fill: none; stroke: var(--ne1); stroke-width: 3; stroke-linecap: round; opacity: .8; }
.m-motes circle { fill: var(--mote); }
.m-motes g { opacity: 0; animation: mote var(--t) ease-in-out infinite; animation-delay: var(--d); }
@keyframes mote { 0% { transform: translateY(30px); opacity: 0; } 30% { opacity: .8; } 100% { transform: translateY(-90px); opacity: 0; } }

/* the air */
.m-fall { animation: fall var(--t) linear var(--d) infinite, snowdrift var(--s) ease-in-out infinite alternate; }   /* a sheet: one band down and a little sideways, then it starts over without a seam */
@keyframes fall { from { transform: translate(0, 0); } to { transform: translate(var(--dx), 980px); } }
@keyframes snowdrift { from { translate: -22px 0; } to { translate: 22px 0; } }
.m-leaf { stroke-width: 1.2; } .m-leaf.l0 { fill: var(--k0); stroke: var(--k4); } .m-leaf.l1 { fill: var(--k1); stroke: var(--k0); } .m-leaf.l2 { fill: var(--k2); stroke: var(--k4); } .m-leaf.l3 { fill: var(--k3); stroke: var(--k1); }
.m-flake { fill: #FFFFFF; opacity: .85; }
.m-petal { opacity: .9; } .m-petal.p0 { fill: #F7A8C4; } .m-petal.p1 { fill: #FFFFFF; } .m-petal.p2 { fill: #F48FB1; }
.m-fly { animation: wander var(--t) ease-in-out infinite alternate, blinkfly var(--b) ease-in-out infinite; animation-delay: var(--d); }
.m-fly-glow { fill: #FFF4A8; opacity: .35; } .m-fly-dot { fill: #FFFBD6; }
@keyframes wander { from { translate: -30px 10px; } to { translate: 40px -50px; } }
@keyframes blinkfly { 50% { opacity: .1; } }

/* the tree */
.t-leaf.k0 { fill: var(--k0); } .t-leaf.k1 { fill: var(--k1); } .t-leaf.k2 { fill: var(--k2); } .t-leaf.k3 { fill: var(--k3); } .t-leaf.k4 { fill: var(--k4); }
.t-crown-back, .t-crown-front { animation: rustle 9s ease-in-out infinite alternate; transform-origin: 700px 160px; }
.t-crown-front { animation-duration: 7s; }
@keyframes rustle { from { transform: rotate(-.8deg); } to { transform: rotate(.9deg); } }
.t-bark { fill: none; stroke: var(--b3); stroke-width: 3; stroke-linecap: round; opacity: .45; }
.t-knot { fill: var(--b3); opacity: .6; }
.m-tree .b1 { stop-color: var(--b1); } .m-tree .o1 { stop-color: var(--o1); } .m-tree .o2 { stop-color: var(--o2); } .m-tree .b2 { stop-color: var(--b2); } .m-tree .b3 { stop-color: var(--b3); }
.t-twig { fill: none; stroke: var(--b2); stroke-width: 7; stroke-linecap: round; }
.t-tip { animation: rustle 6s ease-in-out infinite alternate; transform-origin: 380px 440px; }
.t-leaf.hang { animation: hang 4s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: top; }
@keyframes hang { to { rotate: 14deg; } }
.t-snow { fill: #FFFFFF; }
.t-bloom circle { fill: #FBCFE0; } .t-bloom .t-bloom-c { fill: #F6C453; }
.t-mug-body { fill: var(--mug); stroke: #CFC6B4; stroke-width: 2; } .t-mug-band { fill: var(--scarf); } .t-mug-handle { fill: none; stroke: var(--mug); stroke-width: 6; stroke-linecap: round; }
.t-steam path { fill: none; stroke: #FFFFFF; stroke-width: 4; stroke-linecap: round; opacity: 0; animation: steam 4.2s ease-out infinite; }
.t-steam path:nth-child(2) { animation-delay: -2.1s; }
@keyframes steam { 0% { opacity: 0; transform: translateY(6px); } 30% { opacity: .7; } 100% { opacity: 0; transform: translateY(-22px); } }

/* the owl */
.owl { --lift: 0; }
.o-tail { fill: var(--o2); }
.o-breathe { animation: breathe 4.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes breathe { 50% { transform: scale(1.012, 1.022); } }
.o-shade { fill: rgba(40,20,10,.16); }
.o-belly { fill: var(--belly); }
.o-scallop { fill: none; stroke: var(--scallop); stroke-width: 3; stroke-linecap: round; }
.o-head { animation: tilt 12s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 85%; }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 40%, 55% { transform: rotate(-4deg); } 65%, 100% { transform: rotate(0); } }
.o-tuft { fill: var(--o2); }
.o-tuft-l { animation: twitch 14s ease-in-out infinite; transform-box: fill-box; transform-origin: 80% 100%; }
@keyframes twitch { 0%, 88%, 100% { transform: rotate(0); } 91% { transform: rotate(-9deg); } 94% { transform: rotate(3deg); } }
.o-brow { fill: none; stroke: var(--o2); stroke-width: 6; stroke-linecap: round; opacity: .5; }
.o-look { animation: read 3.4s ease-in-out infinite; }
@keyframes read { 0% { transform: translate(-6px, 1px); } 72% { transform: translate(6px, 1px); } 80% { transform: translate(6px, 3px); } 92%, 100% { transform: translate(-6px, 3px); } }
.o-lid { fill: var(--o1); transform: scaleY(0); transform-box: fill-box; transform-origin: 50% 0; animation: blink 6.5s infinite; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(0); } 95.5% { transform: scaleY(1); } }
.o-happy { fill: none; stroke: #2A1C14; stroke-width: 6; stroke-linecap: round; opacity: 0; }
.o-glasses { fill: rgba(255,255,255,.07); stroke: #3B2A20; stroke-width: 5; stroke-linecap: round; }
.o-glasses path { fill: none; }
.o-beak { fill: #F2A541; } .o-beak-low { fill: #C9781F; }
.o-hat path:first-child { fill: #3F7FC4; } .o-hat-band { fill: #FFFFFF; } .o-pom { fill: #FFFFFF; }
.o-flower circle { fill: #FBCFE0; } .o-flower .o-flower-c { fill: #F6C453; }
.o-scarf path { fill: var(--scarf); } .o-scarf .o-scarf-stripe { fill: none; stroke: var(--stripe); stroke-width: 4; stroke-linecap: round; opacity: .85; }
.o-book { transition: transform .8s cubic-bezier(.3,1.3,.5,1), opacity .5s; transform-box: fill-box; transform-origin: 50% 100%; }
.o-cover { fill: var(--book); }
.o-page { fill: #FFFBF0; stroke: #E6DCC8; stroke-width: 1.5; }
.o-lines { fill: none; stroke: #CFC3AE; stroke-width: 2.4; stroke-linecap: round; }
.o-spine { stroke: #D9CCB4; stroke-width: 2; }
.o-turn { transform-box: fill-box; transform-origin: 0 50%; opacity: 0; animation: turn 17s ease-in-out infinite; }
@keyframes turn { 0%, 86% { transform: scaleX(1); opacity: 0; } 87% { opacity: 1; } 94% { transform: scaleX(-1); opacity: 1; } 95%, 100% { transform: scaleX(-1); opacity: 0; } }
.o-wing { fill: var(--o2); }
.o-feet path { fill: none; stroke: #E59A35; stroke-width: 6; stroke-linecap: round; }
/* time is up: the book goes down, the eyes smile, a little hop */
.scene.is-done .o-book { transform: translateY(26px) scale(.9); opacity: 0; }
.scene.is-done .o-look, .scene.is-done .o-lid { opacity: 0; animation: none; }
.scene.is-done .o-happy { opacity: 1; }
.scene.is-done .owl { animation: hop .9s cubic-bezier(.3,1.6,.5,1) 2; }
@keyframes hop { 50% { translate: 0 -18px; } }
.scene[data-figure="off"] .owl { display: none; }

/* ---------- the parts the teacher edits ---------- */
.sc-content { position: absolute; z-index: 3; left: clamp(20px, 4.5cqw, 80px); top: clamp(18px, 5cqh, 70px); bottom: clamp(18px, 5cqh, 64px); width: min(47cqw, calc(100cqw - 84cqh)); min-width: min(440px, 88cqw); display: flex; flex-direction: column; gap: clamp(8px, 1.8cqh, 22px); }
.sc-clock { display: inline-flex; align-items: baseline; gap: 10px; align-self: flex-start; padding: 8px 16px; border-radius: 999px; background: var(--chip); border: 1.5px solid var(--chip-line); color: var(--title); font-weight: 800; font-size: clamp(13px, 1.9cqh, 20px); }
.sc-clock b { font-size: 1.25em; font-weight: 900; font-variant-numeric: tabular-nums; }
.scene[data-clock="off"] .sc-clock { visibility: hidden; }
.sc-title { margin: 0; font-family: var(--serif); font-style: italic; font-weight: 700; font-size: clamp(46px, min(9.4cqw, 15cqh), 168px); line-height: .98; letter-spacing: -.01em; color: var(--title); text-shadow: 0 6px 30px rgba(30,16,50,.35); }
.sc-sub { display: inline-flex; align-items: center; gap: 12px; align-self: flex-start; margin: 0; padding: 9px 20px 9px 14px; border-radius: 999px; background: var(--chip); border: 1.5px solid var(--chip-line); font-weight: 900; font-size: clamp(14px, 2.3cqh, 26px); letter-spacing: .14em; text-transform: uppercase; color: var(--title); }
.sc-sub svg { width: 1.5em; height: 1.5em; flex: none; }
.sc-card { margin-top: auto; padding: clamp(16px, 3cqh, 34px) clamp(18px, 2.6cqw, 40px); border-radius: clamp(20px, 3cqh, 34px); background: var(--card); color: var(--card-ink); box-shadow: 0 30px 60px -30px rgba(20,10,40,.6); }
.sc-card-h { margin: 0 0 clamp(6px, 1.4cqh, 16px); font-family: var(--serif); font-style: italic; font-weight: 700; font-size: clamp(20px, 3.4cqh, 40px); color: var(--card-ink); }
.sc-steps { display: flex; flex-direction: column; gap: clamp(6px, 1.5cqh, 16px); margin: 0; padding: 0; list-style: none; counter-reset: step; }
.sc-steps li { display: flex; align-items: center; gap: clamp(10px, 1.2cqw, 18px); font-weight: 800; font-size: clamp(16px, 3cqh, 34px); line-height: 1.2; }
.sc-steps li > i { flex: none; display: grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--accent); color: var(--ink); font-style: normal; font-weight: 900; font-size: .8em; counter-increment: step; }
.sc-steps li > i::before { content: counter(step); }
.sc-steps li > span { flex: 1; min-width: 0; }
.sc-steps .sc-del { display: none; }

/* the timer, under the owl */
.sc-timer { position: absolute; z-index: 3; right: calc(43cqh - 17cqh); bottom: 4cqh; width: 34cqh; display: flex; flex-direction: column; align-items: center; gap: 1.4cqh; }
.sc-ring { position: relative; width: 34cqh; height: 34cqh; display: grid; place-items: center; }
.sc-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.sc-ring .sc-track { fill: rgba(20,14,40,.32); stroke: rgba(255,255,255,.22); stroke-width: 5; }
.sc-ring .sc-arc { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .5s linear; }
.sc-read { position: relative; display: flex; flex-direction: column; align-items: center; color: var(--title); }
.sc-label { font-size: clamp(11px, 1.9cqh, 20px); font-weight: 900; letter-spacing: .16em; text-transform: uppercase; opacity: .85; }
.sc-time { font-size: clamp(30px, 8.4cqh, 96px); font-weight: 900; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
button.sc-time { display: block; padding: 0 .08em; border: 0; border-radius: .14em; background: none; color: inherit; font-family: inherit; cursor: text; }
.scene.is-editing button.sc-time:hover { box-shadow: inset 0 -.05em 0 rgba(255,255,255,.6); }
.sc-time-in { width: 5ch; field-sizing: content; min-width: 3ch; padding: 0 .1em; border: 0; border-radius: .14em; background: rgba(255,255,255,.16); color: inherit; font: inherit; letter-spacing: inherit; text-align: center; outline: 3px solid var(--accent); }
.sc-ctrl { display: flex; gap: 6px; }
.sc-ctrl :is([data-act="minus"], [data-act="plus"]) { padding: 0 10px; font-size: 14px; }
.sc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 42px; height: 42px; padding: 0 16px; border: 1.5px solid var(--chip-line); border-radius: 999px; background: var(--chip); color: var(--title); font-weight: 900; font-size: 15px; cursor: pointer; }
.sc-btn:hover { background: rgba(255,255,255,.26); }
.sc-btn svg { width: 18px; height: 18px; }
.sc-go { min-width: 104px; border-color: transparent; background: var(--accent); color: var(--ink); }
.sc-go:hover { background: var(--accent); filter: brightness(1.06); }
.sc-done { position: absolute; z-index: 4; left: 50%; top: 40%; translate: -50% -50%; padding: clamp(18px, 3cqh, 34px) clamp(24px, 4cqw, 56px); border-radius: 34px; background: var(--card); color: var(--card-ink); text-align: center; font-family: var(--serif); font-style: italic; font-weight: 700; font-size: clamp(26px, 5cqh, 60px); box-shadow: 0 30px 70px -30px rgba(20,10,40,.7); }
.sc-done:not([hidden]) { animation: pop .7s cubic-bezier(.2,1.4,.4,1) both; }

/* music */
.sc-music { position: absolute; z-index: 4; left: clamp(20px, 4.5cqw, 80px); bottom: clamp(10px, 2cqh, 22px); display: none; }

/* ---------- the bar over a scene: back to the templates on the left, the rest on the right, dark glass on any world ---------- */
.sc-bar { position: absolute; z-index: 25; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: 12px clamp(12px, 1.6vw, 22px); pointer-events: none; }
.sc-bar > * { pointer-events: auto; }
.sc-bar #scTemplates { margin-right: auto; flex: none; }
.sc-bar > :not(#scMotif) { flex: none; }
.sc-bar #scMotif { min-width: 0; }   /* the motif's name gives way first on a narrow screen */
.sc-bar #scMotif .dd-btn { max-width: 100%; }
.sc-bar .btn { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.sc-bar .btn svg { width: 18px; height: 18px; }
.sc-bar :is(.btn-soft, .dd-btn) { min-height: 44px; border: 2px solid rgba(255,255,255,.24); background: rgba(14,12,30,.52); color: #FFFFFF; }
.sc-bar :is(.btn-soft, .dd-btn):hover { background: rgba(14,12,30,.7); }
.sc-bar :is(.btn-soft, .dd-btn)[aria-expanded="true"] { border-color: #FFFFFF; }
.sc-bar .sc-icon-btn { width: 44px; padding: 0; }
.sc-tune { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 2px solid rgba(255,255,255,.24); background: rgba(14,12,30,.52); color: #FFFFFF; }
.sc-tune button { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(255,255,255,.14); color: #FFFFFF; font-weight: 900; font-size: 14px; cursor: pointer; }
.sc-tune button[aria-pressed="true"] { background: #FFFFFF; color: #1B1730; }
.sc-tune button svg { width: 16px; height: 16px; }
.sc-tune input { width: 90px; accent-color: #FFD27A; }
/* the bar's menus: what to add, and the settings */
.sc-pop-wrap { position: relative; }
.sc-pop { position: absolute; z-index: 30; right: 0; top: calc(100% + 8px); width: min(340px, calc(100vw - 24px)); max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: 22px; background: var(--surface); color: var(--fg); box-shadow: var(--shadow-pop); animation: ddIn .2s ease-out; }
.sc-pop[hidden] { display: none; }
.sc-pop .segc button { padding: 6px 11px; font-size: 13px; }
.sc-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.sc-eq i { width: 3px; height: 30%; border-radius: 2px; background: currentColor; }
[aria-pressed="true"] .sc-eq i { animation: eq 1.1s ease-in-out infinite; transform-origin: bottom; }
[aria-pressed="true"] .sc-eq i:nth-child(2) { animation-delay: -.4s; } [aria-pressed="true"] .sc-eq i:nth-child(3) { animation-delay: -.8s; }
@keyframes eq { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(3); } }

/* flip to the next template */
.sc-flip { position: absolute; z-index: 6; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 54px; height: 54px; border: 0; border-radius: 50%; background: rgba(255,255,255,.2); color: #FFFFFF; cursor: pointer; opacity: 0; transition: opacity .3s, background .2s; }
.sc-flip svg { width: 26px; height: 26px; }
.sc-flip:hover { background: rgba(255,255,255,.34); }
.sc-prev { left: 14px; } .sc-next { right: 14px; }
.scene:hover .sc-flip, .sc-flip:focus-visible, body.awake .sc-flip { opacity: 1; }
.scene.is-swap > :is(svg, .sc-content, .sc-timer, .sc-free) { animation: swapIn .7s cubic-bezier(.2,.9,.3,1) both; }
@keyframes swapIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- editing in place ---------- */
.scene.is-editing [data-field] { outline: 2px dashed rgba(255,255,255,.65); outline-offset: 4px; border-radius: 8px; cursor: text; }
.scene.is-editing .sc-card [data-field] { outline-color: rgba(43,33,64,.35); }
.scene.is-editing [data-field]:focus { outline-style: solid; outline-color: var(--accent); }
.scene.is-editing .sc-steps .sc-del { display: grid; place-items: center; flex: none; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: rgba(43,33,64,.1); color: var(--card-ink); font-size: 18px; font-weight: 900; cursor: pointer; }
.sc-add { display: none; align-self: flex-start; margin-top: 4px; padding: 6px 14px; border: 2px dashed rgba(43,33,64,.3); border-radius: 999px; background: none; color: var(--card-ink); font-weight: 900; font-size: 14px; cursor: pointer; }
.scene.is-editing .sc-add { display: inline-flex; }
.sc-edit-hint { position: absolute; z-index: 6; left: 50%; top: 76px; translate: -50% 0; max-width: calc(100% - 28px); padding: 8px 18px; border-radius: 999px; background: var(--forest); color: var(--paper); font-weight: 800; font-size: 14px; text-align: center; box-shadow: var(--shadow); pointer-events: none; animation: hintOut .5s 6.4s both reverse; }
@keyframes hintOut { from { opacity: 0; } }
.sc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sc-seasons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.sc-season { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; border: 2px solid transparent; border-radius: 14px; background: var(--surface-2); font-weight: 800; font-size: 12px; cursor: pointer; }
.sc-season i { width: 100%; height: 30px; border-radius: 9px; }
.sc-season[aria-pressed="true"] { border-color: var(--fg); }
.sc-adds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin: -6px; }   /* the board's own list (classboard.css) */
#scAddPop { width: min(540px, calc(100vw - 24px)); }
.sc-hid { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 13px; font-weight: 800; }
.sc-hid button { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 11px; border: 1.5px dashed var(--border-strong); border-radius: 999px; background: none; color: var(--fg); font-weight: 800; font-size: 13px; cursor: pointer; }
.sc-hid button b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--fg); color: var(--bg-2); font-size: 15px; line-height: 1; }
.sc-row .btn[disabled] { opacity: .45; cursor: default; }

/* ---------- a free layout: every part is a box (layout.js) ---------- */
.sc-free { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.sc-blk { position: absolute; transform: scale(var(--s, 1)); transform-origin: 0 0; pointer-events: auto; }
.sc-blk > .sc-in { position: relative; }
.sc-blk :is(.sc-clock, .sc-sub) { white-space: nowrap; }
.sc-blk .sc-card { margin: 0; }
.sc-blk:is(.k-card, .k-list) .sc-card { display: block; }   /* a scene that hides its card on tall screens shows it again when the box is shown */
.scene .sc-blk .sc-timer { position: relative; inset: auto; }
.sc-body { display: contents; }
.sc-blk .sc-body { display: flex; flex-direction: column; gap: clamp(8px, 1.8cqh, 22px); }

/* looks: the box keeps the scene's colours and changes how it stands out */
.sc-blk[data-look] > .sc-in { border-radius: clamp(16px, 2.6cqh, 30px); }
.sc-blk:is(.k-title, .k-heading, .k-text)[data-look] > .sc-in { padding: clamp(10px, 2cqh, 24px) clamp(16px, 2cqw, 32px); }
.sc-blk[data-look="card"] > .sc-in { background: var(--card); box-shadow: 0 30px 60px -30px rgba(20,10,40,.6); --title: var(--card-ink); }
.sc-blk[data-look="glass"] > .sc-in { background: rgba(16,12,34,.4); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.2); }
.sc-blk[data-look="chip"] > .sc-in { border-radius: 999px; background: var(--chip); box-shadow: inset 0 0 0 1.5px var(--chip-line); }
.sc-blk[data-look] :is(.sc-title, .sc-x-text) { text-shadow: none; }
.sc-blk:is(.k-clock, .k-sub)[data-look] > .sc-in { background: none; box-shadow: none; }
.sc-blk:is(.k-clock, .k-sub)[data-look="card"] { --chip: var(--card); --chip-line: transparent; }
.sc-blk:is(.k-clock, .k-sub)[data-look="glass"] { --chip: rgba(16,12,34,.4); --chip-line: rgba(255,255,255,.2); }
.sc-blk:is(.k-clock, .k-sub)[data-look="plain"] { --chip: transparent; --chip-line: transparent; text-shadow: 0 2px 14px rgba(20,10,40,.55); }
.sc-blk:is(.k-card, .k-list)[data-look] > .sc-in { background: none; box-shadow: none; }
.sc-blk:is(.k-card, .k-list)[data-look="glass"] .sc-card { --card-ink: var(--title); background: rgba(16,12,34,.4); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.2); }
.sc-blk:is(.k-card, .k-list)[data-look="plain"] .sc-card { --card-ink: var(--title); padding: 0; background: none; box-shadow: none; text-shadow: 0 2px 14px rgba(20,10,40,.55); }
.sc-blk[data-align="center"] > .sc-in { text-align: center; }
.sc-blk[data-align="right"] > .sc-in { text-align: right; }

/* list styles: numbers (as drawn), dots, or boxes to tick off during the lesson */
.sc-blk[data-list="dot"] .sc-steps li > i { width: .5em; height: .5em; margin-inline: .45em .25em; }
.sc-blk[data-list="dot"] .sc-steps li > i::before { content: none; }
.sc-blk[data-list="check"] .sc-steps li > i { border-radius: .32em; background: none; color: inherit; box-shadow: inset 0 0 0 .13em currentColor; opacity: .7; }
.sc-blk[data-list="check"] .sc-steps li > i::before { content: ""; }
.sc-blk[data-list="check"] .sc-steps li.is-done > i { background: var(--accent); box-shadow: none; opacity: 1; }
.sc-blk[data-list="check"] .sc-steps li.is-done > i::before { content: "✓"; color: var(--ink); font-size: 1.1em; }
.sc-blk[data-list="check"] .sc-steps li.is-done > span { text-decoration: line-through; opacity: .5; }
.scene:not(.is-editing) .sc-blk[data-list="check"] .sc-steps li, .scene.is-editing .sc-blk[data-list="check"] .sc-steps li > i { cursor: pointer; }

/* the boxes a teacher adds */
.sc-x-head { font-size: clamp(30px, min(5.6cqw, 9cqh), 100px); line-height: 1.02; }
.sc-x-text { margin: 0; color: var(--title); font-weight: 800; font-size: clamp(16px, 3cqh, 34px); line-height: 1.3; white-space: pre-wrap; text-shadow: 0 2px 16px rgba(20,10,40,.5); }
.sc-x-note { position: relative; padding: clamp(18px, 3cqh, 32px) clamp(16px, 2cqw, 28px) clamp(20px, 3.4cqh, 36px); border-radius: 3px 3px 22px 3px; background: linear-gradient(170deg, #FFF4B0, #FFE680); color: #3F3416; rotate: -2deg; box-shadow: 0 22px 32px -18px rgba(40,26,0,.6); }
.sc-x-note::before { content: ""; position: absolute; left: 50%; top: -11px; width: 36%; height: 22px; translate: -50% 0; rotate: 4deg; background: rgba(255,255,255,.5); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.sc-x-note p { margin: 0; font-family: "Patrick Hand", var(--font); font-size: clamp(20px, 3.8cqh, 46px); line-height: 1.15; white-space: pre-wrap; }
.sc-x-sticker { font-size: clamp(56px, 13cqh, 150px); line-height: 1; user-select: none; }

/* edit mode: boxes move, texts take the cursor, the chosen box gets handles and a toolbar */
.scene.is-editing .sc-blk { cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; }
.scene.is-editing .sc-blk [contenteditable] { cursor: text; -webkit-user-select: text; user-select: text; }
.scene.is-editing .sc-blk::after { content: ""; position: absolute; inset: -6px; border: 1.5px dashed rgba(255,255,255,.75); border-radius: 12px; box-shadow: 0 0 0 1px rgba(10,12,30,.18); opacity: .5; pointer-events: none; transition: opacity .2s; }
.scene.is-editing .sc-blk:hover::after { opacity: 1; }
.scene.is-editing .sc-blk [data-field], .scene.is-editing .sc-blk [data-xfield] { outline-color: transparent; }
.scene.is-editing .sc-blk [contenteditable]:focus { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.scene.is-editing.is-free .sc-flip { display: none; }
.sc-sel { position: absolute; z-index: 8; pointer-events: none; }
/* the board's widgets on a template: the same cards as on the board, in a box of the free layout */
.sc-blk.k-widget > .sc-in, .sc-widget { height: 100%; }
.sc-widget { text-shadow: none; }
.sc-widget > .w-body { padding: 14px 16px 16px; }
.sc-widget.is-still > .w-body { display: grid; place-items: center; }
.sc-w-ico svg { width: 22cqmin; height: 22cqmin; opacity: .5; }
.sc-sel-frame { position: absolute; inset: -6px; border: 2px solid #FFFFFF; border-radius: 12px; box-shadow: 0 0 0 1px rgba(10,12,30,.45), inset 0 0 0 1px rgba(10,12,30,.3); }
.sc-h { position: absolute; z-index: 1; width: 18px; height: 18px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 0 0 1.5px rgba(10,12,30,.5), 0 2px 6px rgba(0,0,0,.3); pointer-events: auto; touch-action: none; }
.sc-h::before { content: ""; position: absolute; inset: -12px; }
.sc-h-w { right: -11px; top: 50%; width: 10px; height: 28px; border-radius: 6px; translate: 0 -50%; cursor: ew-resize; }
.sc-h-s { right: -15px; bottom: -15px; cursor: nwse-resize; }
.sc-tools { position: absolute; left: -6px; bottom: calc(100% + 14px); display: flex; flex-wrap: wrap; align-items: center; gap: 2px; width: max-content; max-width: calc(100cqw - 12px); padding: 5px; border-radius: 16px; background: var(--surface); color: var(--fg); box-shadow: var(--shadow-pop); font-family: var(--font); pointer-events: auto; }
.sc-tools.is-below { top: calc(100% + 14px); bottom: auto; }
.sc-tname { padding: 0 6px 0 8px; color: var(--muted); font-size: 13px; font-weight: 900; white-space: nowrap; }
.sc-tools button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 11px; background: none; color: inherit; cursor: pointer; }
.sc-tools button:hover { background: var(--hover); }
.sc-tools button[aria-pressed="true"] { background: var(--fg); color: var(--bg-2); }
.sc-tools button svg { width: 20px; height: 20px; }
.sc-tools .sc-t-look { display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 0 10px; font-weight: 800; font-size: 13px; white-space: nowrap; }
.sc-tools .sc-t-emoji { font-size: 22px; }
.sc-tsep { flex: none; width: 1px; height: 22px; margin: 0 4px; background: var(--border-strong); }
.sc-menu { position: absolute; left: 0; top: calc(100% + 6px); display: flex; flex-direction: column; gap: 2px; min-width: 190px; padding: 6px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-pop); }
.sc-tools .sc-menu button { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: auto; height: 38px; padding: 0 10px; font-weight: 800; font-size: 14px; }
.sc-tools .sc-menu button[aria-pressed="true"] { background: var(--surface-2); color: var(--fg); }
.sc-menu.sc-emojis { display: grid; grid-template-columns: repeat(8, 38px); min-width: 0; }
.sc-tools .sc-emojis button { width: 38px; padding: 0; justify-content: center; font-size: 22px; }
.sc-sw { position: relative; flex: none; width: 34px; height: 24px; border-radius: 7px; background: linear-gradient(135deg, #4F4A8A, #EE9C7D); overflow: hidden; }
.sc-sw::after { content: ""; position: absolute; inset: 5px 6px; border-radius: 4px; }
.sw-auto::after, .sw-plain::after { background: linear-gradient(#FFF8EC 0 0) 2px 3px / 70% 3px no-repeat, linear-gradient(#FFF8EC 0 0) 2px 9px / 45% 3px no-repeat; }
.sw-plain::after { box-shadow: inset 0 0 0 1px rgba(255,255,255,.6); border-radius: 2px; }
.sw-card::after { background: #FFFAF2; }
.sw-glass::after { background: rgba(16,12,34,.45); box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.sw-chip::after { inset: 6px 4px; border-radius: 99px; background: rgba(255,255,255,.25); box-shadow: inset 0 0 0 1px rgba(255,255,255,.6); }
.sc-guide { position: absolute; z-index: 8; pointer-events: none; }
.sc-guide.v { top: 0; bottom: 0; width: 0; border-left: 1.5px dashed #FF4FA3; }
.sc-guide.h { left: 0; right: 0; height: 0; border-top: 1.5px dashed #FF4FA3; }
.scene.is-dragging, .scene.is-dragging * { cursor: grabbing !important; }
.scene.is-dragging .sc-tools { visibility: hidden; }
@container (max-width: 560px) { .sc-tname, .sc-tname + .sc-tsep, .sc-t-look span { display: none; } }

/* ---------- the template gallery ---------- */
.gal { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; padding: clamp(16px, 3vw, 44px); overflow-y: auto; background: #0D171A; color: #F4FBF8; animation: galIn .3s ease-out; }
body.gal-open :is(.sc-stage, .cb-main) { content-visibility: hidden; }   /* nothing behind the gallery is drawn while it is open */
@keyframes galIn { from { opacity: 0; } }
.gal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1400px; width: 100%; margin: 0 auto 10px; }
.gal-head h2 { margin: 0; font-family: var(--serif); font-style: italic; font-size: clamp(30px, 4vw, 52px); }
.gal-close { display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #FFFFFF; font-size: 28px; font-weight: 800; cursor: pointer; }
.gal-sec { max-width: 1400px; width: 100%; margin: 18px auto 0; }
.gal-sec h3 { margin: 0 0 12px; font-size: 14px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: rgba(244,251,248,.7); }
.gal-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }
.gal-card { position: relative; display: flex; user-select: none; flex-direction: column; padding: 0; border: 3px solid transparent; border-radius: 24px; background: #1B2B30; color: inherit; text-align: left; overflow: hidden; cursor: pointer; transition: transform .25s cubic-bezier(.2,.9,.3,1.3), border-color .2s; animation: rise .5s cubic-bezier(.2,.9,.3,1) both; }
.gal-card:hover, .gal-card:focus-visible { transform: translateY(-5px); border-color: rgba(255,255,255,.6); outline: none; }
.gal-card.is-current { border-color: var(--accent, #FFC86B); }
.gal-shot { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #0F1A1D; contain: content; }
.gal-card { content-visibility: auto; contain-intrinsic-size: auto 300px; }
.gal-shot .scene { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; border-radius: 0; box-shadow: none; transform-origin: 0 0; pointer-events: none; }
.gal-shot .scene * { animation-play-state: paused !important; }
.gal-meta { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px 14px; }
.gal-meta b { font-size: 17px; font-weight: 900; }
.gal-meta span { color: rgba(244,251,248,.7); font-size: 13px; font-weight: 700; }
.gal-badge { position: absolute; left: 12px; top: 12px; z-index: 2; padding: 4px 10px; border-radius: 999px; background: #FFC86B; color: #2B2140; font-size: 12px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.gal-board { display: grid; place-items: center; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #24453A, #1B2D4A); }
.gal-board svg { width: 46%; height: auto; color: rgba(255,255,255,.85); }

/* ---------- small and tall screens ---------- */
@container (max-aspect-ratio: 1.15) {   /* tall screens: the words on top, the owl and the timer below */
  .scene .m-tree { height: 44%; top: auto; bottom: 0; }
  .sc-content { width: auto; right: clamp(16px, 4cqw, 40px); min-width: 0; bottom: auto; gap: 2cqw; }
  .sc-title { font-size: clamp(38px, 13cqw, 110px); }
  .sc-sub { font-size: clamp(12px, 3.4cqw, 22px); }
  .sc-card { margin-top: 1cqw; }
  .sc-card-h { font-size: clamp(18px, 5.2cqw, 34px); }
  .sc-steps li { font-size: clamp(14px, 4.3cqw, 28px); }
  .sc-timer { right: auto; left: clamp(16px, 5cqw, 40px); bottom: 3cqh; width: 40cqw; }
  .sc-ring { width: 40cqw; height: 40cqw; }
  .sc-time { font-size: clamp(26px, 10.5cqw, 90px); }
  .sc-label { font-size: clamp(10px, 2.6cqw, 18px); }
  .sc-ctrl { align-self: flex-start; gap: 5px; }   /* the buttons are wider than the ring: they run to the right, not off the edge */
  .sc-btn { height: 38px; min-width: 38px; padding: 0 12px; }
  .sc-go { min-width: 92px; }
  .sc-blk .sc-body { gap: 2cqw; }
  .sc-edit-hint { top: auto; bottom: 14px; }
  .sc-x-head { font-size: clamp(28px, 9cqw, 80px); }
  .sc-x-text { font-size: clamp(15px, 4.3cqw, 28px); }
  .sc-x-note p { font-size: clamp(18px, 5.4cqw, 38px); }
  .sc-x-sticker { font-size: clamp(48px, 16cqw, 130px); }
}
@media (max-width: 760px) {   /* a phone: the bar's buttons become icons */
  .sc-bar { gap: 6px; padding: 8px 10px; }
  .sc-bar :is(#scTemplates, #scAdd, #scPresent) span, .sc-tune input, #scMusic > span:last-child { display: none; }
  .sc-bar :is(#scTemplates, #scAdd, #scPresent) { width: 44px; padding: 0; }
  .sc-bar #scTemplates { margin-right: 0; }
  .sc-bar #scMotif { flex: 1 1 0; }
  .sc-bar #scMotif .dd-btn { width: 100%; padding-inline: 12px; }
  .sc-tune { padding: 4px; }
  .sc-tune button { width: 32px; padding: 0; justify-content: center; }
  .sc-pop { position: fixed; left: 10px; right: 10px; top: 62px; width: auto; }
  #scAddPop { width: auto; }
  .sc-adds { grid-template-columns: minmax(0, 1fr); }
  .sc-edit-hint { top: auto; bottom: 14px; }
}
