/* ===================================
   CSS Reset & Base Styles
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Modern Color Palette - Light Theme with Soft Colors */
    --color-primary: #6366f1;
    --color-primary-dark: #4f46e5;
    --color-primary-light: #818cf8;
    --color-secondary: #64748b;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-bg: #f8fafc;
    --color-bg-light: #ffffff;
    --color-bg-card: #ffffff;
    --color-text: #0f172a;
    --color-text-muted: #64748b;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Typography */
    --font-size-base: 16px;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-xxl: 2rem;
    --font-size-xxxl: 3rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Borders */
    --border-radius: 12px;
    --border-radius-lg: 20px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 25%, #fef3c7 50%, #fce7f3 75%, #ede9fe 100%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 20%, rgba(251, 191, 36, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.screen {
    position: relative;
    z-index: 1;
}

/* ===================================
   Screen Management
   =================================== */
.screen {
    display: none;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    padding: var(--spacing-sm);
    animation: fadeIn var(--transition-normal);
}

.screen.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: var(--spacing-sm);
    flex: 1;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .container {
        max-width: 800px;
        padding: var(--spacing-md);
    }
}

/* ===================================
   Typography
   =================================== */
h1, h2, h3 {
    font-weight: 700;
    margin-bottom: var(--spacing-md);
}

.game-title {
    font-size: var(--font-size-xxl);
    text-align: center;
    margin-bottom: var(--spacing-xs);
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.02em;
    filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.2));
}

@media (min-width: 768px) {
    .game-title {
        font-size: var(--font-size-xxxl);
    }
}

.game-subtitle {
    text-align: center;
    font-size: var(--font-size-base);
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

@media (min-width: 768px) {
    .game-subtitle {
        font-size: var(--font-size-lg);
        margin-bottom: var(--spacing-md);
    }
}

.menu-header {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

@media (min-width: 768px) {
    .menu-header {
        margin-bottom: var(--spacing-xl);
    }
}

.shape-preview {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    border: 2px solid rgba(226, 232, 240, 0.6);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.shape-preview svg {
    width: 50px;
    height: 50px;
}

@media (min-width: 768px) {
    .shape-preview {
        margin-top: var(--spacing-lg);
        padding: var(--spacing-lg);
        border-radius: var(--border-radius-lg);
    }
    
    .shape-preview svg {
        width: 60px;
        height: 60px;
    }
}

.shape-preview-item {
    animation: floatShape 3s ease-in-out infinite;
    transition: transform var(--transition-normal);
}

.shape-preview-item:nth-child(1) { animation-delay: 0s; }
.shape-preview-item:nth-child(2) { animation-delay: 0.2s; }
.shape-preview-item:nth-child(3) { animation-delay: 0.4s; }
.shape-preview-item:nth-child(4) { animation-delay: 0.6s; }

.shape-preview-item:hover {
    transform: scale(1.2);
}

@keyframes floatShape {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: center;
}

/* ===================================
   Buttons
   =================================== */
.btn {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-size-lg);
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-normal);
    min-height: 60px;
    min-width: 200px;
    touch-action: manipulation;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.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, #6366f1 0%, #8b5cf6 100%);
    color: #ffffff;
    box-shadow: 
        0 4px 14px rgba(99, 102, 241, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0) 100%);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.btn-primary:hover::before {
    transform: translateX(100%);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(99, 102, 241, 0.4),
        0 4px 10px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(99, 102, 241, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-text);
    box-shadow: 
        0 4px 14px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    border: 2px solid rgba(226, 232, 240, 0.8);
    position: relative;
    overflow: hidden;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent 0%, rgba(99, 102, 241, 0.05) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.btn-secondary:hover::before {
    transform: translateX(100%);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.12),
        0 4px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    border-color: rgba(99, 102, 241, 0.3);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-large {
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    margin: 0;
    font-size: var(--font-size-lg);
    padding: var(--spacing-md);
}

@media (min-width: 768px) {
    .btn-large {
        max-width: 400px;
        gap: var(--spacing-sm);
        font-size: var(--font-size-xl);
        padding: var(--spacing-md) var(--spacing-xl);
    }
}

.btn-icon {
    font-size: var(--font-size-xl);
    line-height: 1;
}

@media (min-width: 768px) {
    .btn-icon {
        font-size: var(--font-size-xxl);
    }
}

/* ===================================
   High Scores Section
   =================================== */
.high-scores {
    margin-top: var(--spacing-xl);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.high-scores h2 {
    text-align: center;
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-md);
}

.scores-list {
    list-style: none;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--border-radius);
    font-size: var(--font-size-lg);
    transition: all var(--transition-normal);
}

.score-item:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.score-rank {
    font-weight: 800;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    min-width: 40px;
    font-size: var(--font-size-xl);
}

.score-details {
    flex: 1;
    display: flex;
    justify-content: space-between;
    margin: 0 var(--spacing-md);
}

.no-scores {
    text-align: center;
    color: var(--color-text-muted);
    padding: var(--spacing-lg);
}

/* ===================================
   Instructions Overlay
   =================================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing-md);
}

.overlay.active {
    display: flex;
    animation: fadeIn var(--transition-normal);
}

.overlay-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(226, 232, 240, 0.8);
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.15),
        0 1px 3px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.overlay-content h2 {
    text-align: center;
    font-size: var(--font-size-xxl);
    margin-bottom: var(--spacing-lg);
}

.instructions-text {
    font-size: var(--font-size-lg);
    line-height: 1.8;
}

.instructions-text p {
    margin-bottom: var(--spacing-md);
}

.instructions-text ul {
    margin-left: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

.instructions-text li {
    margin-bottom: var(--spacing-xs);
}

/* ===================================
   Game Screen
   =================================== */
.game-header {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: var(--spacing-sm);
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--border-radius);
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

@media (min-width: 768px) {
    .game-header {
        grid-template-columns: 1fr auto 1fr;
        grid-template-rows: auto;
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
        padding: var(--spacing-md);
        border-radius: var(--border-radius-lg);
    }
}

.score-display,
.timer-display {
    text-align: center;
}

.pattern-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    grid-column: 1;
    order: -1;
    padding: var(--spacing-sm);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-radius: var(--border-radius);
    border: 2px solid rgba(99, 102, 241, 0.2);
    box-shadow: 
        0 4px 16px rgba(99, 102, 241, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
}

.level-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    letter-spacing: 0.02em;
    text-align: center;
    line-height: 1.2;
}

