.game-container {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    -webkit-tap-highlight-color: transparent;
    font-family: 'M PLUS Rounded 1c', sans-serif;
}

.game-container.show {
    display: block;
}

.game-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 40%, rgba(23, 38, 55, 0.25), rgba(8, 10, 14, 0.92));
    animation: fadeIn 0.28s ease-out;
}

.game-content {
    position: relative;
    width: min(100%, 620px);
    height: 100%;
    margin: 0 auto;
    padding: 14px 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(165deg, #f5f9ff 0%, #ecf3fd 48%, #fdf7ed 100%);
    border-left: 1px solid rgba(255, 255, 255, 0.65);
    border-right: 1px solid rgba(255, 255, 255, 0.65);
    overflow: hidden;
}

.game-back-button {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 12;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    border-radius: 10px;
    background: rgba(22, 39, 57, 0.88);
    color: #fff;
    padding: 7px 13px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: transform 0.14s ease, background 0.14s ease;
}

.game-back-button:hover {
    transform: translateY(-1px);
    background: rgba(10, 24, 40, 0.94);
}

.game-header {
    margin-top: 42px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.hud-item {
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(45, 72, 98, 0.14);
    border-radius: 12px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 52px;
}

.hud-label {
    font-size: 10px;
    letter-spacing: 0.08em;
    color: #5f7386;
    font-weight: 700;
}

.hud-value {
    font-size: 18px;
    font-weight: 800;
    color: #1a2c3f;
    line-height: 1.1;
}

.game-main {
    position: relative;
    flex: 1;
    min-height: 240px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(17, 38, 56, 0.2);
    background: #eff5ff;
}

.dash-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    user-select: none;
}

.game-toast {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(14, 30, 46, 0.86);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 7px 14px;
    border-radius: 999px;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
    white-space: nowrap;
}

.game-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hit-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255, 116, 92, 0.65), rgba(255, 116, 92, 0));
    opacity: 0;
    transition: opacity 0.16s ease;
    pointer-events: none;
}

.hit-flash.show {
    opacity: 1;
}

.dash-touch-controls {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.touch-btn {
    flex: 1;
    border: 1px solid rgba(20, 39, 58, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    color: #10293f;
    font-size: 14px;
    font-weight: 800;
    padding: 11px 0;
    cursor: pointer;
    user-select: none;
    transition: transform 0.08s ease, background 0.08s ease;
}

.touch-btn:active {
    transform: scale(0.98);
}

.jump-btn {
    background: linear-gradient(180deg, #ffffff, #eef6ff);
}

.duck-btn {
    background: linear-gradient(180deg, #fff8ef, #fdeed8);
}

.game-help {
    margin: 0;
    text-align: center;
    font-size: 12px;
    color: #3f556a;
    font-weight: 600;
}

.game-start-screen,
.game-over-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    background: linear-gradient(180deg, rgba(245, 250, 255, 0.94), rgba(245, 250, 255, 0.9));
    z-index: 9;
    padding: 24px;
}

.game-start-screen h2,
.game-over-screen h2 {
    margin: 0;
    font-size: 32px;
    color: #13293e;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.game-start-screen p,
.game-over-screen p {
    margin: 0;
    color: #2e455c;
    font-size: 15px;
    line-height: 1.55;
}

.final-score {
    font-weight: 800;
    font-size: 22px;
    color: #102a40;
}

.new-record {
    color: #d84b2d;
    font-size: 17px;
    font-weight: 800;
    animation: pulse 0.9s ease-in-out infinite;
}

.game-start-button,
.game-retry-button,
.game-exit-button {
    border: 0;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 800;
    padding: 12px 30px;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.game-start-button,
.game-retry-button {
    color: #fff;
    background: linear-gradient(135deg, #e94f33 0%, #ca3f24 100%);
    box-shadow: 0 8px 20px rgba(233, 79, 51, 0.28);
}

.game-exit-button {
    color: #ffffff;
    background: linear-gradient(135deg, #23384e 0%, #172839 100%);
    box-shadow: 0 8px 20px rgba(27, 42, 61, 0.24);
}

.game-start-button:hover,
.game-retry-button:hover,
.game-exit-button:hover {
    transform: translateY(-1px);
}

.game-launch-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    pointer-events: none;
    z-index: 9999;
}

.game-launch-effect::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, #e94f33 0%, rgba(233, 79, 51, 0) 68%);
    animation: launchPulse 0.6s ease-out;
}

@keyframes launchPulse {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(18);
        opacity: 0;
    }
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.06);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .game-content {
        padding: 12px 10px 14px;
    }

    .game-header {
        margin-top: 38px;
    }

    .hud-value {
        font-size: 16px;
    }

    .game-start-screen h2,
    .game-over-screen h2 {
        font-size: 28px;
    }

    .game-help {
        font-size: 11px;
    }
}

@media (min-width: 760px) {
    .game-content {
        padding: 16px 16px 20px;
    }

    .game-main {
        min-height: 360px;
    }
}
