/* ============================================
   Wall Click Game - Responsive Styles
   Production-ready CSS with animations
   ============================================ */

/* ============================================
   CSS Variables & Root Styles
   ============================================ */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #ec4899;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-bg: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Global Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, #1a1a2e 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 10px;
}

/* ============================================
   Container & Layout
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* ============================================
   Header Styles
   ============================================ */
.header {
    text-align: center;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    animation: slideDown 0.6s ease-out;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    animation: fadeIn 0.8s ease-out 0.2s backwards;
}

/* ============================================
   Stats Container
   ============================================ */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 25px 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.6s ease-out;
    transition: var(--transition);
}

.stat-box:hover {
    transform: translateY(-5px);
    border-color: var(--secondary-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));
}

.stat-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: scaleIn 0.3s ease-out;
}

/* ============================================
   Game Board & Blocks
   ============================================ */
.game-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 12px;
    padding: 30px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    min-height: 400px;
    max-width: 600px;
    width: 100%;
    animation: fadeIn 0.6s ease-out 0.3s backwards;
}

.block {
    aspect-ratio: 1;
    background: linear-gradient(135deg, var(--card-bg), var(--primary-dark));
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.1);
    user-select: none;
    -webkit-user-select: none;
}

.block::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    transform: scale(0);
    transition: transform 0.6s ease-out;
}

.block:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-color));
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.block:hover::before {
    transform: scale(1);
}

.block.active {
    animation: activateBlock 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    background: linear-gradient(135deg, var(--success-color), var(--primary-light));
    border-color: var(--success-color);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.6);
}

.block.clicked {
    animation: clickBlock 0.4s ease-out;
}

/* ============================================
   Game Overlay (Game Over)
   ============================================ */
.game-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    opacity: 1;
    pointer-events: auto;
    animation: fadeIn 0.4s ease-out;
    z-index: 10;
}

.game-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    animation: fadeOut 0.4s ease-out;
}

.overlay-content {
    text-align: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2));
    border: 2px solid var(--primary-color);
    padding: 40px 30px;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    animation: slideUp 0.5s ease-out;
}

.overlay-content h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.final-stats {
    margin: 20px 0;
    padding: 20px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
}

.final-stats p {
    font-size: 1.25rem;
    margin: 10px 0;
    color: var(--text-primary);
}

.final-stats span {
    color: var(--secondary-color);
    font-weight: 700;
}

/* ============================================
   Button Styles
   ============================================ */
.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeIn 0.8s ease-out 0.4s backwards;
}

.btn {
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-light);
    border: 2px solid var(--primary-light);
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.2);
}

.btn-secondary:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
    animation: fadeIn 1s ease-out 0.5s backwards;
}

/* ============================================
   Animations
   ============================================ */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes activateBlock {
    0% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.15) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

@keyframes clickBlock {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.8);
        opacity: 0;
    }
}

/* ============================================
   Responsive Design - Tablet
   ============================================ */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .stats-container {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 15px;
    }

    .stat-box {
        padding: 20px 15px;
    }

    .stat-value {
        font-size: 2rem;
    }

    .game-board {
        grid-template-columns: repeat(auto-fit, minmax(55px, 1fr));
        gap: 10px;
        padding: 20px;
        min-height: 350px;
        max-width: 100%;
    }

    .controls {
        gap: 10px;
    }

    .btn {
        padding: 12px 24px;
        font-size: 0.95rem;
    }
}

/* ============================================
   Responsive Design - Mobile
   ============================================ */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 15px;
        gap: 20px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .stats-container {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 10px;
    }

    .stat-box {
        padding: 15px 10px;
        border: 1px solid var(--primary-color);
    }

    .stat-label {
        font-size: 0.75rem;
        margin-bottom: 5px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .game-board {
        grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
        gap: 8px;
        padding: 15px;
        min-height: 300px;
    }

    .overlay-content {
        padding: 30px 20px;
    }

    .overlay-content h2 {
        font-size: 1.8rem;
    }

    .final-stats p {
        font-size: 1.1rem;
    }

    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

/* ============================================
   Accessibility & Print
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    body {
        background: white;
        color: black;
    }

    .game-board,
    .controls,
    .footer {
        display: none;
    }
}
