.tb-lobby-actions { display: flex; gap: 7px; flex-wrap: wrap; }
body[data-game=trebuchet] { background: radial-gradient(ellipse at 48% 4%,#393327,#151e1b 68%); }
body[data-game=trebuchet] .tb-battle { width: calc(100% - 16px); }

.siege-stage {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    height: clamp(218px, calc(100dvh - 176px), 840px);
    border-radius: 12px;
    border: 1px solid #766b52;
    background: linear-gradient(180deg,#1219226d 0%,#1d30331e 29%,#30281c25 72%,#201a13aa 100%),url(siege-valley.webp) 58% 65%/cover;
    box-shadow: 0 20px 55px #090f0da3;
}
.siege-stage-head {
    position: absolute;
    z-index: 1;
    inset: 11px 11px auto;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
    align-items: start;
    gap: clamp(5px,2vw,20px);
    pointer-events: none;
}
.siege-unit {
    --unit: #e4bd76;
    width: min(100%, 295px);
    padding: 9px 12px;
    border: 1px solid #a48c625e;
    border-radius: 8px;
    color: #efe4cb;
    background: #152222ec;
    box-shadow: 0 5px 12px #17232061;
    font-size: 11px;
}
.siege-unit[data-player=enemy] {
    --unit: #df9375;
    justify-self: end;
    background: #2c2422ed;
}
.siege-unit[data-ready=true] { border-color: var(--unit); }
.siege-unit [data-ammo] { color: #e3d8b5; }
.siege-unit[data-ready=true] [data-ammo] { color: #cce9ac; }
.siege-unit > div { display: flex; align-items: center; justify-content: space-between; gap: 9px; min-width: 0; }
.siege-unit > div + div { margin-top: 2px; }
.siege-unit strong { font-size: clamp(11px,1.6vw,17px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.siege-unit [data-hp] { color: #ffedca; font-weight: 720; font-variant-numeric: tabular-nums; white-space: nowrap; }
.siege-unit [data-kit] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c7cebe; }
.siege-unit small { flex: none; color: #dcc09a; }
.siege-unit meter { display: block; width: 100%; height: 9px; margin: 5px 0 3px; appearance: none; background: transparent; }
.siege-unit meter::-webkit-meter-bar { border: 0; border-radius: 4px; background: #3b4035; }
.siege-unit meter::-webkit-meter-optimum-value, .siege-unit meter::-webkit-meter-suboptimum-value, .siege-unit meter::-webkit-meter-even-less-good-value {
    border-radius: 4px; background: linear-gradient(90deg,#91744c,var(--unit));
}
.siege-unit meter::-moz-meter-bar { border-radius: 4px; background: var(--unit); }
#siege-distance {
    align-self: start;
    padding: 6px 9px; margin-top: 3px;
    color: #f1ddaf; background: #1e2424e7; border: 1px solid #a899725e; border-radius: 5px;
    white-space: nowrap; font-size: 11px; font-weight: 680; font-variant-numeric: tabular-nums;
}
#siege-canvas {
    position: absolute; inset: 0; width: 100%; height: 100%; display: block;
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.siege-stage[data-can-aim=true] #siege-canvas { cursor: crosshair; }
.siege-stage[data-pulling=true] #siege-canvas { cursor: grabbing; }
#siege-canvas:focus-visible { outline: 2px solid #e9c78a; outline-offset: -3px; }
.siege-readout {
    position: absolute; z-index: 1; inset: auto 10px 10px; text-align: center;
    color: #fff1d2; text-shadow: 0 2px 4px #151813; font-size: 13px; font-weight: 590; pointer-events: none;
}
.siege-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 7px; }
#siege-help { margin: 0; color: #d3d9c7; font-size: 12px; }
.siege-keys kbd { display: inline-block; min-width: 19px; padding: 1px 3px; text-align: center; border: 1px solid #6e7561; border-radius: 4px; color: #f1ddb5; }
.siege-move { display: none; gap: 6px; flex: none; }
.siege-move button { width: 44px; height: 40px; touch-action: none; user-select: none; -webkit-touch-callout: none; }
.siege-move button:disabled { opacity: .55; }
.siege-move button[hidden], .siege-keys [hidden] { display: none; }

@media (pointer: coarse) {
    .siege-move { display: flex; }
    .siege-keys { display: none; }
}

.siege-arsenal { width: min(960px, calc(100% - 24px)); padding: clamp(10px,2.1vw,22px); background: #18251f; }
.arsenal-profile { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 14px; margin-bottom: 9px; color: #d9e0d2; font-size: 13px; }
.arsenal-profile strong { color: #eace9e; }
.arsenal-gold { color: #ffd58d; font-weight: 700; }
.arsenal-profile progress { height: 6px; max-width: 130px; accent-color: #dbb16d; }
.arsenal-vitals { display: grid; }
.arsenal-stat {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px;
    padding: 8px 10px; background: #23332b; border: 1px solid #536358; border-radius: 8px;
}
.arsenal-stat-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 9px; font-size: 12px; color: #c5d1c4; }
.arsenal-stat-title strong { font-size: 14px; color: #f3ddb4; }
.arsenal-stat-title small { font-size: 10px; color: #c7c3ad; }
.arsenal-stat .tb-btn { min-height: 29px; padding: 5px 7px; font-size: 11px; }
.arsenal-tabs { display: flex; gap: 5px; margin: 10px 0 8px; }
.arsenal-tabs .tb-btn { min-height: 32px; }
.arsenal-tabs [aria-pressed=true] { color: #2b2518; background: var(--brass); border-color: #f6d6a2; }
.arsenal-body { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(0,1fr); gap: 10px; min-height: 0; }
.arsenal-preview {
    min-width: 0; overflow: hidden; border: 1px solid #726448; border-radius: 10px;
    background: linear-gradient(25deg,#252d26,#26352c);
}
.arsenal-art {
    display: grid; place-items: center; overflow: hidden; height: clamp(135px,28dvh,238px); padding: 10px 16px;
    background: radial-gradient(ellipse at 50% 64%,#8b78515d,#101b1763 68%), linear-gradient(180deg,#18241e,#21332a);
}
.arsenal-art[data-rank="1"], .arsenal-art[data-rank="2"] { background-color: #795b2c; }
.arsenal-art[data-rank="3"], .arsenal-art[data-rank="4"] { background: radial-gradient(ellipse at 50% 62%,#b9904e77,#101b1790 73%),#2d3e35; }
.arsenal-art img { width: 100%; height: 100%; min-height: 0; min-width: 0; object-fit: contain; filter: drop-shadow(0 7px 9px #111b13); }
.arsenal-art[data-rank="1"] img { filter: saturate(1.10) brightness(1.04) drop-shadow(0 7px 9px #111b13); }
.arsenal-art[data-rank="2"] img { filter: saturate(1.18) brightness(1.08) drop-shadow(0 7px 9px #111b13); }
.arsenal-art[data-rank="3"] img { filter: saturate(1.27) brightness(1.13) drop-shadow(0 7px 10px #111b13); }
.arsenal-art[data-rank="4"] img { filter: saturate(1.4) brightness(1.2) drop-shadow(0 7px 12px #121910); }
.arsenal-item-title { padding: 10px 11px 5px; }
.arsenal-item-title small { color: #cab58a; }
.arsenal-item-title h3 { margin: 3px 0 0; color: #f3e5c8; font-size: clamp(16px,3vw,24px); letter-spacing: -.03em; }
.arsenal-item-stats { display: flex; flex-wrap: wrap; gap: 5px 18px; padding: 6px 11px 7px; }
.arsenal-item-stats span { display: grid; gap: 2px; }
.arsenal-item-stats small { color: #bbcabd; font-size: 11px; }
.arsenal-item-stats strong { color: #f5d798; font-size: 13px; }
.arsenal-item-actions { display: flex; gap: 6px; padding: 4px 11px 9px; }
.arsenal-item-actions p { margin: 2px 0; color: #d2c194; }
.arsenal-item-actions .tb-btn { min-height: 32px; font-size: 12px; }
.arsenal-list {
    display: grid; align-content: start; gap: 4px; max-height: clamp(302px,48dvh,430px); overflow: auto;
    padding-right: 4px; scrollbar-color: #5f7668 #1b2720; overscroll-behavior: contain;
}
.arsenal-option {
    text-align: start; display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 8px; justify-content: start;
    width: 100%; min-height: 44px; padding: 5px 7px; white-space: normal;
}
.arsenal-option img { width: 44px; height: 32px; object-fit: contain; }
.arsenal-option span { display: grid; gap: 1px; }
.arsenal-option span small { color: #b3bcad; font-size: 10px; }
.arsenal-option strong { color: #e4e5d8; font-size: 12px; }
.arsenal-option[data-locked=true] img { opacity: .76; }
.arsenal-option[aria-pressed=true] { background: #323f2e; border-color: #cba875; }
.arsenal-active { color: #c6e6b1; }
#arsenal-notice { min-height: 16px; margin: 7px 0 0; font-size: 12px; }

@media (max-width: 660px) {
    .siege-stage { height: clamp(195px,calc(100dvh - 202px),720px); }
    .siege-stage-head { inset: 5px 5px auto; }
    .siege-unit { padding: 5px 6px; font-size: 9px; }
    .siege-unit > div { gap: 4px; }
    .siege-unit meter { height: 6px; margin: 4px 0 3px; }
    #siege-distance { margin-top: 0; padding: 4px 5px; font-size: 10px; }
    .siege-move { display: flex; }
    #siege-help { font-size: 11px; }
    .siege-controls { flex-wrap: wrap; row-gap: 6px; }
    .siege-readout { font-size: 11px; bottom: 6px; }
    .arsenal-body { grid-template-columns: minmax(0,1fr); gap: 6px; }
    .arsenal-art { height: clamp(115px,23dvh,165px); }
    .arsenal-list { max-height: 140px; }
    .siege-arsenal .tb-btn { white-space: normal; }
    .arsenal-stat { padding: 5px; }
    .arsenal-stat-title { gap: 3px 5px; font-size: 10px; }
    .arsenal-stat .tb-btn { font-size: 10px; padding-inline: 4px; }
}
