/* ========================================
   SUDOKU - PREMIUM GAME APP DESIGN
   ======================================== */

/* ========= ROOT VARIABLES ========= */
:root {
    /* Color Palette - Vibrant & Energetic */
    --color-bg-primary: #0f0a2e;
    --color-bg-secondary: #1a0f3d;
    --color-bg-tertiary: #2d1b5e;
    --color-accent-primary: #00ffff;
    --color-accent-secondary: #ff00ff;
    --color-accent-gold: #ffea00;
    --color-text-primary: #ffffff;
    --color-text-secondary: #e0d5ff;
    --color-text-muted: #a892ee;
    --color-success: #00ff9d;
    --color-danger: #ff2d5f;
    --color-warning: #ffc200;
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-blur: 20px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 25px rgba(0, 255, 255, 0.5);
    --shadow-glow-pink: 0 0 25px rgba(255, 0, 255, 0.5);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-round: 50%;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Typography */
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Outfit', sans-serif;
    
    /* ========= RESPONSIVE STAT VARIABLES ========= */
    /* Smartphone Portrait */
    --stat-icon-sm-portrait: 1.2rem;
    --stat-label-sm-portrait: 0.6rem;
    --stat-value-sm-portrait: 0.9rem;
    --stat-padding-sm-portrait: 0.25rem 0.5rem;
    --stat-gap-sm-portrait: 0.25rem;
    
    /* Smartphone Landscape */
    --stat-icon-sm-landscape: 1.2rem;
    --stat-label-sm-landscape: 0.6rem;
    --stat-value-sm-landscape: 0.9rem;
    --stat-padding-sm-landscape: 0.25rem 0.5rem;
    --stat-gap-sm-landscape: 0.5rem;
    
    /* Tablet Portrait */
    --stat-icon-md-portrait: 1.4rem;
    --stat-label-md-portrait: 0.7rem;
    --stat-value-md-portrait: 1rem;
    --stat-padding-md-portrait: 0.5rem 0.75rem;
    
    /* Tablet Landscape */
    --stat-icon-md-landscape: 1.8rem;
    --stat-label-md-landscape: 0.8rem;
    --stat-value-md-landscape: 1.2rem;
    --stat-padding-md-landscape: 0.5rem 0.5rem;
    --stat-gap-md-landscape: 0.75rem;
    --stat-min-width-md-landscape: 140px;
    
    /* Desktop Portrait */
    --stat-icon-lg-portrait: 1.5rem;
    --stat-label-lg-portrait: 0.75rem;
    --stat-value-lg-portrait: 1.1rem;
    --stat-padding-lg-portrait: 0.5rem 1rem;
    
    /* Desktop Landscape */
    --stat-icon-lg-landscape: 1.6rem;
    --stat-label-lg-landscape: 0.8rem;
    --stat-value-lg-landscape: 1.15rem;
    --stat-padding-lg-landscape: 1rem;
    --stat-gap-lg-landscape: 0.75rem;
}

/* ========= RESET & BASE ========= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* ========= ANIMATED BACKGROUND ========= */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at 20% 30%, 
        rgba(0, 255, 255, 0.25) 0%, 
        transparent 50%
    ),
    radial-gradient(
        circle at 80% 70%, 
        rgba(255, 0, 255, 0.25) 0%, 
        transparent 50%
    ),
    linear-gradient(
        135deg,
        var(--color-bg-primary) 0%,
        var(--color-bg-secondary) 100%
    );
    z-index: -2;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.9; }
}

.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* ========= MAIN CONTAINER ========= */
.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease;
    position: relative;
}

.screen.hidden {
    display: none !important;
}

.screen-content {
    padding: var(--spacing-lg);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========= START SCREEN ========= */
.start-screen-nav {
    position: absolute;
    top: var(--spacing-md);
    left: var(--spacing-md);
    z-index: 10;
}

.game-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.logo-circle {
    width: 120px;
    height: 120px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-round);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-glow);
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.logo-svg {
    width: 100%;
    height: 100%;
}

