/* ============================================
   SUDOKU BLOUM - DARK AURORA THEME v2
   ============================================ */

/* CSS Variables */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a2e;
    --bg-card: rgba(20, 20, 35, 0.8);
    
    --neon-cyan: #00d9ff;
    --neon-purple: #a855f7;
    --neon-pink: #ec4899;
    --neon-green: #22d3ee;
    
    --gradient-aurora: linear-gradient(135deg, #00d9ff 0%, #a855f7 50%, #ec4899 100%);
    --gradient-glow: linear-gradient(135deg, rgba(0, 217, 255, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
    
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    
    --glow-cyan: 0 0 20px rgba(0, 217, 255, 0.5), 0 0 40px rgba(0, 217, 255, 0.3);
    --glow-purple: 0 0 20px rgba(168, 85, 247, 0.5), 0 0 40px rgba(168, 85, 247, 0.3);
    
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    
    --cell-size: 40px;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Background Effects */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 217, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 217, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

.floating-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--neon-cyan);
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--neon-purple);
    top: 50%;
    right: -15%;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--neon-pink);
    bottom: -5%;
    left: 30%;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.1); }
    50% { transform: translate(-20px, 20px) scale(0.9); }
    75% { transform: translate(20px, 10px) scale(1.05); }
}

/* Game Wrapper */
.game-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 217, 255, 0.1);
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--neon-cyan);
}

.game-logo {
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--gradient-aurora);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.icon-btn:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--neon-cyan);
}

/* Game Container */
.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* Screens */
.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.screen.hidden {
    display: none;
}

/* Menu Screen */
.menu-content {
    text-align: center;
    width: 100%;
    max-width: 450px;
    padding: 1rem;
}

.title-glow {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: var(--gradient-aurora);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 217, 255, 0.3);
}

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

/* Difficulty Section */
.difficulty-section {
    margin-bottom: 2rem;
}

.difficulty-section h3 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-difficulty {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.btn-difficulty:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--neon-cyan);
    transform: translateX(5px);
}

.diff-icon {
    font-size: 1.5rem;
}

.diff-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-difficulty small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}

/* Instructions */
.instructions {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.instructions h3 {
    color: var(--neon-cyan);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.instruction-grid {
    display: grid;
    gap: 0.75rem;
}

.instruction {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: left;
}

.instruction .icon {
    font-size: 1.2rem;
    width: 30px;
    text-align: center;
}

/* Game Screen */
.game-screen {
    padding: 0.5rem;
}

.game-info {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 1rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.info-item {
    text-align: center;
}

.info-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--neon-cyan);
}

/* ============================================
   SUDOKU GRID - PERFECT SQUARE CELLS
   ============================================ */
.grid-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, var(--cell-size));
    grid-template-rows: repeat(9, var(--cell-size));
    background: var(--bg-tertiary);
    border: 3px solid var(--neon-cyan);
    border-radius: 8px;
    box-shadow: var(--glow-cyan);
    overflow: hidden;
}

.sudoku-cell {
    width: var(--cell-size);
    height: var(--cell-size);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    position: relative;
    color: var(--text-primary);
    -webkit-user-select: none;
    user-select: none;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Remove right border on last column */
.sudoku-cell:nth-child(9n) {
    border-right: none;
}

/* Remove bottom border on last row */
.sudoku-cell:nth-child(n+73) {
    border-bottom: none;
}

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

/* 3x3 box borders - BOTTOM for rows 3 and 6 */
.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(--neon-cyan);
}

.sudoku-cell.fixed {
    color: var(--neon-cyan);
    font-weight: 800;
    cursor: default;
    background: rgba(0, 217, 255, 0.05);
}

.sudoku-cell.selected {
    background: rgba(0, 217, 255, 0.25);
    box-shadow: inset 0 0 0 2px var(--neon-cyan);
}

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

.sudoku-cell.error {
    color: var(--error) !important;
    background: rgba(239, 68, 68, 0.15) !important;
}

.sudoku-cell.correct {
    color: var(--success);
}

.sudoku-cell.same-number {
    background: rgba(168, 85, 247, 0.15);
}

.sudoku-cell.user-input {
    color: var(--neon-purple);
}

/* ============================================
   NUMBER PAD - HIDDEN BY DEFAULT
   ============================================ */
.number-pad {
    display: none;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    max-width: 360px;
    margin: 0 auto 1rem;
    width: 100%;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 12px;
    animation: fadeIn 0.2s ease;
}

.number-pad.visible {
    display: grid;
}

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

.num-btn {
    aspect-ratio: 1;
    max-height: 55px;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.num-btn:hover {
    background: rgba(0, 217, 255, 0.15);
    border-color: var(--neon-cyan);
    transform: scale(1.05);
}

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

.num-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.erase-btn {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.erase-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 400px;
    margin: 0 auto;
}

.btn-action {
    padding: 0.75rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-action:hover {
    transform: translateY(-2px);
}

.btn-check {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.btn-check:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--success);
}

.btn-solve {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.3);
}

.btn-solve:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: var(--neon-purple);
}

/* Message */
.message {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    animation: slideIn 0.3s ease;
}

.message.hidden {
    display: none;
}

.message.success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.message.error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.message.info {
    background: rgba(0, 217, 255, 0.2);
    color: var(--neon-cyan);
    border: 1px solid rgba(0, 217, 255, 0.3);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Result Screen */
.result-content {
    text-align: center;
    padding: 2rem 1rem;
}

.result-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    animation: celebrate 0.5s ease;
}

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

.result-message {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--neon-cyan);
}

.result-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary {
    padding: 1rem 2rem;
    background: var(--gradient-aurora);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

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

.btn-glow {
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
}

.btn-secondary {
    padding: 1rem 2rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--neon-cyan);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--neon-cyan);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--neon-cyan);
}

.help-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.help-content p, .help-content li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.help-content ul {
    padding-left: 1.5rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    :root {
        --cell-size: 36px;
    }
    
    .game-header {
        padding: 0.75rem 1rem;
    }
    
    .game-logo {
        font-size: 1.1rem;
    }
    
    .title-glow {
        font-size: 1.5rem;
    }
    
    .sudoku-cell {
        font-size: 1.1rem;
    }
    
    .number-pad {
        max-width: 340px;
    }
    
    .num-btn {
        font-size: 1.1rem;
        max-height: 48px;
    }
    
    .action-buttons {
        max-width: 340px;
    }
    
    .btn-action {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .result-stats {
        gap: 1rem;
    }
    
    .btn-primary, .btn-secondary {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    :root {
        --cell-size: 32px;
    }
    
    .sudoku-cell {
        font-size: 1rem;
    }
    
    .number-pad {
        max-width: 300px;
    }
    
    .action-buttons {
        max-width: 300px;
    }
}

/* Touch devices */
@media (hover: none) {
    .btn-difficulty:hover {
        transform: none;
    }
    
    .num-btn:hover {
        transform: none;
    }
}

/* Landscape on small screens */
@media (max-height: 600px) and (orientation: landscape) {
    :root {
        --cell-size: 32px;
    }
    
    .game-container {
        padding: 0.5rem;
    }
    
    .game-info {
        margin-bottom: 0.5rem;
        padding: 0.5rem;
    }
    
    .number-pad {
        max-width: 300px;
    }
    
    .action-buttons {
        margin-top: 0.5rem;
    }
}
