/* Ectoplasm (D11). James, 2026-09-30: "add ghosts flying around and a witch
   going across the moon ... maybe with some movement of a witch passing across
   the moon". Look reference: inbox/lookdev/seasonal-halloween-02-spectral-ectoplasm.png:
   a cube of dark glass (black, violet, teal) haunted by green ectoplasm,
   ghost-green and violet numbers, a moonlit graveyard mist; the plate's
   cemetery gate round the cube, its moon in the header with the witch
   crossing it, and ghosts drifting by (the mist, ghosts and witch are
   ecto.js's scene).
   DESIGNER-OWNED FILE (themes/CONTRACT.md). Every rule is zero-weight
   :where(body[data-theme="ecto"]); keys, panels, inks and lines are set
   through variables only, so a selected, matched, row/column or mistake key
   always keeps the game's own look. Readability is measured, not guessed:
   test/theme-ecto.test.mjs (declared colours) and the browser D3/D9 checks.
   Left navy on purpose (shared, not themeable): the native safe-area strips,
   meta theme-color #090b17 and the game's buttons. */

/* ---- Backdrop: the plate (ecto/graveyard.webp, see ASSET-SOURCES.md) ----
   A violet night sky over a cemetery gate, its tombstones lit by green
   ectoplasm. Its full moon is in ecto/moon.webp too, so the moon can sit
   where the phone has room: the plate's own moon, cut out of
   ecto/graveyard.webp (420 x 420 plate px round its centre, 424/223, disc
   radius 159) with a soft alpha edge and scaled to 252 px, by Claude Opus
   5.5 on 2026-10-01; no other edit.
   Phones (the card is the screen less 8 px: W = 100vw - 8px):
   - the card: the plate at the card's width, raised by 420 of its pixels
     (0.4924 W), so its big moon is above the card and the header shows the
     starry sky;
   - 3D: the stage's foot (.stage:before) carries the gate, fence and
     tombstones in the green mist (the plate's y 1660 at the stage's bottom
     edge), faded in under the cube so no edge shows; the bar below runs on
     from it;
   - the moon: in the header, between the title and the mode label (its
     centre 17.5 px right of the card's middle and 40 px down; disc radius
     28 px), where the scene's witch crosses it (ecto.js MOON);
   - a flat board covers the stage: the bar under it carries the gate's
     spires and arch (the plate from y 1250). */
