:root {
    --bubble-game-width: 1260px;
}

body {
    min-height: 100vh;
    padding: 18px 14px 32px;
}

.shell {
    width: min(var(--bubble-game-width), 100%);
    display: grid;
    gap: 18px;
    margin: 0 auto;
}

.topbar {
    border-radius: 16px;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: start;
}

.arena-panel {
    overflow: hidden;
    border-radius: 16px;
}

.panel-head,
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.panel-head {
    padding: 14px;
    border-bottom: 1px solid var(--ui-line);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(92px, 1fr));
    gap: 10px;
    width: min(460px, 100%);
}

.stats div {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.stats span,
.next-bubble span {
    color: var(--ui-muted);
    font-size: 12px;
    font-weight: 800;
}

.stats strong {
    font-size: 22px;
    line-height: 1;
}

.panel-controls,
.next-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-controls {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.next-bubble {
    padding: 8px 12px;
    border: 1px solid var(--ui-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.sound-button {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
}

.next-bubble i {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bubble-color, #ffd166);
    box-shadow: inset -7px -9px 12px rgba(0, 0, 0, 0.22), inset 6px 6px 8px rgba(255, 255, 255, 0.5);
}

.arena-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 96 / 91;
    min-height: 760px;
    overflow: hidden;
    background: linear-gradient(180deg, #03050f 0%, #080d23 58%, #01030a 100%);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.start-layer,
.message-layer {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(2, 10, 18, 0.4);
}

.start-layer[hidden],
.message-layer[hidden] {
    display: none;
}

.overlay-card {
    width: min(420px, 100%);
    display: grid;
    gap: 14px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 14px;
    background: rgba(5, 18, 30, 0.86);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
    text-align: center;
}

.overlay-kicker {
    color: var(--ui-accent-2);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.overlay-title {
    font-size: 30px;
    line-height: 1.12;
}

.overlay-text {
    margin: 0;
    color: var(--ui-muted);
    line-height: 1.65;
}

.side-column {
    display: grid;
    gap: 18px;
}

.section {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.section h2,
.ranking-panel h2 {
    margin: 0;
    font-size: 21px;
}

.ranking-panel {
    display: grid;
    gap: 14px;
    align-content: start;
    padding: 18px;
}

.ranking-note {
    margin: 0;
    color: var(--ui-muted);
    font-size: 14px;
    line-height: 1.7;
}

.ranking-list {
    display: grid;
    gap: 10px;
}

.ranking-empty {
    padding: 12px;
    border: 1px dashed var(--ui-line);
    border-radius: 8px;
    color: var(--ui-muted);
    background: rgba(255, 255, 255, 0.04);
    text-align: center;
}

.control-list,
.rule-list {
    display: grid;
    gap: 10px;
}

.control-list p,
.rule-list p {
    margin: 0;
    color: var(--ui-muted);
    line-height: 1.7;
}

.key {
    display: inline-flex;
    min-width: 30px;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
    border: 1px solid var(--ui-line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--ui-text);
    font-size: 13px;
    font-weight: 900;
}

.key.wide {
    min-width: 72px;
}

@media (max-width: 980px) {
    .game-layout {
        grid-template-columns: 1fr;
    }

    .arena-wrap {
        min-height: 700px;
    }
}

@media (max-width: 620px) {
    body {
        padding: 14px 10px 24px;
    }

    .page-header {
        padding: 20px 16px;
    }

    .panel-head {
        align-items: stretch;
        flex-direction: column;
    }

    .stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stats div {
        padding: 9px 8px;
    }

    .stats strong {
        font-size: 18px;
    }

    .arena-wrap {
        aspect-ratio: 96 / 91;
        min-height: 680px;
    }
}