.logo-piece {
    animation: piecePulse 2s ease-in-out infinite;
}

.piece-delay-1 { animation-delay: 0.2s; }
.piece-delay-2 { animation-delay: 0.4s; }
.piece-delay-3 { animation-delay: 0.6s; }
.piece-delay-4 { animation-delay: 0.8s; }

@keyframes piecePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

.game-title {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.2em;
    text-shadow: 0 0 40px rgba(0, 245, 255, 0.5);
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

.game-subtitle {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Stats Overview */
.stats-overview {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    max-width: 100%;
    padding: 0 var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-accent-primary);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    font-size: 2rem;
}

.stat-icon i {
    background: linear-gradient(135deg, var(--color-accent-gold), var(--color-warning));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.3));
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-accent-gold), var(--color-warning));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Difficulty Selection */
.difficulty-section {
    margin-top: var(--spacing-xl);
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: var(--spacing-lg);
    color: var(--color-text-secondary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.difficulty-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.difficulty-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left var(--transition-slow);
}

.difficulty-card:hover::before {
    left: 100%;
}

.difficulty-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--color-accent-primary);
    box-shadow: var(--shadow-glow);
}

.difficulty-card.expert-highlight {
    border-color: var(--color-accent-gold);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.05), rgba(252, 0, 255, 0.05));
}

.difficulty-card.expert-highlight:hover {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
}

.difficulty-badge {
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-md);
    display: inline-block;
}

.easy-badge {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: #fff;
}

.medium-badge {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
}

.hard-badge {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: #fff;
}

.expert-badge {
    background: linear-gradient(135deg, var(--color-accent-gold), #dc2626);
    color: #fff;
}

/* Locked Difficulty Cards */
.difficulty-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.difficulty-card.locked:hover {
    transform: none;
    box-shadow: none;
}

.lock-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: var(--color-text-muted);
    z-index: 2;
    pointer-events: none;
}

.lock-overlay i {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.difficulty-icon {
    font-size: 3rem;
    text-align: center;
    margin: var(--spacing-md) 0;
}

.difficulty-desc {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

/* ========= GAME SCREEN ========= */
#game-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-height: 100vh;
    max-width: 100%;
    padding: 0;
}

.game-top-bar {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-shrink: 0;
}

.btn-icon-only {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-accent-primary);
    box-shadow: var(--shadow-glow);
}

/* Game Stats in Top Bar */
.game-stats {
    flex: 1;
    display: flex;
    justify-content: space-around;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: rgba(255, 255, 255, 0.03);
    padding: var(--spacing-md) var(--spacing-sm);
    border-radius: var(--radius-md);
}

.stat-item .stat-icon {
    font-size: 1.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-info .stat-label {
    font-size: 0.65rem;
    color: var(--color-text-muted);
}

.stat-info .stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-primary);
    background: none;
    -webkit-text-fill-color: currentColor;
}

/* Game Board */
.game-board-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
    overflow: hidden;
    min-height: 0;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 3px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    box-shadow: var(--shadow-lg);
    width: min(500px, calc(100vw - 2rem));
    height: min(500px, calc(100vh - 200px));
    max-width: min(500px, calc(100vw - 2rem));
    max-height: min(500px, calc(100vh - 200px));
    aspect-ratio: 1;
}

.sudoku-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-fast);
    color: var(--color-text-primary);
    position: relative;
}

/* 3x3 box borders */
.sudoku-cell:nth-child(3n) {
    border-right: 2px solid var(--glass-border);
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid var(--glass-border);
}

.sudoku-cell.given {
    background: rgba(0, 245, 255, 0.15);
    color: var(--color-accent-primary);
    font-weight: 800;
    cursor: not-allowed;
}

.sudoku-cell.selected {
    background: rgba(252, 0, 255, 0.3);
    border: 2px solid var(--color-accent-secondary);
    z-index: 1;
}