:where(body[data-theme="ecto"]) .ambient{background:radial-gradient(ellipse 95% 38% at 50% 0%,#2a2340,transparent 72%),radial-gradient(ellipse 75% 30% at 50% 104%,#2fbf5a30,transparent 70%),#08060f}
:where(body[data-theme="ecto"]) .ambient:after{background-image:none}
:where(body[data-theme="ecto"]) .stage-shell{background:radial-gradient(ellipse 120% 34% at 50% 0%,#2a23408f,transparent 76%),linear-gradient(172deg,#0e0b18ef,#08060ff5 50%,#0d0a16ef);border-color:#5dff8a2b;box-shadow:0 26px 90px #000b,inset 0 1px #c8ffd61a}
:where(body[data-theme="ecto"]) .stage-top{background:none}
@media(max-width:720px){
:where(body[data-theme="ecto"]) .stage-shell{background:url(ecto/moon.webp) calc(50% + 17.5px) 3px/74px 74px no-repeat,url(ecto/graveyard.webp) 0 calc((100vw - 8px) * -.4924)/100% auto no-repeat,#0b0915}
:where(body[data-theme="ecto"]) .stage:before{background:radial-gradient(ellipse 60% 50% at 50% 52%,#2fd06a2e,transparent 72%)}
:where(body[data-theme="ecto"]):where(:not(.flat-view)) .stage:before{background:radial-gradient(ellipse 60% 50% at 50% 52%,#2fd06a2e,transparent 72%),url(ecto/graveyard.webp) 0 calc(100% + (100vw - 8px) * .2157)/100% auto no-repeat;-webkit-mask-image:linear-gradient(#0000 0,#0000 40%,#000 62%);mask-image:linear-gradient(#0000 0,#0000 40%,#000 62%)}
:where(body[data-theme="ecto"]):where(:not(.flat-view)) .stage-bottom{background:url(ecto/graveyard.webp) 0 calc((100vw - 8px) * -1.9461)/100% auto no-repeat,#0b0915;border-top-color:#5dff8a00}
:where(body[data-theme="ecto"]):where(.flat-view) .stage-bottom{background:url(ecto/graveyard.webp) 0 calc((100vw - 8px) * -1.4654)/100% auto no-repeat,#0b0915;border-top-color:#5dff8a2e}
:where(body[data-theme="ecto"]) .stage:after{background:none}
}
/* (Under 370 px the title and the label leave no room: no moon, and no witch.) */
@media(max-width:369px){:where(body[data-theme="ecto"]) .stage-shell{background:url(ecto/graveyard.webp) 0 calc((100vw - 8px) * -.4924)/100% auto no-repeat,#0b0915}}
/* Wider screens: the plate's foot on the card's (its big moon then falls
   above the card, the gate and tombstones rise beside the cube), a dark
   sky over the header, and the moon there (centre 52 px right of the card's
   middle, 50 px down, disc radius 22 px; none from 721 to 779 px, where the
   title and the label meet). */
@media(min-width:721px){
:where(body[data-theme="ecto"]) .stage-shell{background:linear-gradient(180deg,#0b0915 0,#0b091500 90px),url(ecto/graveyard.webp) 0 100%/100% auto no-repeat,#0b0915}
:where(body[data-theme="ecto"]) .stage:before{background:radial-gradient(ellipse 50% 50% at 50% 54%,#2fd06a30,transparent 72%)}
:where(body[data-theme="ecto"]) .stage:after{background:linear-gradient(90deg,#0b0915 0,#0b091500 7% 93%,#0b0915 100%)}
:where(body[data-theme="ecto"]) .stage-bottom{background:#0b0915b3;border-top-color:#5dff8a1f}
}
@media(min-width:780px){:where(body[data-theme="ecto"]) .stage-shell{background:url(ecto/moon.webp) calc(50% + 52px) 21px/58px 58px no-repeat,linear-gradient(180deg,#0b0915 0,#0b091500 90px),url(ecto/graveyard.webp) 0 100%/100% auto no-repeat,#0b0915}}
/* The orbit rings and the floor grid: spectral green instead of cyan. */
:where(body[data-theme="ecto"]) .stage-halo{border-color:#5dff8a1f;box-shadow:0 0 60px #2fd06a1f,inset 0 0 60px #7a4bd61c}
:where(body[data-theme="ecto"]) .stage-halo:before,:where(body[data-theme="ecto"]) .stage-halo:after{border-color:#8dffb01c}
:where(body[data-theme="ecto"]) .floor{background:repeating-linear-gradient(0deg,#5dff8a17 0 1px,transparent 1px 35px),repeating-linear-gradient(90deg,#5dff8a17 0 1px,transparent 1px 35px)}
/* Chrome around it. */
:where(body[data-theme="ecto"]) .topbar{background:#08060fc7;border-bottom-color:#5dff8a1a}
:where(body[data-theme="ecto"]) .reward-overlay{background:#030605de}

/* ---- Digits on plain keys (highlighted keys keep the standard inks) ----
   Givens: ghost green. Entries (and earned clues, as on Supercharged where
   both are lime): spectral violet. Notes: pale mint. */
:where(body[data-theme="ecto"]){--ink-given:#8cffa0;--ink-given-glow:#2dff6aa6;--ink-entry:#d2b8ff;--ink-entry-glow:#9a5cffa6;--ink-note:#d4ffe2;--ink-note-glow:#5dff8a59;--ink-earned:#d2b8ff;--ink-earned-glow:#b07cff}

/* ---- Faces: front+back black glass, right+left deep violet glass, top+bottom
   dark teal glass; ghost-green 3x3 lines; glass bevels; a green aura.
   The real glass-tile artwork is repeated at the keys' corners by the
   face pseudo-element below; the gradients add a brighter bevel while
   keeping the centre clear of texture. ---- */
:where(body[data-theme="ecto"]) .face{--face-rim:#030605;--face-glow:#3dff7a57;--guide:#4fe88c;--guide-glow:#22ff6a99;--gap:#020504}
:where(body[data-theme="ecto"]) .face-front,:where(body[data-theme="ecto"]) .face-back{--face-panel:#050a09}
:where(body[data-theme="ecto"]) .face-front .voxel,:where(body[data-theme="ecto"]) .face-back .voxel{--key:radial-gradient(circle at 0 0,#e2ffeeb3 0 .5px,#e2ffee00 4.5px),radial-gradient(circle at 100% 100%,#3dff7a73 0 1px,#3dff7a00 6px),linear-gradient(145deg,#d2ffe226 0,#d2ffe200 24% 76%,#2dff6a38 100%),linear-gradient(145deg,#222a2c,#0a0d0e);--band-hi:#dcffea5c;--band-lo:#000000b3;--lit-side:#9edcbcb3;--lit-top:#c4f2d8c2}
:where(body[data-theme="ecto"]) .face-right,:where(body[data-theme="ecto"]) .face-left{--face-panel:#0e0721}
:where(body[data-theme="ecto"]) .face-right .voxel,:where(body[data-theme="ecto"]) .face-left .voxel{--key:radial-gradient(circle at 0 0,#e2ffeeb3 0 .5px,#e2ffee00 4.5px),radial-gradient(circle at 100% 100%,#3dff7a73 0 1px,#3dff7a00 6px),linear-gradient(145deg,#d2ffe226 0,#d2ffe200 24% 76%,#2dff6a38 100%),linear-gradient(145deg,#3d2470,#1b1036);--band-hi:#e2d2ff5c;--band-lo:#06021099;--lit-side:#c4a8f4c2;--lit-top:#dccafccc}
:where(body[data-theme="ecto"]) .face-top,:where(body[data-theme="ecto"]) .face-bottom{--face-panel:#03140f}
:where(body[data-theme="ecto"]) .face-top .voxel,:where(body[data-theme="ecto"]) .face-bottom .voxel{--key:radial-gradient(circle at 0 0,#e2ffeeb3 0 .5px,#e2ffee00 4.5px),radial-gradient(circle at 100% 100%,#3dff7a73 0 1px,#3dff7a00 6px),linear-gradient(145deg,#d2ffe226 0,#d2ffe200 24% 76%,#2dff6a38 100%),linear-gradient(145deg,#0f4a45,#06231f);--band-hi:#c4fff25c;--band-lo:#010a08b3;--lit-side:#8ee6d4c2;--lit-top:#b4f4e6cc}

/* ---- Sprites (ecto.js scene: kit.sprite('ecto-ghost'), kit.sprite('ecto-witch')) ----
   The real art (see ASSET-SOURCES.md), both with their own transparency:
   - ghost (ecto/ghost.webp, 512 x 512, a glowing ghost with its glow as
     alpha): drawn so its body (106..402 x 57..448 of the art) fills the
     sprite's 54 x 67 box;
   - witch (ecto/witch.webp, 960 x 480, a black silhouette on a broom flying
     left to right): her 2:1 art fills the 52 x 26 box. */
:where(body[data-theme="ecto"]) .ambient-sprite.ecto-ghost{--ecto-ghost-art:url(ecto/ghost.webp);width:54px;height:67px;margin:-33.5px 0 0 -27px;background:var(--ecto-ghost-art) -16.5px -9.8px/87.7px 87.7px no-repeat}
:where(body[data-theme="ecto"]) .ambient-sprite.ecto-witch{--ecto-witch-art:url(ecto/witch.webp);width:52px;height:26px;margin:-13px 0 0 -26px;background:var(--ecto-witch-art) center/contain no-repeat}

/* ---- The menu tile: its swatch glows like the ectoplasm. ---- */
#theme-choices [data-theme-choice="ecto"] .theme-swatch{box-shadow:inset 0 0 0 1px #5dff8a47,inset 0 -6px 10px #2fd06a2b}

/* Real material at each key's corners. One static layer per face, below the
   box lines, with a clear centre. The 5% opacity bounds even a black/white
   material pixel; it preserves the three face-pair colours. The repeat
   pitch follows the shared grid (nine cells and its existing gaps).
   No per-key filter, shadow, animation or extra DOM. */
:where(body[data-theme="ecto"]){--material-gap:2px}
@media(max-width:500px){:where(body[data-theme="ecto"]){--material-gap:1px}}
:where(body[data-theme="ecto"]) .face::after{content:'';position:absolute;inset:var(--rail);z-index:4;pointer-events:none;opacity:.05;background-image:url(ecto/glass-tile.webp);background-size:calc((100% + var(--material-gap))/9) calc((100% + var(--material-gap))/9);background-repeat:repeat;-webkit-mask-image:radial-gradient(circle at 2px 2px,#000 0 2px,#0000 4px),radial-gradient(circle at calc(100% - 4px) calc(100% - 4px),#000 0 2px,#0000 4px);mask-image:radial-gradient(circle at 2px 2px,#000 0 2px,#0000 4px),radial-gradient(circle at calc(100% - 4px) calc(100% - 4px),#000 0 2px,#0000 4px);-webkit-mask-size:calc((100% + var(--material-gap))/9) calc((100% + var(--material-gap))/9);mask-size:calc((100% + var(--material-gap))/9) calc((100% + var(--material-gap))/9);-webkit-mask-repeat:repeat;mask-repeat:repeat}
/* Top/Bottom key edges in 3D stay 1 px for this theme (its gaps and box lines measured right at 1 px). */
:where(body[data-theme="ecto"]) .face{--pair-rim-3d:1px}
