﻿:root {
    --primary: #1E73BE;
    --primary-dark: #155a96;
    --secondary: #0A2540;
    --accent: #00C2FF;
    --bg: #F4F7FB;
    --surface: rgba(255,255,255,0.72);
    --surface-solid: #ffffff;
    --border: rgba(10,37,64,0.08);
    --text: #0A2540;
    --muted: #5b6b7f;
    --danger: #e6485f;
    --success: #1fae6e;
    --warning: #e0a020;
    --radius-lg: 22px;
    --radius-md: 14px;
    --radius-sm: 8px;
    --shadow-soft: 0 10px 30px rgba(10,37,64,0.08);
    --shadow-strong: 0 20px 50px rgba(10,37,64,0.18);

    --board-gap: 2px;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0A1420;
    --surface: rgba(20,32,48,0.66);
    --surface-solid: #101d2e;
    --border: rgba(255,255,255,0.08);
    --text: #eaf2fb;
    --muted: #93a4bb;
    --shadow-soft: 0 10px 30px rgba(0,0,0,0.45);
    --shadow-strong: 0 24px 60px rgba(0,0,0,0.6);
    color-scheme: dark;
}

*, *::before, *::after {
    box-sizing: border-box;
}





.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ==================================================
   GLASS CARD
   ================================================== */
.glass {
    background: var(--surface);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

/* ==================================================
   HEADER / TOP BAR
   ================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 14px 0;
    background: linear-gradient(180deg, var(--secondary) 0%, #0d2f52 100%);
    color: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

    .site-header .container {
        display: flex;
        align-items: center;
        gap: 20px;
        flex-wrap: wrap;
    }

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: auto;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg,var(--accent),var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 6px 16px rgba(0,194,255,0.35);
    flex-shrink: 0;
}

.brand-text h2 {
    color: #fff;
    font-size: 1.15rem;
    margin: 0;
}

.brand-text span {
    display: block;
    font-size: .78rem;
    color: #b9d2ea;
    font-family: var(--font-body);
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

    .toolbar select, .toolbar button {
        font-family: var(--font-body);
        font-size: .85rem;
        border: 1px solid rgba(255,255,255,0.18);
        background: rgba(255,255,255,0.08);
        color: #fff;
        padding: 9px 12px;
        border-radius: 10px;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        transition: background .2s ease, transform .12s ease;
        white-space: nowrap;
    }

    .toolbar select {
        appearance: none;
        -webkit-appearance: none;
        padding-right: 28px;
        background-image: linear-gradient(45deg,transparent 50%,#fff 50%),linear-gradient(135deg,#fff 50%,transparent 50%);
        background-position: calc(100% - 14px) center, calc(100% - 9px) center;
        background-size: 5px 5px,5px 5px;
        background-repeat: no-repeat;
    }

        .toolbar button:hover, .toolbar select:hover {
            background: rgba(255,255,255,0.18);
        }

    .toolbar button:active {
        transform: scale(.95);
    }

    .toolbar button.primary {
        background: linear-gradient(135deg,var(--accent),var(--primary));
        border-color: transparent;
        font-weight: 600;
    }

    .toolbar button[aria-pressed="true"] {
        background: var(--accent);
        color: var(--secondary);
        font-weight: 700;
    }

.icon {
    font-size: 1rem;
    line-height: 1;
}

/* ripple */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple-el {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.55);
    transform: scale(0);
    animation: ripple .55s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(2.6);
        opacity: 0;
    }
}

/* ==================================================
   LAYOUT: GAME AREA
   ================================================== */
.hero-note {
    padding: 26px 0 6px;
    text-align: center;
}

    .hero-note h2 {
        font-size: 1.5rem;
    }

    .hero-note p {
        color: var(--muted);
        max-width: 640px;
        margin: 0 auto;
    }

.game-layout {
    display: grid;
    grid-template-columns: minmax(0,1fr) 320px;
    gap: 24px;
    padding: 24px 0 40px;
    align-items: start;
}

@media (max-width: 980px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
}

.board-panel {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: .85rem;
    color: var(--text);
    box-shadow: var(--shadow-soft);
}

    .stat-chip b {
        font-family: var(--font-body);
        font-weight: 600;
        color: var(--muted);
        font-size: .72rem;
        text-transform: uppercase;
        letter-spacing: .04em;
    }

.board-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    perspective: 1200px;
}