.sudoku-cell.highlighted {
    background: rgba(0, 245, 255, 0.15);
}

.sudoku-cell.correct {
    background: rgba(0, 255, 136, 0.2);
    color: var(--color-success);
}

.sudoku-cell.incorrect {
    background: rgba(255, 51, 102, 0.2);
    color: var(--color-danger);
    animation: shake 0.4s ease;
}

.sudoku-cell:hover:not(.given) {
    background: rgba(0, 245, 255, 0.25);
    transform: scale(1.05);
}

/* Notes mode */
.sudoku-cell .notes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    font-size: 0.4rem;
    font-weight: 400;
    position: absolute;
    inset: 2px;
    color: var(--color-text-secondary);
}

.sudoku-cell .notes span {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Control Panel */
.control-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border-top: 1px solid var(--glass-border);
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: var(--spacing-xs);
}

.number-btn {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.number-btn:hover {
    background: var(--color-accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.number-btn:active {
    transform: scale(0.95);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-xs);
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: rgba(0, 245, 255, 0.2);
    border-color: var(--color-accent-primary);
    transform: translateY(-2px);
}

.action-btn.active {
    background: var(--color-accent-secondary);
    border-color: var(--color-accent-secondary);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn svg {
    flex-shrink: 0;
}

/* ========= END SCREENS ========= */
.end-screen .screen-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.end-screen-animation {
    margin: var(--spacing-xl) 0;
}

.trophy-container,
.defeat-container {
    position: relative;
    display: inline-block;
}

.trophy-glow,
.defeat-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    background:radial-gradient(circle, rgba(0, 245, 255, 0.4), transparent);
    border-radius: var(--radius-round);
    animation: glowPulse 2s ease-in-out infinite;
}

.defeat-glow {
    background: radial-gradient(circle, rgba(255, 51, 102, 0.4), transparent);
}

@keyframes glowPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

.trophy-icon,
.defeat-icon {
    font-size: 6rem;
    position: relative;
    z-index: 1;
    animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.end-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: var(--spacing-sm);
}

.victory-title {
    background: linear-gradient(135deg, var(--color-success), var(--color-accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.defeat-title {
    background: linear-gradient(135deg, var(--color-danger), var(--color-warning));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.end-subtitle {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    margin-bottom: var(--spacing-lg);
}

.end-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin: var(--spacing-xl) 0;
}

.end-stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    min-width: 120px;
}

.end-stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    margin-bottom: var(--spacing-xs);
}

.end-stat-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.end-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-secondary));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* Landscape Mode */
#game-screen.landscape .game-top-bar {
    border-right: 1px solid var(--glass-border);
    border-bottom: none;
    flex-direction: column;
}

#game-screen.landscape .game-board-wrapper {
    padding: var(--spacing-md);
}

#game-screen.landscape .control-panel {
    border-left: 1px solid var(--glass-border);
    border-top: none;
    justify-content: space-between;
}

.landscape .game-stats {
    flex-direction: column;
}

.landscape .number-pad {
    grid-template-columns: repeat(3, 1fr);
}

.landscape .action-buttons {
    grid-template-columns: repeat(2, 1fr);
}

/* ==========================================
   RESPONSIVE BREAKPOINTS - STANDARDIZED
   ========================================== */

