/* ── Hangar Screen (Ангар) ── */
#garageScreen {
    /* .screen gives position:fixed, but the !important ensures nothing overrides it.
       position:fixed creates a containing block for position:absolute children. */
    position: fixed !important;
}
#hangarCanvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    display: block;
}

/* Shared overlay base */
.hangar-topbar,
.hangar-side,
.hangar-bottom-bar {
    position: absolute;
    z-index: 10;
}

/* Top bar */
.hangar-topbar {
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 16px;
    background: linear-gradient(180deg, rgba(4,7,3,0.88) 0%, rgba(4,7,3,0) 100%);
    pointer-events: none; /* let clicks through to canvas except actual buttons/inputs */
}
.hangar-topbar > * { pointer-events: auto; }
.hangar-back-btn {
    background: rgba(20,30,12,0.75);
    border: 1px solid rgba(100,160,50,0.4);
    border-radius: 8px;
    color: #a0c068;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 7px 16px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}
.hangar-back-btn:hover {
    background: rgba(40,65,22,0.85);
    border-color: rgba(130,200,60,0.55);
    color: #c0e080;
}
.hangar-title {
    font-family: 'Black Ops One', 'Impact', sans-serif;
    font-size: 20px;
    letter-spacing: 8px;
    color: #c8b560;
    flex: 1;
    text-align: center;
    margin: 0;
    text-shadow: 0 0 20px rgba(200,180,80,0.3);
}
.hangar-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Side panels */
.hangar-side {
    top: 170px; /* leave room for the taller topbar (title + consumables strip) */
    bottom: 136px;
    width: 210px;
    background: rgba(5,9,3,0.88);
    border: 1px solid rgba(100,150,50,0.28);
    border-radius: 12px;
    backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 0 8px;
    box-shadow: 0 6px 28px rgba(0,0,0,0.55), inset 0 1px 0 rgba(140,200,70,0.07);
}
.hangar-left  { left:  14px; }
.hangar-right { right: 14px; }

.hangar-panel-title {
    font-family: 'Black Ops One', 'Impact', sans-serif;
    font-size: 10px;
    letter-spacing: 3.5px;
    color: #88aa58;
    text-align: center;
    margin: 0;
    padding: 9px 10px 8px;
    background: rgba(80,120,40,0.12);
    border-bottom: 1px solid rgba(100,150,50,0.22);
    flex-shrink: 0;
    text-shadow: 0 0 12px rgba(120,180,60,0.25);
}
.hangar-side .item-cards {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(100,150,50,0.3) transparent;
}
.hangar-stats-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(100,150,50,0.25), transparent);
    margin: 6px 8px;
    flex-shrink: 0;
}
/* Compact cards inside hangar panels */
.hangar-side .item-card {
    padding: 6px 8px;
    border-radius: 8px;
    margin-bottom: 5px;
}
.hangar-side .item-card canvas {
    width: 52px !important;
    height: 32px !important;
}

/* Bottom skin strip */
.hangar-bottom-bar {
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(0deg, rgba(4,7,3,0.94) 65%, rgba(4,7,3,0) 100%);
    padding: 6px 238px 14px; /* sidebars 210 + 14 margin + 14 padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-height: 126px;
}
.hangar-bottom-bar .hangar-panel-title {
    background: none;
    border: none;
    padding: 0 0 4px;
}
.hangar-bottom-bar .skin-cards-row {
    justify-content: center;
    overflow-x: auto;
    max-width: 100%;
    flex-wrap: nowrap;
    scrollbar-width: thin;
    scrollbar-color: rgba(100,150,50,0.3) transparent;
}
.hangar-bottom-bar .item-card {
    flex-shrink: 0;
}
/* Topbar centre slot: title above, consumables strip below — no overlap with side panels. */
.hangar-topbar-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    pointer-events: auto;
    flex: 1 1 auto;
    min-width: 0;
}
.hangar-topbar-center .hangar-title { margin: 0; }
.hangar-consumables-strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.hangar-consumables-strip .hangar-panel-title {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 9px;
    letter-spacing: 1px;
}
.hangar-panel-subtitle {
    color: rgba(180,200,140,0.55);
    font-weight: normal;
    font-size: 10px;
    margin-left: 6px;
}
/* Consumable cards — fixed width, vertical stack. Designed to look the same
   regardless of the actual screen DPI / scale. */
