:root {
    --bg-top: #30495f;
    --bg-bottom: #111c2a;
    --panel: rgba(13, 20, 28, 0.88);
    --sand-1: #d9ae70;
    --sand-2: #b8864a;
    --player: #1e6dff;
    --rival: #d3341c;
    --text: #e8ecef;
    --muted: #b5c0c8;
    --accent: #f5c675;
    --board-size: clamp(320px, min(calc(100vw - 470px), calc(100dvh - 290px)), 980px);
    --canvas-size: max(320px, min(var(--board-size), calc(100dvh - 290px)));
    --hud-safe-inset: 44px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    min-height: 100vh;
    background: radial-gradient(circle at 50% 0%, var(--bg-top) 0%, var(--bg-bottom) 75%);
    color: var(--text);
    display: block;
    padding: 12px;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

.page-load-overlay {
    position: fixed;
    inset: 0;
    background: #0d141c;
    pointer-events: none;
    opacity: 0;
}

.game-container {
    width: min(100%, 1400px);
    margin: 0 auto;
}

.game-shell {
    display: grid;
    grid-template-columns: minmax(180px, 210px) minmax(320px, var(--board-size)) minmax(180px, 210px);
    justify-content: center;
    gap: 12px;
    align-items: stretch;
}

header {
    text-align: center;
    margin-bottom: 8px;
}

#gameTitle {
    font-family: 'Press Start 2P', "Impact", "Arial Black", "Segoe UI Black", sans-serif;
    font-size: clamp(28px, 4.4vw, 52px);
    font-weight: 700;
    letter-spacing: 0.6px;
    line-height: 1.05;
    margin: 0;
    color: #ffffff;
    text-shadow:
        0 1px 0 rgba(226, 232, 241, 0.95),
        0 2px 0 rgba(147, 159, 174, 0.85),
        0 6px 14px rgba(7, 14, 22, 0.42);
    animation: none;
}

#gameSubtitle {
    color: #ffffff;
    margin-top: 2px;
    margin-bottom: 8px;
    font-family: 'Press Start 2P', sans-serif;
    font-weight: 600;
    letter-spacing: 0.3px;
    font-size: clamp(11px, 1.4vw, 14px);
    text-shadow:
        0 1px 0 rgba(223, 231, 241, 0.92),
        0 4px 10px rgba(7, 14, 22, 0.38);
    animation: none;
}

@keyframes titleFloat3d {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-1px); }
}

@keyframes subtitleFloat3d {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-0.5px); }
}

