/* ==========================================================================
   «حين نطقت الموسوعة… حكت عُمان» — مسابقة سراج عُمان
   ليل البحر العُماني · سراج نحاسي · نجوم ضوء بلون الفيروز والعاج
   ========================================================================== */

/* ---------- Fonts (local, so kiosk screens work offline) ---------- */
@font-face { font-family: "Reem Kufi"; font-weight: 500; font-display: swap; src: url(../fonts/reem-kufi-arabic-500-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Reem Kufi"; font-weight: 600; font-display: swap; src: url(../fonts/reem-kufi-arabic-600-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Reem Kufi"; font-weight: 700; font-display: swap; src: url(../fonts/reem-kufi-arabic-700-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Reem Kufi"; font-weight: 500 700; font-display: swap; src: url(../fonts/reem-kufi-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Readex Pro"; font-weight: 300; font-display: swap; src: url(../fonts/readex-pro-arabic-300-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Readex Pro"; font-weight: 400; font-display: swap; src: url(../fonts/readex-pro-arabic-400-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Readex Pro"; font-weight: 500; font-display: swap; src: url(../fonts/readex-pro-arabic-500-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Readex Pro"; font-weight: 600; font-display: swap; src: url(../fonts/readex-pro-arabic-600-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Readex Pro"; font-weight: 300 400; font-display: swap; src: url(../fonts/readex-pro-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Readex Pro"; font-weight: 500 600; font-display: swap; src: url(../fonts/readex-pro-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }

/* ---------- Tokens ---------- */
:root {
  --sea-950: #031417;
  --sea-900: #06242A;
  --sea-850: #082C33;
  --sea-800: #0D3A41;
  --sea-700: #13505A;
  --copper-700: #8F4818;
  --copper-600: #A9561F;
  --copper-500: #C8743C;
  --copper-400: #DA8D55;
  --copper-300: #E9AF7F;
  --copper-200: #F3CDAA;
  --glow: #FFE3B0;
  --glow-soft: #FFF4DC;
  --turq: #3FD0C9;
  --turq-300: #7FE3DE;
  --cream: #F4EDE2;
  --muted: rgba(244, 237, 226, .74);
  --faint: rgba(244, 237, 226, .5);
  --line: rgba(127, 227, 222, .16);
  --line-strong: rgba(127, 227, 222, .32);
  --glass: rgba(13, 58, 65, .5);
  --glass-strong: rgba(8, 44, 51, .82);

  --copper-grad: linear-gradient(135deg, #F6D7B8 0%, #E9AF7F 28%, #C8743C 66%, #A9561F 100%);
  --sea-bg:
    radial-gradient(ellipse 60% 45% at 50% 40%, rgba(255, 227, 176, .10), transparent 70%),
    radial-gradient(ellipse 90% 60% at 85% -10%, rgba(63, 208, 201, .16), transparent 60%),
    radial-gradient(ellipse 80% 60% at 0% 110%, rgba(63, 208, 201, .10), transparent 60%),
    linear-gradient(180deg, #06242A 0%, #052026 45%, #031417 100%);

  --radius: 18px;
  --radius-lg: 26px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --font-display: "Reem Kufi", "Readex Pro", "Segoe UI", Tahoma, sans-serif;
  --font-body: "Readex Pro", "Segoe UI", Tahoma, system-ui, sans-serif;

  --z-volume: 20; --z-gate: 30; --z-modal: 40; --z-scene: 50; --z-flyer: 60; --z-toast: 70;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  font-size: clamp(15px, calc(9.5px + .5vmax), 23px);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  background: var(--sea-950);
}
html.is-locked, html.is-locked body { overflow: hidden; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font-body); font-weight: 400; line-height: 1.7;
  color: var(--cream); background: var(--sea-950);
  -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
img, svg, video { display: block; max-width: 100%; }
button, a { touch-action: manipulation; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--turq); outline-offset: 3px; border-radius: 8px; }
.ic { width: 1.25em; height: 1.25em; flex: none; }
.sr-only { position: absolute !important; top: 0; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link { position: fixed; top: -100px; right: 16px; z-index: 100; padding: 10px 16px; border-radius: 12px; background: var(--glow); color: var(--sea-900); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: calc(12px + var(--safe-t)); }
.noscript { padding: 40px 20px; text-align: center; }

/* animated background particles */
.fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 31; pointer-events: none; }

/* ---------- Buttons ---------- */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  min-height: 52px; padding: .55em 1.3em;
  border-radius: 16px; border: 1px solid transparent;
  font: 500 1rem/1.25 var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .25s, border-color .25s, color .25s;
}
.btn:active { transform: scale(.97); }
.btn-copper {
  background: var(--copper-grad); color: var(--sea-950); font-weight: 600;
  box-shadow: 0 0 0 1px rgba(255, 227, 176, .35) inset, 0 12px 30px -12px rgba(200, 116, 60, .8);
}
.btn-copper::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
  transform: translateX(120%); animation: shimmer 3.6s var(--ease) infinite 1.2s;
}
.btn-glass {
  background: rgba(244, 237, 226, .06); color: var(--cream);
  border-color: rgba(244, 237, 226, .18);
}
.btn-soon { background: rgba(244, 237, 226, .04); color: var(--faint); border: 1px dashed rgba(244, 237, 226, .18); cursor: default; font-weight: 400; }
.btn-xl { min-height: 62px; padding: .6em 2.1em; font-size: 1.12rem; border-radius: 999px; }
.btn .seen { width: 1.05em; height: 1.05em; color: var(--turq-300); }
.btn-copper .seen { color: var(--sea-800); }
@media (hover: hover) {
  .btn-copper:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(255, 227, 176, .5) inset, 0 18px 40px -12px rgba(200, 116, 60, .95); }
  .btn-glass:hover { background: rgba(244, 237, 226, .12); border-color: rgba(244, 237, 226, .34); transform: translateY(-2px); }
}
@keyframes shimmer { 0% { transform: translateX(120%); } 55%, 100% { transform: translateX(-120%); } }

.icon-btn {
  width: 46px; height: 46px; flex: none; display: inline-grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); background: rgba(244, 237, 226, .05);
  color: var(--cream); cursor: pointer; text-decoration: none;
  transition: background-color .2s, border-color .2s, transform .25s var(--ease);
}
.icon-btn .ic { width: 21px; height: 21px; }
@media (hover: hover) { .icon-btn:hover { background: rgba(63, 208, 201, .14); border-color: var(--line-strong); transform: rotate(-8deg); } }
.link-btn {
  min-height: 44px; padding: 0 12px; background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: .95rem; text-decoration: underline; text-underline-offset: 6px; text-decoration-color: rgba(127, 227, 222, .45);
  transition: color .2s;
}
@media (hover: hover) { .link-btn:hover { color: var(--cream); } }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 16px; border-radius: 999px;
  background: rgba(63, 208, 201, .1); border: 1px solid rgba(63, 208, 201, .3);
  color: var(--turq-300); font-size: .92rem; font-weight: 500;
}

/* ---------- Lantern ---------- */
.lantern { overflow: visible; width: 100%; height: 100%; }
.lantern .slat-base { fill: rgba(63, 208, 201, .07); }
.lantern .slat-lit { opacity: 0; transition: opacity 1s var(--ease); }
.lantern .slat.is-lit .slat-lit { opacity: .96; }
.lantern .slat.is-flash .slat-lit { animation: slat-flash 1.5s ease-out; }
.lantern .holes-lit, .lantern .inlay-lit { opacity: var(--glow, 0); transition: opacity 1.2s var(--ease); }
.lantern .flame { transform-origin: 100px 256px; transform: scale(calc(.45 + var(--glow, 0) * .55)); transition: transform 1.2s var(--ease); }
.lantern .flame-shape { transform-origin: 100px 256px; animation: flicker 1.6s ease-in-out infinite; }
.lantern .flame-glow { animation: flicker-glow 2.4s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { transform: scale(1, 1) skewX(0); } 25% { transform: scale(.94, 1.06) skewX(2deg); } 50% { transform: scale(1.04, .95) skewX(-1.5deg); } 75% { transform: scale(.97, 1.03) skewX(1deg); } }
@keyframes flicker-glow { 50% { opacity: .7; } }
@keyframes slat-flash { 0% { opacity: 0; } 30% { opacity: 1; } 55% { opacity: .7; } 100% { opacity: .96; } }

.lantern-wrap { position: absolute; z-index: 2; --glow: 0; }
.lantern-wrap > .lantern { position: relative; z-index: 2; animation: hover-float 7s ease-in-out infinite; }
.lantern-halo {
  position: absolute; z-index: 0; left: 50%; top: 58%;
  width: 170%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle closest-side, rgba(255, 227, 176, .5) 0%, rgba(233, 175, 127, .16) 40%, rgba(63, 208, 201, .05) 72%, transparent 100%);
  opacity: calc(.18 + var(--glow) * .82); transition: opacity 1.4s var(--ease);
  pointer-events: none;
}
.lantern-beams {
  position: absolute; z-index: 1; left: 50%; top: 58%;
  width: 220%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 227, 176, .12) 0deg 5deg, transparent 5deg 22.5deg);
  -webkit-mask: radial-gradient(circle closest-side, #000 0%, transparent 100%); mask: radial-gradient(circle closest-side, #000 0%, transparent 100%);
  opacity: 0; transition: opacity 1.6s var(--ease);
  animation: spin 60s linear infinite;
  pointer-events: none;
}
.home.is-complete .lantern-beams { opacity: 1; }
.lantern-wrap.is-pulse .lantern-halo { animation: halo-pulse 1.5s ease-out; }
@keyframes hover-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.2%); } }
@keyframes halo-pulse { 0% { scale: 1; } 35% { scale: 1.18; } 100% { scale: 1; } }
@keyframes spin { to { rotate: 360deg; } }

