/* ============================================
   SUDOKU MASTER — Shared Stylesheet
   Font: Orbitron (display) + Rajdhani (body)
   ============================================ */

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

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg);
    font-family: 'Rajdhani', sans-serif;
    color: #e0e8ff;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Particles Layer */
.bg-particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ---- NAV ---- */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 12px 20px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.nav-link {
    padding: 8px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-family: 'Orbitron', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.5);
    transition: all 0.3s;
    border: 1px solid transparent;
}

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

.nav-link.active {
    color: var(--bg);
    background: var(--gradient);
    border-color: transparent;
    box-shadow: 0 4px 20px var(--glow);
}

/* ---- PAGE WRAPPER ---- */
.page-wrapper {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

/* ---- HERO HEADER ---- */
.hero-header {
    text-align: center;
    margin-bottom: 36px;
    animation: fadeDown 0.8s ease both;
}

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

.difficulty-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 20px;
    border-radius: 50px;
    background: var(--gradient);
    margin-bottom: 16px;
    box-shadow: 0 4px 24px var(--glow);
}

.stars {
    font-size: 12px;
    color: rgba(0,0,0,0.6);
}

.diff-label {
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 4px;
    color: rgba(0,0,0,0.7);
}

.game-title {
    font-family: 'Orbitron', monospace;
    font-size: clamp(40px, 8vw, 72px);
    font-weight: 900;
    letter-spacing: 12px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    line-height: 1;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1px;
    font-weight: 300;
}

/* ---- GAME CONTAINER ---- */
.game-container {
    background: var(--card);
    border-radius: 24px;
    padding: 28px;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.03);
    animation: fadeUp 0.8s ease 0.2s both;
}

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

/* ---- CONTROLS TOP ---- */
.controls-top {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.timer-box, .status-box, .moves-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 16px;
    padding: 12px 20px;
    min-width: 90px;
    transition: border-color 0.3s;
}

.timer-icon, .status-icon, .moves-icon { font-size: 18px; line-height: 1; }

.timer-display {
    font-family: 'Orbitron', monospace;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 2px;
}

.status-text {
    font-family: 'Orbitron', monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
    text-align: center;
}

.moves-count {
    font-family: 'Orbitron', monospace;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}

.timer-label, .status-label, .moves-label {
    font-size: 9px;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.3);
    font-family: 'Orbitron', monospace;
}

/* ---- BOARD ---- */
.board-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.board-glow {
    position: absolute;
    inset: -20px;
    background: radial-gradient(ellipse at center, var(--glow) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(0.98); }
    50% { opacity: 0.8; transform: scale(1.02); }
}

.sudoku-board {
    border-collapse: collapse;
    border: 3px solid var(--thick-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 0 1px var(--thick-border);
}

.sudoku-board tr.thick-bottom {
    border-bottom: 3px solid var(--thick-border);
}

.cell {
    width: 58px;
    height: 58px;
    border: 1px solid var(--border);
    background: var(--cell);
    text-align: center;
    vertical-align: middle;
    position: relative;
    transition: background 0.15s;
    cursor: pointer;
}

@media (max-width: 560px) {
    .cell { width: 36px; height: 36px; }
}

.cell.thick-right {
    border-right: 3px solid var(--thick-border);
}

.cell.highlighted {
    background: rgba(255,255,255,0.05);
}

.cell.selected-cell {
    background: rgba(255,255,255,0.1) !important;
    box-shadow: inset 0 0 0 2px var(--accent);
}

.cell-value {
    font-family: 'Orbitron', monospace;
    font-size: 22px;
    font-weight: 700;
    color: var(--given);
    display: block;
    line-height: 1;
    user-select: none;
}

@media (max-width: 560px) {
    .cell-value { font-size: 16px; }
}

.cell-input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-family: 'Orbitron', monospace;
    font-size: 22px;
    font-weight: 700;
    color: var(--input-color);
    outline: none;
    cursor: pointer;
    caret-color: var(--accent);
}

@media (max-width: 560px) {
    .cell-input { font-size: 16px; }
}

.cell-input.correct { color: var(--accent); }
.cell-input.incorrect { color: #ff4757; }
.cell-input.auto-solved { color: rgba(255,255,255,0.4); font-weight: 400; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.cell.shake { animation: shake 0.4s ease; }

/* ---- NUMPAD ---- */
.numpad {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.numpad-btn {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-family: 'Orbitron', monospace;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.numpad-btn:hover {
    background: var(--gradient);
    border-color: transparent;
    color: rgba(0,0,0,0.8);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--glow);
}

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

.erase-btn { font-size: 20px; }

/* ---- ACTION BUTTONS ---- */
.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    transition: all 0.25s;
    white-space: nowrap;
}

.btn-icon { font-size: 16px; }

.btn-primary {
    background: var(--gradient);
    color: rgba(0,0,0,0.8);
    box-shadow: 0 4px 20px var(--glow);
}

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

.btn-secondary {
    background: rgba(255,255,255,0.07);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
}

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

.btn-ghost {
    background: transparent;
    color: rgba(255,255,255,0.5);
    border: 1px solid rgba(255,255,255,0.1);
}

.btn-ghost:hover { color: #fff; border-color: rgba(255,255,255,0.3); }

/* ---- SHARE + PRINT ROW ---- */
.share-print-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-wrap: wrap;
    gap: 16px;
}

.share-section, .print-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-label {
    font-family: 'Orbitron', monospace;
    font-size: 9px;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.25);
    margin-right: 4px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
    transform: translateY(-2px);
}

.print-btn {
    width: auto;
    padding: 0 14px;
    border-radius: 20px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    gap: 6px;
}

/* ---- FOOTER ---- */
.page-footer {
    text-align: center;
    margin-top: 32px;
    font-size: 12px;
    color: rgba(255,255,255,0.2);
    letter-spacing: 1px;
}

.page-footer a {
    color: rgba(255,255,255,0.35);
    text-decoration: none;
    margin: 0 6px;
    transition: color 0.2s;
}

.page-footer a:hover { color: var(--accent); }

/* ---- WIN MODAL ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: var(--card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 28px;
    padding: 48px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 40px 120px rgba(0,0,0,0.6);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-box { transform: translateY(0); }

.modal-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.confetti-piece {
    position: absolute;
    top: -20px;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(400px) rotate(720deg); opacity: 0; }
}

.modal-trophy { font-size: 64px; margin-bottom: 12px; animation: bounce 0.6s ease; }

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

.modal-title {
    font-family: 'Orbitron', monospace;
    font-size: 24px;
    font-weight: 900;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.modal-time, .modal-moves {
    font-size: 16px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 6px;
}

.modal-time span, .modal-moves span {
    color: var(--accent);
    font-family: 'Orbitron', monospace;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 28px;
}

/* Print styles */
@media print {
    .top-nav, .controls-top, .numpad, .action-buttons, .share-print-row, .page-footer, .modal-overlay, .bg-particles { display: none !important; }
    body { background: #fff !important; }
    .game-container { border: none !important; box-shadow: none !important; background: #fff !important; padding: 0 !important; }
    .cell { border-color: #999 !important; background: #fff !important; }
    .cell-value { color: #000 !important; }
    .cell-input { color: #1565C0 !important; }
    .board-glow { display: none; }
}