@media (min-width: 768px) {
    .level-badge {
        font-size: 0.75rem;
        padding: 4px 10px;
    }
}

@media (min-width: 768px) {
    .pattern-display {
        grid-column: 2;
        order: 0;
        padding: var(--spacing-md);
        border-radius: var(--border-radius-lg);
    }
}

.pattern-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: iconPulse 2s ease-in-out infinite;
}

@media (min-width: 768px) {
    .pattern-icon {
        width: 80px;
        height: 80px;
    }
}

.pattern-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

.pattern-text {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (min-width: 768px) {
    .pattern-text {
        font-size: var(--font-size-lg);
    }
}

.game-header .label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

@media (min-width: 768px) {
    .game-header .label {
        font-size: var(--font-size-base);
        margin-bottom: var(--spacing-xs);
    }
}

.game-header .value {
    display: block;
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--color-text);
}

@media (min-width: 768px) {
    .game-header .value {
        font-size: var(--font-size-xxl);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ===================================
   Game Grid
   =================================== */
.game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: var(--spacing-sm);
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: var(--spacing-xs);
    max-width: 100%;
    width: 100%;
    max-height: 60vh;
    aspect-ratio: 1;
}

@media (min-width: 768px) {
    .game-container {
        padding: var(--spacing-md);
    }
    
    .game-grid {
        max-width: 600px;
        gap: var(--spacing-md);
        max-height: none;
    }
}

.grid-cell {
    position: relative;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    border: 3px solid rgba(226, 232, 240, 0.8);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
    touch-action: manipulation;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

@media (min-width: 768px) {
    .grid-cell {
        border-radius: var(--border-radius-lg);
        border-width: 2px;
        min-height: 100px;
    }
}

.grid-cell:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 0 20px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.grid-cell:active {
    transform: scale(0.95);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Game Object (SVG) - No animations for faster, cleaner gameplay */
.game-object {
    width: 80%;
    height: 80%;
    pointer-events: none;
}

/* Click Feedback */
.grid-cell.correct-hit {
    animation: correctHit 0.4s;
}

@keyframes correctHit {
    0%, 100% {
        background: rgba(255, 255, 255, 0.8);
        border-color: rgba(226, 232, 240, 0.8);
    }
    50% {
        background: rgba(16, 185, 129, 0.25);
        border-color: var(--color-success);
        box-shadow: 
            0 0 40px rgba(16, 185, 129, 0.4),
            0 0 80px rgba(16, 185, 129, 0.2),
            inset 0 0 20px rgba(16, 185, 129, 0.2);
    }
}

.grid-cell.wrong-hit {
    animation: wrongHit 0.4s;
}

@keyframes wrongHit {
    0%, 100% {
        background: rgba(255, 255, 255, 0.8);
        border-color: rgba(226, 232, 240, 0.8);
    }
    50% {
        background: rgba(239, 68, 68, 0.25);
        border-color: var(--color-danger);
        box-shadow: 
            0 0 40px rgba(239, 68, 68, 0.4),
            0 0 80px rgba(239, 68, 68, 0.2),
            inset 0 0 20px rgba(239, 68, 68, 0.2);
    }
}


/* ===================================
   Results Screen
   =================================== */
.results-title {
    text-align: center;
    font-size: var(--font-size-xxxl);
    margin-bottom: var(--spacing-xl);
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 50%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.02em;
    filter: drop-shadow(0 2px 8px rgba(16, 185, 129, 0.2));
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-xl);
    }
}

.result-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(226, 232, 240, 0.8);
    text-align: center;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    transition: all var(--transition-normal);
}

