/* Local Fonts (Inter Variable) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/InterVariable.woff2') format('woff2');
}

/* ============================================
   CSS Custom Properties (Theme Variables)
   ============================================ */
:root {
    /* Colors - Modern palette */
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #dbeafe;
    --secondary-color: #1e293b;
    --accent-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;

    /* Backgrounds */
    --bg-color: #f8fafc;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --board-bg: #ffffff;
    --card-bg: #ffffff;

    /* Borders & Shadows */
    --border-color: #e2e8f0;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;

    /* Text colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* Sudoku specific */
    --cell-size: min(9.5vw, 50px);
    --cell-highlight: #fef3c7;
    --cell-selected: #dbeafe;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

html {
    box-sizing: border-box;
    overflow-x: hidden;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    margin: 0;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--text-inverse);
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

/* Grid Input Focus Highlighting */
.sudoku-grid-input.has-focus .cell-input:not(:focus) {
    opacity: 0.7;
}

.cell-input:focus {
    background-color: var(--cell-selected);
    z-index: 1;
}

/* Row/Column/Box highlighting when cell is focused */
.cell-input.same-row,
.cell-input.same-col,
.cell-input.same-box {
    background-color: var(--cell-highlight);
}

/* Keyboard Hints */
.keyboard-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 15px;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.keyboard-hints kbd {
    display: inline-block;
    padding: 3px 6px;
    font-family: var(--font-family);
    font-size: var(--font-size-xs);
    background: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--secondary-color);
}

.text-success {
    color: #27ae60;
}

.text-link {
    color: var(--primary-color);
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-30 {
    margin-bottom: 30px;
}

.mt-20 {
    margin-top: 20px;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-10 {
    gap: 10px;
}

.gap-15 {
    gap: 15px;
}

/* Breadcrumb Component */
.breadcrumb-nav {
    margin-bottom: 20px;
}

.breadcrumb-list {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumb-list li {
    display: flex;
    align-items: center;
}

.breadcrumb-list .separator {
    margin: 0 10px;
}

.breadcrumb-list a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-list a:hover {
    text-decoration: underline;
}

.breadcrumb-list .current {
    color: var(--secondary-color);
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--secondary-color);
}

/* Body style moved up */

header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #334155 100%);
    color: var(--text-inverse);
    padding: 1rem 0;
    text-align: center;
    box-shadow: var(--shadow-md);
}

header h1 a {
    color: var(--text-inverse);
    text-decoration: none;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--primary-color);
    color: var(--text-inverse);
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.btn:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: var(--text-inverse);
}

.btn.secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn.secondary:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
    border-color: var(--primary-color);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Sudoku Board & Input Grid */
.sudoku-grid-input {
    display: grid;
    grid-template-columns: repeat(9, var(--cell-size));
    grid-template-rows: repeat(9, var(--cell-size));
    gap: 0;
    border: 2px solid var(--secondary-color);
    border-radius: var(--border-radius);
    width: max-content;
    margin: 20px auto;
    background: var(--board-bg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.cell-input {
    width: 100%;
    height: 100%;
    border: 1px solid #ccc;
    text-align: center;
    font-size: min(5vw, 1.5rem);
    font-weight: bold;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    font-family: inherit;
    /* Keep for legacy Firefox if needed, but appearance is standard */
}

.cell-input::-webkit-outer-spin-button,
.cell-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cell-input.error-cell {
    background-color: #ffcccc;
    border: 2px solid red !important;
    color: red;
}

/* 3x3 Box Borders */
.cell-input:nth-child(3n) {
    border-right: 2px solid #000;
}

.cell-input:nth-child(9n) {
    border-right: 1px solid #ccc;
    /* Reset for row ends */
}

/* Visual hack for thick borders on grid edges */
.sudoku-grid-input>input:nth-child(n+19):nth-child(-n+27),
.sudoku-grid-input>input:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #000;
}

/* Sudoku Board (Display only) */
.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, var(--cell-size));
    grid-template-rows: repeat(9, var(--cell-size));
    gap: 0;
    border: 2px solid var(--secondary-color);
    border-radius: var(--border-radius);
    width: max-content;
    margin: 20px auto;
    background: var(--board-bg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    background: var(--board-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: min(5vw, 1.5rem);
    font-weight: bold;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

/* Thick borders for display board */
.cell:nth-child(3n) {
    border-right: 2px solid #000;
}

.cell:nth-child(9n) {
    border-right: 1px solid #ccc;
}

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

.cell.initial {
    background: #fff;
    color: #000;
    font-weight: 800;
    /* Bold */
}

.cell.solved {
    background: #fff;
    color: #2980b9;
    /* Blue */
    font-weight: normal;
}

.cell.solved.hidden {
    color: transparent;
    /* Hide number but keep background/border */
}

/* Notes / Candidate Grid */
.cell {
    position: relative;
    /* Ensure notes are positioned relative to the cell */
    transition: background-color 0.3s;
    /* Smooth transition for source highlighting */
}

/* Logical Source Highlight (Cause) */
.cell.cell-source {
    background-color: rgba(46, 204, 113, 0.3) !important;
    /* Green tint */
}

.notes-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    pointer-events: none;
    /* Let clicks pass through to the cell */
    opacity: 0;
    /* Hidden by default */
    transition: opacity 0.2s;
}

.sudoku-board.show-notes .notes-grid {
    opacity: 1;
    /* Show when parent has class */
}

/* Hide notes when cell is solved/filled (optional, logic might handle removing them) */
.cell.initial .notes-grid,
.cell.solved:not(.hidden) .notes-grid {
    display: none;
}

.note-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    /* Small font for notes */
    color: #7f8c8d;
    /* Grey color */
    font-weight: normal;
    visibility: hidden;
    /* Hidden individual notes by default */
}

