@font-face{font-family:Crown;src:url('./art/DejaVuSans.ttf')}@font-face{font-family:Crown;src:url('./art/DejaVuSans-Bold.ttf');font-weight:700}*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#101e2d;color:#fff0d0;font-family:Crown,sans-serif}button,a{-webkit-tap-highlight-color:transparent}button{font:700 13px Crown,sans-serif;color:#fff0d0;background:#263e50;border:1px solid #86704c;border-radius:7px;min-height:44px;padding:8px 10px;cursor:pointer}button:hover:not(:disabled),button[aria-pressed=true]{background:#6a4b2c;border-color:#f4cf81}button:focus-visible,a:focus-visible{outline:3px solid #fff1b8;outline-offset:2px}button:disabled{opacity:.5;cursor:default}#game{height:100dvh;max-width:1920px;margin:auto;padding:12px 20px;display:flex;flex-direction:column;gap:10px}header{display:flex;align-items:center;gap:24px;min-height:38px}header a{color:#e4bd72;text-decoration:none;font-size:13px}h1{font-family:Georgia,serif;font-size:30px;white-space:nowrap;margin:0;color:#f5d99c}h2,h3,p{margin:0}h2{font-family:Georgia,serif;color:#f5d99c;font-size:20px}h3{font-size:13px}p{font-size:13px;line-height:1.5}.resources{margin-left:auto;display:flex;gap:20px;font-size:13px}.resources strong{padding:8px 10px;background:#1d3143;border:1px solid #64563d;border-radius:5px}.command{display:flex;align-items:center;justify-content:space-between;gap:16px}.tagline{font-size:14px;color:#ddc898}#phase{color:#aec9c4;font-size:12px}.orders{display:flex;gap:8px}#start{background:#d6ac61;color:#142536;min-width:144px}.battle-layout{container-type:size;display:grid;grid-template-columns:200px minmax(0,1fr) 190px;align-items:center;gap:18px;flex:1;min-height:0}.adviser{display:flex;flex-direction:column;gap:14px;align-self:stretch;justify-content:center}.adviser img{width:100%;height:auto;max-height:250px;object-fit:contain}.wave-preview{background:#1b3041;border-left:3px solid #c59b56;padding:12px}.wave-preview h2{color:#d9b572;margin-bottom:6px}.legend{font-size:11px;color:#bcbdad;display:flex;flex-direction:column;gap:7px}.workshop{display:flex;flex-direction:column;gap:14px}.workshop h2{font-size:19px}#tools{display:grid;gap:7px}#selection{min-height:145px;border-top:1px solid #6e5d40;padding-top:12px;display:flex;flex-direction:column;gap:9px}#selection-stats{font-size:12px;color:#c8c9b5}#upgrade{margin-top:auto}.replay{display:flex;gap:6px}.replay button{font-size:11px;flex:1;padding:6px}#battlefield{position:relative;width:min(100%,calc(100cqh * 1280 / 840));max-height:none;aspect-ratio:1280/840;border:2px solid #ae874a;border-radius:12px;box-shadow:0 8px 25px #0008;overflow:hidden;justify-self:center}#map{display:block;width:100%;height:100%;object-fit:fill}#cells{position:absolute;left:3.125%;top:4.7619%;width:93.75%;height:85.7143%;display:grid;grid-template-columns:repeat(12,1fr);grid-template-rows:repeat(9,1fr);touch-action:none}#cells button{padding:0;min-height:0;min-width:0;border:0;border-radius:0;background:transparent;touch-action:none}#cells button:hover{background:#fff1ba20}#cells button:focus-visible{outline-offset:-3px}#outcome{position:absolute;inset:0;background:#101e2de8;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:16px;text-align:center;padding:25px}#outcome[hidden]{display:none}#outcome h2{font-size:35px}#outcome p{max-width:320px}footer{height:48px;flex-shrink:0;display:flex;justify-content:space-between;gap:20px;min-height:35px;align-items:center;border-top:1px solid #3b4b50;padding-top:8px}#notice{flex:1;min-width:0;font-size:12px;color:#f3d79d}small{font-size:10px;color:#a7b4b1;white-space:nowrap}
@media(min-width:901px) and (max-height:800px){#game{padding:8px 14px;gap:6px}.battle-layout{grid-template-columns:150px minmax(0,1fr) 170px;gap:12px}.adviser{gap:9px}.adviser img{max-height:160px}.adviser p{font-size:11px}.legend{display:none}.workshop{gap:8px}#selection{min-height:120px}.workshop button{min-height:38px}h1{font-size:26px}.resources{gap:10px}.wave-preview{padding:9px}footer{min-height:26px}}
@media(max-width:900px){#game{padding:8px 10px;gap:7px}header{gap:9px;flex-wrap:wrap}header a{font-size:10px}h1{font-size:23px}.resources{width:100%;margin:0;gap:6px;justify-content:space-between}.resources strong{flex:1;padding:7px 5px;font-size:11px;text-align:center}.command{gap:5px}.tagline{font-size:11px;max-width:200px;line-height:1.35}#phase{font-size:10px;max-width:195px;line-height:1.3}.orders{gap:5px}#start{min-width:100px;font-size:11px;padding:6px}#pause{font-size:11px;padding:6px}.battle-layout{container-type:normal;display:flex;flex-direction:column;gap:7px;justify-content:center}.adviser{width:100%;flex-direction:row;justify-content:flex-start;align-items:center;gap:8px;min-height:70px;max-height:84px}.adviser img{width:84px;height:76px;flex-shrink:0;object-fit:contain}.adviser #layout-name,.adviser #guidance,.legend{display:none}.wave-preview{padding:7px;flex:1;align-self:center}.wave-preview h2{font-size:11px;margin:0}.wave-preview p{font-size:10px;line-height:1.35}#battlefield{width:100%;flex:none;max-height:none;border-radius:8px}.workshop{width:100%;gap:7px}.workshop>h2{display:none}#tools{grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}#tools button{font-size:10px;line-height:1.3;padding:5px 2px;min-height:48px}#selection{display:grid;grid-template-columns:minmax(0,1fr) 100px;min-height:66px;padding-top:6px;gap:3px 6px}#selection-name{font-size:11px}#selection-stats{font-size:10px;line-height:1.35}#upgrade{grid-column:2;grid-row:1/3;min-height:44px;font-size:10px;padding:4px;margin:0}.replay{justify-content:flex-end}.replay button{flex:none;font-size:10px;min-height:36px;padding:5px 12px}footer{flex-direction:column;gap:3px;align-items:flex-start;min-height:45px;padding-top:5px}#notice{font-size:10px;line-height:1.3}small{font-size:9px}}
@media(max-width:900px) and (max-height:710px){.adviser{display:none}.tagline{display:none}#battlefield{max-height:44vh;width:auto;height:44vh;aspect-ratio:1280/840}.resources strong{padding:3px}.replay{display:none}#selection{min-height:48px}footer{min-height:25px}}

/* Keep the canvas and tile hit areas in the same scrollable coordinate space. */
#map-surface{position:relative;width:100%;aspect-ratio:1280/840}
#battlefield.zoomed{overflow:auto;aspect-ratio:1280/840}
#battlefield.zoomed #map-surface{width:max(100%,760px);max-width:none}
#battlefield.zoomed #cells{touch-action:pan-x pan-y}
#battlefield.zoomed #cells button{touch-action:pan-x pan-y}
.replay{flex-wrap:wrap}.replay button{min-height:44px}
#zoom{flex-basis:100%}
@media(min-width:901px) and (max-height:800px){#tools{grid-template-columns:1fr 1fr;gap:4px}#tools button:first-child{grid-column:1/3}.workshop button{min-height:44px}.replay button{flex:1;padding:4px}#zoom{flex-basis:100%}.workshop{gap:6px}#selection{min-height:104px}}
@media(max-width:900px){.replay{display:flex;flex-wrap:nowrap}.replay button{flex:1;padding:5px;font-size:10px;min-height:44px}#zoom{flex-basis:auto}footer{height:54px;min-height:54px}#notice{font-size:11px}.adviser #rook-line{max-width:115px;font-size:12px}.battle-layout{justify-content:center}}
@media(max-width:900px) and (max-height:710px){html,body{height:auto;min-height:100%;overflow:auto}#game{height:auto;min-height:100dvh}.battle-layout{flex:none;min-height:0}.adviser{display:flex;min-height:56px;max-height:64px}.adviser img{width:60px;height:56px}#battlefield{width:100%;height:auto;max-height:none;aspect-ratio:1280/840}.replay{display:flex}#selection{min-height:66px}.tagline{display:block}footer{height:auto;min-height:54px}}
@media(max-width:900px) and (orientation:landscape){.battle-layout{display:grid;grid-template-columns:minmax(0,1fr) 200px;gap:10px;align-items:start}.adviser{grid-column:1/3}.workshop{grid-column:2;grid-row:2}#battlefield{grid-column:1;grid-row:2}#tools{grid-template-columns:1fr 1fr}#tools button:first-child{grid-column:1/3}#selection{display:flex}#upgrade{min-height:44px}#game{height:auto}footer{margin-top:8px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}

@media(min-width:901px) and (max-height:800px){#tools button{font-size:11px;line-height:1.2;padding:4px}#selection{gap:6px;padding-top:8px}}

#selection-actions{display:grid;grid-template-columns:1fr 1fr;gap:4px;margin-top:auto}#selection-actions button{font-size:11px;padding:4px;min-height:44px;margin:0}#selection-name{font-size:12px}#cells button[data-mount=wall]{box-shadow:inset 0 0 0 2px #f5cf75}#cells button[data-mount=ground]{background:#8dd5d110}
@media(max-width:900px){#selection{min-height:96px}#selection-actions{grid-column:2;grid-row:1/3;display:flex;flex-direction:column;gap:4px;margin:0}#selection-actions button{flex:1;width:100%;font-size:10px;min-height:44px}#upgrade{grid-column:auto;grid-row:auto}#selection-name{font-size:11px}}
@media(max-width:900px) and (orientation:landscape){#selection-actions{display:grid;grid-template-columns:1fr 1fr}}

/* Siege shares the approved illustrated shell; compact controls keep the map central. */
dialog{max-width:min(470px,94vw);color:#fff0d0;background:#152a3b;border:2px solid #c49b59;border-radius:14px;padding:24px}dialog::backdrop{background:#071323d9}dialog p{margin:12px 0}dialog button{display:block;width:100%;margin:9px 0}#mode-progress{color:#bcd8d1}#mode-current{font-size:12px;color:#f4cf81}#tools{grid-template-columns:1fr 1fr;gap:4px}#tools button{font-size:11px;padding:5px 3px}#tools button:first-child{grid-column:1/3}.tagline{display:none}.adviser{gap:8px}
@media(max-width:900px){#tools{display:flex;overflow-x:auto;gap:4px;padding-bottom:3px}#tools button{flex:0 0 84px;min-height:44px;font-size:10px}#mode-current{font-size:11px}.orders{gap:3px}#mode-change{font-size:10px;padding:4px}#phase{font-size:10px}.adviser{min-height:58px;max-height:64px}.adviser img{width:64px;height:60px}#selection{min-height:92px}#game{gap:5px}.battle-layout{gap:5px}.replay button{min-height:44px}header{min-height:30px}footer{height:48px;min-height:48px}}
@media(min-width:901px) and (max-height:800px){.adviser img{max-height:130px}#selection{min-height:104px}.workshop{gap:4px}.workshop h2{font-size:17px}.replay button{font-size:10px}.wave-preview{padding:6px}}

@media(max-width:900px) and (orientation:portrait){#tools{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));overflow:visible;padding:0}#tools button:first-child{grid-column:auto}#tools button{min-width:0;min-height:44px;font-size:10px}#battlefield{width:min(100%,calc((100dvh - 610px)*1280/840));min-width:270px}.adviser{min-height:52px;max-height:56px}.adviser img{width:56px;height:52px}#selection{min-height:92px}.resources strong{padding:5px}footer{height:42px;min-height:42px}.replay{gap:4px}}

/* V3: direct tower selection, six build tools, one real phone overview control. */
[hidden]{display:none!important}#tools button:first-child{grid-column:auto}#selection[data-open=true]{border-color:#e6bf70}#map-view{display:none}#cancel-build{grid-column:1/-1;background:#344e59}#selection-actions[hidden]{display:none}select{font:14px Crown,sans-serif;color:#fff0d0;background:#263e50;border:1px solid #ac8c55;min-height:44px;width:100%;padding:8px;border-radius:6px}select:focus-visible{outline:3px solid #fff1b8}#modes label{display:block;margin:12px 0 6px}#battlefield.enlarged{overflow:auto}#battlefield.enlarged #map-surface{width:840px}#battlefield.enlarged #cells,#battlefield.enlarged #cells button{touch-action:pan-x pan-y}#selection-name{line-height:1.35}
@media(max-width:900px){#map-view{display:block}#tools{grid-template-columns:repeat(4,minmax(0,1fr))}#cancel-build{grid-column:auto}#mode-current{max-width:190px;font-size:10px}#map-view{font-size:10px}.adviser #rook-line{font-size:11px}.replay{gap:4px}#selection-stats{font-size:10px}}
@media(min-width:901px){.replay{flex-wrap:nowrap}.replay button{flex:1}#tools{grid-template-columns:1fr 1fr}}

#health[data-danger=true]{color:#ffe5d5;border-color:#e59a7b;background:#5b302b}

.outcome-actions{display:flex;gap:8px;max-width:360px;width:100%}.outcome-actions button{flex:1;min-height:44px}
@media(max-width:900px){#outcome{gap:8px;padding:12px}#outcome h2{font-size:22px;line-height:1.15}#outcome p{font-size:11px;line-height:1.35}.outcome-actions button{font-size:11px;padding:6px}}