.header-buttons-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.header-btn,
.menu-btn,
.panel-btn,
.overlay-btn {
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    padding: 9px 13px;
    font-weight: 800;
    cursor: pointer;
    background: linear-gradient(180deg, #d8a965 0%, #a66f33 100%);
    color: #1a1208;
}

.header-btn:hover,
.menu-btn:hover,
.panel-btn:hover,
.overlay-btn:hover {
    filter: brightness(1.05);
}

.menu-btn {
    background: linear-gradient(180deg, #d8a965 0%, #a66f33 100%);
    border-color: rgba(255, 223, 170, 0.58);
    color: #f4f7ff;
    box-shadow: inset 0 0 0 1px rgba(255, 236, 197, 0.22), 0 0 0 rgba(255, 182, 88, 0);
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, filter 0.14s ease;
}

.menu-btn:hover {
    border-color: rgba(255, 233, 190, 0.95);
    box-shadow: inset 0 0 0 1px rgba(255, 243, 214, 0.38), 0 0 14px rgba(255, 184, 87, 0.28);
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.menu-btn:active {
    transform: translateY(0);
}

.menu-ico {
    margin-right: 6px;
}

.overlay-btn.secondary {
    background: linear-gradient(180deg, #93a7b8 0%, #667b8d 100%);
    color: #101d29;
}

.hud-row {
    position: absolute;
    top: var(--hud-safe-inset);
    left: var(--hud-safe-inset);
    right: var(--hud-safe-inset);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0;
    z-index: 6;
    pointer-events: none;
    gap: 10px;
}

.hud-left {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(10, 16, 23, 0.34);
    max-width: min(64vw, 420px);
}

.bars-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(96px, 138px));
    gap: 6px;
}

.bars-card {
    display: grid;
    gap: 2px;
}

.bars-title {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.3px;
    color: rgba(242, 247, 255, 0.95);
}

.bar-meta {
    font-size: 9px;
    font-weight: 800;
    color: rgba(255, 236, 196, 0.95);
    margin-bottom: 2px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
    white-space: nowrap;
}

.life-heart {
    color: #ff6f7f;
    font-size: 11px;
    text-shadow: 0 0 6px rgba(255, 111, 127, 0.45);
}

.bar-label {
    font-size: 10px;
    font-weight: 800;
    color: rgba(235, 244, 251, 0.92);
}

.hud-right {
    display: flex;
    gap: 6px;
    align-items: start;
    justify-content: flex-end;
    text-align: left;
    margin-right: 0;
    margin-top: 0;
}

.hud-main-card,
.hud-powerup-card {
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(10, 16, 23, 0.34);
}

.hud-main-card {
    display: grid;
    gap: 4px;
}

.hud-powerup-card {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    min-width: 72px;
}

.hud-topstats {
    display: grid;
    gap: 2px;
    justify-items: start;
    text-align: left;
}

.hud-controls {
    margin-top: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    pointer-events: auto;
}

.hud-icon-btn {
    width: 26px;
    height: 26px;
    border: 1px solid rgba(255, 220, 165, 0.7);
    border-radius: 7px;
    background: linear-gradient(180deg, rgba(155, 108, 56, 0.88) 0%, rgba(108, 74, 37, 0.9) 100%);
    color: #f6f0e6;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.hud-icon-btn:hover,
.hud-icon-btn:focus-visible {
    border-color: rgba(255, 236, 199, 1);
    box-shadow: 0 0 10px rgba(255, 198, 117, 0.45);
    transform: translateY(-1px);
    outline: none;
}

.bar-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(12, 18, 26, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 100%;
    transition: width 0.12s linear;
}

.bar-fill.stamina {
    background: linear-gradient(90deg, #0b5cff 0%, #52a6ff 100%);
}

.bar-fill.rival-stamina {
    background: linear-gradient(90deg, #3a9ad8 0%, #89d6ff 100%);
}

.bar-fill.health {
    background: linear-gradient(90deg, #2ac75a 0%, #a8ef75 100%);
}

.bar-fill.rival-health {
    background: linear-gradient(90deg, #ea6f4f 0%, #ffb060 100%);
}

.stat {
    font-weight: 900;
    font-size: clamp(12px, 1.35vw, 15px);
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.hud-stat-icon {
    opacity: 0.92;
    font-size: 0.95em;
}

.powerup-stat {
    font-size: clamp(10px, 1.1vw, 12px);
    color: #8fe7ff;
    letter-spacing: 0.2px;
    white-space: normal;
    text-align: left;
    line-height: 1.1;
}

.powerup-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
}

.powerup-line {
    display: block;
    font-weight: 900;
}

.powerup-idle {
    opacity: 0.9;
}

#playerScore {
    color: var(--player);
}

#rivalScore {
    color: var(--rival);
}

.canvas-wrap {
    position: relative;
    width: min(100%, var(--canvas-size));
    aspect-ratio: 1 / 1;
    height: auto;
    max-width: 100%;
    max-height: min(var(--canvas-size), calc(100dvh - 290px));
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid #000;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
    margin: 0 auto;
}

.ad-side-panel,
.ad-bottom-panel {
    border-radius: 14px;
    border: 2px solid #000;
    background: rgba(40, 28, 15, 0.58);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
    padding: 10px;
}

.ad-side-panel {
    position: relative;
    height: var(--canvas-size);
    max-height: min(var(--canvas-size), calc(100dvh - 290px));
    display: block;
}

.ad-bottom-panel {
    display: none;
    margin: 10px auto 0;
    width: min(100%, var(--canvas-size));
    grid-template-rows: auto 1fr;
    gap: 8px;
}

.ad-panel-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(246, 239, 228, 0.78);
}

.ad-side-panel .ad-panel-label {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
}

.ad-slot-host {
    min-height: 0;
    height: 100%;
    border-radius: 10px;
    background: rgba(17, 13, 8, 0.32);
    padding: 8px;
    overflow: hidden;
}

.ad-white-placeholder {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 8px;
    background: #ffffff;
    border: 1px dashed rgba(126, 137, 149, 0.9);
}

.ad-slot-host .adsbygoogle {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

.ad-slot-host .adsbygoogle > div,
.ad-slot-host .adsbygoogle iframe {
    width: 100% !important;
    height: 100% !important;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background: linear-gradient(180deg, var(--sand-1), var(--sand-2));
}

.canvas-wrap:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: 0;
    margin: 0;
    box-shadow: none;
    background:
        radial-gradient(circle at 14% 20%, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.08) 14%, rgba(255, 255, 255, 0) 24%),
        radial-gradient(circle at 82% 16%, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.09) 13%, rgba(255, 255, 255, 0) 23%),
        radial-gradient(circle at 20% 78%, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.08) 12%, rgba(255, 255, 255, 0) 22%),
        radial-gradient(circle at 88% 76%, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0.08) 11%, rgba(255, 255, 255, 0) 20%),
        linear-gradient(180deg, #86a0b6 0%, #9cb5c7 38%, #7d95aa 100%);
    --fs-arena-size: min(100vw, 100vh);
}

.canvas-wrap:fullscreen #gameCanvas {
    position: absolute;
    width: var(--fs-arena-size);
    height: var(--fs-arena-size);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.canvas-wrap:fullscreen .hud-row {
    left: calc(50% - (var(--fs-arena-size) / 2) + var(--hud-safe-inset));
    right: calc(50% - (var(--fs-arena-size) / 2) + var(--hud-safe-inset));
    top: calc(50% - (var(--fs-arena-size) / 2) + var(--hud-safe-inset));
}

.canvas-wrap:fullscreen #powerupToast {
    top: 50%;
}

