/* Castle Siege — game-specific styles (shared tokens come from /assets/css/game.css). Utility, question-card, letter-box, start/end card rules are the same as Word Tower. */
/* Word Tower — game-specific styles (shared tokens come from /assets/css/game.css). Utility, question-card and letter-box rules are the same as Connect Quiz. */
/* Connect Quiz — game-specific styles (shared tokens come from /assets/css/game.css) */
.link-btn{background:none;border:0;padding:0;color:var(--sky);font:700 .82rem 'Inter',sans-serif;cursor:pointer;text-align:left}
.link-btn:hover{text-decoration:underline}
.hide-xs{display:inline}
.btn.danger{background:#3b0a14;color:#fecdd3}.btn.danger:hover{background:var(--rose);color:#fff}
.top-list{margin:0.625rem 0 0;padding:0;list-style:none;display:flex;flex-direction:column;gap:4px;font-weight:700;font-size:.88rem}
.top-list li{display:flex;justify-content:space-between;gap:0.5rem;color:var(--soft)}
.top-list li:nth-child(1) b{color:var(--gold)}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:0.75rem}
.check-row{display:flex;align-items:center;gap:0.5rem;font-weight:600;font-size:.9rem;margin:3px 0}
.check-row i{width:1.2em;text-align:center;color:var(--sky)}
.fc-item{display:flex;align-items:center;gap:0.375rem;background:var(--bg);border:2px solid var(--hard);border-radius:0.625rem;padding:4px 0.375rem}
.fc-item input[type=text]{flex:1;min-width:0;border:0;background:transparent;padding:5px 4px;border-radius:0.375rem;font-weight:700;font-size:.88rem}
.fc-item input[type=text]:focus{outline:2px solid var(--sky);border:0}
.cs-item-f{flex:1;min-width:0;display:flex;flex-direction:column}
.cs-item-f input+input{font-weight:500;font-size:.8rem;color:var(--soft)}
.fc-thumb{width:2.5rem;height:2.5rem;flex:none;border-radius:0.5rem;border:2px solid var(--hard);background:var(--panel2);cursor:pointer;padding:0;overflow:hidden;display:grid;place-items:center;font-size:1.3rem;color:var(--muted)}
.fc-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.fc-thumb:hover{filter:brightness(1.12)}
.mini{border:0;background:transparent;color:var(--muted);cursor:pointer;font-size:.8rem;width:1.75rem;height:1.75rem;border-radius:50%;flex:none;display:grid;place-items:center}
.mini:hover:not(:disabled){background:var(--panel2);color:var(--text)}
.mini.del:hover{background:var(--rose);color:#fff}
.fc-none{text-align:center;color:var(--muted);padding:0.75rem 0.375rem;font-size:.88rem;margin:0}

/* ---- the question card ---- */
/* letter boxes, tiles, keyboard */

/* ================================================================ THEMES
   Every theme sets the same variables: --p0 / --p1 (the two team colours), --w-sky and --w-ground (scene and floor), --hill1/2 (the hills), --st1/2 (stone brick), --wd1/2 (wooden brick), --accent. */
[data-cst=classic]{--accent:#f59e0b;--p0:#3b82f6;--p1:#ef4444;--w-sky:linear-gradient(#7dd3fc,#e0f2fe 80%);--w-ground:linear-gradient(#65a30d,#365314);--hill1:#86efac;--hill2:#4ade80;--st1:#e5e7eb;--st2:#9ca3af;--wd1:#c58a3a;--wd2:#92400e;--d1:'☁️';--d2:'☁️';--d3:'☁️'}
[data-cst=desert]{--accent:#f97316;--p0:#2563eb;--p1:#dc2626;--w-sky:linear-gradient(#fdba74,#fef3c7 78%);--w-ground:linear-gradient(#e9c46a,#b7791f);--hill1:#fcd34d;--hill2:#f59e0b;--st1:#fde7b0;--st2:#d4a762;--wd1:#a16207;--wd2:#713f12;--d1:'☁️';--d2:'☁️';--d3:'☀️'}
[data-cst=frost]{--accent:#38bdf8;--p0:#2563eb;--p1:#e11d48;--w-sky:linear-gradient(#bfdbfe,#f0f9ff 80%);--w-ground:linear-gradient(#f8fafc,#cbd5e1);--hill1:#e2e8f0;--hill2:#cbd5e1;--st1:#e0f2fe;--st2:#7dd3fc;--wd1:#94a3b8;--wd2:#475569;--d1:'❄️';--d2:'☁️';--d3:'❄️'}
[data-cst=candy]{--accent:#ec4899;--p0:#0ea5e9;--p1:#e11d48;--w-sky:linear-gradient(#fbcfe8,#fdf2f8 80%);--w-ground:linear-gradient(#fef3c7,#fbbf24);--hill1:#fda4af;--hill2:#f9a8d4;--st1:#fbcfe8;--st2:#f472b6;--wd1:#a16207;--wd2:#713f12;--d1:'🍭';--d2:'☁️';--d3:'🍬'}
.p0{--pc:var(--p0)}.p1{--pc:var(--p1)}

/* ================================================================ LAYOUT (1.61.0: board first)
   The scene is the whole game: sky to the top edge, both castles on the ground, one slim bar underneath. Score / time / menu float over the sky, the Rock and Fire
   buttons appear in the sky while you aim, and the question is a popup over the board. A pause with a Continue button follows each turn. */
.cs-stage{display:flex;flex-direction:column;gap:0.5rem;position:relative}
.cs-stage .stage-head{margin:0}
.cs-play{display:flex;flex-direction:column;min-height:0;position:relative}
.gic-fit-box .cs-play{flex:1 1 auto;min-height:0}
.cs-scenecol{display:flex;flex-direction:column;flex:1 1 auto;min-width:0;min-height:0}
.cs-scene{--cs-top:0.625rem;--cs-ptop:0.625rem;position:relative;display:flex;flex-direction:column;flex:1 1 auto;height:clamp(440px,44vw,580px);border-radius:1rem;overflow:hidden;background:var(--w-sky);border:3px solid var(--hard);isolation:isolate;--u:1.25rem;--gh:3rem}
.gic-fit-box .cs-scene{height:auto;min-height:0;flex:1 1 0}
.cs-world{position:relative;flex:1 1 auto;min-height:0;overflow:hidden}
.cs-build{padding-top:var(--cs-top,0.5rem)}
.cs-bar{position:absolute;left:0;right:0;top:var(--cs-top,0.625rem);z-index:8;display:flex;justify-content:center;height:auto;min-height:0;padding:0 2.875rem;background:none;pointer-events:none}   /* the message floats in the sky as a small pill (no bar under the ground) */
#csPlay.asking .cs-bar{display:none}   /* the question card says it all */
.cs-msg{margin:0;flex:0 1 auto;min-width:0;text-align:center;font-weight:700;font-size:.85rem;line-height:1.25;max-height:calc(2.5em + 0.375rem);overflow:hidden;color:#fff;background:rgba(15,23,42,.62);border-radius:6.1875rem;padding:3px 0.875rem}
.cs-msg:empty{display:none}
.cs-msg.ok{color:#bbf7d0}.cs-msg.bad{color:#fecdd3}
.cs-go{flex:none;display:inline-flex;align-items:center;gap:0.5rem;height:var(--dh,2.25rem);min-height:0;box-sizing:border-box;padding:0 1.125rem;line-height:1;white-space:nowrap;border-radius:6.1875rem;border:0;background:var(--accent);color:#111827;font:800 1rem 'Baloo 2',system-ui,sans-serif;cursor:pointer;box-shadow:0 2px 8px rgba(0,0,0,.45);touch-action:manipulation;animation:csnudge 2.6s ease-in-out infinite}
.cs-go[hidden]{display:none}
.cs-go:hover{filter:brightness(1.08)}
@keyframes csnudge{50%{transform:scale(1.03);box-shadow:0 2px 8px rgba(0,0,0,.45),0 0 14px 3px rgba(251,191,36,.6)}}   /* a slow breath and glow, not a jump */
/* the sky (sun, clouds, balloons, snow, sweets, birds) is drawn on a canvas by assets/js/sky.js */
.cs-sky{position:absolute;inset:0;z-index:0;pointer-events:none;overflow:hidden}
.cs-hills{position:absolute;inset:0;z-index:1;pointer-events:none;overflow:hidden}   /* assets/js/scenery.js paints the hills, trees and the ground strip in here */
.cs-field{position:absolute;top:0;bottom:var(--gh);z-index:2;touch-action:pan-y}
.cs-field.aiming{touch-action:none;cursor:crosshair}
.cs-field.shake{animation:csshake .5s ease-in-out}
@keyframes csshake{15%{transform:translate(-3px,2px)}35%{transform:translate(3px,-2px)}55%{transform:translate(-2px,1px)}75%{transform:translate(2px,-1px)}}
.cs-castle{position:absolute;bottom:0;width:calc(var(--cols) * var(--u));height:calc(var(--rows) * var(--u))}
.cs-castle.left{left:var(--u)}.cs-castle.right{right:var(--u)}
.cs-ground{position:absolute;left:0;right:0;bottom:0;height:var(--gh);box-sizing:border-box;z-index:3;display:flex;justify-content:space-between;align-items:center;gap:0.625rem;padding:var(--lip,0.625rem) 0.875rem 0}   /* the soil itself is painted by the scenery canvas */
.cs-scene.building .cs-field,.cs-scene.building .cs-ground{visibility:hidden}

/* ---- the bricks ---- */
.cs-b{position:absolute;width:var(--u);height:var(--u);left:calc(var(--c) * var(--u));bottom:calc(var(--r) * var(--u))}
.cs-castle.right .cs-b{left:auto;right:calc(var(--c) * var(--u))}
.cs-b .f,.cs-bc .f,.cs-bpal .sw{position:absolute;inset:0;border-radius:2px}
.cs-b.ts .f,.cs-b.tk .f,.cs-bc.ts .f,.cs-bc.tk .f,.cs-bpal .sw.ts{background:linear-gradient(rgba(255,255,255,.38),rgba(255,255,255,0) 48%),linear-gradient(var(--st1),var(--st2));box-shadow:inset 0 0 0 1px rgba(0,0,0,.32),inset 0 -3px 0 rgba(0,0,0,.14)}
.cs-b.tw .f,.cs-bc.tw .f,.cs-bpal .sw.tw{background:repeating-linear-gradient(90deg,rgba(0,0,0,.14) 0 2px,transparent 2px 0.4375rem),linear-gradient(var(--wd1),var(--wd2));box-shadow:inset 0 0 0 1px rgba(0,0,0,.4),inset 0 -3px 0 rgba(0,0,0,.18)}
.cs-b.hurt .f::before{content:"";position:absolute;inset:0;background:linear-gradient(118deg,transparent 44%,rgba(0,0,0,.6) 45% 49%,transparent 50%),linear-gradient(62deg,transparent 58%,rgba(0,0,0,.5) 59% 62%,transparent 63%)}
.cs-b.tk.show .f{box-shadow:inset 0 0 0 2px #facc15,0 0 calc(var(--u) * .5) #facc15}
.cs-b.tk.show .f::after,.cs-bc .k{content:"💰";position:absolute;inset:0;display:grid;place-items:center;font-size:calc(var(--u) * .72);font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif}
.cs-b.pop .f{animation:cspop2 .42s ease-out forwards}
@keyframes cspop2{30%{transform:scale(1.3);filter:brightness(2)}to{transform:scale(.1) rotate(50deg);opacity:0}}
.cs-b.fall{animation:csfall 1s ease-in var(--dl,0ms) forwards}
@keyframes csfall{20%{transform:translate(calc(var(--tx,0.625rem) * .2),0) rotate(calc(var(--rot,30deg) * .3))}to{transform:translate(var(--tx,0.625rem),calc(var(--u) * 3)) rotate(var(--rot,30deg));opacity:0}}
.cs-b.rise .f{animation:csrise .5s ease-out both}
@keyframes csrise{from{transform:translateY(calc(var(--u) * -2.5));opacity:0}}
.cs-ret{border:3px solid #facc15;border-radius:0.375rem;box-shadow:0 0 12px #facc15,inset 0 0 8px rgba(250,204,21,.5);pointer-events:none;z-index:4;animation:cspulse .7s ease-in-out infinite alternate}
@keyframes cspulse{to{transform:scale(1.14)}}
.cs-spy{position:absolute;left:calc(var(--c) * var(--u));bottom:calc(var(--r) * var(--u));width:calc(var(--u) * 3);height:calc(var(--u) * 3);border:3px dashed #a78bfa;border-radius:0.625rem;pointer-events:none;display:grid;place-items:center;z-index:3;background:rgba(167,139,250,.14);animation:cspulse 1s ease-in-out infinite alternate}
.cs-castle.right .cs-spy{left:auto;right:calc(var(--c) * var(--u))}
.cs-spy span{color:#ede9fe;font:800 calc(var(--u) * 1.5) 'Baloo 2',system-ui,sans-serif;text-shadow:0 1px 3px rgba(0,0,0,.6)}
.cs-boom{position:absolute;left:calc(var(--c) * var(--u) - var(--u));bottom:calc(var(--r) * var(--u) - var(--u));line-height:1;pointer-events:none;z-index:5;animation:csboom .8s ease-out forwards;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif}
.cs-castle.right .cs-boom{left:auto;right:calc(var(--c) * var(--u) - var(--u))}
.cs-fx .cs-boom.miss{animation-duration:.9s}
@keyframes csboom{from{transform:scale(.3);opacity:1}to{transform:scale(1.3);opacity:0}}

/* ---- catapults, stones, aiming ---- */
.cs-cat{position:absolute;bottom:0;width:calc(var(--u) * 3.5);height:calc(var(--u) * 2.45);z-index:3}
.cs-cat.left{--pc:var(--p0)}.cs-cat.right{--pc:var(--p1);transform:scaleX(-1)}
.cs-cat svg{width:100%;height:100%;overflow:visible}
.cs-cat .arm{transform-origin:34px 22px;transform-box:view-box;transform:rotate(158deg);transition:transform .6s ease-out}
.cs-cat.fired .arm{transform:rotate(302deg);transition-duration:.1s}
/* the scoop hangs from the arm's tip and counter-rotates, so it stays the right way up (tipping forward as the arm throws) instead of turning over with the arm */
.cs-cat .cupg{transform-origin:66.5px 20px;transform-box:view-box;transform:rotate(-158deg);transition:transform .6s ease-out}
.cs-cat.fired .cupg{transform:rotate(-262deg);transition-duration:.1s}
.cs-cat .ar{fill:#a8672a;stroke:#3b2410;stroke-width:1.2;stroke-linejoin:round}.cs-cat .arhi{fill:rgba(255,255,255,.28)}
.cs-cat .rope{stroke:#e8d3a2;stroke-width:1.5;fill:none;stroke-linecap:round}
.cs-cat .bag{fill:var(--pc);stroke:#111827;stroke-width:1.2}.cs-cat .bagline{stroke:rgba(0,0,0,.35);stroke-width:1;fill:none}
.cs-cat .cup{fill:#6b4423;stroke:#2a170a;stroke-width:1.2;stroke-linejoin:round}
.cs-cat .ammo{fill:#9ca3af;stroke:#374151;stroke-width:1.2;transition:opacity .35s ease .35s}.cs-cat.fired .ammo{opacity:0;transition:none}
.cs-cat .ammohi{stroke:#fff;stroke-width:1;fill:none;opacity:.7;stroke-linecap:round}
.cs-cat .post{fill:#8a5a2b;stroke:#3b2410;stroke-width:1.2;stroke-linejoin:round}.cs-cat .post.hi{fill:rgba(255,255,255,.22);stroke:none}
.cs-cat .brace{fill:#7c4a1e;stroke:#3b2410;stroke-width:1}
.cs-cat .beam{fill:#8a5a2b;stroke:#3b2410;stroke-width:1.3}.cs-cat .beamhi{fill:rgba(255,255,255,.25)}
.cs-cat .iron{fill:#4b5563;stroke:#111827;stroke-width:.8}
.cs-cat .axle{fill:#6b7280;stroke:#111827;stroke-width:1.3}.cs-cat .axhi{fill:#e5e7eb}.cs-cat .skein{fill:none;stroke:#d9c08a;stroke-width:1;opacity:.9}
.cs-cat .tire{fill:#2b2118;stroke:#0b0b0b;stroke-width:1}.cs-cat .rim{fill:#a86f34;stroke:#3b2410;stroke-width:.8}
.cs-cat .spk{stroke:#3b2410;stroke-width:1.2;fill:none;stroke-linecap:round}.cs-cat .hub{fill:#4b5563;stroke:#111827;stroke-width:.8}
.cs-cat .pole{stroke:#4b3621;stroke-width:1.2}
.cs-cat .pen{fill:var(--pc);stroke:rgba(0,0,0,.4);stroke-width:.6;transform-box:fill-box;transform-origin:left center}
html[data-gfx=low] .cs-cat .pen{animation:none}
.cs-aim{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:6;overflow:visible}
.cs-aim polyline{fill:none;stroke:#fff;stroke-width:4;stroke-linecap:round;stroke-dasharray:.1 11;filter:drop-shadow(0 0 2px rgba(0,0,0,.7))}
.cs-fx{position:absolute;left:0;bottom:0;width:0;height:0;overflow:visible;z-index:7;pointer-events:none}
.cs-stone{position:absolute;left:0;bottom:0;display:grid;place-items:center;border-radius:50%;line-height:1;will-change:transform;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif}
.cs-stone.k-pebble,.cs-ammo-ic.k-pebble{border-radius:52% 48% 55% 45% / 48% 56% 44% 52%;background:radial-gradient(circle at 30% 26%,rgba(255,255,255,.75) 0 12%,transparent 30%),radial-gradient(circle at 70% 70%,rgba(60,50,40,.35) 0 14%,transparent 38%),radial-gradient(circle at 60% 35%,rgba(120,100,80,.35) 0 8%,transparent 20%),linear-gradient(150deg,#e5e1da,#a8a29a 60%,#77716a);box-shadow:inset -1px -2px 2px rgba(0,0,0,.35),0 0 0 1px #4b4540;font-size:0!important}
.cs-stone.k-rock,.cs-ammo-ic.k-rock{border-radius:38% 62% 46% 54% / 56% 40% 60% 44%;background:radial-gradient(circle at 28% 24%,rgba(255,255,255,.5) 0 10%,transparent 26%),radial-gradient(circle at 74% 66%,rgba(0,0,0,.4) 0 16%,transparent 40%),radial-gradient(circle at 55% 40%,rgba(160,120,80,.45) 0 9%,transparent 22%),repeating-linear-gradient(160deg,transparent 0 5px,rgba(0,0,0,.14) 5px 0.375rem),linear-gradient(150deg,#9a9690,#5f5a55 55%,#3a3632);box-shadow:inset -2px -3px 3px rgba(0,0,0,.45),0 0 0 2px #26221f;font-size:0!important}

/* ---- name plates (in the soil of the ground strip). Both are the same size and always have a background; the height comes from fit() (--ph). ---- */
.cs-plate{flex:none;box-sizing:border-box;width:clamp(9.375rem,21%,13.125rem);height:var(--ph,2.5rem);display:flex;align-items:center;gap:0.375rem;padding:0 0.5rem;border-radius:0.625rem;overflow:hidden;color:#fff;font-size:.86rem;text-shadow:0 1px 2px rgba(0,0,0,.7);background:rgba(2,6,23,.5);border:2px solid rgba(255,255,255,.16)}
.cs-plate .cs-sw{flex:none;width:1.2em;height:1.2em}
.cs-plate .mid{flex:1 1 0;min-width:0;display:flex;flex-direction:column;justify-content:center;gap:0}
.cs-plate .nm{font-weight:800;line-height:1.15;overflow:hidden;white-space:nowrap}   /* 1.203.139: fitNames() in game.js shrinks the name (down to 10px) so it shows whole; "..." only for a very long teacher-typed name */
.cs-plate .nm .bot{font-size:.75em;color:#e2e8f0;margin-right:4px}
.cs-plate .sub{display:none}
.cs-scene.cs-roomy .cs-plate .sub{display:flex;align-items:center;gap:0.375rem;font-size:.7rem;line-height:1.1;white-space:nowrap;overflow:hidden}
.cs-plate .sub .inv:empty{display:none}
.cs-plate .ct{flex:none;font:800 .95rem 'Baloo 2',sans-serif;color:#fde68a;white-space:nowrap;line-height:1}
.cs-plate .fire{font-weight:800;color:#fdba74;white-space:nowrap;flex:none}
.cs-plate .sub .inv{min-width:0;overflow:hidden;text-overflow:ellipsis}   /* a long list of stones is shortened (the Ammo menu shows them all); the streak count always stays visible */
.cs-plate.cur{background:rgba(2,6,23,.66);border-color:var(--accent)}
.cs-plate.win{background:rgba(2,6,23,.66);border-color:#fde047}

.cs-scene.cs-short .cs-card{padding:0.625rem;gap:5px}
.cs-scene.cs-short .cs-card-icon,.cs-scene.cs-short .cs-ovtext{display:none}
.cs-scene.cs-short .cs-card h2{font-size:1.25rem}

/* ---- the castle builder ---- */
.cs-build{position:absolute;inset:0;z-index:6;display:flex;flex-direction:column;align-items:center;gap:0.5rem;padding:0.5rem;background:rgba(15,23,42,.3)}
.cs-build[hidden]{display:none}
.cs-build-head{display:flex;align-items:center;justify-content:center;gap:0.5rem;flex-wrap:wrap}
.cs-build-head .bt{font:800 1.15rem 'Baloo 2',system-ui,sans-serif;color:#fff;text-shadow:0 1px 3px rgba(0,0,0,.6)}
.cs-build-head .status.low{background:#7f1d1d;color:#fff}
.cs-bwrap{position:relative;flex:1 1 auto;min-height:0;display:flex;align-items:flex-end;justify-content:center}
.cs-bgrid{--bu:1.875rem;display:grid;grid-template-columns:repeat(var(--cols),var(--bu));grid-auto-rows:var(--bu);gap:1px;padding:5px 5px 0;background:rgba(255,255,255,.3);border-radius:0.625rem 0.625rem 0 0;border-bottom:10px solid #4d7c0f;touch-action:none;user-select:none;-webkit-user-select:none}
.cs-bc{position:relative;background:rgba(255,255,255,.14);border-radius:2px}
.cs-bc.gr{background:rgba(255,255,255,.26)}
.cs-bc .k{position:absolute;inset:0;display:grid;place-items:center;font-size:calc(var(--bu) * .72);font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif}
.cs-bfront{position:absolute;bottom:calc(100% - 2px);font:800 .78rem 'Inter',sans-serif;color:#fff;background:rgba(2,6,23,.6);padding:2px 0.5rem;border-radius:0.5rem 0.5rem 0 0;display:none}
.cs-bpal{display:flex;flex-wrap:wrap;gap:0.375rem;justify-content:center}
.cs-bpal button{min-height:2.625rem;padding:0.375rem 0.625rem;border-radius:0.625rem;border:3px solid var(--hard);background:var(--panel2);color:var(--text);font:800 .85rem 'Inter',sans-serif;cursor:pointer;display:inline-flex;align-items:center;gap:0.375rem;touch-action:manipulation}
.cs-bpal button[aria-pressed=true]{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent)}
.cs-bpal .done{background:#10b981;color:#052e1b;border-color:#065f46}
.cs-bpal .sw{position:relative;display:inline-block;width:1.1em;height:1.1em}
.cs-curtain{z-index:9;background:rgba(8,12,24,.97)}

/* ---- the stones and items to pick from ---- */
.cs-tray{display:flex;flex-direction:column;gap:0.5rem;padding:0.625rem;border-radius:0.875rem;background:rgba(2,6,23,.45);border:3px solid rgba(255,255,255,.14)}
.cs-tray[hidden]{display:none}
.cs-tray.off{opacity:.5;pointer-events:none}
.cs-item{padding:0.4375rem 0.625rem;border-radius:0.625rem;border:3px solid var(--hard);background:var(--panel2);color:var(--text);font:800 .85rem 'Inter',sans-serif;cursor:pointer;touch-action:manipulation}
.cs-item:disabled{opacity:.45;cursor:not-allowed}
.cs-fire{width:auto;justify-content:center;min-height:3.125rem;font-size:1.1rem}

/* ---- name swatch for the question card ---- */
.cs-sw{display:inline-block;flex:none;width:1.4em;height:1.4em;border-radius:.38em;background:linear-gradient(rgba(255,255,255,.3),transparent 55%),var(--pc,var(--p0));border:2px solid rgba(0,0,0,.35);vertical-align:middle}
.cs-sw.big{width:2.2em;height:2.2em;font-size:1.05rem}


/* ---- start / setup card, end card ---- */
.cs-over,.cs-end{position:absolute;inset:0;z-index:7;overflow:auto;display:flex;align-items:flex-start;justify-content:center;background:rgba(8,12,24,.72);padding:0.625rem}
.cs-end{z-index:8;background:rgba(8,12,24,.8)}
.cs-over[hidden],.cs-end[hidden]{display:none}
.cs-card{margin:auto;text-align:center;width:min(32.5rem,100%);padding:1rem;display:flex;flex-direction:column;gap:0.5rem;align-items:center;background:var(--panel);border:4px solid var(--hard);border-radius:1.25rem;box-shadow:var(--shadow)}
.cs-card h2{margin:0}
.cs-card-icon{width:3.5rem;height:3.5rem;border-radius:1rem;background:var(--accent);color:#111827;border:4px solid var(--hard);box-shadow:var(--shadow);display:grid;place-items:center;font-size:1.6rem}
.cs-ovtext{color:var(--soft);font-weight:600;font-size:.92rem}
.cs-setup{width:100%;display:flex;flex-direction:column;gap:0.375rem;text-align:left}
.cs-setup:empty{display:none}
.cs-presets{display:grid;grid-template-columns:repeat(5,1fr);gap:0.375rem}
.cs-preset{display:flex;flex-direction:column;align-items:center;gap:3px;padding:0.5rem 2px;border-radius:0.75rem;border:3px solid var(--hard);background:var(--panel2);color:var(--text);cursor:pointer;font:800 .74rem 'Inter',sans-serif;touch-action:manipulation;text-align:center;line-height:1.1}
.cs-preset i{font-size:1.2rem;color:var(--sky)}
.cs-preset.on{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent)}
.cs-preset:hover{filter:brightness(1.12)}
.cs-setup-h{display:flex;justify-content:space-between;align-items:baseline;margin-top:4px}
.cs-setup-h small{color:var(--muted);font-weight:700}
.cs-setup-f{display:flex;justify-content:space-between;align-items:center;gap:0.5rem;flex-wrap:wrap}
.cs-skill{display:flex;align-items:center;gap:0.375rem;font-weight:700;font-size:.85rem;color:var(--soft)}
.cs-skill select{padding:0.375rem 0.5rem;border-radius:0.5rem}
.cs-prow{display:flex;align-items:center;gap:0.375rem}
.cs-prow input{flex:1;min-width:0;font:700 1rem 'Inter',sans-serif;padding:0.6875rem 0.75rem;min-height:2.875rem;border-radius:0.625rem;border:3px solid var(--hard);background:var(--input-bg);color:var(--text)}
.cs-ptype{width:2.875rem;height:2.875rem;flex:none;border-radius:0.625rem;border:3px solid var(--hard);background:var(--panel2);color:var(--text);cursor:pointer}
.cs-ptype:hover{background:var(--sky);color:var(--hard)}
.cs-card .cs-start{position:sticky;bottom:0;z-index:2;width:100%;justify-content:center;min-height:3rem;box-shadow:0 0 0 8px var(--panel),var(--shadow)}
.cs-end-card{margin:auto;width:min(28.75rem,100%);text-align:center;padding:1.125rem;display:flex;flex-direction:column;gap:0.5rem;align-items:center;background:var(--panel);border:4px solid var(--gold);border-radius:1.375rem;box-shadow:var(--shadow);animation:csup .3s ease-out}
.cs-end-card h2{margin:0;font-size:1.7rem}
.cs-end-ic{font-size:3.4rem;line-height:1;animation:cspop 1.2s ease-in-out infinite;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif}
@keyframes cspop{50%{transform:translateY(-6px) scale(1.05)}}
.cs-end-sub{margin:0;color:var(--soft);font-weight:700}
.cs-end-list{list-style:none;margin:4px 0 0;padding:0;width:100%;display:flex;flex-direction:column;gap:5px}
.cs-end-list li{display:flex;align-items:center;gap:0.5rem;padding:0.375rem 0.625rem;border-radius:0.625rem;background:var(--panel2);text-align:left}
.cs-end-list .pl{font:800 1.1rem 'Baloo 2',sans-serif;width:1.2em;color:var(--gold)}
.cs-end-list .nm{flex:1;min-width:0;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cs-end-list .st{font-size:.75rem;color:var(--muted);font-weight:700;white-space:nowrap}
.cs-end-extra{width:100%}
.cs-end-pts{font:800 1.6rem 'Baloo 2',sans-serif;color:var(--gold)}
.cs-end-line{color:var(--soft);font-weight:700;font-size:.9rem}
.cs-end-btns{display:flex;gap:0.5rem;flex-wrap:wrap;justify-content:center}
.cs-confetti{position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:9}
.cs-confetti i{position:absolute;top:-14px;width:0.5625rem;height:0.875rem;border-radius:2px;animation:csconf 3s linear forwards}
@keyframes csconf{to{transform:translateY(110vh) rotate(720deg);opacity:.9}}

/* ---- theme picker ---- */
.cs-themes{display:grid;grid-template-columns:repeat(auto-fill,minmax(10.625rem,1fr));gap:0.5rem}
.cs-theme{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:0.5rem;border:3px solid var(--hard);border-radius:0.75rem;background:var(--panel2);color:var(--text);cursor:pointer;font:inherit;text-align:left}
.cs-theme b{font:800 1rem 'Baloo 2',system-ui,sans-serif}
.cs-theme small{color:var(--muted);font-weight:600;font-size:.74rem;line-height:1.2}
.cs-theme .sw{width:100%;height:2.875rem;border-radius:0.5rem;display:flex;align-items:flex-end;justify-content:center;gap:5px;padding-bottom:5px;background:var(--w-sky);overflow:hidden}
.cs-mini{width:1.875rem;height:0.875rem;border-radius:4px;background:var(--pc);border:2px solid rgba(0,0,0,.35)}
.cs-theme[aria-pressed=true],.cs-theme[aria-checked=true]{border-color:var(--gold);box-shadow:0 0 0 2px var(--gold)}
.cs-theme:hover{filter:brightness(1.12)}

/* ---- richer bricks: texture variants, battlements, slits, windows, door, planks ---- */
.cs-b.ts .f,.cs-b.tk .f,.cs-bc.ts .f,.cs-bc.tk .f{background:linear-gradient(90deg,transparent calc(50% - 1px),var(--mortar) calc(50% - 1px) calc(50% + 1px),transparent calc(50% + 1px)),
  linear-gradient(rgba(255,255,255,.4),rgba(255,255,255,0) 42%),linear-gradient(var(--st1),var(--st2));
  box-shadow:inset 0 0 0 1px var(--mortar),inset 2px 2px 0 rgba(255,255,255,.28),inset -2px -3px 0 rgba(0,0,0,.2)}
.cs-b.ts.odd .f,.cs-b.tk.odd .f,.cs-bc.ts.odd .f,.cs-bc.tk.odd .f{background:linear-gradient(90deg,transparent calc(18% - 1px),var(--mortar) calc(18% - 1px) calc(18% + 1px),transparent calc(18% + 1px),transparent calc(68% - 1px),var(--mortar) calc(68% - 1px) calc(68% + 1px),transparent calc(68% + 1px)),
  linear-gradient(rgba(255,255,255,.4),rgba(255,255,255,0) 42%),linear-gradient(var(--st1),var(--st2))}
.cs-b.v1 .f,.cs-bc.v1 .f{filter:brightness(.92) saturate(1.1)}
.cs-b.v2 .f,.cs-bc.v2 .f{filter:brightness(1.06)}
.cs-b.ts.v1 .f,.cs-b.tk.v1 .f,.cs-bc.ts.v1 .f,.cs-bc.tk.v1 .f{background:radial-gradient(ellipse 30% 36% at 26% 52%,rgba(255,255,255,.38) 0 60%,transparent 64%),radial-gradient(ellipse 30% 36% at 74% 50%,rgba(0,0,0,.14) 0 60%,transparent 64%),
  linear-gradient(var(--st1),var(--st2))}
.cs-b.ts.v2 .f,.cs-b.tk.v2 .f,.cs-bc.ts.v2 .f,.cs-bc.tk.v2 .f{background:repeating-linear-gradient(135deg,rgba(0,0,0,.06) 0 2px,transparent 2px 0.375rem),linear-gradient(rgba(255,255,255,.45),rgba(255,255,255,0) 40%),linear-gradient(var(--st1),var(--st2))}
.cs-b.top .f,.cs-bc.top .f{box-shadow:inset 0 0 0 1px var(--mortar),inset 0 3px 0 rgba(255,255,255,.55),inset -2px -3px 0 rgba(0,0,0,.2)}
.cs-b.mer .f,.cs-bc.mer .f{clip-path:polygon(0 0,30% 0,30% 30%,70% 30%,70% 0,100% 0,100% 100%,0 100%)}
.cs-b.slit .f::after,.cs-bc.slit .f::after{content:"";position:absolute;left:44%;top:20%;width:12%;height:58%;border-radius:2px;background:linear-gradient(#0f172a,#334155);box-shadow:0 0 0 1px rgba(0,0,0,.5),inset 0 0 2px #000}
.cs-b.win .f::after,.cs-bc.win .f::after{content:"";position:absolute;left:28%;top:18%;width:44%;height:62%;border-radius:62.4375rem 62.4375rem 2px 2px;background:linear-gradient(#fef3c7,#fbbf24 55%,#7c2d12);box-shadow:0 0 0 2px rgba(0,0,0,.5),0 0 8px rgba(251,191,36,.55)}
.cs-b.door .f::after,.cs-bc.door .f::after{content:"";position:absolute;left:22%;top:22%;width:56%;bottom:5%;border-radius:62.4375rem 62.4375rem 0 0;background:repeating-linear-gradient(90deg,rgba(0,0,0,.28) 0 1px,transparent 1px 22%),linear-gradient(#6b4423,#3b2410);box-shadow:0 0 0 1.5px #1f1308,inset 0 0 0 1.5px rgba(0,0,0,.3)}
.cs-b.tw.w0 .f,.cs-bc.tw.w0 .f{background:repeating-linear-gradient(0deg,rgba(0,0,0,.28) 0 1px,transparent 1px 25%),radial-gradient(circle at 12% 18%,#451a03 0 7%,transparent 9%),radial-gradient(circle at 88% 18%,#451a03 0 7%,transparent 9%),radial-gradient(circle at 12% 82%,#451a03 0 7%,transparent 9%),radial-gradient(circle at 88% 82%,#451a03 0 7%,transparent 9%),linear-gradient(var(--wd1),var(--wd2))}
.cs-b.tw.w1 .f,.cs-bc.tw.w1 .f{background:linear-gradient(135deg,transparent 46%,rgba(0,0,0,.35) 47% 53%,transparent 54%),repeating-linear-gradient(90deg,rgba(0,0,0,.2) 0 1px,transparent 1px 33%),linear-gradient(var(--wd1),var(--wd2));box-shadow:inset 0 0 0 2px rgba(0,0,0,.4)}

/* roofs and flags on towers, and the shadow of the castles */
.cs-castle.left{--pc:var(--p0)}.cs-castle.right{--pc:var(--p1)}
.cs-b .roof{position:absolute;bottom:calc(100% - 1px);left:0;width:calc(var(--tw) * var(--u) + 4px);margin-left:-2px;height:calc(var(--u) * 1.25);background:linear-gradient(90deg,rgba(255,255,255,.35),transparent 50%,rgba(0,0,0,.3)),var(--pc);clip-path:polygon(50% 0,100% 100%,0 100%);pointer-events:none}
.cs-castle.right .cs-b .roof{left:auto;right:0}
.cs-b .flag{position:absolute;bottom:calc(100% + var(--u) * 1.0);left:calc(var(--tw) * var(--u) / 2 - 1px);width:2px;height:calc(var(--u) * .9);background:#4b3621;pointer-events:none}
.cs-castle.right .cs-b .flag{left:auto;right:calc(var(--tw) * var(--u) / 2 - 1px)}
.cs-b .flag::after{content:"";position:absolute;left:100%;top:0;width:calc(var(--u) * .8);height:calc(var(--u) * .5);background:var(--pc);clip-path:polygon(0 0,100% 50%,0 100%);transform-origin:left center;animation:csflag 1.6s ease-in-out infinite alternate}
.cs-castle.right .cs-b .flag::after{left:auto;right:100%;transform:scaleX(-1);transform-origin:right center}
@keyframes csflag{from{transform:skewY(-8deg)}to{transform:skewY(8deg)}}
.cs-castle{filter:drop-shadow(3px 4px 0 rgba(0,0,0,.22))}
html[data-gfx=low] .cs-castle{filter:none}
html[data-gfx=low] .cs-b .flag::after{animation:none}
html[data-gfx=low] .cs-b .f,html[data-gfx=low] .cs-bc .f{filter:none}
[data-cst=classic]{--mortar:rgba(0,0,0,.3)}[data-cst=desert]{--mortar:rgba(120,53,15,.35)}[data-cst=frost]{--mortar:rgba(255,255,255,.7)}[data-cst=candy]{--mortar:rgba(255,255,255,.65)}
html[data-gfx=low] .cs-ret,html[data-gfx=low] .cs-spy{animation:none}
html[data-gfx=low] .cs-b .f,html[data-gfx=low] .cs-bc .f{box-shadow:inset 0 0 0 1px rgba(0,0,0,.32)!important}
html[data-gfx=low] .cs-field.shake{animation:none}
html[data-gfx=low] .cs-sky{display:none}



html.gic-live.cs-live #restartBtn{display:none!important}
.cs-end-pts{font-weight:800;font-size:1.1rem;margin-top:0.375rem}

/* ---- the middle of the ground strip holds the stones you can throw, the Fire button and the Continue button.
   On a phone it lifts off the strip and floats just above it, where a thumb reaches it. ---- */
.cs-dock{flex:1 1 0;min-width:0;display:flex;align-items:center;justify-content:center;gap:0.5rem;flex-wrap:nowrap}
.cs-dock:empty{display:none}
.cs-tray{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:center;align-items:center;gap:0.5rem;padding:0;border:0;background:none;min-width:0}
.cs-tray[hidden]{display:none}
.cs-tray.off{opacity:.45;pointer-events:none}
.cs-tray-h{display:none}
/* the Ammo button (shows the chosen stone) opens a small menu that slides up with the other stones and items; same rounded-rectangle look as the name plates */
.cs-ammo-wrap{position:relative;flex:none}
.cs-ammobtn{display:inline-flex;align-items:center;justify-content:center;gap:0.4375rem;height:var(--dh,2.25rem);min-width:7rem;padding:0 0.75rem;box-sizing:border-box;border-radius:0.625rem;border:2px solid rgba(255,255,255,.18);background:rgba(2,6,23,.55);color:#fff;font:800 .95rem 'Baloo 2',system-ui,sans-serif;line-height:1;cursor:pointer;white-space:nowrap;text-shadow:0 1px 2px rgba(0,0,0,.6);touch-action:manipulation}
.cs-ammobtn .e,.cs-opt .e{font-size:1.15rem;line-height:1;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif}
.cs-ammobtn .cv{font-size:.65rem;opacity:.8;transition:transform .2s}
.cs-ammobtn[aria-expanded=true]{border-color:var(--accent)}.cs-ammobtn[aria-expanded=true] .cv{transform:rotate(180deg)}
.cs-ammobtn.plain{cursor:default}
.cs-menu{position:absolute;left:0;bottom:calc(100% + 0.5rem);z-index:20;width:min(310px,calc(100vw - 24px));box-sizing:border-box;display:flex;flex-direction:column;gap:4px;padding:0.375rem;border-radius:0.75rem;background:rgba(2,6,23,.94);border:2px solid rgba(255,255,255,.16);box-shadow:0 8px 24px rgba(0,0,0,.5);overflow:auto;overscroll-behavior:contain;animation:csmenu .18s ease-out}
.cs-menu[hidden]{display:none}
@keyframes csmenu{from{transform:translateY(0.625rem);opacity:0}to{transform:none;opacity:1}}
.cs-opt{display:flex;align-items:center;gap:0.5625rem;text-align:left;min-height:2.25rem;padding:3px 0.5625rem;border-radius:0.625rem;border:2px solid rgba(255,255,255,.14);background:rgba(255,255,255,.06);color:#fff;cursor:pointer;font:inherit;touch-action:manipulation}
.cs-opt .t{display:flex;flex-direction:column;min-width:0}
.cs-opt b{font:800 .92rem/1.15 'Baloo 2',system-ui,sans-serif}
.cs-opt small{font:600 .68rem/1.2 'Inter',system-ui,sans-serif;color:#cbd5e1;white-space:normal}
.cs-opt.on{border-color:var(--accent);background:rgba(245,158,11,.14)}
.cs-opt:disabled{opacity:.45;cursor:not-allowed}
.cs-menu-h{font:700 .72rem 'Inter',system-ui,sans-serif;color:#cbd5e1;padding:2px 4px 0}
.cs-fire{width:auto;min-width:7rem;border-radius:0.625rem;border:2px solid rgba(255,255,255,.22);height:var(--dh,2.25rem);min-height:0;box-sizing:border-box;padding:0 1.125rem;font-size:1rem;line-height:1;box-shadow:none;white-space:nowrap}
.cs-fire:disabled{opacity:.5}
/* the computer's own question and answer are not shown: you can see it fire */

/* ---- the question: a popup over the board (every screen size) ---- */
@media (orientation:landscape) and (max-height:640px){
  .cs-msg{font-size:.82rem}
}

/* ---- effects: stone trail, debris, dust, shock ring, coins ---- */
.cs-trail{position:absolute;left:0;bottom:0;pointer-events:none;will-change:transform,opacity}
.cs-trail i{display:block;width:calc(var(--u) * .3);height:calc(var(--u) * .3);margin:calc(var(--u) * -.15) 0 0 calc(var(--u) * -.15);border-radius:50%;background:rgba(255,255,255,.65)}
@keyframes cstrail{to{transform:scale(.2);opacity:0}}
.cs-chip{position:absolute;left:0;bottom:0;width:calc(var(--u) * .24);height:calc(var(--u) * .24);border-radius:2px;background:var(--cc,#9ca3af);box-shadow:0 0 0 1px rgba(0,0,0,.4);pointer-events:none;will-change:transform}
.cs-coin{position:absolute;left:0;bottom:0;font-size:calc(var(--u) * .9);line-height:1;pointer-events:none;will-change:transform;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif}
.cs-dust{position:absolute;left:0;bottom:0;width:calc(var(--u) * 1.8);height:calc(var(--u) * 1.2);margin:calc(var(--u) * -.6) 0 0 calc(var(--u) * -.9);border-radius:50%;background:radial-gradient(ellipse,rgba(255,255,255,.8),rgba(255,255,255,0) 70%);pointer-events:none;animation:csdust .85s ease-out forwards}
@keyframes csdust{from{transform:translate(var(--dx),var(--dy)) scale(.3);opacity:.95}to{transform:translate(var(--dx),calc(var(--dy) - var(--u) * .7)) scale(1.7);opacity:0}}
.cs-ring{position:absolute;left:0;bottom:0;border-radius:50%;border:3px solid rgba(255,255,255,.9);pointer-events:none;animation:csring .55s ease-out forwards}
@keyframes csring{from{transform:translate(var(--dx),var(--dy)) scale(.15);opacity:1}to{transform:translate(var(--dx),var(--dy)) scale(1);opacity:0}}
.cs-b.jolt{animation:csjolt .32s ease-out}
@keyframes csjolt{30%{transform:translate(-2px,1px)}60%{transform:translate(2px,-1px)}}
.cs-cat.fired svg{animation:csrecoil .45s ease-out}
@keyframes csrecoil{0%{transform:translateX(-7%)}100%{transform:none}}

/* ---- low graphics, reduced motion, full screen ---- */
html[data-gfx=low] .cs-end-ic{animation:none}
html[data-gfx=low] .cs-trail,html[data-gfx=low] .cs-dust,html[data-gfx=low] .cs-ring{display:none}
@media(prefers-reduced-motion:reduce){.cs-sky i,.cs-end-ic,.cs-ret,.cs-spy,.cs-go{animation:none}.cs-cat .arm,.cs-cat .cupg{transition:none}}
@media(max-width:560px){.hide-xs{display:none}.grid2{grid-template-columns:1fr}.cs-stage{padding:0.5rem}.cs-presets{grid-template-columns:repeat(3,1fr)}}
.cs-scene.cs-paused .cs-field{cursor:pointer}


/* ---- real-looking materials (stone, brick and wood). The textures are small SVG noise tiles; a brick's own place picks which part of the tile it shows,
   so no two bricks look alike. Skipped in low-graphics mode, which keeps the plain flat bricks above. ---- */
html:not([data-gfx=low]) .cs-scene{--noiseD:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.05 -.46'/%3E%3C/filter%3E%3Crect width='72' height='72' filter='url(%23n)'/%3E%3C/svg%3E");--noiseL:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 -.52'/%3E%3C/filter%3E%3Crect width='72' height='72' filter='url(%23n)'/%3E%3C/svg%3E");--grain:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .55' numOctaves='3' seed='5' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .18 0 0 0 0 .08 0 0 0 0 0 0 0 0 1.9 -.78'/%3E%3C/filter%3E%3Crect width='96' height='48' filter='url(%23g)'/%3E%3C/svg%3E")}
html:not([data-gfx=low]) .cs-b.ts,html:not([data-gfx=low]) .cs-b.tk{background:var(--mortar,rgba(40,30,20,.55))}
html:not([data-gfx=low]) .cs-b.mer{clip-path:polygon(0 0,30% 0,30% 30%,70% 30%,70% 0,100% 0,100% 100%,0 100%)}
html:not([data-gfx=low]) .cs-b.ts .f,html:not([data-gfx=low]) .cs-b.tk .f,html:not([data-gfx=low]) .cs-bc.ts .f,html:not([data-gfx=low]) .cs-bc.tk .f{
  inset:1px 1px 1.5px 1px;border-radius:3px 2px 3px 2px;filter:none;
  background-image:linear-gradient(172deg,transparent 0 28%,rgba(0,0,0,.11) 29% 31%,transparent 32% 61%,rgba(255,255,255,.14) 62% 64%,transparent 65%),
    radial-gradient(ellipse 22% 14% at 14% 12%,rgba(255,255,255,.55),transparent 70%),
    radial-gradient(ellipse 18% 18% at 90% 90%,rgba(0,0,0,.28),transparent 72%),
    linear-gradient(140deg,rgba(255,255,255,.34) 0,rgba(255,255,255,0) 42%,rgba(0,0,0,.2) 100%),
    var(--noiseD),var(--noiseL),linear-gradient(var(--st1),var(--st2));
  background-size:auto,auto,auto,auto,calc(var(--u) * 3.2) calc(var(--u) * 3.2),calc(var(--u) * 3.2) calc(var(--u) * 3.2),auto;
  background-position:0 0,0 0,0 0,0 0,calc(var(--c,0) * var(--u) * -1.27) calc(var(--r,0) * var(--u) * -0.83),calc(var(--c,0) * var(--u) * -0.57 + var(--u)) calc(var(--r,0) * var(--u) * -1.37),0 0;
  box-shadow:inset 1.5px 1.5px 0 rgba(255,255,255,.5),inset -1.5px -2px 0 rgba(0,0,0,.3),inset 0 0 0 1px rgba(0,0,0,.18),0 1px 1px rgba(0,0,0,.25)}
/* a few bricks are two smaller blocks (a vertical joint off-centre), a few are weathered */
html:not([data-gfx=low]) .cs-b.ts.odd .f,html:not([data-gfx=low]) .cs-b.tk.odd .f,html:not([data-gfx=low]) .cs-bc.ts.odd .f,html:not([data-gfx=low]) .cs-bc.tk.odd .f{
  background-image:linear-gradient(172deg,transparent 0 28%,rgba(0,0,0,.11) 29% 31%,transparent 32% 61%,rgba(255,255,255,.14) 62% 64%,transparent 65%),linear-gradient(90deg,transparent calc(38% - 1px),rgba(0,0,0,.42) calc(38% - 1px) calc(38% + .5px),rgba(255,255,255,.35) calc(38% + .5px) calc(38% + 1.5px),transparent calc(38% + 1.5px)),
    radial-gradient(ellipse 22% 14% at 14% 12%,rgba(255,255,255,.55),transparent 70%),linear-gradient(140deg,rgba(255,255,255,.34) 0,rgba(255,255,255,0) 42%,rgba(0,0,0,.2) 100%),var(--noiseD),var(--noiseL),linear-gradient(var(--st1),var(--st2));
  background-size:auto,auto,auto,auto,calc(var(--u) * 3.2) calc(var(--u) * 3.2),calc(var(--u) * 3.2) calc(var(--u) * 3.2),auto;background-position:0 0,0 0,0 0,0 0,calc(var(--c,0) * var(--u) * -1.27) calc(var(--r,0) * var(--u) * -0.83),calc(var(--c,0) * var(--u) * -0.57 + var(--u)) calc(var(--r,0) * var(--u) * -1.37),0 0}
html:not([data-gfx=low]) .cs-b.ts.v1 .f,html:not([data-gfx=low]) .cs-b.tk.v1 .f,html:not([data-gfx=low]) .cs-bc.ts.v1 .f{filter:sepia(.45) brightness(.9) saturate(1.2)}
html:not([data-gfx=low]) .cs-b.ts.v2 .f,html:not([data-gfx=low]) .cs-b.tk.v2 .f,html:not([data-gfx=low]) .cs-bc.ts.v2 .f{filter:hue-rotate(-14deg) brightness(.97) contrast(1.08)}
html:not([data-gfx=low]) .cs-b.ts.odd .f,html:not([data-gfx=low]) .cs-b.tk.odd .f{border-radius:2px 5px 2px 4px / 4px 2px 5px 2px}
html:not([data-gfx=low]) .cs-b.ts:not(.odd) .f,html:not([data-gfx=low]) .cs-b.tk:not(.odd) .f{border-radius:4px 2px 4px 3px / 2px 4px 2px 5px}
html:not([data-gfx=low]) .cs-b.top .f,html:not([data-gfx=low]) .cs-bc.top .f{box-shadow:inset 1.5px 3px 0 rgba(255,255,255,.6),inset -1.5px -2px 0 rgba(0,0,0,.3),inset 0 0 0 1px rgba(0,0,0,.18),0 1px 1px rgba(0,0,0,.25)}
/* wood: three planks with grain, knots and dark iron nails; the crate has a plank brace */
html:not([data-gfx=low]) .cs-b.tw .f,html:not([data-gfx=low]) .cs-bc.tw .f,html:not([data-gfx=low]) .cs-bpal .sw.tw{
  border-radius:2px;inset:0;
  background-image:repeating-linear-gradient(0deg,rgba(0,0,0,.55) 0 1.4px,rgba(255,255,255,.18) 1.4px 2.4px,transparent 2.4px calc(33.33% - 0px)),
    radial-gradient(ellipse 14% 9% at 30% 50%,rgba(60,25,5,.7) 0 55%,transparent 62%),
    radial-gradient(circle at 9% 16%,#1f2937 0 6%,transparent 8%),radial-gradient(circle at 91% 16%,#1f2937 0 6%,transparent 8%),
    radial-gradient(circle at 9% 84%,#1f2937 0 6%,transparent 8%),radial-gradient(circle at 91% 84%,#1f2937 0 6%,transparent 8%),
    var(--grain),linear-gradient(90deg,rgba(255,255,255,.08),rgba(0,0,0,.14)),linear-gradient(var(--wd1),var(--wd2));
  background-size:auto,auto,auto,auto,auto,auto,calc(var(--u) * 4) calc(var(--u) * 2),auto,auto;
  background-position:0 0,0 0,0 0,0 0,0 0,0 0,calc(var(--c,0) * var(--u) * -0.74) calc(var(--r,0) * var(--u) * -0.39),0 0,0 0;
  box-shadow:inset 1.5px 1.5px 0 rgba(255,235,190,.4),inset -1.5px -2px 0 rgba(0,0,0,.35),inset 0 0 0 1px rgba(30,12,2,.65)}
html:not([data-gfx=low]) .cs-b.tw.w1 .f,html:not([data-gfx=low]) .cs-bc.tw.w1 .f{
  background-image:linear-gradient(135deg,transparent 43%,rgba(30,12,2,.7) 44% 46%,rgba(255,225,170,.38) 46% 49%,rgba(0,0,0,.18) 49% 56%,rgba(30,12,2,.7) 56% 58%,transparent 59%),
    repeating-linear-gradient(0deg,rgba(0,0,0,.5) 0 1.2px,transparent 1.2px calc(33.33% - 0px)),
    radial-gradient(circle at 9% 12%,#1f2937 0 6%,transparent 8%),radial-gradient(circle at 91% 88%,#1f2937 0 6%,transparent 8%),
    var(--grain),linear-gradient(var(--wd1),var(--wd2));
  background-size:auto,auto,auto,auto,calc(var(--u) * 4) calc(var(--u) * 2),auto;background-position:0 0,0 0,0 0,0 0,calc(var(--c,0) * var(--u) * -0.74) calc(var(--r,0) * var(--u) * -0.39),0 0}

/* ---- standing a phone up: the ground strip takes two rows (name plates, then the stones and Fire) so nothing covers the castles ---- */
.cs-scene.cs-tall .cs-ground{flex-wrap:wrap;align-content:center;row-gap:4px;padding:var(--lip,0.625rem) 0.5rem 0}
.cs-scene.cs-tall .cs-plate{width:calc(50% - 0.375rem)}
.cs-scene.cs-tall .cs-dock{order:3;flex:1 0 100%;position:static!important;bottom:auto!important;left:auto!important;right:auto!important}

/* bricks smaller than about 15px get flat faces: the stone and wood textures only turn to mush at that size */
.cs-scene.cs-tiny .cs-b .f,.cs-scene.cs-tiny .cs-bc .f{background-image:linear-gradient(rgba(255,255,255,.4),rgba(255,255,255,0) 45%),linear-gradient(var(--st1),var(--st2))!important;box-shadow:inset 0 0 0 1px rgba(0,0,0,.32)!important;border-radius:2px!important;inset:0!important}
.cs-scene.cs-tiny .cs-b.tw .f,.cs-scene.cs-tiny .cs-bc.tw .f{background-image:repeating-linear-gradient(90deg,rgba(0,0,0,.18) 0 1px,transparent 1px 5px),linear-gradient(var(--wd1),var(--wd2))!important}
.cs-scene.cs-tiny .cs-b.ts,.cs-scene.cs-tiny .cs-b.tk{background:none}
.cs-scene.cs-tiny .cs-b .f::after,.cs-scene.cs-tiny .cs-bc .f::after{opacity:.85}

/* performance: while a question is open nothing behind it needs to move (it is covered, and the card must answer taps at once) */
#csPlay.flying .cs-cat .pen,#csPlay.flying .cs-b .flag::after,#csPlay.flying .cs-go,#csPlay.asking .cs-cat .pen,#csPlay.asking .cs-b .flag::after,#csPlay.asking .cs-go,#csPlay.asking .cs-ret,#csPlay.asking .cs-spy{animation-play-state:paused}

html.gic-phone body .cs-castle{filter:none}   /* a drop shadow on every brick tower is costly to repaint on a phone */


/* ---- baked brick pictures (1.64.9): game.js bakeBricks() draws each kind of brick once and sets --tx-*; bricks are then plain images, with no per-brick filters, noise or shadows ---- */
html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.ts,html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tk{background:none!important}
html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.ts .f,html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tk .f,html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tw .f{filter:none!important;border-radius:0!important;inset:0!important;background-color:transparent!important;background-size:100% 100%!important;background-position:center!important;background-repeat:no-repeat!important}
html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.ts .f,html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tk:not(.show) .f,html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tw .f{box-shadow:none!important}
html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.ts .f,html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tk .f{background-image:var(--tx-s0)!important}
html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.ts.v1 .f,html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tk.v1 .f{background-image:var(--tx-s1)!important}
html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.ts.v2 .f,html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tk.v2 .f{background-image:var(--tx-s2)!important}
html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.ts.odd .f,html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tk.odd .f{background-image:var(--tx-s3)!important}
html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.ts.odd.v1 .f,html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tk.odd.v1 .f{background-image:var(--tx-s4)!important}
html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.ts.odd.v2 .f,html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tk.odd.v2 .f{background-image:var(--tx-s5)!important}
html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tw.w0 .f{background-image:var(--tx-w0)!important}
html:not([data-gfx=low]) .cs-scene.tex:not(.cs-tiny) .cs-b.tw.w1 .f{background-image:var(--tx-w1)!important}
.cs-castle{filter:none!important}   /* a drop shadow on the whole castle makes the browser repaint it as a unit; the bricks carry their own shading now */

/* slow device (the page measured under ~20 frames a second, see assets/js/sky.js): the decoration stands still */
html[data-perf=slow] .cs-cat .pen,html[data-perf=slow] .cs-b .flag::after,html[data-perf=slow] .cs-go,html[data-perf=slow] .cs-end-ic,html[data-perf=slow] .cs-ret,html[data-perf=slow] .cs-spy{animation:none}
html[data-perf=slow] .cs-castle{filter:none}

/* ---- PLAY-FIRST layout: html.gic-phone = a phone, a small window or a touch tablet; html.gic-fs = full screen on a computer (see assets/css/game.css).
        The board gets the whole screen edge to edge; the score, time and buttons float over the sky. Every rule below is scoped to those two classes. ---- */
html.gic-fs .layout{grid-template-columns:minmax(0,1fr)}
html.gic-fs .cs-app{max-width:none;padding:0}
html.gic-fs .cs-stage{border-radius:0;border:0;box-shadow:none;padding:0}
html.gic-phone body .cs-app{padding:0}
html.gic-phone body .cs-stage{padding:0;border:0;border-radius:0;background:none;gap:0}
html.gic-phone body .cs-scene,html.gic-fs .cs-scene{border:0;border-radius:0}
html.gic-phone{--edge:1rem}   /* the same margin from the left, top and right edge for the stats and the ... button */
html.gic-phone body .cs-scene{--cs-top:calc(var(--ph-btn) + var(--edge) + 2px);--cs-ptop:calc(var(--ph-btn) + var(--edge) + 2px)}
html.gic-phone body .gic-head-right{top:calc(var(--edge) - 0.4375rem)!important;right:calc(var(--edge) - 0.5rem)!important}
/* the "..." menu is just the dots, no box: dark over the sky (light over a dark one) */
html.gic-phone body .gic-head-right .gic-more.btn span{display:block;font-size:0!important;width:1.25rem;height:0.875rem;background:linear-gradient(currentColor,currentColor) 0 0/100% 2.5px no-repeat,linear-gradient(currentColor,currentColor) 0 50%/100% 2.5px no-repeat,linear-gradient(currentColor,currentColor) 0 100%/100% 2.5px no-repeat;border-radius:2px;filter:drop-shadow(0 0 2px rgba(255,255,255,.85))}
html.gic-phone body .gic-head-right .gic-more.btn{background:none!important;border:0!important;box-shadow:none!important;color:#0f172a!important;text-shadow:0 0 3px rgba(255,255,255,.9),0 1px 2px rgba(255,255,255,.7);font-size:1.25rem}
html.gic-phone body .cs-stage .stage-head{position:absolute;z-index:12;top:var(--edge);left:var(--edge);right:var(--edge);margin:0;min-height:0;padding:0 calc(var(--ph-btn) + 0.375rem) 0 0;pointer-events:none}
html.gic-phone body .cs-stage .stage-head .btn{pointer-events:auto;box-shadow:0 1px 4px rgba(0,0,0,.45)}
/* the question count and the time are plain dark text over the sky: no box, no edge to stick to */
html.gic-phone body .cs-stage .stage-head .status{pointer-events:none;background:none!important;box-shadow:none!important;border:0;padding:0 4px 0 0!important;height:auto!important;min-height:0!important;color:#0f172a!important;font-size:.88rem;font-weight:800;text-shadow:0 0 3px rgba(255,255,255,.85),0 1px 2px rgba(255,255,255,.6)}
html.gic-phone body .cs-stage:has([data-cst=frost]) .stage-head .status{color:#0f172a!important}
html.gic-phone body .cs-plate{padding:0 0.375rem;gap:5px;font-size:.78rem}
html.gic-phone body .cs-plate .ct{font-size:.85rem}
html.gic-phone body .cs-ground{padding-left:0.5rem;padding-right:0.5rem;gap:0.375rem}
/* a phone has no message bar taking up room: the line of text floats over the scene only while there is something to say */
html.gic-phone body .cs-bar{position:absolute;left:0;right:0;top:var(--cs-top,0.625rem);bottom:auto;z-index:8;height:auto;min-height:0;padding:0 2.875rem;background:none;pointer-events:none}
html.gic-phone body .cs-bar{display:flex;justify-content:center}
html.gic-phone body .cs-msg{flex:0 1 auto;font-size:.8rem;line-height:1.25;max-height:calc(2.5em + 0.375rem);color:#fff;background:rgba(15,23,42,.62);border-radius:6.1875rem;padding:2px 0.75rem;text-shadow:none}
html.gic-phone body .cs-msg:empty{display:none}
html.gic-phone body .cs-msg.ok{color:#bbf7d0}html.gic-phone body .cs-msg.bad{color:#fecdd3}
html.gic-phone body .cs-dock{gap:0.375rem}
html.gic-phone body .cs-go{padding:0 1.25rem;font-size:1.02rem}
html.gic-phone body .cs-card{padding:0.875rem;gap:0.375rem}
html.gic-phone body .cs-card-icon{display:none}   /* the round icon only gets in the way of the header buttons on a phone */
html.gic-phone body .cs-presets{grid-template-columns:repeat(5,1fr)}
html.gic-phone body .cs-preset{font-size:.66rem;padding:0.375rem 1px}
html.gic-phone body .cs-end-card{padding:0.75rem}
html.gic-phone body .cs-end-card h2{font-size:1.4rem}
html.gic-phone body .cs-bpal button{min-height:2.25rem;padding:4px 0.5rem;font-size:.78rem}
html.gic-phone body .cs-build{padding:var(--cs-top,4px) 4px 4px;gap:4px}
@media (orientation:landscape) and (max-height:560px){
  html.gic-phone body .cs-scene{--cs-top:var(--edge);--cs-ptop:calc(var(--edge) + 1.75rem)}
  html.gic-phone body .cs-card{padding:0.5rem}
  html.gic-phone body .cs-card-icon{display:none}
  html.gic-phone body .cs-build-head .bt{font-size:.95rem}
  html.gic-phone body .cs-bpal button{min-height:1.875rem;padding:2px 0.4375rem}
}
/* full screen with the floating score bar (stage.js): the board runs to the top edge; the bar floats over the sky and the sideways right-hand column stays free */
html.gic-fs.gic-stage #stage.cs-stage{padding:0 var(--hud-r,0px) 0 0!important;border-radius:0}
html.gic-fs.gic-stage .cs-scene{--cs-top:calc(var(--hud-t,0px) + 0.375rem);--cs-ptop:calc(var(--hud-t,0px) + 0.375rem)}

/* 1.203.130: full screen on a tablet or computer (not a phone): the scene starts BELOW the floating top bar instead of running under it, so the bar and the iPad's clock/status bar never sit on the sky. Phones keep their own layout. */
html.gic-fs.gic-stage:not(.gic-phone) #stage.cs-stage{padding-top:var(--hud-t,0px)!important}
html.gic-fs.gic-stage:not(.gic-phone) .cs-scene{--cs-top:0.375rem;--cs-ptop:0.375rem}

/* 1.203.134 Game Kit pilot: on a tablet, computer or board (not a phone) the reading text grows with the kit scale unit --ku
   (1 at 1280x800, a little less on an iPad, more on a big screen), and never go below the kit floors (14px reading text, 12px small labels).
   Phones are not touched. Sizes were 13-19px fixed. */
html:not(.gic-phone) .cs-msg{font-size:1.125rem;max-height:calc(2.5em + 0.375rem)}
html:not(.gic-phone) .cs-plate .sub{font-size:0.75rem}
html:not(.gic-phone) .cs-theme small{font-size:0.8125rem}
html:not(.gic-phone) .cs-ammobtn .cv{font-size:0.75rem}

/* 1.203.134 Game Kit pilot, part 2: the ground strip (name plates, stones, Fire) scales with --cs-s (set by fit() in game.js; 1 on a phone, 1.2 to 1.9 elsewhere). */
html:not(.gic-phone) .cs-plate{width:clamp(calc(9.375rem * var(--cs-s,1)),21%,calc(13.125rem * var(--cs-s,1)));font-size:.86rem;padding:0 calc(0.5rem * var(--cs-s,1))}
html:not(.gic-phone) .cs-plate .sub{font-size:max(var(--k-text-label,0.75rem),.7rem)}
html:not(.gic-phone) .cs-ammobtn{font-size:.95rem;min-width:calc(7rem * var(--cs-s,1));padding:0 calc(0.75rem * var(--cs-s,1))}
html:not(.gic-phone) .cs-fire{font-size:1rem;min-width:calc(7rem * var(--cs-s,1));padding:0 calc(1.125rem * var(--cs-s,1))}

/* The question card is the shared Game Kit card (assets/js/kit-quiz.js + assets/css/kit-quiz.css, 1.203.140). Castle Siege only says where it sits:
   between the line of text at the top and the ground strip, in the game's accent colour. Someone else answering is shown by the line of text, so the watch pill is not used. */
.cs-q.kq-layer{--kq-pad-t:calc(var(--cs-ptop,0.625rem) + 4px);--kq-pad-b:calc(var(--gh) + 0.375rem);--kq-accent:var(--accent)}
.cs-q.kq-watch{display:none}
.cs-q .kq-badge{border-radius:0.4375rem}
/* the stone count and the shots on the name plate */
html:not(.gic-phone) .cs-plate .ct{font-size:.95rem}
