/* Generic theme art layer (THEME-SPEC.md). game.js applyTheme() turns each optional file a
   theme has into a CSS variable (--art-panel ...) and a body flag (data-art-panel ...).
   Every theme is drawn by these same rules, so a new theme needs art, not new code.
   A theme's own theme.css may only fine-tune colors and fonts on top of this. */

/* Background: portrait painting on phones, wide painting on landscape screens. */
body[data-art-background]{background:#d9dee0 var(--art-background) center top/cover no-repeat}
@media(orientation:landscape){body[data-art-background-wide]{background-image:var(--art-background-wide)}}

/* Title art: the wordmark fits inside the header height. */
body[data-art-title]{--title-art-h:clamp(66px,17vw,84px)}
@media(max-height:760px){body[data-art-title]{--title-art-h:clamp(56px,15vw,68px)}}
body[data-art-title] header.top{min-height:var(--title-art-h);height:var(--title-art-h);width:100%}
body[data-art-title] .brand{display:block;position:relative;height:var(--title-art-h);min-height:var(--title-art-h);padding:0 60px}
body[data-art-title] .stitched-title{position:relative;height:100%;width:100%;margin:0}
body[data-art-title] .title-plain{display:none}
body[data-art-title] .quilt-title-art{display:block;width:100%;height:100%;object-fit:contain}
body[data-art-title] .quilt-home,body[data-art-title] .settings-cog{top:calc((var(--title-art-h) - 52px) / 2)}

/* Home and Settings button art (square, transparent around the button). */
body[data-art-home] .quilt-home{background:transparent var(--art-home) center/contain no-repeat;border:0;border-radius:0;box-shadow:none}
body[data-art-home] .quilt-home svg{display:none}
body[data-art-settings] .settings-cog{background:transparent var(--art-settings) center/contain no-repeat;border:0;border-radius:0;box-shadow:none}
body[data-art-settings] .settings-cog svg{display:none}
body[data-art-home] .quilt-home:focus-visible,body[data-art-settings] .settings-cog:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:10px}

/* Stats panel art: nine-slice, so corners keep their shape at any panel size. */
body[data-art-panel] .dashboard{position:relative;isolation:isolate;background:transparent;border:0;box-shadow:none}
body[data-art-panel] .dashboard:before{content:'';position:absolute;inset:0;z-index:-1;border:14px solid transparent;border-image:var(--art-panel) 100 fill / 14px stretch;pointer-events:none}
body[data-art-panel] .status,body[data-art-panel] .scorebar{background:transparent}

/* Board: frame art drawn over the edge, tile art repeated once per cell. */
body[data-art-frame] .board-wrap{background:transparent;border-color:transparent;outline:0;box-shadow:none;overflow:visible;padding:11px}
body[data-art-frame] .board-wrap:after{content:'';position:absolute;z-index:10;inset:0;border:14px solid transparent;border-image:var(--art-frame) 100 / 14px stretch;pointer-events:none}
body[data-art-tile] #stage{background:var(--art-tile) left top/var(--cell) var(--cell) repeat;box-shadow:inset 0 1px 3px #0000002a}

/* Nudge and 988 buttons: one blank surface, nine-slice. Labels stay live text. */
body[data-art-button] .boost,body[data-art-button] .support-link button{position:relative;isolation:isolate;background:transparent;border:0;outline:0;box-shadow:none}
body[data-art-button] .boost:before,body[data-art-button] .support-link button:before{content:'';position:absolute;inset:0;z-index:-1;border:12px solid transparent;border-image:var(--art-button) 100 fill / 12px stretch;pointer-events:none}
body[data-art-button] .boost.armed{outline:2px solid var(--accent);outline-offset:2px;border-radius:12px}

/* 988 symbol art replaces the drawn heart-hands. */
body[data-art-support] #supportBtn svg{display:none}
#supportBtn img.support-art{width:28px;height:28px;object-fit:contain;flex:none}

