/* Local Fonts */
@font-face {font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 400; src: url('/fonts/inter-v20-latin-regular.woff2') format('woff2');}
@font-face {font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 600; src: url('/fonts/inter-v20-latin-600.woff2') format('woff2');}
@font-face {font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 700; src: url('/fonts/inter-v20-latin-700.woff2') format('woff2');}
@font-face {font-display: swap; font-family: 'Orbitron'; font-style: normal; font-weight: 400; src: url('/fonts/orbitron-v35-latin-regular.woff2') format('woff2');}
@font-face {font-display: swap; font-family: 'Orbitron'; font-style: normal; font-weight: 700; src: url('/fonts/orbitron-v35-latin-700.woff2') format('woff2');}

:root { 
    --menu-width: 200px; 
    --accent-color: #00C9FF; 
    --accent-hover: #00a3d9;
    --text-color: #f8fafc;
    --text-muted: #94a3b8; 
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --border-color: #334155;
    --grid-line: #475569;
    --error-color: #ef4444;
}

html, body { height: 100%; width: 100%; overflow-x: hidden; }
body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg-dark); 
    background-image: radial-gradient(circle at top center, rgba(0, 201, 255, 0.05) 0%, transparent 70%); 
    margin: 0; padding: 0; color: var(--text-color); 
    display: flex; flex-direction: row; 
    user-select: none; -webkit-tap-highlight-color: transparent;
}