.canvas-wrap:fullscreen .overlay {
    inset: auto;
    left: 50%;
    top: 50%;
    width: var(--fs-arena-size);
    height: var(--fs-arena-size);
    transform: translate(-50%, -50%);
}

.canvas-wrap:fullscreen .joystick {
    left: calc(50% - (var(--fs-arena-size) / 2) + 14px);
    bottom: calc(50% - (var(--fs-arena-size) / 2) + 14px);
}

.canvas-wrap:fullscreen .boost-btn {
    right: calc(50% - (var(--fs-arena-size) / 2) + 14px);
    bottom: calc(50% - (var(--fs-arena-size) / 2) + 14px);
}

.powerup-toast {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 800;
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(3, 7, 11, 0.73);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    text-align: center;
    padding: 16px;
}

#overlayTitle {
    font-size: clamp(30px, 5vw, 52px);
    font-weight: 900;
}

#overlayMessage {
    font-size: clamp(16px, 2.6vw, 24px);
    font-weight: 800;
}

#overlaySubMessage {
    color: #e8ecf0;
    font-weight: 700;
}

.overlay-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.panel {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 540px);
    max-height: min(80dvh, 720px);
    overflow: auto;
    padding: 16px;
    border-radius: 14px;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.28);
    display: grid;
    gap: 10px;
    z-index: 30;
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.5);
}

.panel h3 {
    font-size: 24px;
}

.panel label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.panel input[type="range"] {
    width: min(52vw, 320px);
}

.panel-link {
    display: inline-block;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: linear-gradient(180deg, #d8a965 0%, #a66f33 100%);
    color: #1a1208;
    font-weight: 800;
    text-decoration: none;
    transition: filter 0.14s ease, transform 0.14s ease;
}

.panel-link:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 10, 16, 0.62);
    backdrop-filter: blur(2px);
    z-index: 25;
}

.game-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px auto 0;
    gap: 12px;
    width: min(100%, var(--canvas-size));
}

.game-footer-left {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    min-width: 0;
}

.game-footer-right {
    margin-left: auto;
    text-align: right;
    min-width: 0;
}

