/* Gate Defense v4: full-bleed painted plate, floating HUD (390x844 phone, no page scroll). v3.1: _stage_gate/_gate_v31_backup.css */
/* Wide screens (computer / landscape, 2026-11-23): the game sits in a centred phone-shaped column (390:844) with dark side margins,
   so the whole road and gate show and the HUD stays phone-sized. All HUD sizes use --w (column width); on phones --w = 100vw (unchanged). */
:root { --w: 100vw; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
body.gd-page { position: fixed; inset: 0; color: #f3e6c8; font-family: "Crimson Text", Georgia, serif; background: #0e0a06; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }
/* top HUD band (top 8% of the plate is the dim forest/mist strip) */
.gd-top { position: absolute; left: 0; right: 0; top: 0; z-index: 20; padding: max(5px, env(safe-area-inset-top)) 8px 0; pointer-events: none; display: flex; flex-direction: column; gap: 4px; }
.gd-top > * { pointer-events: none; } .gd-top button, .gd-top a { pointer-events: auto; }
.gd-row1, .gd-row2 { display: flex; align-items: center; gap: 6px; }
.gd-back { flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; border: 2px solid #c8924a; color: #ffe0a8; text-decoration: none; font-size: 1.5rem; line-height: 1; background: rgba(26,14,6,.82); box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.gd-gatebar { flex: 1 1 auto; position: relative; height: 22px; border-radius: 11px; overflow: hidden; background: rgba(28,10,6,.85); border: 2px solid #c8924a; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.gd-gatefill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: linear-gradient(180deg, #e8883a, #a02a18); transition: width .2s; }
.gd-gatebar span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 .72rem Georgia, serif; color: #fff3dc; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.gd-pill { flex: 0 0 auto; height: 26px; padding: 0 9px 0 5px; border-radius: 13px; border: 2px solid #c8924a; background: rgba(26,14,6,.85); font: 700 .86rem Georgia, serif; display: inline-flex; align-items: center; gap: 3px; box-shadow: 0 2px 6px rgba(0,0,0,.5); color: #ffe6b0; }
.gd-pill small { font-size: .56rem; font-weight: 400; color: #d8b88a; margin-left: 2px; }
.gd-pill .cur-ico { width: 16px; height: 16px; }
.gd-mute { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #c8924a; background: rgba(26,14,6,.85); font-size: .9rem; padding: 0; cursor: pointer; }
.gd-wave { flex: 0 0 auto; padding: 2px 10px; border-radius: 12px; background: rgba(26,14,6,.82); border: 2px solid #c8924a; font: 700 .78rem Georgia, serif; color: #ffd48a; white-space: nowrap; max-width: 62%; overflow: hidden; text-overflow: ellipsis; }
.gd-foebar { flex: 1 1 auto; position: relative; height: 10px; border-radius: 5px; background: rgba(20,10,6,.8); border: 1px solid #c8924a; }
.gd-foefill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 5px; background: linear-gradient(180deg, #c8e870, #6aa038); transition: width .25s; }
.gd-foebar i { position: absolute; right: -6px; top: -8px; font-style: normal; font-size: 1.05rem; filter: grayscale(1) brightness(.8); }
.gd-foebar i.on { filter: none; animation: gdpulse .7s infinite alternate; }
@keyframes gdpulse { from { transform: scale(1); } to { transform: scale(1.3); } }
.gd-go { flex: 0 0 auto; margin-left: auto; height: 28px; padding: 0 14px; border-radius: 14px; border: 2px solid #5a2a08; background: linear-gradient(180deg, #8ad070, #3a8020); color: #0e2008; font: 700 .86rem Georgia, serif; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.gd-banner { position: absolute; left: 50%; top: 24%; transform: translate(-50%, -50%); z-index: 22; padding: 10px 18px; border-radius: 14px; background: rgba(20,8,4,.84); border: 2px solid #c8873a; font: 700 1.25rem Georgia, serif; color: #ffd48a; text-align: center; pointer-events: none; max-width: 84%; box-shadow: 0 6px 24px rgba(0,0,0,.6); }
.gd-banner small { display: block; font: 400 .85rem Georgia, serif; color: #f0d8b0; margin-top: 4px; }
.gd-hint { position: absolute; left: 10px; right: 10px; top: 72px; z-index: 21; padding: 5px 10px; border-radius: 10px; background: rgba(0,0,0,.6); font-size: .82rem; text-align: center; color: #ffe0b0; pointer-events: none; line-height: 1.25; }
/* bottom ability bar (bottom 14% of the plate is the dim ground) */
.gd-actions { position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; height: 14%; min-height: 98px; display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; justify-items: center; padding: 6px 10px max(8px, env(safe-area-inset-bottom)); box-sizing: border-box; background: linear-gradient(180deg, rgba(20,10,4,.1), rgba(20,10,4,.78) 38%, rgba(14,7,3,.92)); border-top: 2px solid rgba(200,146,74,.6); }
.gd-act { position: relative; overflow: hidden; width: 66px; height: 66px; border-radius: 50%; border: 3px solid #c8924a; background: radial-gradient(circle at 35% 30%, #7a5430, #34200f); color: #ffe6bf; font: 700 .6rem Georgia, serif; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; cursor: pointer; padding: 0; box-shadow: 0 3px 10px rgba(0,0,0,.6); touch-action: manipulation; }
.gd-act b { font-size: 1.45rem; line-height: 1; }
.gd-act.fire { border-color: #e0702a; } .gd-act.boulder { border-color: #aaa090; } .gd-act.rally { border-color: #e8c050; } .gd-act.build { border-color: #d8a840; }
.gd-act.busy::after { content: "…"; position: absolute; right: 8px; top: 2px; font-size: 1rem; color: #ffd060; }
.gd-act.armed { box-shadow: 0 0 0 3px #ffd060 inset, 0 0 16px #ffb040; background: radial-gradient(circle at 35% 30%, #c0702a, #5a2a0a); }
.gd-act:disabled { opacity: .5; }
.gd-cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0,0,0,.62); pointer-events: none; }
.gd-aidrow { position: absolute; right: 6px; top: 96px; z-index: 19; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.gd-aid { pointer-events: auto; position: relative; overflow: hidden; width: 54px; height: 54px; border-radius: 50%; border: 3px solid #78c8e8; background: radial-gradient(circle at 35% 30%, #3a6a7a, #14303a); color: #e8f8ff; font: 700 .54rem Georgia, serif; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.6); }
.gd-aid b { font-size: 1.2rem; line-height: 1; } .gd-aid i { font-style: normal; max-width: 50px; line-height: 1; text-align: center; margin-top: 1px; }
.gd-aid:disabled { opacity: .55; } .gd-aid.armed { box-shadow: 0 0 0 3px #ffd060 inset, 0 0 14px #ffe090; }
.gd-sq { position: absolute; left: 8px; right: 8px; bottom: calc(14% + 6px); z-index: 24; display: flex; gap: 6px; padding: 6px; border-radius: 14px; background: rgba(24,12,5,.92); border: 2px solid #c8924a; box-shadow: 0 6px 20px rgba(0,0,0,.6); }
.gd-chipbtn { flex: 1 1 0; min-width: 0; min-height: 52px; border-radius: 10px; border: 2px solid #8a5a2a; background: linear-gradient(180deg, #5a3a1e, #2e1c0e); color: #ffe6bf; font: 700 .78rem Georgia, serif; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px; }
.gd-chipbtn b { font-size: 1.2rem; line-height: 1; } .gd-chipbtn i { font-style: normal; font-weight: 400; font-size: .6rem; color: #d8c0a0; }
.gd-chipbtn:disabled { opacity: .45; }
/* radial build menu */
.gd-radial { position: absolute; inset: 0; z-index: 23; pointer-events: none; }
.gd-disc { pointer-events: auto; position: absolute; width: 62px; height: 62px; border-radius: 50%; border: 3px solid #e8c868; background: radial-gradient(circle at 35% 28%, #5a3c20, #24140a); color: #fff0d0; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; overflow: hidden; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.7); animation: gdpop .14s ease-out; touch-action: manipulation; }
@keyframes gdpop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.gd-disc img { position: absolute; left: 50%; top: 2px; height: 36px; width: auto; max-width: 52px; object-fit: contain; transform: translateX(-50%); filter: drop-shadow(0 2px 2px rgba(0,0,0,.7)); }
.gd-disc em { position: absolute; left: 0; right: 0; top: 4px; font-style: normal; font-size: 1.5rem; line-height: 1.3; text-align: center; }
.gd-disc .n { position: relative; z-index: 1; font: 700 .52rem Georgia, serif; line-height: 1; text-shadow: 0 1px 2px #000; margin-bottom: 1px; }
.gd-disc .c { position: relative; z-index: 1; font: 700 .6rem Georgia, serif; line-height: 1.1; padding: 1px 5px; margin-bottom: 3px; border-radius: 8px; background: rgba(0,0,0,.6); color: #ffe070; display: inline-flex; align-items: center; gap: 2px; }
.gd-disc .c .cur-ico { width: 11px; height: 11px; }
.gd-disc.short { border-color: #b86a50; } .gd-disc.short img { filter: grayscale(.4) brightness(.8); } .gd-disc.short .c { color: #ff9a8a; }
.gd-disc.lock { border-color: #6a6a6a; opacity: .75; } .gd-disc.lock img { filter: grayscale(1) brightness(.6); }
.gd-disc.sell { border-color: #a0c070; }
.gd-rlabel { position: absolute; transform: translateX(-50%); min-width: 130px; max-width: 220px; text-align: center; padding: 4px 10px; border-radius: 12px; background: rgba(20,10,4,.9); border: 2px solid #c8924a; pointer-events: none; font-size: .8rem; line-height: 1.15; }
.gd-rlabel b { color: #ffd48a; font-size: .86rem; } .gd-rlabel .st { color: #ffd23a; letter-spacing: 1px; } .gd-rlabel i { display: block; font-style: normal; font-size: .66rem; color: #e0cca8; }
/* sheets */
.gd-sheet { position: absolute; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.4); padding: 8px; box-sizing: border-box; touch-action: manipulation; }
.gd-card { width: min(480px, 100%); max-height: 78%; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 18px 18px 12px 12px; background: linear-gradient(180deg, #34200f, #1e120a); border: 3px solid #b07a40; position: relative; box-sizing: border-box; }
.gd-x { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 10px; border: 2px solid #b07a40; background: rgba(0,0,0,.4); color: #ffd9a0; font-size: 1.3rem; cursor: pointer; z-index: 2; }
.gd-card h2 { margin: 0 40px 0 0; font: 700 1.2rem Georgia, serif; color: #ffcf7a; } .gd-card h3 { margin: 6px 0 0; font: 700 .95rem Georgia, serif; color: #e8c080; }
.gd-card p { margin: 0; font-size: .9rem; line-height: 1.25; color: #ead6b4; }
.gd-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: rgba(0,0,0,.28); border: 1px solid #6a4422; }
.gd-row .ic { font-size: 1.4rem; width: 30px; text-align: center; flex: 0 0 auto; } .gd-row .tx { flex: 1 1 auto; min-width: 0; }
.gd-row .tx b { display: block; font-size: .94rem; color: #ffe2b0; } .gd-row .tx i { display: block; font-style: normal; font-size: .74rem; color: #d0b490; }
.gd-own { flex: 0 0 auto; font: 700 .8rem Georgia, serif; color: #b8f0a0; padding: 0 6px; } .gd-own.lock { color: #d8b88a; }
.gd-cost { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.gd-chip { display: inline-flex; align-items: center; gap: 2px; font-size: .72rem; padding: 1px 5px; border-radius: 999px; background: rgba(0,0,0,.35); border: 1px solid #5a3a1a; color: #c8f0b0; } .gd-chip.short { color: #ff9a8a; border-color: #8a2a1a; } .gd-chip .cur-ico { width: 13px; height: 13px; }
.gd-btn { flex: 0 0 auto; min-height: 40px; min-width: 70px; border-radius: 12px; border: 2px solid #6b3a12; background: linear-gradient(180deg, #e8a848, #a8601c); color: #2a1206; font: 700 .88rem Georgia, serif; cursor: pointer; padding: 4px 10px; touch-action: manipulation; }
.gd-btn.red { background: linear-gradient(180deg, #e8603a, #9a2a12); color: #fff0e0; border-color: #5a1a08; } .gd-btn.green { background: linear-gradient(180deg, #8ad070, #3a8020); border-color: #1a4a10; color: #0e2008; }
.gd-btn.ghost { background: rgba(0,0,0,.3); color: #ffd9a0; border-color: #8a5a2a; } .gd-btn:disabled { opacity: .5; } .gd-btn.big { width: 100%; min-height: 48px; font-size: 1.05rem; }
.gd-tabs { display: flex; gap: 6px; } .gd-tabs .gd-btn { flex: 1; min-width: 0; padding: 4px 2px; font-size: .8rem; }
.gd-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .gd-stat { padding: 6px 8px; border-radius: 10px; background: rgba(0,0,0,.3); border: 1px solid #5a3a1a; }
.gd-stat b { display: block; font-size: 1.05rem; color: #ffe2b0; } .gd-stat span { font-size: .74rem; color: #d0b490; } .gd-stat.bad b { color: #ff9a8a; } .gd-stat.good b { color: #b8f0a0; }
.gd-log { font-size: .8rem; color: #e0c8a0; padding: 6px 8px; border-radius: 10px; background: rgba(0,0,0,.25); }
.gd-troop, .gd-aidrow2, .gd-card .gd-aidrow { position: static; }
.gd-troop { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 12px; background: rgba(0,0,0,.28); border: 1px solid #6a4422; }
.gd-troop b { font-size: 1.5rem; width: 32px; text-align: center; } .gd-troop span { flex: 1; min-width: 0; } .gd-troop u, .gd-card .gd-aidrow u { text-decoration: none; display: block; font-weight: 700; color: #ffe2b0; font-size: .94rem; }
.gd-troop i, .gd-card .gd-aidrow i { display: block; font-style: normal; font-size: .72rem; color: #d0b490; } .gd-troop.lock { opacity: .65; }
.gd-card .gd-aidrow { display: flex; flex-direction: row; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 12px; background: rgba(0,0,0,.28); border: 1px solid #4a6a7a; pointer-events: auto; right: auto; bottom: auto; }
.gd-card .gd-aidrow b { font-size: 1.4rem; width: 30px; text-align: center; } .gd-card .gd-aidrow span { flex: 1; min-width: 0; } .gd-card .gd-aidrow u em { font-style: normal; font-weight: 400; color: #8ac0d8; font-size: .7rem; text-transform: capitalize; } .gd-card .gd-aidrow.lock { opacity: .65; }
.gd-toast { position: absolute; left: 50%; top: 104px; transform: translateX(-50%); z-index: 60; padding: 8px 14px; border-radius: 12px; background: #2a1408; border: 2px solid #c08040; color: #ffd9a0; max-width: calc(var(--w) * 88 / 100); font-size: .9rem; text-align: center; pointer-events: none; }
.gd-toast.bad { border-color: #d04a2a; }
@media (max-height: 700px) { .gd-act { width: 56px; height: 56px; } .gd-actions { min-height: 84px; } }

/* ===== phase-2 painted HUD (body.gd-art, set by applyHudArt() once the Concord Art kit loads; without it everything above is the fallback) ===== */
.gd-glow, .gd-topart, .gd-ribbon, .gd-hp { display: none; }
body.gd-art { /* --w: phone column width, set on :root at the top */ }
body.gd-art .gd-topart { display: block; position: absolute; left: 0; top: 0; width: 100%; height: calc(var(--w) * 14.53 / 100); background: var(--a-top) center top / 100% 100% no-repeat; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
body.gd-art .gd-top { padding: 0; gap: 0; height: calc(var(--w) * 15 / 100); max-width: none; }
body.gd-art .gd-row1 { position: absolute; left: 0; right: 0; top: 0; height: calc(var(--w) * 14.53 / 100); }
body.gd-art .gd-gatebar { display: none; }
body.gd-art .gd-back { position: absolute; left: calc(var(--w) * 2.4 / 100); top: calc(var(--w) * 2.9 / 100); width: calc(var(--w) * 8.6 / 100); height: calc(var(--w) * 8.6 / 100); max-width: 36px; max-height: 36px; background: radial-gradient(circle at 35% 30%, #6a4a28, #24140a); border: 2px solid #d8a850; }
body.gd-art .gd-mute { position: absolute; left: calc(var(--w) * 12.4 / 100); top: calc(var(--w) * 3.2 / 100); width: calc(var(--w) * 8 / 100); height: calc(var(--w) * 8 / 100); max-width: 34px; max-height: 34px; background: radial-gradient(circle at 35% 30%, #6a4a28, #24140a); border: 2px solid #d8a850; font-size: .8rem; }
body.gd-art .gd-ribbon { display: grid; place-items: center; position: absolute; left: 50%; top: calc(var(--w) * 1.7 / 100); width: calc(var(--w) * 36.75 / 100); height: calc(var(--w) * 11.54 / 100); transform: translateX(-50%); background: var(--a-ribbon) center / 100% 100% no-repeat; z-index: 2; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
body.gd-art .gd-ribbon span { font: 700 .74rem Georgia, serif; color: #fff4d0; text-shadow: 0 1px 2px #0a1030, 0 0 4px #0a1030; letter-spacing: .02em; white-space: nowrap; padding-bottom: 1px; }
body.gd-art .gd-ribbon.boss span { color: #ffd8c0; text-shadow: 0 1px 2px #300808, 0 0 5px #801010; }
body.gd-art .gd-pill { position: absolute; right: calc(var(--w) * 3 / 100); top: calc(var(--w) * 2.4 / 100); width: calc(var(--w) * 23.9 / 100); height: calc(var(--w) * 9.74 / 100); padding: 0; border: 0; border-radius: 0; background: var(--a-coin) center / 100% 100% no-repeat; box-shadow: none; display: flex; align-items: center; justify-content: flex-end; gap: 0; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
body.gd-art .gd-pill .cc-ico { position: absolute; left: 1%; top: 50%; width: 33%; height: 100%; transform: translateY(-50%) scale(1.04); background: var(--a-coinico) left center / contain no-repeat; }
body.gd-art .gd-pill .cc-n { width: 62%; padding-right: 5%; box-sizing: border-box; text-align: right; font: 700 .82rem Georgia, serif; color: #ffe9b0; text-shadow: 0 1px 2px #000; white-space: nowrap; }
body.gd-art .gd-pill .cc-n small { font-size: .5rem; font-weight: 400; color: #e8c88a; margin-left: 2px; }
body.gd-art .gd-row2 { position: absolute; left: 8px; right: 8px; top: calc(calc(var(--w) * 14.53 / 100) + 3px); }
body.gd-art .gd-wave { background: rgba(26,14,6,.8); border: 1.5px solid #c8924a; font-size: .68rem; padding: 1px 9px; }
body.gd-art .gd-wave:empty { display: none; }
body.gd-art .gd-foebar i { font-size: 0; width: 22px; height: 24px; right: -8px; top: -9px; background: var(--a-skull) center / contain no-repeat; }
body.gd-art .gd-hint { top: calc(calc(var(--w) * 14.53 / 100) + 34px); }
body.gd-art .gd-toast { top: calc(calc(var(--w) * 14.53 / 100) + 40px); }
body.gd-art .gd-banner { top: 27%; }
/* layered gate HP bar sits on the wall, above the ability buttons */
body.gd-art .gd-hp { display: block; position: absolute; left: 50%; bottom: 72px; transform: translateX(-50%); width: min(94%, 400px); aspect-ratio: 1030 / 90; z-index: 21; pointer-events: none; }
body.gd-art .gd-hp::after { content: ""; position: absolute; inset: 0; background: var(--a-hpframe) center / 100% 100% no-repeat; z-index: 3; }
body.gd-art .gd-hp .hb, body.gd-art .gd-hp .hf { position: absolute; left: 3.59%; top: 31.1%; width: 92.8%; height: 37.8%; }
body.gd-art .gd-hp .hb { background: var(--a-hpback) center / 100% 100% no-repeat; z-index: 1; }
body.gd-art .gd-hp .hf { z-index: 2; overflow: hidden; }
body.gd-art .gd-hp .hf b { position: absolute; inset: 0; background: var(--a-hpfill) left center / 100% 100% no-repeat; clip-path: inset(0 0 0 0); transition: clip-path .2s; }
body.gd-art .gd-hp span { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; font: 700 .6rem Georgia, serif; color: #fff6e0; text-shadow: 0 1px 2px #000, 0 0 3px #000; white-space: nowrap; }
/* ability buttons: ready-made composites, 24-frame cooldown sweep, dim, ready glow */
body.gd-art .gd-actions { background: linear-gradient(180deg, rgba(10,6,3,0), rgba(10,6,3,.45) 40%, rgba(10,6,3,.75)); border-top: 0; height: 14%; min-height: 0; align-items: end; padding: 0 8px max(10px, env(safe-area-inset-bottom)); }
body.gd-art .gd-act { overflow: visible; width: 62px; height: 62px; border: 0; border-radius: 50%; background: var(--a-btn) center / 100% 100% no-repeat; box-shadow: none; filter: drop-shadow(0 3px 3px rgba(0,0,0,.55)); }
body.gd-art .gd-act.fire { --a-btn: var(--a-b-fire); } body.gd-art .gd-act.boulder { --a-btn: var(--a-b-boulder); } body.gd-art .gd-act.rally { --a-btn: var(--a-b-rally); } body.gd-art .gd-act.build { --a-btn: var(--a-b-build); }
body.gd-art .gd-act b { display: none; }
body.gd-art .gd-act > span:not(.gd-cd) { position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); font: 700 .5rem Georgia, serif; line-height: 1; padding: 1px 5px; border-radius: 7px; background: rgba(20,10,4,.82); border: 1px solid #c8924a; color: #ffe6bf; white-space: nowrap; z-index: 3; }
body.gd-art .gd-act.fire > span:not(.gd-cd), body.gd-art .gd-act.boulder > span:not(.gd-cd), body.gd-art .gd-act.build > span:not(.gd-cd) { display: none; }
body.gd-art .gd-cd { left: 14.5%; top: 14.5%; right: auto; bottom: auto; width: 71%; height: 71%; border-radius: 50%; background: var(--a-sweep) 0 0 / 2400% 100% no-repeat; z-index: 1; display: none; }
body.gd-art .gd-act.cd .gd-cd { display: block; }
body.gd-art .gd-act::after { content: ""; position: absolute; left: 14.5%; top: 14.5%; width: 71%; height: 71%; border-radius: 50%; background: var(--a-dim) center / 100% 100% no-repeat; opacity: 0; z-index: 2; pointer-events: none; transition: opacity .15s; }
body.gd-art .gd-act.dim::after { opacity: .88; }
body.gd-art .gd-act:disabled { opacity: 1; }
body.gd-art .gd-act .gd-glow { display: block; position: absolute; left: -8%; top: -8%; width: 116%; height: 116%; background: var(--a-glow) center / 100% 100% no-repeat; opacity: 0; pointer-events: none; z-index: -1; }
body.gd-art .gd-act.ready .gd-glow { opacity: .9; animation: gdglow 1.3s ease-in-out infinite alternate; }
body.gd-art .gd-act.armed .gd-glow { opacity: 1; animation: none; transform: scale(1.12); }
body.gd-art .gd-act.armed { box-shadow: none; background: var(--a-btn) center / 100% 100% no-repeat; filter: drop-shadow(0 0 6px #ffd060) drop-shadow(0 3px 3px rgba(0,0,0,.5)); }
body.gd-art .gd-act.busy::after { content: "…"; opacity: 1; background: none; left: auto; right: 6px; top: 0; width: auto; height: auto; color: #ffd060; font-size: 1rem; }
@keyframes gdglow { from { opacity: .35; transform: scale(.96); } to { opacity: .95; transform: scale(1.05); } }
body.gd-art .gd-aid { overflow: visible; width: 56px; height: 56px; border: 0; background: var(--a-aidbtn, var(--a-frame)) center / 100% 100% no-repeat; box-shadow: none; filter: drop-shadow(0 3px 3px rgba(0,0,0,.55)); color: #fff; }
body.gd-art .gd-aid.noart b { font-size: 1.15rem; margin-top: -4px; } body.gd-art .gd-aid:not(.noart) b { display: none; }
body.gd-art .gd-aid i { position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); background: rgba(20,10,4,.85); border: 1px solid #78c8e8; border-radius: 7px; padding: 1px 4px; max-width: none; white-space: nowrap; font-size: .46rem; z-index: 3; }
body.gd-art .gd-aid .gd-cd { left: 14.5%; top: 14.5%; right: auto; bottom: auto; width: 71%; height: 71%; border-radius: 50%; background: var(--a-sweep) 0 0 / 2400% 100% no-repeat; display: none; }
body.gd-art .gd-aid.cd .gd-cd { display: block; }
body.gd-art .gd-aid:disabled { opacity: 1; filter: grayscale(.5) brightness(.75) drop-shadow(0 3px 3px rgba(0,0,0,.55)); }
body.gd-art .gd-aid.armed { box-shadow: none; filter: drop-shadow(0 0 7px #ffe090); }
body.gd-art .gd-sq { bottom: calc(14% + 40px); }
/* radial build menu: painted ring + slot frames + medallions + parchment info card */
body.gd-art .gd-ringart { position: absolute; width: 167px; height: 167px; margin: -83px 0 0 -83px; background: var(--a-ring) center / 100% 100% no-repeat; pointer-events: none; animation: gdpop .16s ease-out; filter: drop-shadow(0 4px 6px rgba(0,0,0,.55)); }
body.gd-art .gd-disc { width: 56px; height: 56px; border: 0; background: var(--a-slot) center / 100% 100% no-repeat; border-radius: 50%; overflow: visible; box-shadow: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
body.gd-art .gd-disc img { top: 50%; height: auto; width: 74%; max-width: none; max-height: 74%; transform: translate(-50%, -52%); }
body.gd-art .gd-disc img.med { width: 76%; border-radius: 50%; filter: none; }
body.gd-art .gd-disc em { top: 50%; transform: translateY(-50%); line-height: 1; }
body.gd-art .gd-disc .n { position: absolute; left: 50%; top: -8px; transform: translateX(-50%); font-size: .5rem; padding: 1px 5px; border-radius: 7px; background: rgba(20,10,4,.88); border: 1px solid #c8924a; white-space: nowrap; margin: 0; }
body.gd-art .gd-disc .c { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); margin: 0; border: 1px solid #8a5a2a; white-space: nowrap; }
body.gd-art .gd-disc.short .med, body.gd-art .gd-disc.short img { filter: grayscale(.45) brightness(.8); } body.gd-art .gd-disc.lock .med, body.gd-art .gd-disc.lock img { filter: grayscale(1) brightness(.6); }
body.gd-art .gd-disc.sell { border: 0; }
body.gd-art .gd-rlabel { width: 152px; min-width: 0; max-width: none; height: 92px; box-sizing: border-box; padding: 15px 20px 14px; border: 0; border-radius: 0; background: var(--a-card) center / 100% 100% no-repeat; color: #3a2410; display: flex; flex-direction: column; align-items: center; justify-content: center; filter: drop-shadow(0 4px 5px rgba(0,0,0,.5)); }
body.gd-art .gd-rlabel b { color: #5a2a08; font-size: .8rem; } body.gd-art .gd-rlabel .st { color: #b87a10; text-shadow: 0 0 1px #5a3a08; } body.gd-art .gd-rlabel i { color: #3a2410; font-size: .58rem; line-height: 1.12; margin-top: 2px; }
/* results card */
body.gd-art #sheet[data-kind=result] { align-items: center; padding-top: 8%; }
body.gd-art #sheet[data-kind=result] .gd-card { width: min(348px, calc(var(--w) * 92 / 100)); max-height: none; aspect-ratio: unset; height: auto; background: none; border: 40px solid transparent; border-image-source: var(--a-rcard); border-image-slice: 94 94 101 97 fill; border-image-width: 40px 39px 42px 40px; border-image-repeat: stretch; border-radius: 0; padding: 22px 16px 14px; overflow: visible; filter: drop-shadow(0 8px 14px rgba(0,0,0,.6)); justify-content: flex-start; gap: 8px; }
body.gd-art #sheet[data-kind=result] .gd-x { display: none; }
body.gd-art #sheet[data-kind=result] h2 { display: none; }
body.gd-art #sheet[data-kind=result] .gd-rib { position: absolute; left: 50%; top: -76px; width: calc(100% + 40px); aspect-ratio: 676 / 204; transform: translateX(-50%); background: var(--a-rib) center / 100% 100% no-repeat; display: grid; place-items: center; filter: drop-shadow(0 3px 3px rgba(0,0,0,.5)); }
body.gd-art #sheet[data-kind=result] .gd-rib.bad { background-image: var(--a-ribd); }
body.gd-art #sheet[data-kind=result] .gd-rib span { font: 700 1.28rem Georgia, serif; color: #fff4d8; text-shadow: 0 2px 3px #200808, 0 0 6px #200808; letter-spacing: .03em; margin-top: -2px; }
body.gd-art #sheet[data-kind=result] .gd-stats { grid-template-columns: 1fr; gap: 5px; }
body.gd-art #sheet[data-kind=result] .gd-stat { background: rgba(110,74,28,.14); border: 1px solid rgba(110,74,28,.4); padding: 5px 8px; }
body.gd-art #sheet[data-kind=result] .gd-stat b { color: #4a2a0a; font-size: .95rem; } body.gd-art #sheet[data-kind=result] .gd-stat span { color: #3e2812; font-size: .74rem; }
body.gd-art #sheet[data-kind=result] .gd-stat.good b { color: #2a6a18; } body.gd-art #sheet[data-kind=result] .gd-stat.bad b { color: #a02a14; }
body.gd-art #sheet[data-kind=result] .gd-btn.big { margin-top: 8px; }
.gd-aidico { width: 36px; height: 36px; object-fit: contain; }
.gd-rib { display: none; }
body.gd-art #sheet[data-kind=result] #sheetBody { display: flex; flex-direction: column; gap: 8px; flex: 0 1 auto; min-height: 0; }
body.gd-art .gd-act > span:empty { display: none; }
body.gd-art .gd-act { width: 66px; height: 66px; }
body.gd-art .gd-aidrow { top: calc(calc(var(--w) * 14.53 / 100) + 44px); right: 5px; }
body.gd-art .gd-aid { width: 50px; height: 50px; }
/* banners: pre-raid tip and wave banners are a slim strip under the HUD so they never cover the road */
.gd-banner.pre { top: calc(calc(var(--w) * 14.53 / 100) + 34px); transform: translateX(-50%); padding: 5px 12px; font-size: .82rem; font-weight: 700; border-radius: 10px; background: rgba(0,0,0,.6); border: 0; box-shadow: none; white-space: nowrap; max-width: 92%; color: #ffe0b0; }
.gd-banner.wave { top: calc(calc(var(--w) * 14.53 / 100) + 38px); transform: translateX(-50%); padding: 4px 14px; font-size: .82rem; border-radius: 12px; background: rgba(20,8,4,.8); box-shadow: 0 3px 10px rgba(0,0,0,.5); white-space: normal; max-width: 92%; }
.gd-banner.wave small { font-size: .7rem; margin-top: 1px; white-space: normal; }
@media (max-width: 370px) { .gd-banner.pre, body.gd-art .gd-hint { font-size: .76rem; } }
body.gd-art .gd-banner.pre { top: calc(calc(var(--w) * 14.53 / 100) + 34px); } body.gd-art .gd-banner.wave { top: calc(calc(var(--w) * 14.53 / 100) + 38px); }

/* qa8: the "Practice raid" hint banner steps aside while the tower menu is open so it never covers an option */
body:has(#radial:not([hidden]) .gd-disc) .gd-banner { visibility: hidden; }
/* road2 (2026-11-20): allied aid buttons sit bottom-right over the wall, clear of the long road's hairpins */
body.gd-art .gd-aidrow, .gd-aidrow { top: auto; bottom: 112px; right: 5px; }

/* road3: the global feedback pill sat on the lower-left hairpin; park it beside the gate wall on this page */
body.gd-page .ccfb-pill{top:auto;bottom:136px}
/* ===== art polish 1 (Concord Art, 2026-11-27, staged) ===== */
/* ap1: the global "online" debug chip sat on the coin pill; hidden on game pages (same as castle/crystal) */
body.gd-page #ccNet { display: none !important; }
/* ap1: build-ring cost badges: the generic ".gd-disc img" rule also grabbed the coin <img> and stretched it over the number, so tower prices were invisible */
body.gd-art .gd-disc .c img.cur-ico, .gd-disc .c img.cur-ico { position: static; left: auto; top: auto; transform: none; width: 11px !important; height: 11px !important; max-width: none; max-height: none; border-radius: 0; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
body.gd-art .gd-disc .c { padding: 1px 6px 1px 4px; gap: 2px; font-size: .62rem; }
/* ap1: neon lime buttons/labels -> forest green with a brass rim (reads medieval, still clearly "on") */
.gd-btn.green { background: linear-gradient(180deg, #6e9a48, #355a22); border-color: #c8924a; color: #fff4dc; text-shadow: 0 1px 1px rgba(0,0,0,.6); }
.gd-go { background: linear-gradient(180deg, #6e9a48, #355a22); border-color: #c8924a; color: #fff4dc; text-shadow: 0 1px 1px rgba(0,0,0,.6); }
.gd-own { color: #b9d98c; }
.gd-chip { color: #d8e8b8; }
/* ap1: painted icons in sheet rows sit at the same size as the emoji they replace */
.gd-row .ic .ua, .gd-card .gd-aidrow b .ua { width: 1.35em; height: 1.35em; vertical-align: middle; }
.gd-disc em .ua { width: 1.1em; height: 1.1em; }
/* ap1: tiny HUD labels (8-9.6px) up a step so they read on phones and desktop */
body.gd-art .gd-pill .cc-n small { font-size: .56rem; }
body.gd-art .gd-hp span { font-size: .66rem; }
.gd-pill .cc-n small.prac { font-size: .64rem; color: #f0d49a; letter-spacing: .02em; }
/* ===== art polish 2 (Concord Art, 2026-11-27, staged) ===== */
/* ap2: gate HP fill: CSS-painted enamel, deep blood-red at the empty end to warm amber at the full end (replaces the web-green / amber / red PNG fills).
   The JS clip still reveals it from the left, so a failing gate shows only the dark red end. No image files. */
body.gd-art .gd-hp .hf b {
  background:
    linear-gradient(180deg, rgba(255,236,190,.55) 0%, rgba(255,220,160,.12) 22%, rgba(0,0,0,0) 45%, rgba(0,0,0,.18) 70%, rgba(40,6,2,.55) 100%),
    repeating-linear-gradient(100deg, rgba(0,0,0,.06) 0 3px, rgba(255,255,255,.03) 3px 7px),
    linear-gradient(90deg, #4a0c08 0%, #7c1a10 22%, #a8321a 48%, #c8601e 74%, #e09a34 100%) !important;
  border-radius: 6px / 50%;
}
body.gd-art .gd-hp .hb { background: linear-gradient(180deg, #120806, #2a120a 60%, #120806) !important; border-radius: 6px / 50%; box-shadow: inset 0 2px 3px rgba(0,0,0,.8); }
/* brass frame: warm the painted frame toward brass */
body.gd-art .gd-hp::after { filter: sepia(.45) saturate(1.5) brightness(1.18) contrast(1.05); }
body.gd-art .gd-hp span { color: #fff3d6; text-shadow: 0 1px 2px #1a0602, 0 0 3px #1a0602, 0 0 1px #000; }

/* ap2: phone overlaps. Feedback tab leaves the left wall tower: it docks at the bottom-left edge of the ability bar (dark strip, nothing painted there). */
body.gd-page .ccfb-pill { top: auto !important; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 9px) !important; width: 12px !important; height: 40px !important; line-height: 40px !important; }
body.gd-art .gd-actions { padding-left: 16px; }
/* ap2: Allied aid buttons leave the right wall tower: during a raid they join the ability bar at the bottom-right, side by side,
   and the four ability buttons step down a little to make room (58px at 390, 54px at 360; still well above a 44px tap target). */
body.gd-art .gd-aidrow, .gd-aidrow { top: auto; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 7px); right: 6px; flex-direction: row; gap: 6px; }
body.gd-art .gd-aid { width: 48px; height: 48px; }
body.gd-art .gd-aid:disabled { filter: grayscale(.3) brightness(.95) drop-shadow(0 3px 3px rgba(0,0,0,.55)); }   /* recharging aid stays readable on the dark bar */
body.gd-art .gd-aid i { bottom: -7px; top: auto; font-size: .44rem; padding: 0 3px; max-width: 54px; overflow: hidden; text-overflow: ellipsis; }
body.gd-art:has(.gd-aidrow .gd-aid) .gd-actions { padding-right: 112px; }
body.gd-art:has(.gd-aidrow .gd-aid) .gd-act { width: 58px; height: 58px; }
@media (max-width: 370px) { body.gd-art:has(.gd-aidrow .gd-aid) .gd-act { width: 54px; height: 54px; } body.gd-art:has(.gd-aidrow .gd-aid) .gd-actions { padding-right: 108px; } body.gd-art .gd-aid { width: 46px; height: 46px; } }
/* wide-screen phone column (must stay last: overrides body.gd-page inset) */
@media (min-aspect-ratio: 3/4) {
  :root { --w: calc(100vh * 390 / 844); --w: calc(100dvh * 390 / 844); }
  html { background: #050302; }
  body.gd-page { left: calc(50% - var(--w) / 2); right: auto; width: var(--w); box-shadow: 0 0 40px rgba(0,0,0,.8); }
}
/* ap1: wide screens: the black side margins become the town behind the gate (approved Human town plate, blurred + darkened, CSS only) */
@media (min-aspect-ratio: 3/4) {
  html::before { content: ""; position: fixed; inset: -30px; z-index: -1; background: #050302 url("assets/town/scene/village_pan.webp") center / cover no-repeat; filter: blur(14px) brightness(.3) saturate(.75); pointer-events: none; }
  body.gd-page { box-shadow: 0 0 0 2px rgba(200,146,74,.55), 0 0 48px rgba(0,0,0,.9); }
  body.gd-page .ccfb-pill { left: calc(50% - var(--w) / 2); }   /* feedback tab rides the column edge, not the screen edge */
}

/* ===== art polish 3 (Concord Art 2026-11-27): a recharging aid reads as "charging", not dead =====
   The button art moves to ::before so only it is desaturated; an amber ring fills clockwise as the aid recharges (--cdp from gate.js 0..1),
   the painted cooldown sweep is lightened so the icon shows through, and the seconds tag turns amber. Ready aid keeps full colour, no ring. */
body.gd-art .gd-aid.cd { background: none; filter: drop-shadow(0 3px 3px rgba(0,0,0,.55)); }
body.gd-art .gd-aid.cd::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--a-aidbtn, var(--a-frame)) center / 100% 100% no-repeat; filter: grayscale(.7) brightness(1.3) contrast(1.05); z-index: 0; pointer-events: none; }
body.gd-art .gd-aid.cd .gd-cd { opacity: .22; }
body.gd-art .gd-aid.cd::after { content: ""; position: absolute; inset: 1px; border-radius: 50%; pointer-events: none; z-index: 2;
  background: conic-gradient(#ffc24f calc(var(--cdp, 0) * 360deg), rgba(255, 214, 140, .16) 0);
  -webkit-mask: radial-gradient(circle closest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); mask: radial-gradient(circle closest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  filter: drop-shadow(0 0 2px rgba(255, 170, 50, .8)); }
body.gd-art .gd-aid.cd i { border-color: #e0a640; color: #ffe2a8; }
/* ready aid (in a raid, not recharging): brighter, full colour, warm glow that breathes, so ready vs charging is obvious at a glance */
body.gd-art .gd-aidrow .gd-aid:not(.cd):not(:disabled) { filter: brightness(1.22) saturate(1.15) drop-shadow(0 0 5px rgba(255, 196, 80, .8)); animation: gdAidReady 1.6s ease-in-out infinite; }
@keyframes gdAidReady { 50% { filter: brightness(1.32) saturate(1.2) drop-shadow(0 0 9px rgba(255, 196, 80, .95)); } }
body.gd-art .gd-aidrow .gd-aid.armed { animation: none; }
