/* ================================
   Playground Hero
   ================================ */

.playground-hero {
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, rgba(255, 102, 0, 0.08) 0%, transparent 70%);
    position: relative;
    margin-top: 80px;
}

.playground-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 102, 0, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 102, 0, 0.02) 1px, transparent 1px);
    background-size: 20px 20px;
}

.playground-hero-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

/* ================================
   Game Section
   ================================ */

.game-section {
    padding: 4rem 0 6rem;
    background-color: var(--color-bg-primary);
}

.game-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 3rem;
}

/* ================================
   Game Container
   ================================ */

.game-container {
    background-color: var(--color-bg-secondary);
    border: 1px solid rgba(255, 102, 0, 0.2);
    border-radius: 16px;
    padding: 2rem;
}

.game-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 102, 0, 0.1), rgba(255, 102, 0, 0.05));
    border-radius: 12px;
}

.score-display,
.highscore-display,
.lives-display {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.score-label,
.highscore-label,
.lives-label {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value,
.highscore-value {
    color: var(--color-accent);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.lives-icons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.life-icon {
    font-size: 1.6rem;
    color: #FF3366;
    filter: drop-shadow(0 0 6px rgba(255, 51, 102, 0.5));
}

.status-display {
    text-align: center;
    background: rgba(255, 102, 0, 0.08);
    padding: 0.85rem 1.2rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 102, 0, 0.2);
    margin-bottom: 1.5rem;
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.status-display[data-status="info"] {
    border-color: rgba(255, 102, 0, 0.3);
    color: var(--color-text-secondary);
}

.status-display[data-status="success"] {
    border-color: rgba(0, 200, 83, 0.5);
    color: #34c759;
}

.status-display[data-status="warning"] {
    border-color: rgba(255, 204, 0, 0.5);
    color: #ffcc00;
}

.status-display[data-status="danger"] {
    border-color: rgba(255, 59, 48, 0.6);
    color: #ff3b30;
}

/* ================================
   Game Canvas
   ================================ */

.game-canvas-wrapper {
    position: relative;
    width: 600px;
    height: 600px;
    max-width: 100%;
    margin: 0 auto 2rem;
    border: 3px solid var(--color-accent);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(255, 102, 0, 0.3);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
    background-color: #0a0a0a;
    border-radius: 6px;
}

.flash {
    animation: flashEffect 0.25s ease;
}

@keyframes flashEffect {
    0% {
        filter: brightness(1.4);
    }
    100% {
        filter: brightness(1);
    }
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(13, 13, 13, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    z-index: 10;
}

.game-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    padding: 2rem;
}

.overlay-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--color-accent);
}

.overlay-content p {
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
}

.final-score {
    font-size: 1.5rem;
    color: var(--color-text-primary);
    margin-bottom: 2rem;
}

.final-score span {
    color: var(--color-accent);
    font-size: 2rem;
    font-weight: 700;
}

.player-name-input {
    margin-bottom: 1.5rem;
}

.player-name-input input {
    width: 100%;
    max-width: 300px;
    padding: 1rem;
    background-color: var(--color-bg-secondary);
    border: 2px solid rgba(255, 102, 0, 0.3);
    border-radius: 8px;
    color: var(--color-text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.player-name-input input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 15px rgba(255, 102, 0, 0.3);
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid rgba(255, 102, 0, 0.5);
    color: var(--color-text-secondary);
    margin-top: 1rem;
}

.btn-secondary:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* ================================
   Game Controls
   ================================ */

.game-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 1.5rem;
    background-color: rgba(255, 102, 0, 0.05);
    border-radius: 12px;
}

.controls-info h4 {
    color: var(--color-accent);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.control-keys {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.key-row {
    display: flex;
    gap: 0.5rem;
}

.key-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(255, 102, 0, 0.2), rgba(255, 102, 0, 0.1));
    border: 2px solid var(--color-accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--color-accent);
    font-weight: 700;
}

.game-info p {
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

/* ================================
   Ranking Container
   ================================ */

.ranking-container {
    background-color: var(--color-bg-secondary);
    border: 1px solid rgba(255, 102, 0, 0.2);
    border-radius: 16px;
    padding: 2rem;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.ranking-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--color-accent);
    font-size: 1.8rem;
}

.ranking-list {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
}

.ranking-loading {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 2rem;
}

.ranking-item {
    display: grid;
    grid-template-columns: 40px 1fr 80px;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background-color: rgba(255, 102, 0, 0.05);
    border-left: 3px solid rgba(255, 102, 0, 0.3);
    border-radius: 8px;
    align-items: center;
    transition: var(--transition-smooth);
}

.ranking-item:hover {
    background-color: rgba(255, 102, 0, 0.1);
    border-left-color: var(--color-accent);
    transform: translateX(5px);
}

.ranking-item.top-1 {
    border-left-color: #FFD700;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), rgba(255, 102, 0, 0.05));
}

.ranking-item.top-2 {
    border-left-color: #C0C0C0;
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.1), rgba(255, 102, 0, 0.05));
}

.ranking-item.top-3 {
    border-left-color: #CD7F32;
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.1), rgba(255, 102, 0, 0.05));
}

.ranking-position {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
    text-align: center;
}

.ranking-item.top-1 .ranking-position {
    color: #FFD700;
}

.ranking-item.top-2 .ranking-position {
    color: #C0C0C0;
}

.ranking-item.top-3 .ranking-position {
    color: #CD7F32;
}

.ranking-name {
    color: var(--color-text-primary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-score {
    color: var(--color-accent);
    font-weight: 700;
    font-size: 1.2rem;
    text-align: right;
}

.ranking-empty {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 3rem 1rem;
    font-style: italic;
}

.btn-small {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    width: 100%;
}

/* Scrollbar Customization */
.ranking-list::-webkit-scrollbar {
    width: 8px;
}

.ranking-list::-webkit-scrollbar-track {
    background: rgba(255, 102, 0, 0.05);
    border-radius: 4px;
}

.ranking-list::-webkit-scrollbar-thumb {
    background: var(--color-accent);
    border-radius: 4px;
}

.ranking-list::-webkit-scrollbar-thumb:hover {
    background: #ff8533;
}

/* ================================
   Responsive Design
   ================================ */

@media (max-width: 968px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
    
    .ranking-container {
        position: relative;
        top: 0;
    }
    
    .game-controls {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .playground-hero {
        min-height: 30vh;
    }
    
    .game-section {
        padding: 2rem 0 4rem;
    }
    
    .game-container {
        padding: 1rem;
    }
    
    .game-canvas-wrapper {
        width: 100%;
        height: 0;
        padding-bottom: 100%;
        position: relative;
    }
    
    #gameCanvas {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
    
    .game-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .score-value,
    .highscore-value {
        font-size: 2rem;
    }
    
    .overlay-content h2 {
        font-size: 1.5rem;
    }
    
    .player-name-input input {
        max-width: 100%;
    }
}