/* ========= SMARTPHONE PORTRAIT (≤480px) ========= */
@media only screen and (max-width: 480px) and (orientation: portrait) {
    .game-title {
        font-size: 2rem;
    }
    
    .stats-overview {
        flex-direction: column;
        align-items: center;
    }
    
    .stat-card {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .game-stats {
        gap: var(--stat-gap-sm-portrait);
    }
    
    .stat-item {
        padding: var(--stat-padding-sm-portrait);
        gap: var(--stat-gap-sm-portrait);
    }
    
    .stat-item .stat-icon {
        font-size: var(--stat-icon-sm-portrait);
    }
    
    .stat-info .stat-label {
        font-size: var(--stat-label-sm-portrait);
    }
    
    .stat-info .stat-value {
        font-size: var(--stat-value-sm-portrait);
    }
    
    .sudoku-cell {
        font-size: 0.9rem;
    }
    
    .number-btn {
        font-size: 0.9rem;
    }
    
    .difficulty-grid {
        grid-template-columns: 1fr;
    }
}

/* ========= SMARTPHONE LANDSCAPE (≤812px) ========= */
@media only screen and (max-width: 812px) and (orientation: landscape) {
    .game-stats {
        gap: var(--stat-gap-sm-landscape);
    }
    
    .stat-item {
        flex-direction: row;
        text-align: left;
        gap: var(--stat-gap-sm-landscape);
        min-width: 0;
        width: 100%;
        padding: var(--stat-padding-sm-landscape);
    }
    
    .stat-item .stat-icon {
        font-size: var(--stat-icon-sm-landscape);
    }
    
    .stat-info .stat-label {
        font-size: var(--stat-label-sm-landscape);
    }
    
    .stat-info .stat-value {
        font-size: var(--stat-value-sm-landscape);
    }
}

/* ========= TABLET PORTRAIT (600px-900px) ========= */
@media only screen and (min-width: 600px) and (max-width: 900px) and (orientation: portrait) {
    .stat-item {
        padding: var(--stat-padding-md-portrait);
    }
    
    .stat-item .stat-icon {
        font-size: var(--stat-icon-md-portrait);
    }
    
    .stat-info .stat-label {
        font-size: var(--stat-label-md-portrait);
    }
    
    .stat-info .stat-value {
        font-size: var(--stat-value-md-portrait);
    }
}

/* ========= TABLET LANDSCAPE (900px-1200px) ========= */
@media only screen and (min-width: 900px) and (max-width: 1200px) and (orientation: landscape) {
    .stat-item {
        padding: var(--stat-padding-md-landscape);
        flex-direction: row;
        text-align: left;
        gap: var(--stat-gap-md-landscape);
        min-width: var(--stat-min-width-md-landscape);
    }
    
    .stat-item .stat-icon {
        font-size: var(--stat-icon-md-landscape);
    }
    
    .stat-info .stat-label {
        font-size: var(--stat-label-md-landscape);
    }
    
    .stat-info .stat-value {
        font-size: var(--stat-value-md-landscape);
    }
}

/* ========= DESKTOP PORTRAIT (≥1200px) ========= */
@media only screen and (min-width: 1200px) and (orientation: portrait) {
    .stat-item {
        padding: var(--stat-padding-lg-portrait);
    }
    
    .stat-item .stat-icon {
        font-size: var(--stat-icon-lg-portrait);
    }
    
    .stat-info .stat-label {
        font-size: var(--stat-label-lg-portrait);
    }
    
    .stat-info .stat-value {
        font-size: var(--stat-value-lg-portrait);
    }
}

/* ========= DESKTOP LANDSCAPE (≥1200px) ========= */
@media only screen and (min-width: 1200px) and (orientation: landscape) {
    .stat-item {
        padding: var(--stat-padding-lg-landscape);
        gap: var(--stat-gap-lg-landscape);
    }
    
    .stat-item .stat-icon {
        font-size: var(--stat-icon-lg-landscape);
    }
    
    .stat-info .stat-label {
        font-size: var(--stat-label-lg-landscape);
    }
    
    .stat-info .stat-value {
        font-size: var(--stat-value-lg-landscape);
    }
}

/* ========= GENERAL MOBILE (≤768px) ========= */


/* Notification System */
.game-notification {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important;
    top: auto !important;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: var(--spacing-md);
    box-shadow: var(--shadow-lg);
    z-index: 9999 !important;
    transform: translateY(100px);
    opacity: 0;
    transition: all var(--transition-normal);
    min-width: 300px;
    max-width: 350px;
    overflow: hidden;
    cursor: pointer;
}

.game-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.game-notification.success {
    border-color: var(--color-success);
    background: rgba(0, 255, 136, 0.15);
}

.game-notification.error {
    border-color: var(--color-danger);
    background: rgba(255, 51, 102, 0.15);
}

.game-notification.info {
    border-color: var(--color-accent-primary);
    background: rgba(0, 245, 255, 0.15);
}

/* Grace Period Notification Specific */
.grace-period-notification {
    position: relative;
}

.grace-period-notification:hover {
    border-color: var(--color-accent-primary);
    box-shadow: var(--shadow-glow);
}

.notification-icon {
    font-size: 1.2rem;
    color: var(--color-accent-primary);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-round);
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.notification-title {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0;
    line-height: 1.2;
}

.notification-message {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.notification-timer {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-accent-gold);
    margin-left: auto;
}

.notification-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-accent-primary), var(--color-accent-secondary));
    width: 100%;
    transition: width 1s linear;
    box-shadow: 0 0 10px var(--color-accent-primary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ========= STATS SCREEN ========= */
.stats-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000 !important;
    padding: var(--spacing-md);
    animation: fadeIn 0.3s ease;
    max-width: none !important; /* Override .screen max-width */
    margin: 0 !important; /* Override .screen margin */
}

