/* ═══════════════════════════════════════════════════════════
   DEBUG RUNNER GAME - PREMIUM 2026 EDITION
   Refined, polished design matching the site's aesthetic
   ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════
   1. SECTION SUBTITLE
   ═══════════════════════════════════════════════════════════ */
.section-subtitle {
    text-align: center;
    max-width: 600px;
    margin: -8px auto 48px;
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════
   2. GAME CONTROLS - Premium Keyboard Style
   ═══════════════════════════════════════════════════════════ */
.game-controls-wrapper {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 48px;
    flex-wrap: wrap;
}

.game-control-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html.dark .game-control-item {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.game-control-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 113, 227, 0.18);
    border-color: rgba(0, 113, 227, 0.4);
}

html.dark .game-control-item:hover {
    box-shadow: 0 12px 32px rgba(41, 151, 255, 0.25);
    border-color: rgba(41, 151, 255, 0.5);
}

.game-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    height: 42px;
    padding: 0 16px;
    background: linear-gradient(135deg, #0071e3 0%, #0a84ff 100%);
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 10px;
    box-shadow:
        0 4px 12px rgba(0, 113, 227, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.game-kbd-action {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ═══════════════════════════════════════════════════════════
   3. GAME AREA - Canvas + Stats Layout
   ═══════════════════════════════════════════════════════════ */
.game-area {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 48px;
}

/* Game Canvas Wrapper - Premium Frame */
.game-canvas-wrapper {
    flex: 1;
    max-width: 800px;
    padding: 20px;
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
}

html.dark .game-canvas-wrapper {
    background: linear-gradient(145deg, #1a1a1a 0%, #0d0d0d 100%);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Canvas Container */
#debug-runner-container {
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    position: relative;
}

html.dark #debug-runner-container {
    background: #000;
}

#debug-runner-canvas {
    display: block;
    width: 100%;
    max-width: 800px;
    border-radius: 16px;
    background: #fff !important;
}

html.dark #debug-runner-canvas {
    background: #000 !important;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE TOUCH CONTROLS - Large, Easy-to-Use Buttons
   ═══════════════════════════════════════════════════════════ */

/* Hide on desktop by default */
.debug-runner-mobile-controls {
    display: none;
}

/* Show on mobile screens */
@media (max-width: 768px) {
    .debug-runner-mobile-controls {
        display: flex !important;
        justify-content: center;
        gap: 16px;
        margin-top: 20px;
        padding: 16px;
        width: 100%;
    }

    .debug-runner-mobile-controls button {
        flex: 1;
        max-width: 160px;
        padding: 18px 24px;
        background: linear-gradient(135deg, #0071e3 0%, #0a84ff 100%);
        color: #fff;
        border: none;
        border-radius: 16px;
        font-weight: 800;
        font-size: 16px;
        letter-spacing: 0.02em;
        box-shadow:
            0 6px 20px rgba(0, 113, 227, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        cursor: pointer;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        touch-action: manipulation;
    }

    .debug-runner-mobile-controls button:active {
        transform: scale(0.95);
        box-shadow:
            0 3px 12px rgba(0, 113, 227, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }

    /* Different colors for different actions */
    .debug-runner-mobile-controls .debug-game-btn--jump {
        background: linear-gradient(135deg, #34c759 0%, #30d158 100%);
        box-shadow:
            0 6px 20px rgba(52, 199, 89, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }

    .debug-runner-mobile-controls .debug-game-btn--jump:active {
        box-shadow:
            0 3px 12px rgba(52, 199, 89, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }

    .debug-runner-mobile-controls .debug-game-btn--duck {
        background: linear-gradient(135deg, #ff9500 0%, #ff9f0a 100%);
        box-shadow:
            0 6px 20px rgba(255, 149, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }

    .debug-runner-mobile-controls .debug-game-btn--duck:active {
        box-shadow:
            0 3px 12px rgba(255, 149, 0, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
}

/* Show on touch devices regardless of screen size */
@media (hover: none) and (pointer: coarse) {
    .debug-runner-mobile-controls {
        display: flex !important;
        justify-content: center;
        gap: 16px;
        margin-top: 20px;
        padding: 16px;
        width: 100%;
    }
}

/* Stats Panel - Side Cards */
.game-stats-panel {
    display: none;
    flex-direction: column;
    gap: 16px;
    min-width: 140px;
}

@media (min-width: 1024px) {
    .game-stats-panel {
        display: flex;
    }
}

.game-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

html.dark .game-stat-box {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.game-stat-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
}

html.dark .game-stat-box:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

.game-stat-emoji {
    font-size: 32px;
    line-height: 1;
}

.game-stat-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.game-stat-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* ═══════════════════════════════════════════════════════════
   4. GAME LEGEND - Power-ups Guide
   ═══════════════════════════════════════════════════════════ */
.game-legend-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    max-width: 960px;
    margin: 0 auto;
}

.legend-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 160px;
}

html.dark .legend-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.legend-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 113, 227, 0.3);
}

html.dark .legend-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border-color: rgba(41, 151, 255, 0.4);
}

.legend-emoji {
    font-size: 28px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(145deg, #f0f0f5 0%, #e5e5ea 100%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

html.dark .legend-emoji {
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.legend-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.legend-info strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.legend-info span {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════
   5. RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .game-controls-wrapper {
        gap: 12px;
        margin-bottom: 32px;
    }

    .game-control-item {
        padding: 12px 18px;
        gap: 12px;
        border-radius: 14px;
    }

    .game-kbd {
        min-width: 48px;
        height: 38px;
        font-size: 13px;
        border-radius: 8px;
    }

    .game-kbd-action {
        font-size: 14px;
    }

    .game-canvas-wrapper {
        padding: 14px;
        border-radius: 20px;
    }

    #debug-runner-container {
        border-radius: 12px;
    }

    .game-area {
        flex-direction: column;
        align-items: center;
        gap: 20px;
        margin-bottom: 32px;
    }

    .game-stats-panel {
        display: flex;
        flex-direction: row;
        gap: 12px;
    }

    .game-stat-box {
        padding: 16px 20px;
        border-radius: 16px;
        min-width: 100px;
    }

    .game-stat-emoji {
        font-size: 24px;
    }

    .game-stat-num {
        font-size: 22px;
    }

    .game-legend-row {
        gap: 10px;
    }

    .legend-card {
        padding: 12px 16px;
        gap: 12px;
        min-width: 140px;
        border-radius: 14px;
    }

    .legend-emoji {
        width: 44px;
        height: 44px;
        font-size: 22px;
        border-radius: 12px;
    }

    .legend-info strong {
        font-size: 13px;
    }

    .legend-info span {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .game-controls-wrapper {
        gap: 8px;
    }

    .game-control-item {
        padding: 10px 14px;
        gap: 10px;
    }

    .game-kbd {
        min-width: 40px;
        height: 34px;
        font-size: 12px;
        padding: 0 12px;
    }

    .game-kbd-action {
        font-size: 13px;
    }

    .legend-card {
        flex: 1;
        min-width: calc(50% - 8px);
        max-width: calc(50% - 8px);
    }
}