#sudoku-board {
    --cell: min(7.4vw,58px);
    display: grid;
    grid-template-columns: repeat(9, var(--cell));
    grid-template-rows: repeat(9, var(--cell));
    gap: var(--board-gap);
    background: var(--secondary);
    padding: var(--board-gap);
    border-radius: 16px;
    box-shadow: var(--shadow-strong);
    touch-action: manipulation;
    transition: filter .3s ease, opacity .3s ease;
}

    #sudoku-board.paused {
        filter: blur(10px);
        opacity: .5;
        pointer-events: none;
    }

.cell {
    position: relative;
    background: var(--surface-solid);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: calc(var(--cell) * 0.5);
    font-weight: 600;
    color: var(--secondary);
    cursor: pointer;
    user-select: none;
    transition: background .15s ease, transform .1s ease;
}

    .cell.given {
        color: var(--secondary);
        font-weight: 700;
    }

    .cell.user-value {
        color: var(--primary);
        font-weight: 600;
    }

    .cell:nth-child(9n+3), .cell:nth-child(9n+6) {
        box-shadow: inset -2px 0 0 var(--secondary);
    }

#sudoku-board.paused .cell {
    color: transparent !important;
}

/* thick box borders: computed via nth-child rows */
.cell[data-boxr-end="1"] {
    box-shadow: inset 0 -2px 0 var(--secondary);
}

.cell[data-boxc-end="1"] {
    box-shadow: inset -2px 0 0 var(--secondary);
}

.cell[data-boxr-end="1"][data-boxc-end="1"] {
    box-shadow: inset -2px -2px 0 var(--secondary);
}

.cell.peer {
    background: rgba(30,115,190,0.10);
}

.cell.same-row, .cell.same-col, .cell.same-box {
    background: rgba(30,115,190,0.08);
}

.cell.same-number {
    background: rgba(0,194,255,0.20);
}

.cell.selected {
    background: rgba(30,115,190,0.28);
    box-shadow: 0 0 0 2px var(--primary) inset;
    z-index: 2;
}

.cell.conflict {
    background: rgba(230,72,95,0.22);
    color: var(--danger) !important;
    animation: shake .3s ease;
}

.cell.hinted {
    animation: pop .4s ease;
}

@keyframes shake {
    0%,100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

@keyframes pop {
    0% {
        transform: scale(0.7);
    }

    60% {
        transform: scale(1.12);
    }

    100% {
        transform: scale(1);
    }
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    grid-template-rows: repeat(3,1fr);
    width: 100%;
    height: 100%;
    padding: 2px;
}

    .notes-grid span {
        font-family: var(--font-mono);
        font-size: calc(var(--cell) * 0.18);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--muted);
        font-weight: 600;
    }

/* ==================================================
   KEYPAD
   ================================================== */
.keypad-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(9,minmax(34px,44px));
    gap: 8px;
}

.key-btn {
    aspect-ratio: 1/1;
    border: 1px solid var(--border);
    background: var(--surface-solid);
    border-radius: 10px;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary);
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform .1s ease, background .15s ease;
}

    .key-btn:hover {
        background: rgba(30,115,190,0.12);
    }

    .key-btn:active {
        transform: scale(.92);
    }

.action-keys {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

    .action-keys button {
        border: 1px solid var(--border);
        background: var(--surface-solid);
        color: var(--secondary);
        padding: 10px 14px;
        border-radius: 12px;
        font-weight: 600;
        font-size: .85rem;
        cursor: pointer;
        box-shadow: var(--shadow-soft);
        display: flex;
        align-items: center;
        gap: 6px;
        transition: transform .1s ease, background .15s ease;
    }

        .action-keys button:hover {
            background: rgba(30,115,190,0.10);
        }

        .action-keys button:active {
            transform: scale(.95);
        }

        .action-keys button[aria-pressed="true"] {
            background: var(--accent);
            color: var(--secondary);
        }

.remaining-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--accent);
    color: var(--secondary);
    font-size: .6rem;
    font-weight: 800;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
}