.consumable-cards {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    justify-content: center;
}
.consumable-card {
    width: 110px;
    flex: 0 0 110px;
    background: rgba(20,30,15,0.85);
    border: 1px solid rgba(120,150,80,0.3);
    border-radius: 8px;
    padding: 10px 8px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    box-sizing: border-box;
}
.consumable-card .cc-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    color: var(--cc-color, #aaccaa);
    font-size: 26px;
    line-height: 1;
}
.consumable-card .cc-name {
    font-size: 12px;
    font-weight: bold;
    color: #cce0a8;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}
.consumable-card .cc-count {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    line-height: 1;
    margin-top: 1px;
}
.consumable-card .cc-buy {
    margin-top: 4px;
    background: rgba(60,90,30,0.6);
    border: 1px solid rgba(120,170,60,0.5);
    color: #d8ffaa;
    border-radius: 5px;
    padding: 4px 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
    line-height: 1.1;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}
.consumable-card .cc-buy:hover { background: rgba(80,120,40,0.85); }
.consumable-card .cc-buy:disabled { background: rgba(40,40,40,0.5); color: #666; cursor: not-allowed; border-color: rgba(80,80,80,0.4); }
.consumable-card .cc-key {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(255,220,120,0.92);
    color: #1a1a0a;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

/* ── Bot count selector (lives in the create-battle column) ── */
.bot-count-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}
.bot-count-toggle-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
}
.bot-count-value {
    color: #ffd24a;
    font-size: 14px;
    font-weight: bold;
    background: rgba(255,210,74,0.10);
    padding: 1px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255,210,74,0.35);
    min-width: 28px;
    text-align: center;
    flex-shrink: 0;
}
.bot-count-body[hidden] { display: none; }
/* ── Toggle switch — military tumbler style ──
   Рычажок-tumbler: thumb БОЛЬШЕ track'а, выпирает сверху и снизу
   (как настоящий механический переключатель). Track тонкий, thumb
   массивный квадрат. */
/* Контейнер 44×24 — даёт небольшой overflow для thumb'а, который
   чуть больше track'а. Track занимает всю основную высоту (20px),
   thumb 24×24 — выступает по 2px сверху и снизу. */