@media (max-width: 480px) {
    .note-item {
        font-size: 0.5rem;
        /* Even smaller for mobile */
        line-height: 1;
        /* Reset line-height to allow tight packing */
    }
}

.note-item.active {
    visibility: visible;
}

.note-item.highlighted {
    visibility: visible;
    color: #e74c3c;
    /* Red for elimination */
    font-weight: bold;
    transform: scale(1.2);
    transition: transform 0.2s, color 0.2s;
}

/* Logical Target Highlight (The candidate being removed) */
.note-item.target {
    visibility: visible;
    color: #e74c3c;
    /* Red */
    font-weight: 800;
    font-size: 0.8rem;
    /* Larger */
    transform: scale(1.4);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
}

.cell.newly-solved {
    background-color: #d4efdf;
    /* Greenish tint for new numbers */
    animation: fadeIn 0.5s;
}

/* Chain Visualization - ON/OFF States */
.cell.chain-on {
    background-color: rgba(46, 204, 113, 0.4) !important;
    /* Green - candidate is ON */
    box-shadow: inset 0 0 0 2px #27ae60;
}

.cell.chain-off {
    background-color: rgba(231, 76, 60, 0.3) !important;
    /* Red - candidate is OFF */
    box-shadow: inset 0 0 0 2px #c0392b;
}

.cell.chain-current {
    animation: chainPulse 0.6s ease-in-out;
}

@keyframes chainPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Chain Text Display */
.chain-display {
    margin-top: 12px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-x: auto;
    border-left: 3px solid var(--primary-color);
}

.chain-display .chain-node {
    display: inline-block;
    padding: 2px 6px;
    margin: 2px;
    border-radius: 4px;
    transition: all 0.2s;
}

.chain-display .chain-node.on {
    background: rgba(46, 204, 113, 0.2);
    color: #27ae60;
}

.chain-display .chain-node.off {
    background: rgba(231, 76, 60, 0.2);
    color: #c0392b;
}

.chain-display .chain-node.active {
    font-weight: bold;
    transform: scale(1.1);
}

.chain-display .chain-link {
    color: #7f8c8d;
    margin: 0 2px;
}

/* Warnings */
.warning-banner {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
}

/* Layout - Grid for Game + Sidebar */
.game-layout {
    display: flex;
    gap: 30px;
}

.main-content {
    flex: 2;
    min-width: 0;
    /* Prevents overflow in flexbox */
}

.sidebar {
    flex: 1;
    min-width: 300px;
}

/* Sticky Sidebar */
.sticky-ad {
    position: sticky;
    top: 20px;
}

.ad-placeholder {
    background: #e0e0e0;
    height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #999;
}

/* Explanation Box */
.explanation-box {
    background: var(--card-bg);
    padding: 16px 20px;
    border-left: 4px solid var(--primary-color);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin-bottom: 20px;
    min-height: 50px;
    box-shadow: var(--shadow-sm);
}

.success-msg {
    color: var(--success-color);
    font-weight: 600;
    font-size: var(--font-size-lg);
}

/* Responsive */


/* Error 404 Page */
.error-page {
    text-align: center;
    padding: 50px 20px;
}

.error-content h1 {
    font-size: 5rem;
    color: var(--primary-color);
    margin: 0;
}

.error-content h2 {
    color: var(--secondary-color);
    margin-top: 10px;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 20px);
    grid-template-rows: repeat(3, 20px);
    gap: 2px;
    margin: 30px auto;
    width: max-content;
}

.mini-grid div {
    background: #ccc;
    border: 1px solid #999;
}

.mini-grid div.missing {
    background: transparent;
    border: 1px dashed var(--accent-color);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn.secondary {
    background: var(--secondary-color);
    color: #fff;
}

/* Analysis Box */
/* Analysis Box */
.analysis-box {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin: 30px 0;
    text-align: left;
}

/* Specific override for center class */
.analysis-box.text-center {
    text-align: center;
}

.analysis-box h2,
.analysis-box h3 {
    margin-top: 0;
    color: var(--secondary-color);
}

/* Difficulty Gauge (Tachometer Style) */
.difficulty-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    padding-top: 10px;
}

