:root {
    --gold-light: #f9d976;
    --gold-main: #e5b233;
    --gold-dark: #b3821a;
    --bg-dark: #0f1610; /* Dark emerald/forest green tint */
    --board-bg: rgba(20, 28, 20, 0.85);
    --cell-bg: rgba(255, 255, 255, 0.05);
    --cell-border: rgba(229, 178, 51, 0.3);
    --cell-selected: rgba(229, 178, 51, 0.4);
    --cell-highlight: rgba(229, 178, 51, 0.15);
    --text-main: #fff;
    --text-gold: #f9d976;
    --error-red: #ff4d4d;
    --success-green: #4dff88;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    position: relative;
}

.glitter-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: url('background.png');
    background-size: cover;
    background-position: center;
    opacity: 0.4;
    mix-blend-mode: overlay;
}

/* Subtle sparkle animation overlay */
.glitter-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 4px),
                      radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 3px),
                      radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 4px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    animation: sparkle 15s linear infinite;
    opacity: 0.5;
}

@keyframes sparkle {
    0% { background-position: 0 0, 40px 60px, 130px 270px; }
    100% { background-position: 550px 550px, 390px 410px, 380px 520px; }
}

.app-container {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: linear-gradient(135deg, rgba(15, 22, 16, 0.9) 0%, rgba(5, 8, 5, 0.95) 100%);
    box-shadow: 0 0 50px rgba(229, 178, 51, 0.1);
    backdrop-filter: blur(10px);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(to right, var(--gold-light), var(--gold-main), var(--gold-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0px 2px 10px rgba(229, 178, 51, 0.4));
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.timer {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    color: var(--text-gold);
    letter-spacing: 2px;
    opacity: 0.8;
}

.gold-btn {
    background: linear-gradient(135deg, var(--gold-main), var(--gold-dark));
    border: 1px solid var(--gold-light);
    color: #111;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(229, 178, 51, 0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.gold-btn:hover, .gold-btn:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 178, 51, 0.5);
    background: linear-gradient(135deg, var(--gold-light), var(--gold-main));
}

.board-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    min-height: 0;
}

.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--board-bg);
    border: 3px solid var(--gold-main);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(229, 178, 51, 0.2), inset 0 0 20px rgba(229, 178, 51, 0.1);
    overflow: hidden;
}

.cell {
    position: relative;
    border: 1px solid var(--cell-border);
    background: var(--cell-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-gold);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.cell.fixed {
    font-weight: 600;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.cell:nth-child(3n) { border-right: 2px solid var(--gold-main); }
.cell:nth-child(9n) { border-right: none; }
.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--gold-main); }

.cell.selected {
    background: var(--cell-selected);
    box-shadow: inset 0 0 10px rgba(229, 178, 51, 0.5);
    font-weight: bold;
    color: #E0115F;
}

.cell.highlight {
    background: var(--cell-highlight);
}

.cell.same-number {
    background: rgba(229, 178, 51, 0.25);
    box-shadow: inset 0 0 8px rgba(229, 178, 51, 0.3);
    font-weight: bold;
    color: #E0115F;
}

.cell.error {
    color: var(--error-red);
    animation: shake 0.4s;
}

.cell.pop-in {
    animation: popIn 0.2s ease-out;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.controls-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 10px;
}

.controls-row .gold-btn {
    flex: 1;
    padding: 12px 0;
    font-size: 0.9rem;
}

.secondary-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.secondary-controls .gold-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
}

.numpad-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.numpad {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 6px;
    width: 100%;
}

.num-btn {
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: rgba(20, 28, 20, 0.6);
    border: 2px solid var(--gold-main);
    color: var(--gold-light);
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.num-btn:active {
    transform: scale(0.9);
    background: var(--gold-main);
    color: #000;
}

.num-btn.completed {
    opacity: 0.3;
    pointer-events: none;
    border-color: rgba(229, 178, 51, 0.2);
}

.difficulty-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: auto;
}

.diff-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    padding-bottom: 5px;
    transition: color 0.3s;
}

.diff-btn.active {
    color: var(--gold-light);
    border-bottom: 2px solid var(--gold-light);
}

/* Sparkle effect on complete */
.cell.complete-anim {
    animation: flashGold 1s ease-out;
}

@keyframes flashGold {
    0% { background: var(--cell-bg); }
    50% { background: var(--gold-main); color: #fff; box-shadow: 0 0 20px var(--gold-light); }
    100% { background: var(--cell-bg); }
}

/* Glassmorphism Toast Overlay */
.love-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translate(-50%, 20px);
    background: rgba(15, 22, 16, 0.65);
    border: 1px solid rgba(229, 178, 51, 0.4);
    color: var(--text-gold);
    padding: 14px 28px;
    border-radius: 30px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), 0 0 15px rgba(229, 178, 51, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.love-toast--visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

/* Button shake feedback */
.btn-shake {
    animation: btnShake 0.4s ease;
}

@keyframes btnShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}


/* Confirmation Modal */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.confirm-modal.hidden {
    display: none;
}

.confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.confirm-content {
    position: relative;
    background: rgba(15, 22, 16, 0.9);
    border: 1px solid rgba(229, 178, 51, 0.4);
    border-radius: 16px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(229, 178, 51, 0.1);
    backdrop-filter: blur(15px);
    max-width: 320px;
}

.confirm-content p {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    color: var(--text-gold);
    margin-bottom: 25px;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-buttons .gold-btn {
    min-width: 80px;
    padding: 10px 24px;
}