/* Glows as gold stars cut from the theme's own piece sheet (glowStar: true). */
body[data-glow-star] .glow-orb{background:transparent var(--art-pieces) 50% 100%/300% 200% no-repeat;border:0;border-radius:0;box-shadow:none;filter:grayscale(.85);opacity:.4}
body[data-glow-star] .glow-orb:before,body[data-glow-star] .glow-orb:after{display:none}
body[data-glow-star] .reached .glow-orb{filter:drop-shadow(0 1px 1px #0003);opacity:1}

/* Glows use the theme's own symbol everywhere: the score bar, the level-complete card and
   level select (star when glowStar is true, rings otherwise). Earned and unearned states are
   kept here so the older ring styles in index.html can't turn the star into a square. */
body[data-glow-star] .glow-mark .glow-orb,body[data-glow-star] .glow-mark.reached .glow-orb{background:transparent var(--art-pieces) 50% 100%/300% 200% no-repeat;border:0;border-radius:0;box-shadow:none}
body[data-glow-star] .glow-mark .glow-orb:before,body[data-glow-star] .glow-mark .glow-orb:after{display:none!important}
/* Unearned: a solid slate star, at least 3 : 1 against the panel (studio standard 6). */
body[data-glow-star] .glow-mark:not(.reached) .glow-orb{filter:grayscale(1) brightness(.68) sepia(.15);opacity:1}
/* Ring themes: unearned rings at full strength so their outline stays at least 3 : 1. */
body:not([data-glow-star]) .glow-mark:not(.reached) .glow-orb{opacity:1}
/* Score labels under the Glows are small text: use the label color (4.5 : 1), not the Glow color. */
.result-glows .glow-mark>span:last-child{color:var(--muted)!important}
body[data-glow-star] .glow-mark.reached .glow-orb{filter:drop-shadow(0 1px 1px #0003);opacity:1}
body[data-glow-star] .result-glows .glow-orb{width:38px;height:38px}
.glow-explain{margin:-8px 0 12px!important;font-size:13px!important}
.lvbtn .lv-glows{display:flex;gap:1px;left:50%;transform:translateX(-50%);bottom:2px;letter-spacing:0}
.lvbtn .lv-glows .glow-orb{width:11px;height:11px;border-width:1.5px}
.lvbtn .lv-glows .glow-orb:before,.lvbtn .lv-glows .glow-orb:after{display:none}

/* Tangles: shared hand-drawn overlays for every theme (art/). Dormant = tied cord,
   Growing = vine. The tied piece underneath fades so "this piece is held" reads at a
   glance; the cord/vine shape carries the meaning, not color alone (studio standard 6). */
.tangle,.lesson-icon .tangle{inset:2%;border:0;border-radius:0;box-shadow:none;transform:none;background:url("art/tangle-dormant.webp?v=2026-10-21a") center/contain no-repeat;filter:drop-shadow(0 1px 1.5px #0005)}
.tangle.growing{background-image:url("art/tangle-growing.webp?v=2026-10-21a");animation:tangleGrow 1.6s ease-in-out infinite}
.tangle:before,.tangle:after{display:none}
.gem.locked>svg,.gem.locked>img,.lesson-icon:has(.tangle)>svg{filter:saturate(.45) brightness(.93)}
@keyframes tangleGrow{50%{transform:scale(1.05)}}

/* Badge grid: an odd last badge sits centered instead of hugging the left column. */
.badge-grid>.badge:last-child:nth-child(odd){grid-column:1/-1;justify-self:center;width:calc((100% - 9px)/2)}

/* The level-complete card has an older, more specific rule for an earned 3rd Glow
   (.result-glows .glow-mark.g3.reached) that painted a glowing ball over the star.
   Match its specificity so star themes always show the star. */
body[data-glow-star] .result-glows .glow-mark.g3.reached .glow-orb{background:transparent var(--art-pieces) 50% 100%/300% 200% no-repeat;border:0;border-radius:0;box-shadow:none;filter:drop-shadow(0 1px 1px #0003);opacity:1}

/* Glow art of its own (optional "glow" file, Nov 24, 2026): a theme can give its Glows their own star instead of
   cutting the star piece from its piece sheet. The Kitchen uses a brass-gold star (Jacqui chose it over the brown
   stoneware star piece). Unearned Glows keep the same grayed-out look as before. */
body[data-glow-star][data-art-glow] .glow-orb,body[data-glow-star][data-art-glow] .glow-mark .glow-orb,body[data-glow-star][data-art-glow] .glow-mark.reached .glow-orb,body[data-glow-star][data-art-glow] .result-glows .glow-mark.g3.reached .glow-orb{background:transparent var(--art-glow) center/contain no-repeat}
