:root {
    --ink: #f7f3df;
    --muted: rgba(247, 243, 223, 0.62);
    --panel: rgba(17, 28, 26, 0.92);
    --panel-2: rgba(27, 43, 37, 0.94);
    --line: rgba(247, 243, 223, 0.10);
    --gold: #f6c65b;
    --green: #79c267;
    --danger: #ef6b61;
    --cyan: #83dfdc;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
button:focus-visible,
a:focus-visible {
    outline: 2px solid #f6d675;
    outline-offset: 2px;
}

body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    padding: max(8px, env(safe-area-inset-top, 0px)) 10px max(10px, env(safe-area-inset-bottom, 0px));
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, rgba(78, 137, 98, 0.25), transparent 38%),
        radial-gradient(circle at 100% 90%, rgba(175, 102, 58, 0.16), transparent 42%),
        #0b1413;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    display: flex;
    flex-direction: column;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

button { font: inherit; }
.user-bar { width: 100%; max-width: 520px; margin: 0 auto 8px; flex-shrink: 0; }

.access-screen {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    place-items: center;
    align-content: center;
    gap: 12px;
    color: rgba(247, 243, 223, .72);
    background: #0b1413;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: .3px;
}
.access-castle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #f0cf78;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.1);
    font-size: 24px;
}
body.access-pending .access-screen { display: grid; }
body.access-pending > :not(.access-screen) { visibility: hidden; }