.toggle-switch {
    position: relative;
    width: 44px; height: 24px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    height: 20px;
    transform: translateY(-50%);
    background: linear-gradient(180deg, rgba(15,22,10,0.95), rgba(25,32,18,0.85));
    border: 1px solid rgba(120,160,70,0.45);
    border-radius: 0;
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
    box-shadow:
        inset 0 1px 2px rgba(0,0,0,0.6),
        inset 0 -1px 0 rgba(255,255,255,0.04);
}
.toggle-slider::before {
    /* Square thumb — чуть больше track'а. Track 20px, thumb 24px →
       выступает на 2px сверху и снизу. Достаточно чтобы выглядел
       как механический переключатель но не слишком гипертрофирован. */
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 24px; height: 24px;
    transform: translateY(-50%);
    background: linear-gradient(180deg, #7a8770 0%, #4a5440 50%, #3a4232 100%);
    border: 1px solid rgba(0,0,0,0.55);
    border-radius: 0;
    transition: left 0.18s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s;
}
.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(180deg, rgba(80,60,20,0.55), rgba(50,38,12,0.7));
    border-color: rgba(216,160,64,0.55);
}
.toggle-switch input:checked + .toggle-slider::before {
    left: calc(100% - 24px);
    background: linear-gradient(180deg, #f0c878 0%, #c89240 50%, #a8761c 100%);
}
.toggle-switch:hover .toggle-slider { border-color: rgba(160,200,90,0.6); }
.toggle-switch:hover input:checked + .toggle-slider { border-color: rgba(236,180,84,0.75); }
.bot-count-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bot-count-btn {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(120,170,60,0.45);
    background: rgba(40,60,20,0.55);
    color: #d8ffaa;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s, transform 0.05s;
    flex-shrink: 0;
}
.bot-count-btn:hover { background: rgba(80,120,40,0.85); }
.bot-count-btn:active { transform: scale(0.92); }
.bot-count-track {
    position: relative;
    flex: 1;
    height: 28px;
}
.bot-count-track input[type="range"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    z-index: 2;
    cursor: pointer;
}
/* Track + thumb — те же формы что .settings-slider в настройках:
   тонкий горизонтальный track, прямоугольный gold thumb 14×18. */
.bot-count-track input[type="range"]::-webkit-slider-runnable-track {
    height: 5px;
    background: linear-gradient(90deg, rgba(180,140,40,0.4), rgba(180,140,40,0.4));
    border: 1px solid rgba(120,160,70,0.25);
    border-radius: 1px;
    margin-top: 11px;
}
.bot-count-track input[type="range"]::-moz-range-track {
    height: 5px;
    background: linear-gradient(90deg, rgba(180,140,40,0.4), rgba(180,140,40,0.4));
    border: 1px solid rgba(120,160,70,0.25);
    border-radius: 1px;
}
.bot-count-track input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px; height: 18px;
    border-radius: 1px;
    background: linear-gradient(180deg, #e8b860, #b88420);
    border: 1px solid rgba(40,30,10,0.7);
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    cursor: grab;
    margin-top: -7px;
}
.bot-count-track input[type="range"]::-moz-range-thumb {
    width: 14px; height: 18px;
    border-radius: 1px;
    background: linear-gradient(180deg, #e8b860, #b88420);
    border: 1px solid rgba(40,30,10,0.7);
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    cursor: grab;
}
.bot-count-pips {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 9px;
    pointer-events: none;
    z-index: 1;
}
.bot-count-pips span {
    width: 3px; height: 3px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    transition: background 0.12s, transform 0.12s;
}
.bot-count-pips span.active {
    background: rgba(255,210,74,0.9);
    transform: scale(1.5);
}

/* Old panel-garage — kept for compatibility */
.panel-garage { flex: 3 1 0; min-width: 400px; }
.panel-garage h4 { color: #7a9a5a; }
.garage-inline {
    display: flex;
    gap: 10px;
    flex: 1;
    min-height: 0;
}
.garage-section {
    flex: 0 0 125px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.garage-section .item-cards {
    flex: 1;
    overflow-y: auto;
}
.garage-preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 0;
    justify-content: center;
}
#previewCanvas {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 480 / 300;
    max-height: 280px;
    background: radial-gradient(ellipse at center, rgba(30,45,20,0.6) 0%, rgba(10,15,8,0.8) 100%);
    border-radius: 12px;
    border: 1px solid rgba(100,140,60,0.3);
    box-shadow: inset 0 0 40px rgba(0,0,0,0.3);
    object-fit: contain;
}
.tank-stats {
    font-size: 11px;
    line-height: 1.6;
    color: #9aaa80;
    width: 100%;
    flex-shrink: 0;
    padding: 0 8px;
}
.stat-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 2px 0;
}
.stat-label {
    width: 62px;
    text-align: right;
    font-size: 8.5px;
    text-transform: uppercase;
    color: #5a7a4a;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}
.stat-track {
    flex: 1;
    height: 7px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(100,140,60,0.12);
    border-radius: 4px;
    overflow: hidden;
}
.stat-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.35s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 0 4px currentColor;
}

/* ── Collapsible Item Cards ── */
.item-cards {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.item-card {
    background: rgba(12,20,8,0.65);
    border: 1px solid rgba(100,140,60,0.2);
    border-radius: 9px;
    padding: 6px 8px;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
    position: relative;
}
.item-card::before {
    content: '';
    position: absolute;
    left: 0; top: 25%; bottom: 25%;
    width: 2px;
    border-radius: 0 2px 2px 0;
    background: transparent;
    transition: background 0.18s;
}
.item-card:hover {
    border-color: rgba(130,190,65,0.4);
    background: rgba(50,80,24,0.22);
}
.item-card.selected {
    border-color: rgba(150,210,75,0.55);
    background: rgba(60,100,28,0.32);
    box-shadow: 0 0 18px rgba(120,180,60,0.12), inset 0 0 0 0 transparent;
}
.item-card.selected::before {
    background: #8acc44;
}
.item-card.locked {
    opacity: 0.55;
    cursor: not-allowed;
}
.item-card h4 {
    color: #d8c870;
    margin-bottom: 0;
    font-size: 11px;
    text-align: left;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-card p {
    font-size: 10px;
    color: #6a7a5a;
    line-height: 1.3;
    margin-top: 4px;
    display: none;
}
.item-card.expanded p {
    display: block;
}
.item-card-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}
.item-card canvas {
    flex-shrink: 0;
    border-radius: 5px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(80,120,40,0.2);
}
.item-card.selected canvas {
    border-color: rgba(140,200,70,0.3);
}
.item-card-info {
    flex: 1;
    min-width: 0;
}
.item-card-info h4 {
    margin-bottom: 0;
}

/* Inside garage sections: stack canvas + name vertically */
.garage-section .item-card-inner {
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.garage-section .item-card-info {
    width: 100%;
    text-align: center;
}
.garage-section .item-card-info h4 {
    text-align: center;
    font-size: 10px;
}

