main{max-width:1180px;margin:24px auto}.tower-tools{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:14px 0}.tower-tools label{display:flex;align-items:center;gap:8px}.tower-tools button,.tower-tools select,#tower-finish,#tower-retry{min-height:44px;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--ink);padding:9px 12px;font:600 .86rem system-ui;display:inline-flex;align-items:center;justify-content:center;gap:7px}.tower-tools svg,#tower-finish svg,#tower-retry svg{width:20px;height:20px;flex:none}.tower-tools button:disabled{opacity:.45}.tower-layout{display:grid;grid-template-columns:minmax(0,1fr) 190px;gap:14px;align-items:start}#tower-board{display:block;width:100%;height:auto;aspect-ratio:3/2;border:1px solid var(--line);border-radius:18px;touch-action:none;user-select:none;background:#fff2d4;cursor:crosshair}#tower-board:focus-visible{outline:3px solid #ecc16e;outline-offset:3px}.tower-bank h2{font-size:1rem;margin:0 0 10px}#tower-palette{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}#tower-palette button{min-width:0;background:var(--surface);color:var(--ink);border:2px solid var(--line);border-radius:12px;padding:7px;font:600 .73rem system-ui;cursor:pointer}#tower-palette button[aria-pressed=true]{border-color:#e3b24e;box-shadow:0 0 0 2px #e3b24e33}#tower-palette img{width:100%;height:66px;object-fit:contain;display:block}#tower-palette span{display:block;margin-top:5px}.tower-stats{display:flex;gap:22px;flex-wrap:wrap;margin:9px 0;color:var(--muted)}#tower-status{min-height:1.5em}#tower-finish{background:#e9be68;color:#202c43}.tower-paper{display:none}@media(max-width:650px){.tower-layout{grid-template-columns:1fr}#tower-palette{grid-template-columns:repeat(3,minmax(0,1fr))}#tower-palette img{height:60px}.tower-tools button{flex:1 1 120px}.tower-tools label{width:100%}}@media(orientation:landscape) and (max-height:650px){.tower-layout{grid-template-columns:minmax(0,1fr) 155px}#tower-board{width:min(100%,calc((100svh - 85px)*1.5));height:auto;max-height:none;margin:auto}#tower-palette img{height:40px}.tower-tools button{flex:0 1 auto}.tower-tools label{width:auto}#tower-palette button{min-height:65px}}
@media print{@page{size:letter landscape;margin:.6in}html,body{padding:0!important;margin:0!important;background:#fff!important;color:#111!important}body>*:not(.tower-paper){display:none!important}.tower-paper{display:block!important;position:relative;box-sizing:border-box;width:100%;height:180mm;max-height:180mm;overflow:hidden;margin:0!important;color:#111;font:9pt Arial}.tower-paper h1{font:15pt Arial;margin:0 0 2mm}.tower-paper-help{font:9pt Arial;margin:2mm 0 3mm}.tower-cutouts{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:2mm}.tower-cutouts figure{margin:0;border:.25mm dashed #999;padding:1mm;break-inside:avoid;text-align:center;height:42mm;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:space-between}.tower-cutouts img{max-width:100%;max-height:37mm;object-fit:contain;display:block;flex:none}.tower-cutouts figcaption{font:7.5pt Arial}.tower-sheet{position:relative;width:100%;height:120mm}.tower-sheet>#tower-paper-image{width:190mm;height:120mm;object-fit:contain}.tower-small-reference{position:absolute;right:0;top:0;width:37mm;height:37mm;object-fit:contain}body[data-tower-print=pieces] .tower-sheet{display:none}body[data-tower-print=tower] .tower-cutouts,body[data-tower-print=tower] .tower-paper-help{display:none}}

@media print{.tower-cutouts[data-level="0"]{grid-template-columns:repeat(3,minmax(0,1fr))}.tower-cutouts[data-level="0"] figure{height:64mm}.tower-cutouts[data-level="0"] img{max-height:59mm}.tower-cutouts[data-level="1"]{grid-template-columns:repeat(4,minmax(0,1fr))}}

/* Only a real load failure exposes recovery; author display rules must never override hidden. */
#tower-retry[hidden]{display:none!important}#tower-palette button:disabled{opacity:.45;cursor:default}#tower-palette .tower-stock{display:block;font:700 .72rem system-ui;margin-top:4px}#tower-board{cursor:grab}
