/* R24: positions live in data/ui-layout.json. The existing painted wood is the backdrop. */
#hud .header .header-brand{display:flex;align-items:center;justify-content:center;gap:18px;padding:0;margin:0;border:0;white-space:nowrap}
#hud .header .header-brand .logo{font-size:30px;line-height:38px;letter-spacing:4px;color:#ffe6ad;text-shadow:0 2px 1px #26170d,1px 0 #54371c}
#hud .header .header-brand .chapter{font-size:12px;line-height:18px;letter-spacing:2px;color:#e9d2a0}
#hud .hud-command-frame{position:absolute;pointer-events:none;clip-path:polygon(6% 1%,94% 1%,96% 7%,99% 13%,100% 28%,100% 72%,98% 89%,94% 99%,6% 99%,3% 88%,0% 70%,0% 30%,3% 12%)}
#hud .hud-command-frame svg{display:block;width:100%;height:100%;overflow:hidden;pointer-events:none}
#hud .header .toolbar{display:grid;grid-template-columns:44px 44px 98px 98px;gap:12px;align-items:center}
#hud .toolbar .icon-button,#hud .toolbar .text-button{height:44px;min-height:44px;border-radius:6px;font-size:18px;box-shadow:inset 0 0 0 1px #efca7733,0 2px 2px #23170c77}
#hud .toolbar .icon-button img{width:38px;height:38px}
#hud .toolbar .text-button{background:linear-gradient(#765330e8,#4a321de8);border:1px solid #c29b5d;text-decoration:none;color:#ffe8b6;letter-spacing:2px}
#hud .speed-action{height:44px;min-height:44px;padding:0 4px;border:1px solid #bb985e;border-radius:6px;background:linear-gradient(#765330e8,#4a321de8);box-shadow:inset 0 0 0 1px #efca7733,0 2px 2px #23170c77}
#hud .speed-action strong{font-size:22px;line-height:23px}
#hud .speed-action small{font-size:11px;line-height:14px}
#hud .speed-action[data-speed="4"]{background:linear-gradient(#896035,#56361b);border-color:#f2cf82}
#hud .stats{gap:12px;height:26px;pointer-events:none}
#hud .stats .stat{height:26px;padding:0 4px;gap:6px;font-size:22px;line-height:26px;background:#251b1266;border:0;border-radius:3px;box-shadow:inset 0 1px 0 #e6bd6433;color:#ffebbb}
#hud .stats .stat small{font-size:11px;line-height:16px;color:#e0cca3}
#hud .stat-symbol{width:28px;height:26px;flex:0 0 28px}
#hud .stats .stat .stat-symbol>.stat-art{left:-6px;top:-10px;width:88px;height:47px}
#hud .stat-symbol.wave-symbol{width:34px;flex-basis:34px}
#hud .stats .stat .wave-symbol>.stat-art{position:static;width:34px;height:26px}
#hud .stage-title{display:flex;align-items:center;gap:11px;padding:0 11px 0 5px;white-space:nowrap;line-height:30px;font-size:21px;letter-spacing:2px;background:linear-gradient(100deg,#30271bf5,#5a4128f0 62%,#3b2c1df5);border:1px solid #b89455;border-radius:5px;box-shadow:inset 0 0 0 1px #e7bc6433,0 2px 3px #061c1888;color:#ffe9b9;text-shadow:0 1px 1px #291a10}
#hud .stage-title .chapter-label{display:flex;align-items:baseline;justify-content:center;gap:2px;min-width:63px;height:27px;margin:0;padding:0 4px;background:#1d342bd9;border-right:1px solid #aa8a50;border-radius:3px 0 0 3px;color:#e6c888;font-family:Forest,serif;letter-spacing:0}
#hud .chapter-label small{font-size:10px;line-height:25px}
#hud .chapter-label b{font-size:20px;line-height:25px;font-weight:400;font-variant-numeric:tabular-nums}
#hud .chapter-name{display:block;min-width:0;font-weight:400;letter-spacing:2px}
.compact #hud .header .header-brand .logo{visibility:visible;font-size:30px;line-height:38px;letter-spacing:3px}
.compact #hud .header .header-brand .chapter{display:none}
.compact #hud .header .toolbar{display:block}
.compact #hud .toolbar .icon-button{width:88px;height:88px;min-height:88px}
.compact #hud .toolbar .icon-button img{width:76px;height:76px}
.compact #hud .speed-action{width:88px;height:88px;min-height:88px}
.compact #hud .speed-action strong{font-size:32px;line-height:36px}
.compact #hud .speed-action small{font-size:22px;line-height:26px}
.compact #hud .stats{top:22px!important;height:84px!important;flex-direction:column;align-items:stretch;gap:3px}
.compact #hud .stats .stat{height:26px;flex:0 0 26px;font-size:24px;line-height:26px}
.compact #hud .stats .stat small{font-size:15px;line-height:20px}
.compact #hud .stage-title{font-size:26px!important;gap:8px;padding-right:7px;letter-spacing:0}
.compact #hud .chapter-label{min-width:62px}
.compact #hud .chapter-label small{font-size:12px}
.compact #hud .chapter-label b{font-size:24px}
.compact #hud .chapter-name{letter-spacing:0}