/* ---------- Gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: var(--z-gate);
  display: grid; place-items: center; overflow-y: auto;
  padding: calc(28px + var(--safe-t)) 18px calc(28px + var(--safe-b));
  text-align: center;
  background: var(--sea-bg);
  transition: opacity .6s var(--ease), visibility .6s;
}
.gate.is-leaving { opacity: 0; visibility: hidden; }
.gate-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 900px; }
.gate-lantern { position: relative; width: clamp(96px, 16vh, 210px); aspect-ratio: 200 / 334; margin-bottom: 6px; --glow: .1; }
.gate-lantern .lantern { animation: hover-float 6s ease-in-out infinite; }
.gate-lantern .lantern-halo { opacity: .55; }
.gate-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.4rem, 8vw, 5.6rem); line-height: 1.32; letter-spacing: 0;
}
.gate-title .line { display: block; }
.gate-title .w { display: inline-block; opacity: 0; transform: translateY(.45em); filter: blur(8px); animation: word-in .9s var(--ease) forwards; animation-delay: calc(.25s + var(--w) * .12s); }
.gate-title .line + .line .w {
  background: linear-gradient(90deg, var(--copper-300), var(--glow), var(--turq-300), var(--glow), var(--copper-300));
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: word-in .9s var(--ease) forwards calc(.25s + var(--w) * .12s), sheen 9s linear infinite;
}
@keyframes word-in { to { opacity: 1; transform: none; filter: none; } }
@keyframes sheen { to { background-position: 300% 0; } }
.gate-team { color: var(--muted); }
.gate-team:empty { display: none; }
.gate-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 12px; animation: fade-up .9s var(--ease) both 1s; }
.gate .chip { animation: fade-up .8s var(--ease) both .1s; }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Home ---------- */
.home {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  overflow-x: hidden; overflow-x: clip;
}
.home::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--sea-bg); }
.navbar {
  position: relative; z-index: 6;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: calc(100% - 28px); max-width: 1320px;
  margin: calc(12px + var(--safe-t)) auto 0;
  padding: 7px 7px 7px 7px; padding-inline-start: 16px;
  border-radius: 999px;
  background: rgba(8, 44, 51, .55); border: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .8);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.brand-mark { width: 22px; height: 40px; flex: none; background: url(../img/mark.svg) center / contain no-repeat; filter: drop-shadow(0 0 8px rgba(255, 227, 176, .5)); }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.brand-text strong { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text strong .line { display: inline; }
.brand-text small { color: var(--turq-300); font-size: .74rem; }
.nav-actions { display: flex; gap: 6px; flex: none; }

/* school + governorate */
.place { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 6px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.place-item { display: inline-flex; align-items: center; gap: 7px; }
.place .ic { width: 17px; height: 17px; color: var(--copper-300); }
.place-sep { width: 5px; height: 5px; border-radius: 50%; background: var(--turq); margin: 0 6px; box-shadow: 0 0 8px var(--turq); }
.nav-place { flex: 1; min-width: 0; margin: 0; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.place-row { position: relative; z-index: 5; display: none; margin: 10px 18px 0; text-align: center; }
@media (max-width: 979px) {
  .nav-place { display: none !important; }
  .place-row:not([hidden]) { display: flex; }
}
.gate-place { padding: 6px 16px; border-radius: 999px; background: rgba(244, 237, 226, .05); border: 1px solid var(--line); color: var(--cream); animation: fade-up .8s var(--ease) both .8s; }

.stage { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; outline: none; }
.sky { position: relative; flex: 1; min-height: 380px; }
.rays { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 1; pointer-events: none; }
.ray { stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: 2 10; animation: flow 1.8s linear infinite; transition: opacity .6s; }
.ray.is-lit { stroke: rgba(255, 227, 176, .5); stroke-width: 2; stroke-dasharray: none; animation: none; filter: drop-shadow(0 0 4px rgba(255, 227, 176, .7)); }
@keyframes flow { to { stroke-dashoffset: -24; } }

.stars { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; z-index: 3; }
.star-btn {
  position: absolute; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 14px;
}
.star-btn:focus-visible { outline-offset: 8px; border-radius: 16px; }

/* a light piece: an arched glass pane like the lantern's own window */
.piece { position: absolute; inset: 0; animation: bob 5.5s ease-in-out infinite; animation-delay: calc(var(--i) * -.9s); }
.piece-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transition: transform .45s var(--spring), filter .4s; transform-origin: 50% 55%; }
.p-halo { fill: url(#piece-halo); transform-box: fill-box; transform-origin: 50% 50%; transform: scale(1.35); animation: twinkle 3.2s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -.5s); }
.p-frame, .p-sill { fill: url(#piece-cu); }
.p-glass { fill: url(#piece-glass); transition: fill .8s var(--ease); }
.p-sheen { fill: url(#piece-sheen); animation: pane-sheen 5.2s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -.85s); }
.p-line { fill: none; stroke: #3FD0C9; stroke-width: 1.3; opacity: .6; }
.p-key { fill: #3FD0C9; }
.p-num { fill: var(--sea-900); font-family: var(--font-display); font-weight: 700; transition: fill .6s; }
.piece-badge {
  position: absolute; z-index: 2; bottom: 4%; inset-inline-start: -6px;
  width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center;
  background: var(--glow); color: var(--sea-900); box-shadow: 0 0 0 3px var(--sea-900), 0 0 16px rgba(255, 227, 176, .9);
}
.piece-badge .ic { width: 15px; height: 15px; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes twinkle { 50% { opacity: .55; } }
@keyframes spin-slow { to { rotate: 360deg; } }
@keyframes pane-sheen { 0%, 60% { transform: translateX(0); } 100% { transform: translateX(150px); } }
@media (hover: hover) {
  .star-btn:hover .piece-svg { transform: scale(1.1); filter: drop-shadow(0 0 16px rgba(255, 227, 176, .75)); }
  .star-btn:hover .star-label .title { color: var(--glow); }
}
.star-btn:active .piece-svg { transform: scale(.95); }

/* gathered piece: its glass has travelled into the lantern — the empty frame remains */
.star.is-lit .p-glass, .piece-svg.is-empty .p-glass { fill: rgba(3, 20, 23, .88); }
.star.is-lit .p-halo, .piece-svg.is-empty .p-halo { opacity: .12; animation: none; }
.star.is-lit .p-sheen, .piece-svg.is-empty .p-sheen { display: none; }
.star.is-lit .p-line { opacity: .35; }
.star.is-lit .p-num, .piece-svg.is-empty .p-num { fill: var(--glow); }
.star.is-lit .piece-badge { display: grid; }

.star-label {
  position: absolute; display: flex; flex-direction: column; gap: 1px;
  pointer-events: auto; line-height: 1.35;
  text-shadow: 0 2px 12px rgba(3, 20, 23, .9);
}
.star-label .kicker { font-size: .72rem; color: var(--turq-300); }
.star-label .title { font-family: var(--font-display); font-weight: 600; font-size: 1.06rem; color: var(--cream); transition: color .2s; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.star-label .meta { font-size: .74rem; color: var(--muted); }
.star-label .meta .lit { display: none; color: var(--glow); }
.star.is-lit .star-label .meta .lit { display: inline; }
.star.is-lit .star-label .meta .lit::before { content: " · "; color: var(--faint); }

.status {
  position: relative; z-index: 4; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 4px 18px calc(84px + var(--safe-b));
}
.gauge { display: flex; gap: 6px; }
.gauge i { width: 26px; height: 5px; border-radius: 99px; background: rgba(244, 237, 226, .14); transition: background-color .8s, box-shadow .8s; }
.gauge i.on { background: linear-gradient(90deg, var(--glow), var(--copper-300)); box-shadow: 0 0 10px rgba(255, 227, 176, .8); }
.status-text { font-weight: 500; font-size: 1rem; }
.status-hint { color: var(--muted); font-size: .9rem; }
.complete-title {
  display: none;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 4.6vw, 3.4rem); line-height: 1.35;
  background: linear-gradient(90deg, var(--copper-300), var(--glow-soft), var(--turq-300), var(--glow-soft), var(--copper-300));
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 8s linear infinite;
}
.complete-title .line { display: block; }
.home.is-complete .status-hint, .home.is-empty .status-hint, .home.is-empty .gauge { display: none; }
.home.is-complete .status-text { color: var(--glow); }
.home.is-complete .complete-title { display: block; animation: sheen 8s linear infinite, fade-up 1.1s var(--ease) both .2s; }

.waves { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; height: 110px; pointer-events: none; overflow: hidden; }
.waves svg { position: absolute; bottom: 0; width: 200%; height: 100%; }
.waves svg:first-child { animation: wave 26s linear infinite; }
.waves svg:last-child { animation: wave 18s linear infinite reverse; }
.waves .w1 { fill: rgba(63, 208, 201, .07); }
.waves .w2 { fill: rgba(3, 20, 23, .7); }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(50%); } }

/* entrance */
.home.is-entering .lantern-wrap { animation: rise-in 1.2s var(--ease) both; }
.home.is-entering .rays { animation: fade-in 1.4s ease both .6s; }
.home.is-entering .star-btn { animation: pop-in .8s var(--spring) both; animation-delay: calc(.5s + var(--i) * 90ms); }
.home.is-entering .status { animation: fade-up .9s var(--ease) both .9s; }
@keyframes rise-in { from { opacity: 0; transform: translateY(40px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.2) rotate(-40deg); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } }

/* the light travelling to the lantern (when no ready-made clip exists) */
.flyer {
  position: fixed; left: 0; top: 0; z-index: var(--z-flyer);
  width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%; pointer-events: none; will-change: transform, opacity;
  background: radial-gradient(circle, #fff 0%, var(--glow-soft) 24%, rgba(255, 227, 176, .55) 46%, rgba(63, 208, 201, .15) 60%, transparent 70%);
}

/* kiosk QR */
.kiosk-qr {
  position: fixed; z-index: 7; left: max(16px, var(--safe-l)); bottom: calc(16px + var(--safe-b));
  width: 158px; padding: 12px 12px 10px; border-radius: 20px;
  background: var(--glass-strong); border: 1px solid var(--line); backdrop-filter: blur(12px);
  text-align: center; font-size: .74rem; line-height: 1.5; color: var(--muted);
}
.kiosk-qr-code { padding: 8px; border-radius: 12px; background: #fff; }
.kiosk-qr-code svg { width: 100%; height: auto; }
.kiosk-qr p { margin-top: 8px; }
@media (orientation: portrait) and (min-height: 1100px) { .kiosk-qr { width: 230px; font-size: .85rem; } }

/* ---------- Volume (folder) page ---------- */
.volume {
  position: fixed; inset: 0; z-index: var(--z-volume);
  overflow-y: auto; overscroll-behavior: contain;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(63, 208, 201, .14), transparent 65%),
    radial-gradient(ellipse 50% 30% at 100% 30%, rgba(200, 116, 60, .1), transparent 70%),
    linear-gradient(180deg, #082C33 0%, #04191D 55%, #031417 100%);
}
.vol-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--safe-t)) max(16px, var(--safe-r)) 10px max(16px, var(--safe-l));
  background: rgba(4, 25, 29, .78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 0 18px 0 20px; border-radius: 999px; border: 0; cursor: pointer; flex: none; white-space: nowrap;
  background: var(--cream); color: var(--sea-900); font-weight: 600; font-size: .95rem;
  transition: transform .25s var(--ease), background-color .2s;
}
@media (hover: hover) { .back-btn:hover { background: #fff; transform: translateX(4px); } }
.vol-bar-label { min-width: 0; color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.vol-hero {
  position: relative; overflow: hidden;
  max-width: 1240px; margin-inline: auto;
  padding: clamp(26px, 6vh, 72px) max(18px, var(--safe-r)) clamp(20px, 4vh, 44px) max(18px, var(--safe-l));
}
.vol-emblem {
  position: absolute; inset-inline-end: 4%; top: 50%; translate: 0 -50%;
  width: clamp(120px, 17vw, 230px); aspect-ratio: 100 / 120;
  pointer-events: none; user-select: none;
  animation: fade-in 1.2s ease both .2s;
}
.vol-emblem .piece-svg { animation: hover-float 6s ease-in-out infinite; filter: drop-shadow(0 0 40px rgba(255, 227, 176, .35)); }
@media (max-width: 760px) { .vol-emblem { opacity: .3; inset-inline-end: -4%; } }
.vol-hero-text { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 760px; }
.vol-hero-text > * { animation: fade-up .8s var(--ease) both; }
.vol-hero-text > *:nth-child(2) { animation-delay: .08s; }
.vol-hero-text > *:nth-child(3) { animation-delay: .16s; }
.vol-hero-text > *:nth-child(4) { animation-delay: .24s; }
.vol-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.1rem, 5.6vw, 4rem); line-height: 1.3; outline: none; }
.vol-desc { color: var(--muted); max-width: 62ch; font-size: 1.02rem; }
.vol-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.vol-meta .chip .ic { width: 16px; height: 16px; }
.chip-glow { background: rgba(255, 227, 176, .12); border-color: rgba(255, 227, 176, .35); color: var(--glow); }

.vol-body { max-width: 1240px; margin-inline: auto; padding: 8px max(18px, var(--safe-r)) calc(48px + var(--safe-b)) max(18px, var(--safe-l)); }
.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(16px, 2vw, 26px); grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 410px)); justify-content: center; }
.task { animation: card-in .8s var(--ease) both; animation-delay: calc(.25s + var(--i) * .09s); }
@keyframes card-in { from { opacity: 0; transform: translateY(26px) scale(.97); } to { opacity: 1; transform: none; } }
.task-card {
  position: relative; height: 100%;
  display: flex; flex-direction: column;
  border-radius: var(--radius-lg); overflow: hidden;
  background: linear-gradient(180deg, rgba(19, 80, 90, .42), rgba(8, 44, 51, .55));
  border: 1px solid var(--line);
  box-shadow: 0 24px 50px -30px rgba(0, 0, 0, .9);
  transition: transform .45s var(--ease), border-color .3s, box-shadow .45s var(--ease);
}
@media (hover: hover) {
  .task-card:hover { transform: translateY(-6px); border-color: var(--line-strong); box-shadow: 0 34px 60px -30px rgba(0, 0, 0, .95), 0 0 0 1px rgba(255, 227, 176, .08); }
}
.task-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--sea-850); }
.task-media.is-playable { cursor: pointer; }
.task-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); }
@media (hover: hover) { .task-card:hover .task-media img { transform: scale(1.05); } }
.task-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(3, 20, 23, .7)); pointer-events: none; }
.task-ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 55%, rgba(255, 227, 176, .22), transparent 45%),
    radial-gradient(ellipse at 0% 100%, rgba(63, 208, 201, .18), transparent 55%),
    linear-gradient(160deg, #13505A, #06242A);
}
.task-ph-piece { position: relative; width: 26%; aspect-ratio: 100 / 120; animation: hover-float 6s ease-in-out infinite; animation-delay: calc(var(--i) * -1s); }
.play-badge {
  position: absolute; z-index: 1; inset-inline-start: 16px; bottom: 16px;
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--copper-grad); color: var(--sea-950);
  box-shadow: 0 10px 26px -6px rgba(0, 0, 0, .6), 0 0 0 6px rgba(255, 227, 176, .14);
  transition: transform .35s var(--spring);
}
.play-badge .ic { width: 22px; height: 22px; margin-inline-end: -3px; }
@media (hover: hover) { .task-card:hover .play-badge { transform: scale(1.1); } }
.task-body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 18px 20px 20px; }
.task-kicker { color: var(--turq-300); font-weight: 500; font-size: .8rem; }
.task-title { font-family: var(--font-display); font-weight: 600; font-size: 1.32rem; line-height: 1.45; }
.task-desc { color: var(--muted); font-size: .94rem; }
.task-students { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: .88rem; }
.task-students .ic { width: 18px; height: 18px; margin-top: 3px; color: var(--copper-300); }
.task-actions { margin-top: auto; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.task-actions .btn { flex: 1 1 200px; }

.empty {
  max-width: 520px; margin: 24px auto; padding: 36px 24px; text-align: center;
  border-radius: var(--radius-lg); border: 1px dashed var(--line-strong); color: var(--muted);
}
.empty strong { display: block; font-family: var(--font-display); font-size: 1.4rem; color: var(--cream); margin-bottom: 4px; }
.vol-foot { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: clamp(32px, 5vh, 56px); text-align: center; }
.vol-hint { display: inline-flex; align-items: center; gap: 8px; color: var(--glow); font-size: .95rem; animation: fade-up .6s var(--ease) both; }
.vol-hint .ic { width: 18px; height: 18px; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: flex; flex-direction: column;
  background: rgba(2, 14, 17, .97);
  animation: fade-in .25s var(--ease);
}
.modal-bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "head tools" "seg seg";
  align-items: center; gap: 10px 12px;
  padding: calc(10px + var(--safe-t)) max(16px, var(--safe-r)) 10px max(16px, var(--safe-l));
}
.modal-heading { grid-area: head; min-width: 0; }
.modal-kicker { color: var(--turq-300); font-size: .8rem; }
.modal-title { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-tools { grid-area: tools; display: flex; gap: 8px; }
.seg { grid-area: seg; justify-self: center; display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(244, 237, 226, .07); border: 1px solid var(--line); }
.seg button { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 500; font-size: .92rem; cursor: pointer; transition: background-color .25s, color .25s; }
.seg button .ic { width: 18px; height: 18px; }
.seg button[aria-pressed="true"] { background: var(--cream); color: var(--sea-900); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
@media (min-width: 760px) { .modal-bar { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "head seg tools"; } }
.modal-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 max(16px, var(--safe-r)) calc(16px + var(--safe-b)) max(16px, var(--safe-l)); }
.media-box { position: relative; width: 100%; height: 100%; max-width: 1600px; display: flex; align-items: center; justify-content: center; animation: zoom-in .4s var(--ease); }
.media-box video, .media-box img, .media-box iframe { width: 100%; height: 100%; object-fit: contain; border: 0; background: transparent; }
.media-box video { height: auto; max-height: 100%; border-radius: 14px; }
.media-box--card img { filter: drop-shadow(0 24px 50px rgba(0, 0, 0, .6)); }
.media-box iframe { background: var(--cream); border-radius: 14px; }
.media-frame { position: relative; aspect-ratio: 16 / 9; width: min(100%, calc((100dvh - 150px) * 16 / 9)); border-radius: 14px; overflow: hidden; background: #000; animation: zoom-in .4s var(--ease); }
.media-frame.is-portrait { aspect-ratio: 9 / 16; width: min(100%, calc((100dvh - 150px) * 9 / 16)); }
.media-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@keyframes zoom-in { from { opacity: 0; transform: scale(.96); } }
.media-msg { max-width: 460px; padding: 30px 24px; text-align: center; border-radius: var(--radius-lg); background: var(--glass); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.media-msg .ic { width: 30px; height: 30px; color: var(--turq-300); }
.media-msg strong { font-family: var(--font-display); font-size: 1.35rem; }
.media-msg p { color: var(--muted); font-size: .95rem; }
.media-msg code { direction: ltr; unicode-bidi: embed; font-size: .82rem; color: var(--glow); overflow-wrap: anywhere; }

.modal--dialog { align-items: center; justify-content: center; padding: 16px; overflow-y: auto; background: rgba(2, 14, 17, .78); backdrop-filter: blur(6px); }
.dialog-card {
  position: relative; width: 100%; max-width: 440px; padding: 30px 24px 24px;
  border-radius: 28px; text-align: center;
  background: linear-gradient(180deg, #0D3A41, #082C33); border: 1px solid var(--line-strong);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9);
  animation: pop-in .5s var(--spring);
}
.dialog-card h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; line-height: 1.35; }
.dialog-card > p { color: var(--muted); margin-top: 6px; }
.dialog-close { position: absolute; top: 14px; left: 14px; }
.qr-box { width: min(240px, 68vw); margin: 18px auto 10px; padding: 12px; border-radius: 20px; background: #fff; box-shadow: 0 0 0 6px rgba(63, 208, 201, .14); }
.qr-box svg { width: 100%; height: auto; }
.share-url { direction: ltr; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.share-note { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(63, 208, 201, .08); color: var(--turq-300); font-size: .84rem; line-height: 1.65; }
.share-note code { direction: ltr; unicode-bidi: embed; }
.dialog-actions { display: grid; gap: 10px; margin-top: 18px; }
.dialog-actions .btn { width: 100%; }

/* ---------- Story scenes ---------- */
.scene { position: fixed; inset: 0; z-index: var(--z-scene); background: var(--scene-bg, #041A1F); opacity: 0; transition: opacity .4s ease; }
.scene.is-visible { opacity: 1; }
.scene-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: var(--scene-fit, contain); opacity: 0; transition: opacity .5s ease; }
.scene-video.is-active { opacity: 1; }
.scene-spinner { position: absolute; left: 50%; top: 50%; margin: -24px 0 0 -24px; width: 48px; height: 48px; border-radius: 50%; border: 3px solid rgba(244, 237, 226, .15); border-top-color: var(--glow); opacity: 0; transition: opacity .2s; animation: spin .9s linear infinite; }
.scene.is-loading .scene-spinner { opacity: 1; transition-delay: .35s; }
.scene-play { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 96px; height: 96px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; background: var(--copper-grad); color: var(--sea-950); box-shadow: 0 0 0 12px rgba(255, 227, 176, .14); }
.scene-play .ic { width: 38px; height: 38px; margin-inline-end: -5px; }
.scene-skip { position: absolute; z-index: 2; left: calc(20px + var(--safe-l)); bottom: calc(20px + var(--safe-b)); display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 16px 0 20px; border-radius: 999px; cursor: pointer; background: rgba(0, 0, 0, .35); color: rgba(255, 255, 255, .92); border: 1px solid rgba(255, 255, 255, .24); font-weight: 500; font-size: .95rem; opacity: .8; transition: opacity .2s, background-color .2s; backdrop-filter: blur(6px); }
.scene-skip:hover, .scene-skip:focus-visible { opacity: 1; background: rgba(0, 0, 0, .5); }
.scene-skip .ic { width: 18px; height: 18px; }

/* ---------- Toast + fatal ---------- */
.toast { position: fixed; z-index: var(--z-toast); left: 50%; bottom: calc(24px + var(--safe-b)); translate: -50% 0; padding: 11px 20px; border-radius: 999px; background: var(--cream); color: var(--sea-900); font-weight: 500; box-shadow: 0 16px 34px -10px rgba(0, 0, 0, .6); animation: fade-up .3s var(--ease); }
.fatal { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--sea-bg); text-align: center; }
.fatal div { max-width: 520px; display: flex; flex-direction: column; gap: 10px; }
.fatal h1 { font-family: var(--font-display); font-size: 1.8rem; }
.fatal p { color: var(--muted); }

html.is-kiosk { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .navbar { padding-inline-start: 12px; }
  .brand-text strong { white-space: normal; font-size: .95rem; }
  .brand-text strong .line { display: block; }
  [data-action="fullscreen"] { display: none !important; }
  .icon-btn { width: 42px; height: 42px; }
  .star-label .title { font-size: .92rem; }
  .star-label .kicker, .star-label .meta { font-size: .68rem; }
  .status { padding-bottom: calc(72px + var(--safe-b)); }
}
@media (orientation: landscape) and (max-height: 520px) {
  .status-hint { display: none; }
  .status { padding-bottom: 18px; }
  .waves { height: 60px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .gate-title .w { opacity: 1; transform: none; filter: none; }
}