.gauge-svg {
    width: 160px;
    height: 90px;
    overflow: visible;
}

.gauge-track {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 14;
    stroke-linecap: round;
}

.gauge-ticks {
    fill: none;
    stroke: #cbd5e1;
    stroke-width: 2;
    stroke-dasharray: 2 4;
}

.gauge-fill {
    fill: none;
    stroke-width: 14;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.1));
}

.gauge-value {
    font-size: 1.8rem;
    font-weight: 800;
    fill: var(--secondary-color);
    font-family: monospace;
}

.gauge-label {
    font-size: 0.7rem;
    fill: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gauge-difficulty {
    font-size: 0.9rem;
    font-weight: 700;
    fill: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dynamic gauge colors */
.score-easy .gauge-fill {
    stroke: #10b981;
}

.score-medium .gauge-fill {
    stroke: #3b82f6;
}

.score-hard .gauge-fill {
    stroke: #f59e0b;
}

.score-expert .gauge-fill {
    stroke: #ef4444;
}

.score-expert-plus .gauge-fill {
    stroke: #ec4899;
}

.score-extreme .gauge-fill {
    stroke: #8b5cf6;
}

/* Strategy Badges */
.strategy-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.strategy-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--primary-light);
    color: var(--primary-hover);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.strategy-badge:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--primary-color);
    color: var(--text-inverse);
    border-radius: 11px;
    font-size: 0.75rem;
    font-weight: 600;
}

.strategy-badge:hover .badge-count {
    background: var(--text-inverse);
    color: var(--primary-color);
}

/* Strategy Difficulty Colors (Modern/Subtle) */
/* Easy (Green) */
.strat-easy {
    background-color: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.strat-easy .badge-count {
    background-color: #10b981;
    color: #fff;
}

.strat-easy:hover {
    background-color: #10b981;
    color: #fff;
    border-color: #059669;
}

.strat-easy:hover .badge-count {
    background-color: #fff;
    color: #10b981;
}

/* Medium (Blue) */
.strat-medium {
    background-color: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.strat-medium .badge-count {
    background-color: #3b82f6;
    color: #fff;
}

.strat-medium:hover {
    background-color: #3b82f6;
    color: #fff;
    border-color: #2563eb;
}

.strat-medium:hover .badge-count {
    background-color: #fff;
    color: #3b82f6;
}

/* Hard (Amber) */
.strat-hard {
    background-color: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.strat-hard .badge-count {
    background-color: #f59e0b;
    color: #fff;
}

.strat-hard:hover {
    background-color: #f59e0b;
    color: #fff;
    border-color: #d97706;
}

.strat-hard:hover .badge-count {
    background-color: #fff;
    color: #f59e0b;
}

/* Expert (Red) */
.strat-expert {
    background-color: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.strat-expert .badge-count {
    background-color: #ef4444;
    color: #fff;
}

.strat-expert:hover {
    background-color: #ef4444;
    color: #fff;
    border-color: #dc2626;
}

.strat-expert:hover .badge-count {
    background-color: #fff;
    color: #ef4444;
}

/* Extreme (Violet) */
.strat-extreme {
    background-color: #f5f3ff;
    color: #6d28d9;
    border-color: #ddd6fe;
}

.strat-extreme .badge-count {
    background-color: #8b5cf6;
    color: #fff;
}

.strat-extreme:hover {
    background-color: #8b5cf6;
    color: #fff;
    border-color: #7c3aed;
}

.strat-extreme:hover .badge-count {
    background-color: #fff;
    color: #8b5cf6;
}

.analysis-box ul {
    columns: 2;
    -webkit-columns: 2;
    -moz-columns: 2;
}



/* Copy Section */
.modern-separator {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0));
    margin: 30px 0;
}

.copy-section {
    margin: 30px 0;
    text-align: left;
}

.copy-section .input-group {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.copy-section input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    font-family: monospace;
}

/* Similar Puzzles */
.similar-puzzles {
    margin-top: 40px;
    text-align: left;
}

.similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.placeholder-card {
    background: #e0e0e0;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #777;
    font-size: 0.8rem;
    border-radius: 4px;
}

/* Print Styles */
/* Advanced Print Styles */


/* More Puzzles / Circular Linking Styles */
.more-puzzles,
.latest-feed {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.more-puzzles h3,
.latest-feed h3 {
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.puzzles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.puzzle-card {
    display: block;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.puzzle-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.puzzle-icon {
    background: #f8f9fa;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #eee;
}

.icon-grid {
    width: 40px;
    height: 40px;
    background-image:
        linear-gradient(#ccc 1px, transparent 1px),
        linear-gradient(90deg, #ccc 1px, transparent 1px);
    background-size: 13px 13px;
    border: 2px solid #999;
}

.puzzle-info {
    padding: 10px;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: bold;
    align-self: flex-start;
}

.badge.easy {
    background-color: #27ae60;
}

.badge.medium {
    background-color: #e67e22;
}

.badge.hard {
    background-color: #c0392b;
}

.badge.expert {
    background-color: #8e44ad;
}

.badge.expert-plus {
    background-color: #4b0082;
}

.badge.extreme {
    background-color: #2c3e50;
}

.puzzle-id {
    font-weight: bold;
    color: var(--secondary-color);
}

.puzzle-steps {
    color: #555;
    font-size: 0.8rem;
    font-weight: 500;
}





/* Navigation Styles */
.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-nav {
    margin-left: auto;
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 20px;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    line-height: inherit;
    display: inline-block;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 20px;
    min-width: 300px;
    z-index: 1000;
    border: 1px solid #ddd;
}

/* Show dropdown on hover */
.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dropdown-group h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.dropdown-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-group li {
    margin-bottom: 5px;
}

.dropdown-group a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    padding: 2px 0;
}

.dropdown-group a:hover {
    color: var(--primary-color);
    transform: translateX(3px);
    transition: transform 0.2s;
}

/* Mobile Hamburger Menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}

.hamburger-line {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #fff;
    margin: 5px 0;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Responsive Nav */


/* Focus States for Accessibility */
.cell-input:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: -3px;
    background-color: #e3f2fd;
}

/* Remove default focus ring on click, show only on keyboard navigation */
.btn:focus,
.nav-link:focus,
.dropdown-toggle:focus,
a:focus {
    outline: none;
}

.btn:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.nav-link:focus-visible,
.dropdown-toggle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip to content link for keyboard users */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary-color);
    color: #fff;
    padding: 8px 15px;
    z-index: 2000;
    transition: top 0.3s;
    /* Ensure it's not clickable or visible when off-screen */
    opacity: 0;
    pointer-events: none;
}

.skip-link:focus {
    top: 0;
    opacity: 1;
    pointer-events: auto;
    outline: 3px solid #fff;
    outline-offset: -3px;
}

/* Reduced Motion Support */


/* Media Player Controls */
.player-header {
    background: #fff;
    padding: 8px 15px;
    /* Compact padding */
    border-radius: 8px;
    margin-bottom: 10px;
    /* Reduced margin */
    border: 1px solid #dee2e6;
}

#strategy-name {
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0;
}

#step-counter {
    background: #e9ecef;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #495057;
}

/* Compact Explanation Box */
.explanation-box {
    padding: 10px 15px;
    /* Reduced padding */
    margin-bottom: 10px;
    /* Reduced margin */
    min-height: auto;
    /* Remove fixed height constraint */
}

.sudoku-board {
    margin: 10px auto;
    /* Reduced margin */
}

#progress-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: #d3d3d3;
    outline: none;
    transition: background .2s;
}

#progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4A90E2;
    cursor: pointer;
    transition: transform 0.1s ease;
}

#progress-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#progress-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4A90E2;
    cursor: pointer;
}

/* Global Pagination Pills */
.pagination-pills {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    background: #f1f3f5;
    padding: 10px;
    border-radius: 50px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.pill {
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 30px;
    color: #495057;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.pill:hover {
    background: #e9ecef;
    color: #212529;
}

.pill.active {
    background: #4A90E2;
    color: white;
    box-shadow: 0 2px 5px rgba(74, 144, 226, 0.3);
}

.pill.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

/* Toggle Switch Container */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

/* Hide default HTML checkbox */
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The Track */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    /* OFF State: Gray */
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 34px;
}

/* The Knob */
.slider-knob {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
    /* Ensure knob is above track */
}

/* Checked State: Track becomes Blue */
.toggle-switch input:checked+.slider {
    background-color: #2196F3 !important;
    /* Force Blue */
}

/* Checked State: Knob Moves */
.toggle-switch input:checked+.slider+.slider-knob {
    -webkit-transform: translateX(20px);
    -ms-transform: translateX(20px);
    transform: translateX(20px);
}

.toggle-switch input:focus+.slider {
    box-shadow: 0 0 1px #2196F3;
}

/* ============================================
   Social Share Buttons
   ============================================ */
.share-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.share-section h4 {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: none;
    color: var(--text-inverse);
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
}

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

.share-btn.twitter {
    background: #1DA1F2;
}

.share-btn.facebook {
    background: #1877f2;
}

.share-btn.telegram {
    background: #0088cc;
}

.share-btn.whatsapp {
    background: #25D366;
}

.share-btn.copy-link {
    background: var(--secondary-color);
}

.share-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* ============================================
   Difficulty Filter
   ============================================ */
.filter-section {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    border-color: var(--primary-hover);
    color: var(--primary-hover);
    background-color: #f0f7ff;
}

.filter-btn.active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