/* R27: keep live controls inside the painted inner board, clear of the carved rim. */
#hud .hud-command-frame{display:grid;grid-template-columns:36px minmax(0,1fr) 36px;grid-template-rows:12px minmax(0,1fr) 12px}
#hud .hud-command-frame svg{min-width:0;min-height:0}
#hud .header .toolbar{grid-template-columns:40px 40px 83px 83px;gap:12px}
#hud .toolbar .icon-button,#hud .toolbar .text-button{height:40px;min-height:40px;font-size:17px;letter-spacing:1px}
#hud .toolbar .icon-button img{width:34px;height:34px}
#hud .speed-action{height:40px;min-height:40px}
#hud .speed-action strong{font-size:21px;line-height:22px}
#hud .stats{height:22px;gap:10px}
#hud .stats .stat{height:22px;font-size:20px;line-height:22px;padding:0 2px;gap:5px}
#hud .stat-symbol{width:25px;height:22px;flex-basis:25px}
#hud .stats .stat .stat-symbol>.stat-art{width:80px;height:43px;left:-6px;top:-10px}
#hud .stat-symbol.wave-symbol{width:31px;flex-basis:31px}
#hud .stats .stat .wave-symbol>.stat-art{width:31px;height:22px}
.compact #hud .toolbar .icon-button{width:88px;height:88px;min-height:88px}
.compact #hud .toolbar .icon-button img{width:76px;height:76px}
.compact #hud .speed-action{width:88px;height:88px;min-height:88px}
.compact #hud .stats .stat{height:26px;font-size:24px;line-height:26px}

/* Reserve a real footer for the scroll; labels belong to its blank paper, beside the seal. */
#hud .sidebar{display:flex;flex-direction:column}
#hud .sidebar h2{flex:0 0 auto}
#hud .sidebar .tower-grid{display:grid;grid-template-columns:1fr;gap:8px;flex:0 0 auto}
#hud .sidebar .tower-card{height:84px;margin:0;padding:7px}
#hud .sidebar .tower-card img{width:55px;height:66px}
#hud .sidebar .tower-card .price{margin-top:3px}
#hud .sidebar .hint{flex:1;min-height:52px;max-height:none;overflow:auto;margin:8px 0 6px;padding-top:8px;line-height:1.6}
#hud .workshop-footer{flex:0 0 auto;display:flex;flex-direction:column;gap:6px}
#hud .workshop-footer .cancel-selection{height:44px;min-height:44px;margin:0}
#hud .workshop-footer .goal-button{width:100%;height:82px;min-height:82px;margin:0;flex:none}
#hud .goal-button>span{position:absolute;width:max-content;height:auto;padding:0;margin:0;display:block;transform:translate(-50%,-50%);font-size:15px;line-height:1;letter-spacing:0;white-space:nowrap}
.compact #hud .sidebar .tower-grid{grid-template-columns:1fr 1fr;gap:8px}
.compact #hud .sidebar .tower-card{height:138px;padding:5px}
.compact #hud .sidebar .tower-card img{width:78px;height:70px}
.compact #hud .sidebar .hint{min-height:54px;max-height:none;font-size:20px;line-height:1.35;margin:8px 0 6px;padding-top:7px}
.compact #hud .workshop-footer .cancel-selection{height:88px;min-height:88px}
.compact #hud .workshop-footer .goal-button{height:96px;min-height:96px}
.compact #hud .goal-button>span{font-size:22px}