.footer-sep {
    color: rgba(214, 228, 241, 0.72);
    font-weight: 700;
    line-height: 1;
    user-select: none;
}

.game-footer a {
    color: #cfe2f2;
    font-weight: 600;
    font-size: clamp(13px, 1.2vw, 20px);
    line-height: 1.15;
    white-space: nowrap;
    text-decoration: none;
    transition: color 0.14s ease;
}

.game-footer a:hover {
    color: #ffd6a0;
}

.footer-modal-content {
    max-height: min(55dvh, 380px);
    overflow: auto;
    line-height: 1.55;
    color: #e9edf1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #ba3f37;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    font-weight: 900;
    cursor: pointer;
}

.modal-close-btn:hover {
    filter: brightness(1.05);
}

.share-modal-content {
    min-width: 300px;
    max-width: min(430px, 92vw);
    font-family: 'Press Start 2P', monospace;
}

.share-modal-branding h3 {
    margin: 0;
    font-size: 14px;
}

.share-modal-subtitle {
    margin-top: 4px;
    font-size: 10px;
    letter-spacing: 0.8px;
    color: #f5c675;
}

.share-score-preview {
    margin-top: 10px;
    background: rgba(30, 73, 95, 0.3);
    border: 1px solid rgba(245, 198, 117, 0.45);
    border-radius: 9px;
    padding: 10px;
    font-size: 10px;
    line-height: 1.55;
}

.share-score-preview .share-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.share-score-preview .label {
    color: #ffffff;
}

.share-score-preview .value {
    color: #f5c675;
}

.share-score-preview .value.player {
    color: #1e6dff;
}

.share-score-preview .value.rival {
    color: #d3341c;
}

.share-score-preview .value.win-player {
    color: #1e6dff;
}

.share-score-preview .value.win-rival {
    color: #d3341c;
}

.share-score-preview .value.win-draw {
    color: #ffffff;
}

.share-modal-content .share-name-wrap {
    margin-top: 10px;
    display: grid;
    gap: 8px;
    font-size: 10px;
    align-items: initial;
    justify-content: initial;
}

.share-modal-input,
.share-url-input {
    width: 100%;
    border: 1px solid rgba(245, 198, 117, 0.48);
    border-radius: 8px;
    padding: 8px 10px;
    background: rgba(12, 19, 29, 0.56);
    color: #e8ecef;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
}

.share-url-row {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.share-download-row {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.footer-modal-content h1,
.footer-modal-content h2,
.footer-modal-content h3,
.footer-modal-content h4 {
    margin-top: 12px;
    margin-bottom: 8px;
}

.doc-page {
    max-width: 860px;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    padding: 20px;
    display: grid;
    gap: 10px;
}

.joystick {
    position: absolute;
    left: 14px;
    bottom: 14px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.14);
    touch-action: none;
}

.stick {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.52);
}

.boost-btn {
    position: absolute;
    right: 14px;
    bottom: 14px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid rgba(170, 232, 255, 0.82);
    background: rgba(74, 185, 255, 0.26);
    color: rgba(218, 245, 255, 0.96);
    font-size: 46px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    backdrop-filter: blur(1px);
}

.boost-btn.active {
    background: rgba(89, 196, 255, 0.44);
    transform: scale(0.96);
}

.boost-btn:hover {
    background: rgba(89, 196, 255, 0.36);
}

.hidden {
    display: none !important;
}