.stats-modal {
    background: var(--color-bg-secondary);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-xl);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--glass-border);
}

.stats-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.stats-icon {
    font-size: 1.75rem;
}

.btn-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.stats-table-container {
    padding: var(--spacing-lg);
    overflow-x: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table thead th {
    padding: var(--spacing-md);
    text-align: left;
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    border-bottom: 2px solid var(--glass-border);
}

.stats-table tbody tr {
    transition: background var(--transition-fast);
}

.stats-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.stats-table tbody td {
    padding: var(--spacing-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary);
}

.stat-highlight {
    color: var(--color-success) !important;
    font-weight: 700;
}

.stat-danger {
    color: var(--color-danger) !important;
    font-weight: 700;
}

/* Clickable stat card */
.stat-card-clickable {
    cursor: pointer;
    position: relative;
}

.stat-card-clickable:hover {
    transform: translateY(-4px);
    border-color: var(--color-accent-primary);
    box-shadow: 0 8px 32px rgba(0, 245, 255, 0.3);
}

.stat-hint {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Mobile Responsive Stats */


/* ========= COMPREHENSIVE RESPONSIVE DESIGN ========= */

/* Tablet (481px - 1024px) */
@media (min-width: 481px) and (max-width: 1024px) {
    .game-title {
        font-size: 2.5rem;
    }
    
    .logo-circle {
        width: 100px;
        height: 100px;
    }
}

/* Mobile (max-width: 480px) */
@media (max-width: 480px) {
    /* Start Screen */
    .game-title {
        font-size: 2rem;
    }
    
    .logo-circle {
        width: 80px;
        height: 80px;
    }
    
    .logo-icon {
        font-size: 2.5rem;
    }
    
    .stats-overview {
        gap: var(--spacing-sm);
    }
    
    .stat-card {
        flex: 1 1 auto;
        min-width: 150px;
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .stat-icon {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    /* Game Screen */
    .sudoku-cell {
        font-size: 1rem;
    }
    
    .number-btn {
        font-size: 1rem;
    }
    
    /* End Screen */
    .end-title {
        font-size: 2rem;
    }
    
    /* Stats Modal */
    .stats-modal {
        max-height: 95vh;
        margin: var(--spacing-sm);
    }

    .stats-header {
        padding: var(--spacing-md);
    }

    .stats-title {
        font-size: 1.25rem;
    }

    .stats-table-container {
        padding: var(--spacing-md);
    }

    .stats-table thead th,
    .stats-table tbody td {
        padding: var(--spacing-sm);
        font-size: 0.875rem;
    }

    .stats-table {
        font-size: 0.875rem;
    }
}
