/* Lunar (D11). James, 2026-09-30, loved the gold foil and asked for more
   nods to the moon landings. No space agency's name or logo appears anywhere
   (a paid app can't use them), not even in these notes.
   Look reference: inbox/lookdev/space-03-lunar-regolith-shield.png: black
   heat-shield tiles with glowing green (and orange) digits, wrapped in
   crinkled gold foil, on grey regolith under a black sky.
   DESIGNER-OWNED FILE (themes/CONTRACT.md). Every rule is zero-weight
   :where(body[data-theme="lunar"]); keys, panels, inks and lines are set
   through variables only, so selected, matched, row/column and mistake keys
   keep the game's own look.
   Readability (D3/D9) is proved in test/theme-lunar.test.mjs from these
   values, and on pixels in Chromium and WebKit. */

/* ---- Backdrop: black sky, grey regolith, gold hairlines ---- */
/* The page: black space, with the grey glow of the ground at the bottom.
   Its :after is a fixed field of tiny static stars (the twinkling ones are
   the ambient scene's). */
:where(body[data-theme="lunar"]) .ambient{background:radial-gradient(ellipse 130% 34% at 50% 104%,#5b5a5733 0,transparent 70%),radial-gradient(circle at 18% 36%,#1b2238 0,transparent 42%),#040507}
:where(body[data-theme="lunar"]) .ambient:after{opacity:.55;mask-image:linear-gradient(#000 55%,transparent 92%);background-image:radial-gradient(circle at 23px 41px,#f4f1e6d9 0 .7px,transparent 1.3px),radial-gradient(circle at 117px 13px,#dfe8ffb3 0 .6px,transparent 1.2px),radial-gradient(circle at 71px 97px,#fff6dc99 0 .8px,transparent 1.4px),radial-gradient(circle at 151px 133px,#f4f1e680 0 .5px,transparent 1.1px),radial-gradient(circle at 39px 157px,#cfe0ff8c 0 .6px,transparent 1.2px);background-size:173px 181px}
/* Approved photographic sky plates. ambient.js places these with transforms
   on its shared frame loop; no CSS animation, hit target, flash, or trail. */
:where(body[data-theme="lunar"]) .ambient-sprite.lunar-earth,:where(body[data-theme="lunar"]) .ambient-sprite.lunar-earth-stage{background-image:url(lunar/earth-oct6.webp)}
:where(body[data-theme="lunar"]) .ambient-sprite.lunar-ufo,:where(body[data-theme="lunar"]) .ambient-sprite.lunar-ufo-stage{background-image:url(lunar/ufo-oct6.webp)}
:where(body[data-theme="lunar"]) .ambient-sprite.lunar-satellite,:where(body[data-theme="lunar"]) .ambient-sprite.lunar-satellite-stage{background-image:url(lunar/satellite-oct6.webp)}
/* The game card: dark charcoal glass with a gold-foil hairline. */
:where(body[data-theme="lunar"]) .stage-shell{border-color:#d8ad4a3d;background:linear-gradient(168deg,#111216f0,#08090bf4 48%,#0e0f12f0);box-shadow:0 26px 90px #000a,inset 0 1px #f3d58a26}
/* Behind the cube: a cool light around it, and the lunar ground low down:
   a soft horizon at about three quarters of the stage, sunlit at its rim and
   brightening toward the viewer. (Nothing touches the stage's top edge, so
   it runs on from the card's title area without a seam.) */
:where(body[data-theme="lunar"]) .stage:before{background:radial-gradient(ellipse 50% 40% at 47% 46%,#262d3c8c,transparent 72%),radial-gradient(ellipse 75% 7% at 50% 76.5%,#9a958a33,transparent 70%),linear-gradient(180deg,transparent 73.5%,#1a1918 77%,#2f2d2a 86%,#45423d)}
:where(body[data-theme="lunar"]) .stage:after{background:linear-gradient(90deg,#08090b 1%,transparent 19% 100%)}
@media(max-width:720px){:where(body[data-theme="lunar"]) .stage:after{background:none}}
/* The orbit rings around the cube: a faint cyan path and gold dashes. */
:where(body[data-theme="lunar"]) .stage-halo{border-color:#7fdcff1f;box-shadow:0 0 60px #4fb6ff12,inset 0 0 60px #e9c25a10}
:where(body[data-theme="lunar"]) .stage-halo:before{border-color:#e9c25a26}
:where(body[data-theme="lunar"]) .stage-halo:after{border-color:#7fdcff1f}
/* The ground plane: soft regolith shading instead of the grid. (Its grit is
   drawn flat by the ambient scene: fine texture on this steeply tilted plane
   renders as streaks in WebKit.) */
:where(body[data-theme="lunar"]) .floor{background:radial-gradient(ellipse 34% 30% at 30% 46%,#00000024,transparent 70%),radial-gradient(ellipse 30% 26% at 72% 58%,#9d978914,transparent 70%),radial-gradient(ellipse at 50% 42%,#6f6c6438,transparent 70%)}
:where(body[data-theme="lunar"]) .topbar{border-bottom-color:#d8ad4a1f;background:#07080bc7}
:where(body[data-theme="lunar"]) .stage-bottom{border-top-color:#d8ad4a29;background:#0a0b0ecc}
:where(body[data-theme="lunar"]) .reward-overlay{background:#040507db}
/* Crinkled gold-foil artwork in the frame around every face. */
:where(body[data-theme="lunar"]) .face::before{content:'';position:absolute;inset:0;padding:var(--rail,4px);box-sizing:border-box;z-index:6;pointer-events:none;background:linear-gradient(135deg,#8a6418,#e9b84c 10%,#fff1b8 16%,#b9851f 26%,#f3cd66 38%,#8a5f14 48%,#ecbd52 60%,#fff3c8 67%,#a77319 78%,#f0c45a 89%,#7c5512),url(lunar/foil-tile.webp) 0 0/90px 90px;background-blend-mode:hard-light,normal;-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0)}
/* Wide view: Earthrise beside the cube, the lander and flag at its foot. */
@media(min-width:721px){
:where(body[data-theme="lunar"]) .stage-shell{background:linear-gradient(0deg,#00000000 calc(74px + 152px),#000 calc(74px + 196px)),#000}
:where(body[data-theme="lunar"]) .stage-top{background:linear-gradient(180deg,#020306e8 0,#020306a8 62%,#02030600)}
:where(body[data-theme="lunar"]) .stage:before{background:url(lunar/surface.webp) left 8px bottom -46px/307px auto no-repeat;-webkit-mask-image:radial-gradient(ellipse 150px 120px at 105px calc(100% - 150px),#000 55%,#0000);mask-image:radial-gradient(ellipse 150px 120px at 105px calc(100% - 150px),#000 55%,#0000)}
}
/* Phone: Earthrise above the cube; the lander and flag below it. Quick
   Play keeps Earth in the header and the landing scene in the foot. */
@media(max-width:720px){
:where(body[data-theme="lunar"]):where(:not(.flat-view)) .stage-shell{background:radial-gradient(ellipse 62px 16px at calc(100% - 145px) 476px,#000000c7,#00000000 72%),linear-gradient(0deg,#050506 161px,#050506d9 166px,#05050600 214px),#000}
:where(body[data-theme="lunar"]):where(:not(.flat-view)) .stage-top{background:linear-gradient(180deg,#020306e8 0,#020306a8 62%,#02030600)}
:where(body[data-theme="lunar"]):where(:not(.flat-view)) .stage:before{-webkit-mask-image:linear-gradient(90deg,#000 158px,#0000 192px);mask-image:linear-gradient(90deg,#000 158px,#0000 192px);background:radial-gradient(ellipse 62px 16px at calc(100% - 145px) calc(100% - 78px),#000000c7,#00000000 72%),linear-gradient(180deg,#05050600 calc(100% - 52px),#050506d9 calc(100% - 5px)),url(lunar/surface.webp) left -2px bottom -29px/196px auto no-repeat,#000}
:where(body[data-theme="lunar"]):where(.flat-view) .stage-top{background:linear-gradient(180deg,#020306e8 0,#020306a8 62%,#02030600)}
:where(body[data-theme="lunar"]):where(.flat-view) .stage:before{background:#000}
:where(body[data-theme="lunar"]):where(.flat-view) .stage-shell{background:none}
:where(body[data-theme="lunar"]):where(.flat-view) .ambient{background:url(lunar/surface.webp) left -60px top calc(100vw + 155px - 882px)/512px auto no-repeat,#000}
:where(body[data-theme="lunar"]):where(.flat-view) .stage-bottom{background:linear-gradient(90deg,#050506cc calc(100% - 64px),#05050600 calc(100% - 50px)),linear-gradient(180deg,#05050600 41px,#050506cc 50px),url(lunar/surface.webp) right 8px top -112px/92px auto no-repeat,linear-gradient(#050506cc,#050506cc),url(lunar/surface.webp) center bottom/100% auto no-repeat,#000}
:where(body[data-theme="lunar"]):where(:not(.flat-view)) .stage-bottom{background:linear-gradient(#050506cc,#050506cc),url(lunar/surface.webp) center bottom/100% auto no-repeat,#000}
}

/* ---- Digits on plain keys (highlighted keys keep the standard inks) ----
   Givens glow phosphor green, as in the reference; your entries are the
   reference's warm amber, clearly apart from the givens; pencil notes a
   pale console cyan; earned clues a pale gold-cream (inside the lime ring). */
:where(body[data-theme="lunar"]){--ink-given:#86ffa8;--ink-given-glow:#2bff6c5c;--ink-entry:#ffc174;--ink-entry-glow:#ff8a1a6b;--ink-note:#ade8ff;--ink-note-glow:#4fc9ff4d;--ink-earned:#fff7d6;--ink-earned-glow:#ffc23a}

/* ---- Faces: gold foil around every face, gold 3x3 lines ----
   The face border is left clear so the panel's foil shows through it, and
   the panel is foil from the border to the keys' edge (border + rail),
   with near-black under the keys (content-box), so the cell gaps stay dark
   and the gold lines are the only bright breaks. The foil is a CSS sheen:
   a long gold gradient crossed by fine light and dark crinkles. Static (no
   motion), one background per face. */
:where(body[data-theme="lunar"]) .face{--face-rim:#0000;--face-glow:#e3b14a33;--guide:#f3c75c;--guide-glow:#e0a42e85;--gap:#050608;--face-panel:linear-gradient(#08090b,#08090b) content-box,repeating-linear-gradient(104deg,#fff3c600 0 6px,#fff3c670 7px,#fff3c600 9px 16px) border-box,repeating-linear-gradient(31deg,#3a250600 0 9px,#3a250666 10px,#3a250600 12px 22px) border-box,linear-gradient(135deg,#6b480f,#d6a43c 8%,#fff0b4 14%,#a8761c 23%,#f1c95f 35%,#6d480e 45%,#e6b64a 57%,#fff2c2 65%,#9a6a16 76%,#efc358 88%,#6c470e) border-box}
/* Front+back: charcoal heat-shield tiles. */
:where(body[data-theme="lunar"]) .face-front .voxel,:where(body[data-theme="lunar"]) .face-back .voxel{--key:linear-gradient(145deg,#37393e,#121316);--band-hi:#e6eaf063;--band-lo:#040405ad;--lit-side:#d3d8e0b8;--lit-top:#eceff4c9}
/* Right+left: a dark gold-foil tint (bronze), lit in gold. */
:where(body[data-theme="lunar"]) .face-right .voxel,:where(body[data-theme="lunar"]) .face-left .voxel{--key:linear-gradient(145deg,#5a4316,#160f04);--band-hi:#ffd97a6b;--band-lo:#0d0802b3;--lit-side:#f5cd6cb8;--lit-top:#ffe2a0cc}
:where(body[data-theme="lunar"]) .face-right,:where(body[data-theme="lunar"]) .face-left{--guide:#ffd978}
/* Top+bottom: deep space navy, lit in pale starlight blue. */
:where(body[data-theme="lunar"]) .face-top .voxel,:where(body[data-theme="lunar"]) .face-bottom .voxel{--key:linear-gradient(145deg,#1c2a59,#0a1029);--band-hi:#b9c9ff5e;--band-lo:#02040cad;--lit-side:#aebfffb8;--lit-top:#cad6ffcc}

/* The menu tile: a gold-foil edge on its swatch. */
#theme-choices [data-theme-choice="lunar"] .theme-swatch{box-shadow:inset 0 0 0 1px #e9c25a99}

/* 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="lunar"]){--material-gap:2px}
@media(max-width:500px){:where(body[data-theme="lunar"]){--material-gap:1px}}
:where(body[data-theme="lunar"]) .face::after{content:'';position:absolute;inset:var(--rail);z-index:4;pointer-events:none;opacity:.05;background-image:url(lunar/foil-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="lunar"]) .face{--pair-rim-3d:1px}