.puzzle-card.hidden {
    display: none;
}

/* ============================================
   Footer
   ============================================ */
footer {
    background: var(--secondary-color);
    color: var(--text-inverse);
    padding: 40px 20px 20px;
    margin-top: 60px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.footer-section h3 {
    color: var(--text-inverse);
    font-size: var(--font-size-base);
    margin-bottom: 15px;
    font-weight: 600;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: color var(--transition-fast);
}

.footer-section ul a:hover {
    color: var(--text-inverse);
}

.footer-bottom {
    max-width: 1200px;
    margin: 30px auto 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: var(--font-size-xs);
}

/* ============================================
   Step Player - Compact Layout
   ============================================ */
.step-player {
    max-width: 600px;
    margin: 0 auto;
    padding: 10px 20px 20px;
}

/* Header Bar */
.step-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 10px;
}

.step-player-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-sm);
}

.step-player-breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.step-player-breadcrumb a:hover {
    text-decoration: underline;
}

.step-player-breadcrumb .sep {
    color: var(--text-secondary);
}

.step-player-breadcrumb .current {
    color: var(--text-secondary);
    font-weight: 500;
}

.step-player-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--secondary-color);
    color: var(--text-inverse);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.step-player-back:hover {
    background: #475569;
}

/* Control Bar */
.step-player-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    gap: 10px;
    flex-wrap: wrap;
}

.control-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.part-badge {
    background: var(--primary-color);
    color: var(--text-inverse);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    white-space: nowrap;
}

