/* Cube Garage: arcade service-bay hardware, using the existing shell palette. */
#panel-cubes .cube-garage {
    --garage-ink: var(--arcade-ink, #080d1b);
    --garage-base: var(--arcade-surface, #101c31);
    --garage-cyan: var(--arcade-cyan, #89efff);
    --garage-gold: var(--arcade-gold, #ffd887);
    --garage-ice: #edf6ff;
    --garage-hint: #b9ccdf;
    --garage-line: #35536a;
    grid-column: 1 / -1;
    display: grid;
    min-width: 0;
    gap: clamp(16px, 2.5vw, 28px);
    text-align: left;
    color: var(--garage-ice);
    font: 600 14px/1.45 "Trebuchet MS", sans-serif;
}
#panel-cubes .cube-garage *,
#panel-cubes .cube-garage *::before,
#panel-cubes .cube-garage *::after { box-sizing: border-box; }
.cube-garage :is(p, h1, h2, h3) { margin: 0; }
.cube-garage-header,
.cube-garage-section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px 12px;
    min-width: 0;
}
.cube-garage-header { align-items: flex-end; padding-bottom: 12px; border-bottom: 1px solid var(--garage-line); }
.cube-garage-id { display: grid; min-width: 0; gap: 4px; }
.cube-garage-kicker,
.cube-garage-stage-label,
.cube-garage-file-code {
    color: var(--garage-cyan);
    font: 800 10px/1.3 Orbitron, sans-serif;
    letter-spacing: .12em;
}
#panel-cubes .cube-garage-title {
    color: var(--garage-ice);
    font: 900 clamp(24px, 5vw, 38px)/1.12 Orbitron, sans-serif;
    text-transform: uppercase;
    letter-spacing: .025em;
}
.cube-garage-count {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--garage-hint);
    font: 800 10px/1.32 Orbitron, sans-serif;
    letter-spacing: .045em;
}
.cube-garage-count strong { color: var(--garage-cyan); font-size: 16px; }
.cube-garage-hero {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--garage-line);
    border-top-color: var(--garage-cyan);
    border-radius: 14px 4px 14px 4px;
    background: var(--garage-base);
}
.cube-garage-stage {
    display: grid;
    position: relative;
    isolation: isolate;
    min-width: 0;
    min-height: clamp(195px, 30vw, 270px);
    place-items: center;
    overflow: hidden;
    border-right: 1px solid var(--garage-line);
    background: radial-gradient(ellipse at 50% 72%, #284d60 0, #122137 48%, var(--garage-ink) 82%);
}
.cube-garage-stage::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 36% -35% -55%;
    background:
        repeating-linear-gradient(90deg, transparent 0 32px, #89efff28 32px 33px),
        repeating-linear-gradient(0deg, transparent 0 25px, #89efff24 25px 26px);
    transform: perspective(180px) rotateX(49deg);
    mask-image: linear-gradient(transparent, #0009 65%, #000);
}
.cube-garage-stage-label { position: absolute; z-index: 3; top: 14px; left: 14px; pointer-events: none; }
.cube-garage-platform {
    position: absolute;
    z-index: -1;
    width: clamp(125px, 55%, 236px);
    aspect-ratio: 4.6;
    left: 50%;
    bottom: 10%;
    transform: translateX(-50%);
    border: 2px solid #6dd9efaa;
    border-radius: 50%;
    background: radial-gradient(ellipse, #2e5f71, #112d42 70%);
    box-shadow: 0 10px #071420, 0 12px #4e778b, 0 18px 21px #060b16, 0 0 22px #3b9fbd65;
    pointer-events: none;
}
.cube-garage-preview {
    display: grid;
    position: relative;
    min-width: 0;
    isolation: isolate;
    place-items: center;
    --cube-paint: #89efff;
}
.cube-garage-preview > .cube-garage-fallback {
    position: absolute;
    width: 53%;
    height: 53%;
    inset: 23.5%;
    pointer-events: none;
}
.cube-garage-preview.is-mounted:has(> :is(canvas, svg:not(.cube-garage-fallback))) > .cube-garage-fallback { visibility: hidden; }
.cube-garage-stage > .cube-garage-preview { width: min(100%, 275px); height: clamp(160px, 25vw, 224px); z-index: 1; }
.cube-garage-preview canvas { position: relative; max-width: 100%; max-height: 100%; z-index: 1; }
/* The hero sits over the bay lighting, not inside the thumbnail’s background tile. */
.cube-garage-stage > .cube-garage-preview.skin-preview-has-renderer { background: transparent !important; }
.cube-garage-face-top { fill: var(--cube-paint, #89efff); }
.cube-garage-face-left { fill: var(--cube-paint, #89efff); filter: brightness(.49); }
.cube-garage-face-right { fill: var(--cube-paint, #89efff); filter: brightness(.75); }
.cube-garage-hero-details { align-content: center; display: grid; min-width: 0; gap: 10px; padding: clamp(16px, 3.5vw, 32px); }
.cube-garage-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--garage-cyan);
    font: 800 10px/1 Orbitron, sans-serif;
    letter-spacing: .09em;
}
.cube-garage-status svg, .cube-garage-equipped-tag svg { width: 15px; height: 15px; }
#panel-cubes .cube-garage-hero-name {
    color: var(--garage-ice);
    font: 900 clamp(18px, 3.7vw, 30px)/1.15 Orbitron, sans-serif;
    overflow-wrap: anywhere;
}
.cube-garage-rarity { color: var(--garage-gold); font: 800 11px/1.3 Orbitron, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.cube-garage-hero-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 5px; }
.cube-garage .cube-garage-button {
    min-height: 44px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 6px 9px;
    border: 1px solid #476c84;
    border-radius: 8px 2px 8px 2px;
    color: var(--garage-ice);
    background: #182a3e;
    font: 800 11px/1.3 Orbitron, sans-serif;
    cursor: pointer;
}
.cube-garage-button svg { flex: 0 0 15px; width: 15px; height: 15px; }
.cube-garage .cube-garage-icon path { fill: none; stroke: currentColor; stroke-width: 1.75px; stroke-linecap: round; stroke-linejoin: round; }
.cube-garage .cube-garage-button:is(:hover, :focus-visible) { border-color: var(--garage-cyan); }
.cube-garage :is(.cube-garage-primary, .cube-garage-equip) {
    background: var(--garage-cyan);
    border-color: var(--garage-cyan);
    color: #091726;
}
.cube-garage .cube-garage-shop { background: transparent; }
.cube-garage-section { display: grid; min-width: 0; gap: 10px; }
#panel-cubes .cube-garage-section-head h2 { color: var(--garage-ice); font: 850 clamp(16px, 4.2vw, 23px)/1.2 Orbitron, sans-serif; }
.cube-garage-grid { display: grid; min-width: 0; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.cube-garage-tile {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 9px;
    padding: 14px;
    border: 1px solid var(--garage-line);
    border-radius: 10px 3px 10px 3px;
    background: var(--garage-base);
}
.cube-garage-tile.is-equipped { border-color: var(--garage-cyan); border-bottom-width: 2px; }
.cube-garage-tile .cube-garage-preview {
    width: 100%;
    height: clamp(150px, 22vw, 188px);
    overflow: hidden;
    border-radius: 6px 2px 6px 2px;
    background: radial-gradient(ellipse, #213c54, #0c1728 77%);
}
.cube-garage-tile .cube-garage-preview > :is(svg, canvas) { max-height: 100%; }
#panel-cubes .cube-garage-tile-name { color: var(--garage-ice); font: 850 15px/1.32 Orbitron, sans-serif; overflow-wrap: anywhere; }
.cube-garage-tile-rarity { color: var(--garage-hint); font: 750 10px/1.2 "Trebuchet MS", sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.cube-garage-tile-trail { color: var(--garage-hint); font-size: 12px; }
.cube-garage-tile-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cube-garage-tile-actions > * { flex: 1 1 58px; }
.cube-garage-tile-actions > button { min-height: 44px; padding-inline: 8px; font-size: 11px; }
.cube-garage-equipped-tag { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; color: var(--garage-cyan); font: 850 10px/1.3 Orbitron, sans-serif; }
.cube-garage-classified { color: var(--garage-gold); font: 850 9px/1.3 Orbitron, sans-serif; letter-spacing: .11em; }
.cube-garage-file-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: 8px; }
.cube-garage-file {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    align-items: center;
    min-height: 98px;
    gap: 14px;
    padding: 10px 13px;
    border: 1px solid #5b533d;
    border-left: 2px solid var(--garage-gold);
    border-radius: 8px 2px 8px 2px;
    background: #141d29;
}
.cube-garage-silhouette {
    position: relative;
    height: 73px;
    display: grid;
    place-items: center;
    color: var(--garage-gold);
    background: repeating-linear-gradient(135deg, #091427 0 10px, #122034 10px 11px);
    border-radius: 6px 2px 6px 2px;
}
.cube-garage-silhouette .cube-garage-fallback { position: static; width: 52px; height: 52px; opacity: .78; }
.cube-garage-silhouette .cube-garage-fallback polygon { fill: #243144; stroke: #74879b; stroke-width: .85; filter: none; }
.cube-garage-silhouette > svg:last-child {
    position: absolute;
    width: 23px;
    height: 23px;
    padding: 3px;
    right: 3px;
    bottom: 3px;
    background: #0a1322;
    border-radius: 5px;
}
.cube-garage-file-details { display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.cube-garage-file-code { color: var(--garage-gold); }
#panel-cubes .cube-garage-file-details h3 { color: var(--garage-ice); font: 800 12px/1.35 Orbitron, sans-serif; }
.cube-garage-file-goal { color: var(--garage-ice); font: 650 13px/1.4 "Trebuchet MS", sans-serif; }
.cube-garage-file-progress, .cube-garage-empty { color: var(--garage-hint); font-size: 12px; }
@media (max-width: 740px) {
    .cube-garage-hero { grid-template-columns: minmax(0, 1fr); }
    .cube-garage-stage { min-height: 185px; border-right: 0; border-bottom: 1px solid var(--garage-line); }
    .cube-garage-stage > .cube-garage-preview { height: 169px; width: min(100%, 205px); }
    .cube-garage-hero-details { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 5px 8px; padding: 14px; }
    .cube-garage-hero-details :is(.cube-garage-status, .cube-garage-hero-name, .cube-garage-rarity) { grid-column: 1; }
    .cube-garage-hero-actions { grid-column: 2; grid-row: 1 / 4; justify-content: end; margin: 0; }
    .cube-garage-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .cube-garage-tile .cube-garage-preview { height: clamp(158px, 44vw, 215px); }
}
@media (max-width: 380px) {
    .cube-garage-hero-details { grid-template-columns: 1fr; }
    .cube-garage-hero-actions { grid-column: 1; grid-row: auto; justify-content: start; }
}


#level-complete-prompt .level-complete-box {
    max-height: min(90dvh, calc(100% - 16px));
    overflow-y: auto;
    overscroll-behavior: contain;
}
#level-cube-reveal:not(.hidden) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: min(100%, 250px);
    min-height: 44px;
    margin: 8px 0 12px;
}