@media (pointer: coarse), (max-width: 860px) {
    :root {
        --board-size: clamp(260px, min(calc(100vw - 16px), calc(100dvh - 245px)), 920px);
        --canvas-size: var(--board-size);
        --hud-safe-inset: 10px;
    }

    #gameTitle {
        font-size: clamp(28px, 8vw, 44px);
    }

    .game-container {
        width: 100%;
    }

    .game-shell {
        grid-template-columns: minmax(0, var(--canvas-size));
        gap: 8px;
    }

    .ad-side-panel {
        display: none;
    }

    .ad-bottom-panel {
        display: grid;
    }

    .hud-row {
        top: var(--hud-safe-inset);
        left: var(--hud-safe-inset);
        right: var(--hud-safe-inset);
        gap: 4px;
    }

    .bars-grid {
        grid-template-columns: repeat(2, minmax(64px, 88px));
        gap: 3px;
    }

    .hud-left,
    .hud-main-card,
    .hud-powerup-card {
        padding: 4px 6px;
        border-radius: 6px;
        background: rgba(10, 16, 23, 0.32);
    }

    .hud-left {
        max-width: min(58vw, 260px);
    }

    .hud-main-card {
        gap: 2px;
    }

    .hud-powerup-card {
        min-width: 52px;
    }

    .hud-right {
        min-width: 0;
        margin-right: 0;
        margin-top: 0;
        gap: 4px;
    }

    .hud-icon-btn {
        width: 22px;
        height: 22px;
        font-size: 12px;
        border-radius: 6px;
    }

    .bar-label {
        font-size: 8px;
    }

    .bar-meta {
        font-size: 8px;
    }

    .bars-title {
        font-size: 8px;
    }

    .bar-track {
        height: 4px;
    }

    .stat {
        font-size: clamp(9px, 2.6vw, 11px);
        line-height: 1.1;
    }

    .powerup-stat {
        font-size: 9px;
    }

    .panel {
        width: min(94vw, 460px);
        max-height: min(82dvh, 620px);
        padding: 14px;
    }

    .share-url-row,
    .share-download-row {
        grid-template-columns: 1fr;
    }

    .game-footer {
        width: min(100%, var(--canvas-size));
        justify-content: space-between;
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
        padding-inline: 8px;
    }

    .game-footer-left {
        width: auto;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .game-footer-right {
        width: auto;
        margin-left: auto;
        text-align: right;
    }

    .game-footer a {
        font-size: clamp(10px, 3.2vw, 16px);
    }

    .joystick,
    .boost-btn {
        width: clamp(74px, 23vw, 106px);
        height: clamp(74px, 23vw, 106px);
        bottom: max(10px, env(safe-area-inset-bottom));
    }

    .joystick {
        left: max(10px, env(safe-area-inset-left));
    }

    .boost-btn {
        right: max(10px, env(safe-area-inset-right));
        font-size: clamp(28px, 8vw, 40px);
    }

    .stick {
        width: clamp(30px, 9vw, 44px);
        height: clamp(30px, 9vw, 44px);
    }
}

@media (max-width: 520px), (max-height: 700px) {
    .hud-row {
        top: 8px;
        left: 8px;
        right: 8px;
        justify-content: space-between;
    }

    .hud-left {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
        max-width: calc(100% - 104px);
        padding: 3px 4px;
    }

    .bars-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2px;
    }

    .bars-card {
        gap: 1px;
    }

    .bars-title,
    .bar-meta,
    .bar-label {
        font-size: 7px;
        line-height: 1.05;
    }

    .bar-track {
        height: 3px;
    }

    .hud-right {
        flex: 0 0 auto;
        gap: 3px;
    }

    .hud-main-card,
    .hud-powerup-card {
        padding: 3px 4px;
    }

    .hud-powerup-card {
        display: none;
    }

    .hud-topstats {
        gap: 1px;
    }

    .stat {
        font-size: 8px;
    }

    .hud-icon-btn {
        width: 19px;
        height: 19px;
        font-size: 10px;
    }

    .hud-controls {
        gap: 2px;
    }

    .joystick,
    .boost-btn {
        width: clamp(62px, 20vw, 84px);
        height: clamp(62px, 20vw, 84px);
        bottom: max(8px, env(safe-area-inset-bottom));
    }

    .boost-btn {
        font-size: clamp(22px, 7vw, 32px);
    }

    .stick {
        width: clamp(24px, 8vw, 34px);
        height: clamp(24px, 8vw, 34px);
    }

    .game-footer {
        margin-top: 10px;
        gap: 6px;
        padding-inline: 6px;
    }

    .game-footer-left {
        gap: 6px;
    }

    .game-footer a {
        font-size: clamp(9px, 3vw, 13px);
        line-height: 1.15;
    }
}