/* ==================================================
   SIDEBAR
   ================================================== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.side-card {
    padding: 18px;
}

    .side-card h3 {
        font-size: .95rem;
        margin-bottom: 10px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .side-card .big-stat {
        font-family: var(--font-mono);
        font-size: 1.6rem;
        color: var(--primary);
        font-weight: 700;
    }

    .side-card .small-label {
        color: var(--muted);
        font-size: .78rem;
        text-transform: uppercase;
        letter-spacing: .04em;
    }

.progress-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg,var(--primary),var(--accent));
    border-radius: 999px;
    transition: width .4s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

    .stats-grid div {
        background: var(--surface-solid);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 8px 10px;
    }

    .stats-grid b {
        display: block;
        font-family: var(--font-mono);
        font-size: 1.05rem;
        color: var(--secondary);
    }

[data-theme="dark"] .stats-grid b {
    color: var(--text);
}

.stats-grid small {
    color: var(--muted);
    font-size: .7rem;
    text-transform: uppercase;
}

.tip-of-day {
    font-style: italic;
    color: var(--muted);
    font-size: .9rem;
}

.achv-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .achv-list li {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: .82rem;
        padding: 6px 8px;
        border-radius: 8px;
        background: var(--surface-solid);
        border: 1px solid var(--border);
        opacity: .45;
    }

        .achv-list li.unlocked {
            opacity: 1;
        }

        .achv-list li .dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--muted);
            flex-shrink: 0;
        }

        .achv-list li.unlocked .dot {
            background: var(--success);
        }

/* ==================================================
   MODALS
   ================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,20,32,0.55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    padding: 20px;
}

    .modal-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

.modal {
    background: var(--surface-solid);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-strong);
    transform: translateY(16px) scale(.96);
    transition: transform .3s ease;
    border: 1px solid var(--border);
}

.modal-overlay.open .modal {
    transform: translateY(0) scale(1);
}

.modal h2 {
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.modal p {
    color: var(--muted);
}

.modal .modal-stats {
    display: flex;
    justify-content: center;
    gap: 22px;
    margin: 18px 0;
}

    .modal .modal-stats div b {
        display: block;
        font-family: var(--font-mono);
        font-size: 1.3rem;
        color: var(--primary);
    }

    .modal .modal-stats div small {
        color: var(--muted);
        font-size: .72rem;
        text-transform: uppercase;
    }

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

    .modal-actions button {
        border: none;
        padding: 12px 20px;
        border-radius: 12px;
        font-weight: 700;
        cursor: pointer;
        font-size: .9rem;
        background: linear-gradient(135deg,var(--accent),var(--primary));
        color: #fff;
        box-shadow: var(--shadow-soft);
        transition: transform .12s ease;
    }

        .modal-actions button.ghost {
            background: transparent;
            color: var(--text);
            border: 1px solid var(--border);
        }

        .modal-actions button:active {
            transform: scale(.95);
        }

#confetti-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 300;
}

/* toast */
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--secondary);
    color: #fff;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: .88rem;
    box-shadow: var(--shadow-strong);
    opacity: 0;
    pointer-events: none;
    transition: all .3s ease;
    z-index: 250;
}

    #toast.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

/* ==================================================
   ARTICLE / SEO CONTENT
   ================================================== */
.article-section {
    padding: 50px 0;
}

    .article-section:nth-of-type(even) {
        background: var(--surface);
    }

    .article-section h2 {
        font-size: 1.9rem;
        margin-bottom: .6em;
    }

    .article-section h3 {
        font-size: 1.25rem;
        margin-top: 1.4em;
    }

.lede {
    font-size: 1.1rem;
    color: var(--muted);
    max-width: 800px;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(230px,1fr));
    gap: 18px;
    margin-top: 20px;
}

.article-card {
    padding: 20px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

    .article-card h3 {
        margin-top: 0;
        font-size: 1.05rem;
    }

.badge-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.badge {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: .8rem;
    color: var(--muted);
}

.difficulty-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 18px;
}

    .difficulty-table th, .difficulty-table td {
        padding: 12px 14px;
        text-align: left;
        border-bottom: 1px solid var(--border);
        font-size: .92rem;
    }

    .difficulty-table th {
        color: var(--muted);
        text-transform: uppercase;
        font-size: .72rem;
        letter-spacing: .05em;
    }

/* FAQ accordion */
.faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-q {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 16px 4px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

    .faq-q::after {
        content: "+";
        font-size: 1.3rem;
        color: var(--primary);
        transition: transform .25s ease;
        flex-shrink: 0;
    }

.faq-item.open .faq-q::after {
    transform: rotate(45deg);
}

.faq-a {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
    color: var(--muted);
    font-size: .92rem;
}

.faq-item.open .faq-a {
    max-height: 400px;
}

.faq-a p {
    padding: 0 4px 16px;
}
.text-white{
    color:#fff;
}
footer {
    padding: 36px 0;
    text-align: left;
    color: #fff;
    font-size: .85rem;
    border-top: 1px solid var(--border);
}

/* skip link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: #fff;
    color: #000;
    padding: 10px;
    z-index: 1000;
}

    .skip-link:focus {
        left: 10px;
        top: 10px;
    }

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

@media (max-width: 560px) {
    #sudoku-board {
        --cell: min(9.6vw,42px);
    }

    .keypad {
        grid-template-columns: repeat(9,minmax(28px,34px));
    }
}
