/* The HUD inside the Leviathan (ui/islands/ui/leviathan-hud.js, docs/superpowers/specs/2026-11-28-leviathan.md C): restrained, in the body's palette
   (bile gold-green #B7C94A, lantern amber #FFC46B, heart #E0325A, fever #FF6A4A, trust gold #FFD98A, pearl #EAF2FF, cyan rim #7FD8FF).
   Everything is under z-index 20 and ignores the pointer; the veil of the crossings (#leviathanVeil) is written by scene/leviathan-fx.js. */
#leviathan{position:fixed;inset:0;z-index:13;pointer-events:none;color:#EAF2FF;font:500 13px var(--sans);text-shadow:0 1px 3px rgba(0,0,0,.75)}
#leviathan[hidden]{display:none}
#leviathan [hidden]{display:none!important}
/* the ride dims every other panel (islands.css `body.riding>:not(…)`): these two are part of the ride, as #deep and #deepVeil are (the id repeated outweighs that rule's four) */
body.riding>#leviathan#leviathan#leviathan#leviathan#leviathan,body.riding>#leviathanVeil#leviathanVeil#leviathanVeil#leviathanVeil#leviathanVeil{opacity:1!important;pointer-events:none!important}
/* the ride's keys card and the dragon's growth and fire gauges mean nothing inside; its health bar shows only below full (as in the memory sky) */
body:has(#leviathan:not([hidden])) :is(#rideCard,#rideEmber,#rideGrowth){display:none!important}
body:has(#leviathan:not([hidden])) #rideHealth{opacity:calc((1 - var(--hp,1))*40);transition:opacity .6s ease}
body:has(#leviathan:not([hidden])) #ride.hurt #rideHealth{opacity:1}
#leviathan .lv-card{background:rgba(7,22,26,.6);backdrop-filter:blur(12px) saturate(1.1);-webkit-backdrop-filter:blur(12px) saturate(1.1);border:1px solid rgba(127,216,255,.16);border-radius:14px;box-shadow:0 12px 36px rgba(0,0,0,.38)}

/* the goal: one calm line, top centre, under the rail */
#leviathan .lv-goal{position:absolute;left:50%;top:calc(7% + 8px);transform:translateX(-50%);margin:0;max-width:calc(100vw - 36px);padding:6px 16px;border-radius:999px;background:rgba(7,22,26,.46);border:1px solid rgba(127,216,255,.14);font:600 11.5px var(--sans);letter-spacing:.12em;text-transform:uppercase;color:#EAF2FF;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;animation:lvIn .5s ease both}
/* the note: one line under the goal, in for a moment, out by itself (the HUD drops .on after about 5 s) */
#leviathan .lv-note{position:absolute;left:50%;top:calc(7% + 48px);transform:translateX(-50%);margin:0;max-width:calc(100vw - 36px);font:500 12.5px var(--sans);letter-spacing:.06em;color:#FFE9B8;white-space:nowrap;opacity:0}
#leviathan .lv-note.on{animation:lvNote 5s ease both}

/* the zone title: serif capitals with a hairline under the sub line; in, held, out by itself (~4.2 s); a long name ("The Sea of the Swallowed") wraps inside 92vw */
#leviathan .lv-title,#leviathan .lv-film{position:absolute;left:50%;top:42%;transform:translate(-50%,-50%);width:max-content;max-width:92vw;text-wrap:balance;text-align:center;opacity:0}
#leviathan .lv-title.on{animation:lvTitle 4.2s ease both}
#leviathan .lv-title b,#leviathan .lv-film b{display:block;font:600 clamp(36px,6.4vw,88px)/1 var(--serif);letter-spacing:.24em;padding-left:.24em;text-transform:uppercase;color:#F4F8FF;text-shadow:0 0 30px rgba(183,201,74,.4),0 2px 12px rgba(0,0,0,.92)}
#leviathan .lv-title span,#leviathan .lv-film span{display:block;margin:16px auto 0;padding-top:13px;width:max-content;font:600 13px var(--sans);letter-spacing:.22em;text-indent:.22em;text-transform:uppercase;color:#CFE6EC;background:linear-gradient(90deg,transparent,#B7C94A 30%,#B7C94A 70%,transparent) top/100% 1px no-repeat}

/* the meters: thin bars, bottom centre, above the key line; fever and trust only in the blood */
#leviathan .lv-meters{position:absolute;left:50%;bottom:34px;transform:translateX(-50%);display:flex;gap:18px;align-items:flex-end;width:min(440px,calc(100vw - 36px))}
#leviathan .lv-m{flex:1;min-width:0}
#leviathan .lv-m.strain{flex:2}
#leviathan .lv-m>span{display:block;margin:0 0 4px;font:600 9.5px var(--sans);letter-spacing:.16em;text-transform:uppercase;color:rgba(214,232,238,.6)}
#leviathan .lv-m>b{display:block;height:3px;border-radius:2px;background:rgba(190,215,225,.16);overflow:hidden}
#leviathan .lv-m i{display:block;height:100%;transform-origin:0 50%;transform:scaleX(0);transition:transform .25s ease,background-color .4s ease;background:#B7C94A}
#leviathan .lv-m.strain.mid i{background:#FFC46B}
#leviathan .lv-m.strain.hi i{background:#E0325A}
#leviathan .lv-m.fever i{background:#FF6A4A}
#leviathan .lv-m.trust i{background:#FFD98A}

/* the marks: one pooled span each, placed by transform; ships amber, the pool cyan, nests sick green, the memory cells gold */
#leviathan .lv-labels{position:absolute;inset:0;overflow:hidden}
#leviathan .bm{position:absolute;left:0;top:0;white-space:nowrap;font:600 10px/1 var(--sans);letter-spacing:.14em;text-transform:uppercase;color:rgba(234,242,255,.88);text-shadow:0 0 6px rgba(0,0,0,.95),0 1px 2px rgba(0,0,0,.9);will-change:transform,opacity}
#leviathan .bm.ship{color:#FFC46B;letter-spacing:.06em;text-transform:none;font-weight:500;font-size:11px}
#leviathan .bm.pool{color:#BFE3F2;letter-spacing:.2em}
#leviathan .bm.on{color:#fff;letter-spacing:.18em}
#leviathan .bm.valve{color:#EAF2FF;padding:3px 9px;border:1px solid rgba(127,216,255,.55);border-radius:999px;background:rgba(7,22,26,.5)}
#leviathan .bm.nest{color:#7CFF6B;padding:3px 9px;border:1px solid rgba(124,255,107,.5);border-radius:999px;background:rgba(11,12,16,.62)}
#leviathan .bm.cell{color:#FFD98A;letter-spacing:.04em;text-transform:none;font-weight:500}
#leviathan .bm.out{color:#BFE3F2;letter-spacing:.2em;padding:3px 9px;border:1px solid rgba(191,227,242,.5);border-radius:999px}
#leviathan .bm.edge{font-size:9.5px;letter-spacing:.1em;padding:2px 7px;border:1px solid rgba(190,215,225,.35);border-radius:999px;background:rgba(7,22,26,.55)}

/* the card: a run or a lesson, bottom left */
#leviathan .lv-card{position:absolute;left:18px;bottom:18px;max-width:min(36ch,calc(100vw - 36px));padding:12px 15px;line-height:1.4;animation:lvIn .4s ease both}
#leviathan .lv-card b{color:#fff;font-weight:600}
#leviathan .lv-card i{color:#FFC46B;font-style:normal;font-size:11px;letter-spacing:.06em}
#leviathan .lv-kind{margin:0 0 5px;font:600 10.5px var(--sans);letter-spacing:.14em;text-transform:uppercase;color:#FFC46B}
#leviathan .lv-title2{margin:0 0 6px;font:600 15px/1.3 var(--sans);color:#fff;overflow-wrap:anywhere}
#leviathan .lv-line{margin:0;color:rgba(224,236,242,.82);overflow-wrap:anywhere}

/* key hints: one quiet line along the bottom */
#leviathan .lv-hints{position:absolute;left:50%;bottom:10px;transform:translateX(-50%);margin:0;display:flex;flex-wrap:wrap;justify-content:center;gap:2px 8px;max-width:calc(100vw - 36px);font-size:11px;color:rgba(204,224,230,.58)}
#leviathan .lv-hints kbd{font:inherit;font-weight:700;padding:0 5px;border-radius:4px;background:rgba(190,215,225,.14);color:rgba(234,242,255,.85)}
#leviathan .lv-hints span{margin-right:6px}
#leviathan .lv-hints.gone{opacity:0;transition:opacity 1.6s ease}

/* the clean frame (K): only the marks and the film stay; the ride's own HUD goes; the calm: the keys, the card and the meters fade slowly and return quickly;
   under the film's bars (body.leviathan-film) and the zone title nothing else is written */
#leviathan.clean>:not(.lv-film):not(.lv-labels){display:none!important}
body.leviathan-clean #ride{opacity:0}
#leviathan>:is(.lv-hints,.lv-card,.lv-meters),body:has(#leviathan:not([hidden])) #ride{transition:opacity .3s ease}
#leviathan.calm>:is(.lv-hints,.lv-card,.lv-meters),body.leviathan-calm #ride{opacity:0;transition-duration:1.2s}
body.leviathan-film #leviathan>:not(.lv-film):not(.lv-title),body.leviathan-film #ride{opacity:0;transition:none}
/* the narrator's line in the Book film's bar (tale-host.js .tale.film) keeps it to its end, also after the film: here that bar is the meters' row, so in here it stands just over them (.lv-meters: bottom 34px, 20 px high), for the whole line, never a jump (look.md 2) */
body:has(#leviathan:not([hidden])) .tale.film{bottom:62px}
#leviathan:has(.lv-title.on)>:is(.lv-goal,.lv-note,.lv-card,.lv-hints),body:has(#leviathan .lv-title.on) #rideFree{opacity:0}

@keyframes lvIn{from{opacity:0;transform:translate(var(--lv-x,0),6px)}}
#leviathan .lv-goal{--lv-x:-50%}
#leviathan .lv-card{--lv-x:0}
@keyframes lvNote{0%{opacity:0;transform:translate(-50%,-6px)}8%,82%{opacity:1;transform:translate(-50%,0)}100%{opacity:0;transform:translate(-50%,0)}}
@keyframes lvTitle{0%{opacity:0;letter-spacing:.34em}16%,70%{opacity:1}100%{opacity:0}}
@media (max-width:640px){#leviathan .lv-card{bottom:auto;top:60px}#leviathan .lv-meters{bottom:30px;gap:10px}#leviathan .lv-goal{font-size:10.5px}}
@media (prefers-reduced-motion:reduce){#leviathan .lv-goal,#leviathan .lv-card{animation:none}#leviathan .lv-note.on{animation:lvFade .3s ease both}#leviathan .lv-title.on{animation:lvFade .3s ease both}#leviathan .lv-m i{transition:none}}
@keyframes lvFade{from{opacity:0}to{opacity:1}}

/* the veil of the crossings (scene/leviathan-fx.js writes its opacity, background and hidden), over the ride's and the HUD; the gulp's jaws close from top and bottom
   by --gulp 0..1 with an uneven, organic edge (two clip-paths that do not match, so the seam is never a straight line) */
#leviathanVeil{position:fixed;inset:0;pointer-events:none;z-index:14;overflow:hidden}
#leviathanVeil[hidden]{display:none}
#leviathanVeil .jaw{position:absolute;left:0;right:0;height:56%;background:linear-gradient(var(--jaw-dir,180deg),#020608 0%,#050c10 70%,#1a0c14 100%);will-change:transform}
#leviathanVeil .jaw.top{top:0;--jaw-dir:180deg;transform:translateY(calc(-101% * (1 - var(--gulp,0))));clip-path:polygon(0 0,100% 0,100% 90%,94% 96%,88% 89%,81% 97%,73% 91%,66% 98%,58% 90%,50% 95%,43% 88%,35% 96%,27% 90%,19% 97%,11% 91%,5% 96%,0 89%)}
#leviathanVeil .jaw.bottom{bottom:0;--jaw-dir:0deg;transform:translateY(calc(101% * (1 - var(--gulp,0))));clip-path:polygon(0 11%,6% 4%,13% 10%,21% 3%,30% 9%,38% 2%,47% 8%,55% 4%,63% 10%,71% 3%,79% 9%,87% 2%,94% 8%,100% 5%,100% 100%,0 100%)}
/* the shrink's iris (--iris 0..1) and the grow's flood (--flood 0..1), written by scene/leviathan-fx.js */
#leviathanVeil::before{content:"";position:absolute;inset:0;opacity:calc(var(--iris,0) * 100);background:radial-gradient(circle at 50% 50%,transparent 0,transparent calc((1 - var(--iris,0)) * 72vmax),#02090c calc((1 - var(--iris,0)) * 72vmax + 3vmax + 16vmax * (1 - var(--iris,0))))}
#leviathanVeil::after{content:"";position:absolute;inset:0;opacity:calc(var(--flood,0) * 100);background:radial-gradient(circle at 50% 50%,#fff 0,#fff calc(var(--flood,0) * 74vmax),rgba(255,255,255,0) calc(var(--flood,0) * 74vmax + 6vmax + 18vmax * var(--flood,0)))}