.strategy-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.control-center {
    display: flex;
    gap: 8px;
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-nav:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

.btn-nav.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

.btn-nav.primary:hover:not(:disabled) {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.control-right {
    display: flex;
    align-items: center;
}

.step-counter {
    background: var(--card-bg);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Progress Slider */
.step-player-progress {
    padding: 5px 0 10px;
}

.step-player-progress input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.step-player-progress input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Explanation Box */
.step-player-explanation {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    background: var(--card-bg);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    margin-bottom: 15px;
    min-height: 50px;
}

.explanation-text {
    flex: 1;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    line-height: 1.5;
}

.explanation-text p {
    margin: 0;
}

.candidates-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    white-space: nowrap;
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 22px;
}

.toggle-switch input:checked+.slider {
    background-color: var(--primary-color);
}

.toggle-switch .slider:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.toggle-switch input:checked+.slider:before {
    transform: translateX(18px);
}

/* Part Complete Message */
.step-player-complete {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

.complete-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.complete-text {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-weight: 600;
    font-size: var(--font-size-base);
}

.complete-text svg {
    fill: white;
}

.step-player-complete .btn {
    background: white;
    color: #059669;
    padding: 10px 20px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.step-player-complete .btn:hover {
    background: #f0fdf4;
}

/* Part Pills */
.step-player-parts {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding-top: 10px;
}

.part-pill {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.part-pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.part-pill.active {
    background: var(--primary-color);
    color: var(--text-inverse);
    border-color: var(--primary-color);
}

/* Responsive */


/* ============================================
   Service Pages (Privacy, Terms, About, Contact)
   ============================================ */
.service-page {
    padding: 30px 20px 60px;
}

.service-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

.service-page h1 {
    color: var(--secondary-color);
    margin: 0 0 10px;
    font-size: var(--font-size-3xl);
}

.service-page .last-updated {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    margin-bottom: 30px;
}

.service-page .lead {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.7;
}

.service-page section {
    margin-bottom: 30px;
}

.service-page section:last-child {
    margin-bottom: 0;
}

.service-page h2 {
    color: var(--secondary-color);
    font-size: var(--font-size-xl);
    margin: 0 0 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}

.service-page h3 {
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    margin: 20px 0 10px;
}

.service-page p {
    color: var(--text-secondary);
    margin-bottom: 15px;
    line-height: 1.7;
}

.service-page ul,
.service-page ol {
    color: var(--text-secondary);
    padding-left: 25px;
    margin-bottom: 15px;
}

.service-page li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.service-page a {
    color: var(--primary-color);
    text-decoration: none;
}

.service-page a:hover {
    text-decoration: underline;
}

/* About Page Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.feature-card {
    background: var(--bg-color);
    padding: 25px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.feature-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.feature-card h3 {
    color: var(--secondary-color);
    margin: 0 0 10px;
    font-size: var(--font-size-base);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin: 0;
}

/* Contact Page Layout */
.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 30px;
}

.contact-intro {
    margin-bottom: 0;
}

.contact-form-section h2,
.contact-info-section h2 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 20px;
}

/* Contact Form */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: var(--font-size-sm);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.submit-btn {
    display: inline-block;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

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

.submit-btn:active {
    transform: translateY(0);
}

/* Contact Info Cards */
.contact-card {
    background: var(--bg-color);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.contact-card h3 {
    margin: 0 0 8px;
    font-size: var(--font-size-base);
    color: var(--secondary-color);
}

.contact-card p {
    font-size: var(--font-size-sm);
    margin: 0;
}

.contact-card ul {
    font-size: var(--font-size-sm);
    margin: 10px 0 0;
    padding-left: 20px;
}

.contact-card li {
    margin-bottom: 4px;
}

.contact-link {
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    margin-top: 5px;
}

.contact-link:hover {
    text-decoration: underline;
}

/* Flash Messages */
.flash-message {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-weight: 500;
}

.flash-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.flash-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Service Pages Responsive */


/* Mega Menu Dropdown */
/* Mega Menu Dropdown */
.dropdown-menu.mega-menu {
    width: 1000px;
    max-width: calc(100vw - 30px);
    right: 0;
    left: auto;
    transform: translateY(10px);
    padding: 25px;
    display: none;
    /* Controlled by hover/JS */
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), transform var(--transition-base), visibility var(--transition-base);
    z-index: 1000;
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.nav-item.dropdown:hover .dropdown-menu.mega-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* New CSS Columns Layout */
.mega-menu-content {
    column-count: 4;
    column-gap: 30px;
}

/* Ensure groups don't split awkwardly, but allow long lists to flow */
.dropdown-group {
    margin-bottom: 5px;
    /* Keep groups tight */
}

.difficulty-group {
    margin-bottom: 20px;
    break-inside: avoid-column;
    /* Default: try to avoid breaking headers from lists */
}

/* Allow long lists (Expert/Expert+) to break across columns */
.difficulty-group:not(.break-avoid) {
    break-inside: auto;
}

/* Force small groups to stay together */
.difficulty-group.break-avoid {
    break-inside: avoid;
}

/* Headers */
.dropdown-group h4 {
    display: none;
    /* We removed H4s in base.html logic essentially, keys are now H5s? No, H4s removed. */
}

.difficulty-group h5 {
    font-size: var(--font-size-sm);
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px;
    font-weight: 700;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 5px;
    display: inline-block;
    /* Looks better with border */
    width: 100%;
}

@media (max-width: 1200px) {
    .mega-menu-content {
        column-count: 3;
    }
}

@media (max-width: 992px) {
    .mega-menu-content {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    .mega-menu-content {
        column-count: 1;
    }

    .dropdown-menu.mega-menu {
        width: 100%;
        max-width: 100vw;
        left: 0;
        right: 0;
        border-radius: 0;
        padding: 15px;
    }
}

.mega-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-menu li {
    margin-bottom: 5px;
}

.mega-menu a {
    display: block;
    padding: 4px 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    border-radius: 4px;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.mega-menu a:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}



/* ============================================
   Responsive & Print Styles (Consolidated)
   ============================================ */

/* Desktop Overrides */
@media (min-width: 992px) {
    .puzzles-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .hamburger-line {
        transition: none;
    }

    .cell.newly-solved {
        animation: none;
    }

    .dropdown-group a:hover {
        transform: none;
    }
}

/* Mobile Devices (Tablet & Phones) */
@media (max-width: 768px) {

    /* Game Layout */
    .game-layout {
        flex-direction: column;
    }

    .sidebar {
        order: 2;
    }

    .ad-placeholder {
        height: 250px;
    }

    .controls {
        margin-bottom: 20px;
    }

    /* Analysis Box */
    .analysis-box ul {
        columns: 1;
        -webkit-columns: 1;
        -moz-columns: 1;
    }

    /* Navigation */
    .header-container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        width: 100%;
        order: 3;
    }

    .main-nav.mobile-open {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        gap: 0;
        padding: 15px 0;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        display: block;
        padding: 12px 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
        padding: 10px 15px;
        display: none;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 0;
    }

    .dropdown.active .dropdown-menu {
        display: block;
    }

    .dropdown-content {
        grid-template-columns: 1fr;
    }

    .dropdown-footer {
        padding: 10px 0;
        border-top: 1px solid #eee;
        margin-top: 10px;
    }

    /* Service Pages */
    .service-container {
        padding: 25px 20px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .contact-info-section {
        order: 2;
    }

    /* Mega Menu */
    .dropdown-menu.mega-menu {
        width: 100%;
        left: 0;
        right: 0;
        transform: none;
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 10px 0;
        display: none;
        background: rgba(255, 255, 255, 0.98);
        max-height: 70vh;
        overflow-y: auto;
    }

    .nav-item.dropdown.active .dropdown-menu.mega-menu {
        display: block;
        opacity: 1;
        visibility: visible;
    }

    .mega-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .mega-col {
        padding: 12px 20px;
        border-bottom: 1px solid var(--border-color);
    }

    .mega-col:last-child {
        border-bottom: none;
    }

    .mega-col h4 {
        font-size: 0.9rem;
        margin-bottom: 10px;
        padding-bottom: 6px;
    }

    .difficulty-group {
        margin-bottom: 12px;
    }

    .difficulty-group h5 {
        font-size: 0.75rem;
        margin: 8px 0 4px;
    }

    .mega-menu a {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .dropdown-footer {
        padding: 12px 20px;
        margin-top: 0;
        border-top: 1px solid var(--border-color);
        background: #f8f9fa;
        /* Redefining to override previous overrides if any */
    }

    .dropdown-footer a {
        display: block;
        text-align: center;
        font-weight: 600;
        color: var(--primary-color);
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {

    .step-player {
        padding: 10px;
    }

    .step-player-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .step-player-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .control-left {
        justify-content: center;
    }

    .control-center {
        justify-content: center;
    }

    .control-right {
        justify-content: center;
    }

    .step-player-explanation {
        flex-direction: column;
    }

    .candidates-toggle {
        align-self: flex-end;
    }

    .complete-content {
        flex-direction: column;
        text-align: center;
    }
}

/* Print Styles */
@media print {

    /* Hide non-printable elements */
    header,
    .breadcrumb-nav,
    .action-buttons,
    .action-buttons-container,
    .copy-section,
    .similar-puzzles,
    .warning-banner,
    .sidebar,
    .analysis-box,
    nav,
    footer,
    #toggle-solution-btn,
    .share-section,
    .more-puzzles,
    .latest-feed {
        display: none !important;
    }

    /* Reset Layout */
    .game-layout {
        display: block;
        margin: 0;
        padding: 0;
    }

    .container {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    html,
    body {
        margin: 1cm;
        background: #fff;
        color: #000;
        min-height: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Print Header & Footer */
    #print-footer {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 20px;
        margin-top: 30px;
        border-top: 2px solid #000;
        padding-top: 15px;
    }

    #print-qr {
        display: block !important;
    }

    #print-qr img {
        display: block;
        width: 80px;
        height: 80px;
    }

    .print-text {
        font-size: 12pt;
        line-height: 1.4;
    }

    /* Sudoku Grid Styling for Print */
    .sudoku-board {
        margin: 0 auto;
        border: 4px solid #000;
        page-break-inside: avoid;
    }

    .cell {
        border: 1px solid #666;
        color: #000 !important;
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 20pt;
    }

    .cell:nth-child(3n) {
        border-right: 2px solid #000;
    }

    .cell:nth-child(9n) {
        border-right: 1px solid #666;
    }

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

    /* Mode Handling */
    body.print-mode-unsolved .cell.solved {
        color: transparent !important;
    }

    body.print-mode-solved .cell.solved {
        color: #000 !important;
        font-weight: normal;
        font-style: italic;
    }

    body.print-mode-solved .cell.initial {
        font-weight: 800;
    }

    h1 {
        text-align: center;
        margin-bottom: 20px;
        color: #000;
        font-size: 24pt;
        display: block !important;
    }
}

/* Home Description Section */
.home-description {
    margin-top: 60px;
    margin-bottom: 40px;
    color: var(--text-secondary);
}

.home-description .content-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.home-description h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.home-description h3 {
    font-size: 1.4rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.home-description p {
    line-height: 1.6;
    margin-bottom: 15px;
}

.home-description .steps-list,
.home-description .features-list {
    margin-bottom: 30px;
    padding-left: 20px;
}

.home-description .steps-list li,
.home-description .features-list li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.home-description .steps-list li strong,
.home-description .features-list li strong {
    color: var(--text-primary);
}

/* FAQ Section */
.home-description .faq-section {
    margin-top: 30px;
}

.home-description .faq-item {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.home-description .faq-item:last-child {
    border-bottom: none;
}

.home-description .faq-item h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

/* Language Switcher */
.lang-flag {
    font-weight: bold;
    color: var(--primary-color);
}

.lang-menu {
    min-width: 150px;
    padding: 10px 0;
}

.lang-menu .dropdown-item {
    display: block;
    padding: 8px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color var(--transition-fast);
}

.lang-menu .dropdown-item:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.lang-menu .dropdown-item.active {
    font-weight: bold;
    color: var(--primary-color);
    background-color: var(--primary-light);
}

/* ============================================
   Strategies List Page
   ============================================ */

.strategies-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.strategies-header {
    text-align: center;
    margin-bottom: 40px;
}

.strategies-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.strategies-intro {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Quick Navigation Bar */
.difficulty-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 50px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

.diff-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.diff-nav-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.diff-nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.3);
}

/* Difficulty Colors */
.diff-nav-item.diff-easy,
.difficulty-badge.diff-easy {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.diff-nav-item.diff-medium,
.difficulty-badge.diff-medium {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.diff-nav-item.diff-hard,
.difficulty-badge.diff-hard {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.diff-nav-item.diff-expert,
.difficulty-badge.diff-expert {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.diff-nav-item.diff-expert-plus,
.difficulty-badge.diff-expert-plus {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    color: white;
}

.diff-nav-item.diff-extreme,
.difficulty-badge.diff-extreme {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

/* Strategy Section */
.strategy-section {
    margin-bottom: 50px;
    scroll-margin-top: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.section-title-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.difficulty-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.strategy-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Strategy Cards Grid */
.strategy-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.strategy-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-base);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.strategy-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.strategy-card.diff-easy::before {
    background: #10b981;
}

.strategy-card.diff-medium::before {
    background: #3b82f6;
}

.strategy-card.diff-hard::before {
    background: #f59e0b;
}

.strategy-card.diff-expert::before {
    background: #ef4444;
}

.strategy-card.diff-expert-plus::before {
    background: #ec4899;
}

.strategy-card.diff-extreme::before {
    background: #8b5cf6;
}

.strategy-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.strategy-card:hover::before {
    opacity: 1;
}

.card-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--bg-color);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.card-icon svg {
    width: 22px;
    height: 22px;
}

.strategy-card.diff-easy:hover .card-icon {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.strategy-card.diff-medium:hover .card-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.strategy-card.diff-hard:hover .card-icon {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.strategy-card.diff-expert:hover .card-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.strategy-card.diff-expert-plus:hover .card-icon {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
}

.strategy-card.diff-extreme:hover .card-icon {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.card-content {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.card-desc {
    font-size: 0.875rem;
    color: #475569;
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-arrow {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-color);
    color: var(--text-muted);
    transition: all var(--transition-fast);
    align-self: center;
}

.card-arrow svg {
    width: 16px;
    height: 16px;
}

.strategy-card:hover .card-arrow {
    background: var(--primary-color);
    color: white;
    transform: translateX(4px);
}

/* Responsive */
@media (max-width: 768px) {
    .strategies-header h1 {
        font-size: 1.8rem;
    }

    .strategies-intro {
        font-size: 1rem;
    }

    .difficulty-nav {
        gap: 8px;
        padding: 15px;
    }

    .diff-nav-item {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .diff-nav-count {
        min-width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }

    .strategy-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .strategy-card {
        padding: 16px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .section-header h2 {
        font-size: 1.3rem;
    }
}

/* ============================================
   Strategy Detail Page
   ============================================ */

.strategy-detail-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Strategy Header */
.strategy-header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #334155 100%);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.strategy-header-content {
    max-width: 700px;
    margin: 0 auto;
}

.strategy-header .difficulty-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.strategy-header h1 {
    color: white;
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.strategy-short-desc {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin: 0;
    line-height: 1.6;
}

/* Strategy Article */
.strategy-article {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

/* Example Section */
.strategy-article .example-section {
    background: var(--bg-color);
    padding: 30px;
    border-bottom: 1px solid var(--border-color);
}

.strategy-article .section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
}

.strategy-article .section-title svg {
    color: var(--primary-color);
}

/* Player Controls */
.player-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.player-controls .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.player-controls .btn svg {
    flex-shrink: 0;
}

/* Player Explanation */
.player-explanation {
    margin-top: 20px;
    text-align: center;
}

.explanation-content {
    background: white;
    padding: 16px 20px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    text-align: left;
    margin-bottom: 12px;
}

.explanation-content p {
    margin: 0;
    color: var(--text-secondary);
}

.candidates-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.candidates-toggle input {
    accent-color: var(--primary-color);
}

/* Article Content */
.strategy-article .article-content {
    padding: 40px;
}

.strategy-article .article-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 32px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.strategy-article .article-content h2:first-child {
    margin-top: 0;
}

.strategy-article .article-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 12px 0;
}

.strategy-article .article-content p {
    color: #475569;
    line-height: 1.8;
    margin-bottom: 16px;
}

.strategy-article .article-content ul,
.strategy-article .article-content ol {
    color: #475569;
    line-height: 1.8;
    margin-bottom: 16px;
    padding-left: 24px;
}

.strategy-article .article-content li {
    margin-bottom: 8px;
}

.strategy-article .article-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.strategy-article .article-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.strategy-article .article-content a:hover {
    text-decoration: underline;
}

/* Embedded Example */
.strategy-article .embedded-example {
    margin: 30px 0;
    padding: 30px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.grid-caption {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 12px;
}

/* Strategy Navigation */
.strategy-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 40px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

.nav-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.nav-back:hover {
    color: var(--primary-color);
}

.nav-back svg {
    transition: transform var(--transition-fast);
}

.nav-back:hover svg {
    transform: translateX(-4px);
}

.strategy-nav .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .strategy-header {
        padding: 30px 20px;
    }

    .strategy-header h1 {
        font-size: 1.6rem;
    }

    .strategy-short-desc {
        font-size: 1rem;
    }

    .strategy-article .example-section,
    .strategy-article .article-content {
        padding: 24px 20px;
    }

    .strategy-nav {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }

    .player-controls {
        flex-direction: column;
    }

    .player-controls .btn {
        width: 100%;
        justify-content: center;
    }
}