/* Sidebar Menu */
.left-menu { width: var(--menu-width); min-width: var(--menu-width); height: 100vh; position: fixed; top: 0; left: 0; background: rgba(10, 10, 10, 0.95); box-shadow: 2px 0 15px rgba(0, 0, 0, 0.5); padding: 0 20px; box-sizing: border-box; z-index: 1001; font-family: 'Orbitron', sans-serif; display: flex; flex-direction: column; justify-content: center; overflow-y: auto; }
.left-menu ul { list-style: none; padding: 0; margin: 0; } .left-menu li { margin-bottom: 20px; }
.left-menu a { font-size: 24px; font-weight: 600; color: var(--accent-color); text-decoration: none; text-shadow: 0 0 2px var(--accent-color); display: block; padding: 8px 0; transition: all 0.3s ease; }
.left-menu a:hover, .left-menu a:focus { color: #fff; text-shadow: 0 0 8px #fff, 0 0 12px rgba(255, 255, 255, 0.5); transform: translateX(5px); }
.left-menu a.active-page-link { color: #fff; background-color: rgba(0, 190, 255, 0.15); border-radius: 8px; padding-left: 15px; padding-right: 15px; }

/* Main Layout */
.mobile-header, .menu-overlay { display: none; }
.main-content-wrapper { flex-grow: 1; padding: 40px 20px; padding-left: calc(var(--menu-width) + 40px); display: flex; flex-direction: column; align-items: center; min-height: 100vh; box-sizing: border-box; width: 100%; }

/* Breadcrumbs */
.breadcrumbs { width: 100%; max-width: 600px; margin-bottom: 10px; } 
.breadcrumbs ol { display: flex; list-style: none; padding: 0; margin: 0; font-size: 0.9rem; color: var(--text-muted); font-weight: 600;} 
.breadcrumbs li:not(:last-child)::after { content: '>'; margin: 0 0.75rem; } 
.breadcrumbs a { color: var(--text-muted); text-decoration: none; transition: color 0.2s;} 
.breadcrumbs a:hover { color: var(--accent-color); }

/* Game Container */
.sudoku-game-container { background-color: var(--bg-card); border-radius: 1rem; padding: 1.5rem; box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(0,201,255,0.05); border: 1px solid rgba(0,201,255,0.15); display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 550px; box-sizing: border-box; position: relative; }
.game-header { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px;}
.game-header h1 { font-family: 'Orbitron', sans-serif; font-size: 2rem; color: var(--accent-color); margin: 0; text-shadow: 0 0 10px rgba(0, 201, 255, 0.4); }
.top-stats { display: flex; gap: 15px; font-family: 'Orbitron', sans-serif; font-size: 1.1rem; color: #fff;}

.controls-row { display: flex; gap: 10px; width: 100%; margin-bottom: 15px; }
.controls-row select, .action-btn { flex: 1; background: var(--bg-dark); color: #fff; font-family: 'Orbitron', sans-serif; font-size: 1rem; padding: 0.8rem; border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer; transition: 0.2s; outline: none; text-align: center; font-weight: 600;}
.controls-row select:hover, .action-btn:hover { border-color: var(--accent-color); box-shadow: 0 0 10px rgba(0, 201, 255, 0.2); }
.action-btn { background: var(--accent-color); color: #000; border: none; display: flex; align-items: center; justify-content: center; gap: 8px; }
.action-btn:hover { background: var(--accent-hover); color: #000;}
.action-btn.secondary { background: var(--border-color); color: #fff; }

/* The Sudoku Board */
#sudoku-board { 
    display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr); 
    width: 100%; aspect-ratio: 1 / 1; 
    border: 3px solid var(--accent-color); border-radius: 6px; 
    background-color: var(--grid-line); gap: 1px;
    box-shadow: 0 0 20px rgba(0, 201, 255, 0.2); overflow: hidden; outline: none;
}
.cell { 
    background-color: var(--bg-card); display: flex; justify-content: center; align-items: center; 
    font-family: 'Orbitron', sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--accent-color); 
    cursor: pointer; position: relative; transition: background-color 0.1s, color 0.1s;
}
/* 3x3 Box Thick Borders */
.cell:nth-child(3n):not(:nth-child(9n)) { border-right: 2px solid var(--accent-color); }
.cell:nth-child(n+19):nth-child(-n+27), .cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--accent-color); }

/* Cell States */
.cell.fixed { color: #fff; }
.cell.selected { background-color: rgba(0, 201, 255, 0.4); }
.cell.related { background-color: rgba(0, 201, 255, 0.1); }
.cell.same-number { background-color: rgba(0, 201, 255, 0.25); }
.cell.error { background-color: rgba(239, 68, 68, 0.8); color: #fff; animation: pulseRed 0.5s;}

/* Pencil Notes */
.notes-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 100%; height: 100%; padding: 2px; box-sizing: border-box; }
.note { display: flex; justify-content: center; align-items: center; font-family: 'Inter', sans-serif; font-size: 0.65rem; color: var(--text-muted); font-weight: 600; }

/* Tool Buttons (Undo, Erase, Notes, Hint) */
.tools-row { display: flex; justify-content: space-between; width: 100%; margin: 20px 0; }
.tool-btn { background: none; border: none; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; transition: 0.2s; position: relative; width: 60px;}
.tool-btn i { font-size: 1.5rem; background: var(--bg-dark); width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--border-color); transition: 0.2s;}
.tool-btn span { font-size: 0.75rem; font-weight: 600; }
.tool-btn:hover { color: var(--accent-color); }
.tool-btn:hover i { border-color: var(--accent-color); background: rgba(0, 201, 255, 0.1); }
.tool-btn.active i { background: var(--accent-color); color: #000; border-color: var(--accent-color); }

.badge { position: absolute; top: -5px; right: 0; background: var(--border-color); color: #fff; font-size: 0.6rem; padding: 2px 5px; border-radius: 10px; font-family: 'Inter', sans-serif;}
.tool-btn.active .badge { background: #000; color: var(--accent-color); }
.badge.hint { background: var(--accent-color); color: #000; font-weight: bold; }

/* Number Pad */
.number-pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; width: 100%; }
.num-btn { background: var(--bg-dark); color: var(--accent-color); border: 1px solid var(--border-color); border-radius: 8px; font-family: 'Orbitron', sans-serif; font-size: 1.8rem; font-weight: 700; height: 55px; cursor: pointer; transition: 0.1s; }
.num-btn:hover, .num-btn:active { background: var(--accent-color); color: #000; transform: scale(0.95); }

/* Overlays & Animations */
.game-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(5px); display: none; flex-direction: column; justify-content: center; align-items: center; text-align: center; border-radius: 1rem; z-index: 10; animation: fadeIn 0.3s ease; }
.game-overlay.show { display: flex; }
.game-overlay h2 { font-family: 'Orbitron', sans-serif; font-size: 2.5rem; color: var(--accent-color); margin: 0 0 10px; }
.game-overlay p { font-size: 1.1rem; margin-bottom: 20px; }
.btn-group { display: flex; gap: 10px; }
.hidden { display: none !important; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulseRed { 0% { background-color: rgba(239, 68, 68, 0.2); } 50% { background-color: rgba(239, 68, 68, 1); } 100% { background-color: rgba(239, 68, 68, 0.8); } }
@keyframes screenShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.shake { animation: screenShake 0.3s ease; }
.win-pulse { animation: winPulse 1.5s infinite; }
@keyframes winPulse { 0% { box-shadow: 0 0 20px rgba(0, 201, 255, 0.2); } 50% { box-shadow: 0 0 40px rgba(0, 201, 255, 0.8); border-color: #fff;} 100% { box-shadow: 0 0 20px rgba(0, 201, 255, 0.2); } }

/* Instructions */
.game-instructions { background-color: var(--bg-card); border-radius: 1rem; padding: 2rem; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); border: 1px solid var(--border-color); width: 100%; max-width: 550px; box-sizing: border-box; margin-top: 20px; margin-bottom: 40px;}
.game-instructions h2 { font-family: 'Orbitron', sans-serif; font-size: 1.5rem; color: var(--accent-color); margin-top: 0; margin-bottom: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; text-align: center; }
.game-instructions p, .game-instructions ul { font-size: 0.95rem; line-height: 1.7; color: #cbd5e0; margin-bottom: 10px; }
.game-instructions ul { list-style: none; padding-left: 0; }
.game-instructions ul li { margin-bottom: 10px; position: relative; padding-left: 20px; }
.game-instructions ul li::before { content: '▸'; color: var(--accent-color); position: absolute; left: 0; font-weight: bold; }

/* Mobile */
@media (max-width: 992px) {
    :root { --menu-width: 250px; }
    body { flex-direction: column; padding: 0; } body.menu-open { overflow: hidden; }
    .main-content-wrapper { padding: 80px 15px 20px; margin-left: 0; width: 100%; }
    .mobile-header { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; height: 60px; background-color: rgba(15, 23, 42, 0.95); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-color); position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; box-sizing: border-box; }
    .hamburger-btn { background: none; border: none; padding: 10px; margin-left: -10px; cursor: pointer;} .hamburger-btn .line { display: block; width: 24px; height: 3px; background-color: #f8fafc; margin: 5px 0; border-radius: 3px; transition: transform 0.3s ease, opacity 0.3s ease; }
    .mobile-title { font-family: 'Orbitron', sans-serif; font-size: 1.3rem; font-weight: 700; color: var(--accent-color); }
    .left-menu { transform: translateX(-100%); transition: transform 0.3s ease-in-out; height: 100vh; width: var(--menu-width); min-width: var(--menu-width); }
    .left-menu.menu-open { transform: translateX(0); }
    .menu-overlay { display: block; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; } .menu-overlay.menu-open { opacity: 1; pointer-events: auto; }
    
    .sudoku-game-container { padding: 1rem; }
    .game-header h1 { font-size: 1.6rem; }
    .cell { font-size: 1.5rem; }
    .note { font-size: 0.5rem; }
    .number-pad { grid-template-columns: repeat(5, 1fr); }
    .num-btn { font-size: 1.5rem; height: 50px; }
    .num-btn:nth-child(n+6) { margin-top: 5px; } /* Wrap bottom row nicely */
    .num-btn:last-child { grid-column: span 2; }
}