.result-card:hover {
    transform: translateY(-6px);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.12),
        0 0 30px rgba(99, 102, 241, 0.15);
}

.result-label {
    font-size: var(--font-size-base);
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
}

.result-value {
    font-size: var(--font-size-xxl);
    font-weight: 700;
    color: var(--color-text);
}

/* ===================================
   Charts
   =================================== */
.difficulty-progression,
.interval-performance {
    margin-bottom: var(--spacing-xl);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.difficulty-progression h2,
.interval-performance h2 {
    text-align: center;
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-lg);
}

.chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    padding: var(--spacing-md);
    background: var(--color-bg-light);
    border-radius: var(--border-radius);
    gap: var(--spacing-xs);
}

.chart-bar {
    flex: 1;
    background: linear-gradient(180deg, #818cf8 0%, #6366f1 50%, #4f46e5 100%);
    border-radius: 8px 8px 0 0;
    position: relative;
    min-width: 30px;
    transition: all var(--transition-normal);
    animation: barGrow 0.5s ease-out;
    box-shadow: 
        0 -4px 12px rgba(99, 102, 241, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

@keyframes barGrow {
    from {
        height: 0;
    }
}

.chart-bar:hover {
    opacity: 1;
    transform: scaleY(1.05);
    box-shadow: 
        0 -8px 24px rgba(99, 102, 241, 0.5),
        0 0 20px rgba(99, 102, 241, 0.4);
}

.chart-bar-label {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.chart-bar-value {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: center;
}

/* ===================================
   Mobile First - Responsive Design
   =================================== */

/* Mobile styles are the default above */

/* Tablet and up (768px+) */
@media (min-width: 768px) {
    .game-header {
        grid-template-columns: 1fr auto 1fr;
        grid-template-rows: auto;
    }
    
    .pattern-display {
        order: 0;
    }
    
    .game-grid {
        max-width: 600px;
        gap: var(--spacing-md);
    }
    
    .grid-cell {
        min-height: 100px;
    }
    
    .results-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .shape-preview {
        gap: var(--spacing-lg);
    }
}

/* ===================================
   Accessibility
   =================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus-visible,
.grid-cell:focus-visible {
    outline: 3px solid var(--color-warning);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --color-bg: #000000;
        --color-bg-light: #1a1a1a;
        --color-bg-card: #2a2a2a;
        --color-text: #FFFFFF;
    }
    
    .grid-cell {
        border-width: 3px;
    }
}