.tw-shell {
    width: 100%;
    max-width: 520px;
    flex: 1;
    min-height: 0;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.tw-topbar {
    min-height: 48px;
    display: grid;
    grid-template-columns: 1.2fr repeat(3, auto) 34px;
    align-items: center;
    gap: 7px;
    padding: 5px 7px 5px 12px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(35, 54, 47, 0.96), rgba(15, 26, 24, 0.96));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.round-block { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.round-block .eyebrow { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: 1.4px; }
.round-block strong { font-family: Georgia, serif; font-size: 25px; color: #fff7d6; }
.stage-value {
    padding: 2px 5px;
    border-radius: 999px;
    color: rgba(247, 243, 223, .68);
    background: rgba(255,255,255,.07);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .35px;
}
.resource {
    height: 31px;
    min-width: 49px;
    padding: 0 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.055);
    font-size: 13px;
}
.resource-icon { font-size: 13px; }
.resource-icon.heart { color: #f07b71; }
.resource-icon.coin { color: var(--gold); text-shadow: 0 0 8px rgba(246, 198, 91, .5); }
.resource-icon.action { color: #7dd9ca; }
.icon-button,
.speed-button {
    border: 1px solid rgba(255,255,255,.11);
    color: var(--ink);
    background: rgba(255,255,255,.07);
    cursor: pointer;
}
.icon-button { width: 32px; height: 32px; border-radius: 10px; font-weight: 900; }

.tw-arena {
    position: relative;
    flex: 1;
    min-height: 250px;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(247, 243, 223, 0.13);
    background: #31583f;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(255,255,255,.03);
    touch-action: none;
}
#gameCanvas { width: 100%; height: 100%; display: block; }
.level-labels {
    min-width: 0;
    flex: 0 1 clamp(76px, 24vw, 96px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    pointer-events: none;
}
.level-index {
    flex-shrink: 0;
    color: rgba(247, 243, 223, .54);
    font-size: 8px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
}
.biome-pill,
.mutator-pill {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: rgba(255, 250, 229, .88);
    background: transparent;
    font-size: 9.5px;
    font-weight: 850;
    line-height: 1.08;
    letter-spacing: .25px;
    text-transform: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mutator-pill { color: #f1cf78; font-size: 8.5px; }
.threat-panel {
    min-width: 0;
    flex: 0 1 clamp(92px, 28vw, 116px);
    max-width: 116px;
    min-height: 36px;
    padding: 4px 7px;
    border: 1px solid rgba(246, 198, 91, .10);
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff8dd;
    background: rgba(246, 198, 91, .065);
    pointer-events: none;
}
.threat-panel.boss {
    border-color: rgba(255, 159, 103, .22);
    background: rgba(132, 52, 40, .16);
}
.threat-icon {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    color: #18241e;
    background: linear-gradient(145deg, #f7df91, #dca44b);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
    font-size: 12px;
    font-weight: 950;
}
.boss .threat-icon { color: #fff2d5; background: linear-gradient(145deg, #e9794e, #8e342d); }
.threat-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.threat-copy small {
    overflow: hidden;
    color: #f1cf78;
    font-size: 8px;
    font-weight: 950;
    line-height: 1;
    letter-spacing: .15px;
    text-transform: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.threat-copy strong {
    overflow: hidden;
    font-size: 10px;
    font-weight: 850;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wave-track {
    position: absolute;
    right: 11px;
    bottom: 10px;
    display: flex;
    gap: 4px;
    padding: 5px 7px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 999px;
    background: rgba(8,18,16,.58);
    backdrop-filter: blur(6px);
    pointer-events: none;
}
.wave-track i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,.22);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.wave-track i.done { background: #8bd178; }
.wave-track i.current { background: #f5cb65; box-shadow: 0 0 8px rgba(245,203,101,.75); }
.wave-track i.boss { border-radius: 2px; transform: rotate(45deg); }
.toast {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translate(-50%, 12px);
    max-width: calc(100% - 28px);
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(8, 15, 14, .86);
    color: #fff9df;
    box-shadow: 0 8px 22px rgba(0,0,0,.3);
    font-size: 11px;
    font-weight: 750;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: .22s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.selection-panel {
    min-height: 54px;
    padding: 6px 9px 6px 11px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(21, 34, 31, .91);
    display: flex;
    align-items: center;
    gap: 10px;
}
.selection-context,
.selection-main { min-width: 0; display: flex; align-items: center; gap: 8px; }
.selection-context {
    flex: 0 0 auto;
    width: calc(clamp(76px, 24vw, 96px) + 7px + clamp(92px, 28vw, 116px));
    gap: 7px;
}
.selection-main { flex: 1 1 130px; }
.selection-panel:has(.tower-actions.visible) .selection-context { display: none; }
.selection-panel:has(.tower-actions.visible) .selection-main { flex-basis: 100%; }
.selection-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.selection-title {
    font-size: 12.5px;
    font-weight: 850;
    line-height: 1.08;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.selection-subtitle {
    color: rgba(247, 243, 223, .66);
    font-size: 10.5px;
    line-height: 1.12;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tower-actions { display: none; gap: 5px; }
.tower-actions.visible { display: flex; }
.tower-actions button {
    height: 31px;
    border: 0;
    border-radius: 9px;
    padding: 0 9px;
    background: #5f9e58;
    color: white;
    font-size: 10px;
    font-weight: 850;
    cursor: pointer;
}
.tower-actions button:disabled { opacity: .38; }
.tower-actions .target {
    padding: 0 8px;
    color: #bcebe5;
    background: rgba(86, 171, 159, .13);
    border: 1px solid rgba(125, 217, 202, .22);
}
.tower-actions .sell { background: rgba(239,107,97,.16); color: #ff9b91; border: 1px solid rgba(239,107,97,.25); }

.tower-tray {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 12px 2px 0;
    scroll-padding-inline: 0 12px;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tower-tray::-webkit-scrollbar { display: none; }
.tower-card {
    position: relative;
    flex: 0 0 75px;
    min-width: 75px;
    padding: 6px 2px 5px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    color: var(--ink);
    background: linear-gradient(160deg, rgba(255,255,255,.085), rgba(255,255,255,.035));
    cursor: pointer;
    scroll-snap-align: start;
    touch-action: pan-x;
    transition: transform .12s, border-color .12s, background .12s;
}
.tower-card:active { transform: scale(.95); }
.tower-card.selected { border-color: var(--tower-color); background: rgba(255,255,255,.13); box-shadow: 0 0 0 1px var(--tower-color); }
.tower-card:disabled { opacity: .38; filter: grayscale(.35); }
.tower-symbol {
    width: 34px;
    height: 31px;
    margin: 0 auto 3px;
    display: grid;
    place-items: center;
    border-radius: 50% 50% 45% 45%;
    color: #fff;
    background: radial-gradient(circle at 38% 30%, rgba(255,255,255,.9), var(--tower-color) 34%, #17241f 66%);
    box-shadow: 0 4px 9px rgba(0,0,0,.28), inset 0 0 0 2px rgba(255,255,255,.10);
}
.tower-symbol svg {
    width: 27px;
    height: 25px;
    overflow: visible;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.42));
}
.tower-name {
    min-height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff9e5;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.05;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}
.tower-cost { display: block; color: #f8d477; font-size: 12px; font-weight: 900; text-align: center; margin-top: 2px; }

.battle-button,
.modal-primary {
    border: 0;
    color: #132019;
    background: linear-gradient(135deg, #f8d675, #e7a940);
    box-shadow: 0 7px 18px rgba(218, 157, 51, .24), inset 0 1px 0 rgba(255,255,255,.55);
    font-weight: 900;
    cursor: pointer;
}
.battle-controls {
    min-height: 46px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px 96px;
    gap: 6px;
    flex-shrink: 0;
}
.battle-button {
    min-width: 0;
    height: 46px;
    border-radius: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    letter-spacing: .2px;
    transition: transform .12s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}
.battle-button:active, .modal-primary:active { transform: scale(.985); }
.battle-button:disabled { opacity: .38; filter: grayscale(.5); cursor: default; }
.battle-button.battle-running {
    color: #fff4d4;
    background: linear-gradient(135deg, rgba(168, 68, 48, .92), rgba(115, 44, 34, .92));
    box-shadow: 0 7px 18px rgba(93, 31, 24, .26), inset 0 1px 0 rgba(255,255,255,.16);
}
.battle-button.is-paused {
    color: #183026;
    background: linear-gradient(135deg, #dff1c8, #9dcf91);
    box-shadow: 0 7px 18px rgba(119, 180, 108, .22), inset 0 1px 0 rgba(255,255,255,.55);
}
.battle-arrow { flex-shrink: 0; font-size: 16px; }
.speed-button {
    position: static;
    width: 48px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 950;
    transition: transform .12s ease, opacity .18s ease, background .18s ease;
}
.speed-button:active:not(:disabled) { transform: scale(.96); }
.speed-button:disabled { opacity: .38; cursor: default; }
.autoplay-button {
    min-width: 0;
    height: 46px;
    padding: 0 8px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    color: var(--muted);
    background: rgba(255,255,255,.055);
    cursor: pointer;
    transition: transform .12s ease, border-color .18s ease, background .18s ease, color .18s ease;
}
.autoplay-button:active { transform: scale(.97); }
.autoplay-button:disabled { opacity: .42; cursor: default; }
.autoplay-button.active {
    color: #efffe6;
    border-color: rgba(145, 211, 117, .38);
    background: rgba(112, 179, 92, .16);
}
.autoplay-copy { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.autoplay-copy small { font-size: 10px; font-weight: 950; letter-spacing: .65px; }
.autoplay-copy strong { font-size: 10px; font-weight: 800; }
.autoplay-switch {
    width: 29px;
    height: 17px;
    padding: 2px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    background: rgba(255,255,255,.16);
    transition: background .18s ease;
}
.autoplay-switch i {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: rgba(255,255,255,.72);
    box-shadow: 0 2px 5px rgba(0,0,0,.26);
    transform: translateX(0);
    transition: transform .18s ease, background .18s ease;
}
.autoplay-button.active .autoplay-switch { background: #80c86d; }
.autoplay-button.active .autoplay-switch i { background: #fffde9; transform: translateX(12px); }

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    padding: 18px;
    display: grid;
    place-items: center;
    background: rgba(4, 10, 9, .76);
    backdrop-filter: blur(9px);
}
.modal-backdrop.hidden { display: none; }
.game-modal {
    width: min(100%, 390px);
    padding: 25px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 25px;
    background:
        radial-gradient(circle at 50% -20%, rgba(131, 196, 110, .25), transparent 44%),
        linear-gradient(145deg, #21362f, #101c1a 74%);
    box-shadow: 0 28px 70px rgba(0,0,0,.54);
    text-align: center;
}
.modal-kicker { color: #f5cc6b; font-size: 10px; font-weight: 950; letter-spacing: 1.8px; }
.game-modal h1 { margin: 7px 0 10px; font: 800 33px/1 Georgia, serif; color: #fff7dd; }
.game-modal h2 { margin: 8px 0 6px; font: 800 26px/1.05 Georgia, serif; color: #fff7dd; }
.game-modal > p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.choice-card > p {
    max-width: 310px;
    margin: 10px auto 0;
    color: #f4edd3;
    font: 700 15px/1.35 Georgia, serif;
}
.choice-card {
    width: min(100%, 440px);
    max-height: calc(100dvh - 28px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.intro-mark { display: flex; justify-content: center; align-items: flex-end; margin-bottom: 13px; }
.mini-tower {
    width: 43px;
    height: 52px;
    margin: 0 -3px;
    border-radius: 50% 50% 13px 13px;
    display: grid;
    place-items: center;
    border: 3px solid #c6b586;
    background: #2e4038;
    font: 900 21px Georgia, serif;
    box-shadow: 0 8px 15px rgba(0,0,0,.35);
}
.mini-tower:nth-child(2) { width: 50px; height: 62px; z-index: 2; }
.mini-tower.ice { color: #9be5ff; transform: rotate(-6deg); }
.mini-tower.fire { color: #ff8a48; }
.mini-tower.storm { color: #d5b4ff; transform: rotate(6deg); }
.rules-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 18px 0 12px; }
.rules-grid div { min-height: 78px; padding: 10px 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.055); display: flex; flex-direction: column; justify-content: center; gap: 7px; }
.rules-grid b { width: 26px; height: 26px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; color: #213122; background: #e8d598; font-size: 13px; }
.rules-grid span { color: rgba(255, 250, 229, .84); font-size: 13px; font-weight: 750; line-height: 1.2; }
.combo-tip { margin-bottom: 16px; color: var(--muted); font-size: 10px; }
.combo-tip span { color: #fff; font-weight: 900; }
.modal-primary { width: 100%; height: 48px; border-radius: 14px; }

.choice-list { display: grid; gap: 8px; margin-top: 17px; }
.choice-option {
    width: 100%;
    min-height: 66px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 14px;
    color: var(--ink);
    background: rgba(255,255,255,.05);
    display: grid;
    grid-template-columns: 38px 1fr auto;
    align-items: center;
    gap: 10px;
    text-align: left;
    cursor: pointer;
}
.choice-option:active { transform: scale(.985); background: rgba(255,255,255,.09); }
.choice-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #162119; background: #e7cf84; font-size: 18px; font-weight: 950; }
.choice-copy { display: flex; flex-direction: column; gap: 4px; }
.choice-copy strong {
    color: #eacb78;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .75px;
    text-transform: uppercase;
}
.choice-copy span {
    color: #fff8e2;
    font: 750 13px/1.28 Georgia, serif;
}
.choice-arrow { color: #f0cc72; font-size: 18px; }

.combined-choice-list { display: block; margin-top: 15px; }
.reward-section + .reward-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.reward-section-title {
    margin-bottom: 7px;
    color: #f1d37f;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 1px;
    text-align: left;
    text-transform: uppercase;
}
.reward-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.grid-option {
    min-height: 76px;
    padding: 8px;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
}
.grid-option .choice-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 16px;
}
.grid-option .choice-copy { min-width: 0; }
.grid-option .choice-copy span { font-size: 12px; line-height: 1.22; }
.grid-option.picked {
    border-color: #f1cf73;
    background: rgba(241, 207, 115, .14);
    box-shadow: inset 0 0 0 1px rgba(241, 207, 115, .34), 0 0 18px rgba(241, 207, 115, .10);
}
.technology-grid .grid-option:last-child:nth-child(odd) {
    min-height: 64px;
    grid-column: 1 / -1;
}
.reward-continue { margin-top: 12px; }
.reward-continue:disabled {
    opacity: .36;
    filter: grayscale(.5);
    cursor: default;
    box-shadow: none;
}

.resource-account-balance {
    min-height: 38px;
    margin-top: 13px;
    padding: 8px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    font-size: 11px;
    font-weight: 750;
}
.resource-account-balance strong { color: #fff2b9; font-size: 14px; }

.revive-backdrop {
    background: radial-gradient(circle at 50% 34%, rgba(156, 55, 48, .25), transparent 36%), rgba(4, 10, 9, .84);
}
.revive-card {
    width: min(100%, 410px);
    max-height: calc(100dvh - 28px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background:
        radial-gradient(circle at 50% -8%, rgba(216, 94, 80, .24), transparent 42%),
        linear-gradient(145deg, #2a3831, #101c1a 74%);
}
.revive-heart {
    width: 62px;
    height: 62px;
    margin: 0 auto 13px;
    border: 1px solid rgba(255, 156, 143, .34);
    border-radius: 20px;
    display: grid;
    place-items: center;
    color: #ff8f82;
    background: rgba(217, 70, 58, .12);
    box-shadow: 0 0 28px rgba(230, 74, 61, .15);
    font-size: 34px;
    line-height: 1;
}
.revive-card > p:first-of-type {
    max-width: 340px;
    margin: 10px auto 0;
    color: #f4edd3;
    font: 700 14px/1.4 Georgia, serif;
}
.revive-frozen-note {
    min-height: 38px;
    margin-top: 14px;
    border: 1px solid rgba(137, 211, 202, .17);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #bce7df;
    background: rgba(105, 183, 172, .08);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .25px;
}
.revive-frozen-note span { font-size: 15px; }
.revive-balance { margin-top: 9px; }
.revive-buy {
    min-height: 56px;
    height: auto;
    margin-top: 10px;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
}
.revive-buy span { font-size: 15px; }
.revive-buy small {
    flex-shrink: 0;
    border-radius: 9px;
    padding: 5px 7px;
    color: #213122;
    background: rgba(255,255,255,.32);
    font-size: 11px;
    font-weight: 950;
}
.revive-buy:disabled {
    opacity: .42;
    filter: grayscale(.45);
    cursor: default;
    box-shadow: none;
}
.revive-topup {
    width: 100%;
    min-height: 44px;
    margin-top: 8px;
    border: 1px solid rgba(245, 204, 107, .3);
    border-radius: 13px;
    color: #fff3c4;
    background: rgba(245, 204, 107, .09);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}
.revive-topup.ready { border-color: rgba(255,255,255,.11); color: var(--muted); background: rgba(255,255,255,.04); }
.revive-topup:disabled,
.revive-finish:disabled { opacity: .4; cursor: default; }
.revive-status {
    min-height: 18px;
    margin: 8px 0 0 !important;
    color: #f5d475 !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
}
.revive-status.error { color: #ff9b91 !important; }
.revive-finish {
    min-height: 38px;
    margin-top: 1px;
    border: 0;
    color: rgba(255,255,255,.58);
    background: transparent;
    font-size: 11px;
    font-weight: 750;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

@media (max-height: 720px) {
    body { padding-top: 5px; padding-bottom: 5px; }
    .user-bar { margin-bottom: 5px; transform: scale(.96); transform-origin: top center; }
    .tw-shell { gap: 5px; }
    .tw-topbar { min-height: 43px; }
    .selection-panel { min-height: 50px; padding-top: 5px; padding-bottom: 5px; }
    .tower-symbol { width: 30px; height: 27px; }
    .tower-symbol svg { width: 24px; height: 22px; }
    .battle-controls { min-height: 40px; grid-template-columns: minmax(0, 1fr) 44px 91px; }
    .battle-button, .speed-button, .autoplay-button { height: 40px; }
    .speed-button { width: 44px; }
    .choice-card > p { font-size: 13px; }
    .choice-copy span { font-size: 12px; }
    .choice-card { padding: 18px; }
    .grid-option { min-height: 76px; }
    .revive-card { padding: 18px; }
    .revive-heart { width: 52px; height: 52px; margin-bottom: 9px; font-size: 29px; }
    .revive-frozen-note { margin-top: 10px; }
}

@media (max-width: 370px) {
    .tw-topbar { grid-template-columns: 1fr repeat(3, auto) 30px; gap: 4px; padding-left: 9px; }
    .resource { min-width: 43px; padding: 0 5px; }
    .icon-button { width: 29px; }
    .tower-tray { gap: 3px; }
    .tower-card { padding: 5px 1px 4px; }
    .battle-controls { grid-template-columns: minmax(0, 1fr) 42px 86px; gap: 4px; }
    .speed-button { width: 42px; }
    .autoplay-button { padding: 0 6px; }
    .round-block { gap: 4px; }
    .stage-value { display: none; }
    .selection-panel { gap: 7px; padding-inline: 9px 7px; }
    .selection-context { width: 181px; gap: 5px; }
    .level-labels { flex-basis: 80px; }
    .level-index { letter-spacing: .75px; }
    .biome-pill { font-size: 9px; }
    .threat-panel { flex-basis: 96px; max-width: 96px; min-width: 84px; padding-inline: 5px; gap: 4px; }
    .threat-icon { width: 24px; height: 24px; flex-basis: 24px; }
    .threat-copy small { font-size: 7.5px; }
    .threat-copy strong { font-size: 9.5px; }
    .selection-title { font-size: 12px; }
    .selection-subtitle { font-size: 10px; }
    .tower-actions { gap: 3px; }
    .tower-actions button { padding: 0 6px; font-size: 9px; }
}

@media (max-width: 340px) {
    .selection-panel { gap: 6px; padding-inline: 8px 6px; }
    .selection-context { width: 141px; }
    .level-labels { flex-basis: 60px; }
    .level-index { display: none; }
    .biome-pill { font-size: 8.5px; }
    .threat-panel { flex-basis: 76px; min-width: 72px; max-width: 76px; }
    .threat-panel { padding-inline: 4px; gap: 3px; }
    .threat-icon { display: none; }
    .threat-copy small { text-transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
