:root {
    --bg-light: #f3f4f6;
    --card-bg-light: rgba(255, 255, 255, 1);
    --bg-dark: #090a0f;
    --card-bg-dark: rgba(31, 41, 55, 0.5);
    --border-dark: rgba(255, 255, 255, 0.1);
    --border-light: rgba(0,0,0,0.08);
    --glow-color: #a78bfa; 
    --glow-color-rgb: 167, 139, 250;
}
body { 
    font-family: 'Inter', sans-serif; 
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}
.dark body { 
    background-color: var(--bg-dark); 
    background-image: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 70%), linear-gradient(to bottom, transparent 85%, rgba(74, 222, 128, 0.08));
    color: #e5e7eb; 
}
.light body { background-color: var(--bg-light); color: #1f2937; }

.lobster-font { font-family: 'Lobster', cursive; }

.interactive-card { 
    backdrop-filter: blur(10px); 
    border: 1px solid; 
    transition: transform 0.3s ease, box-shadow 0.3s ease; 
}
.dark .interactive-card { background-color: var(--card-bg-dark); border-color: var(--border-dark); }
.light .interactive-card { background-color: var(--card-bg-light); border-color: var(--border-light); box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }

.btn-primary {
    background-color: var(--glow-color);
    color: #ffffff;
    font-weight: bold;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px 0px rgba(var(--glow-color-rgb), 0);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px 0px rgba(var(--glow-color-rgb), 0.7);
}

#grid-wrapper {
    border-radius: 0.75rem;
    overflow: hidden;
}
.dark #grid-wrapper {
     border: 3px solid var(--glow-color);
     box-shadow: 0 0 8px var(--glow-color), 0 0 16px rgba(var(--glow-color-rgb), 0.5), inset 0 0 4px rgba(var(--glow-color-rgb), 0.5);
}
 .light #grid-wrapper {
     border: 3px solid #374151;
}


#crossword-grid {
    display: grid;
    touch-action: manipulation;
    /* Borders are now handled by the cells to ensure a perfect grid */
    border-top: 1px solid;
    border-left: 1px solid;
    background-color: transparent;
}
.dark #crossword-grid {
    border-color: #4b5563; /* This IS the grid line color */
}
.light #crossword-grid {
    border-color: #9ca3af; /* This IS the grid line color */
}

.grid-cell {
    width: 100%;
    height: 100%;
    position: relative;
    transition: background-color 0.3s ease;
    border-right: 1px solid;
    border-bottom: 1px solid;
}
.dark .grid-cell { 
    background-color: #1f2937;
    border-color: #4b5563;
}
.light .grid-cell { 
    background-color: #ffffff;
    border-color: #9ca3af;
}

.grid-cell input {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    text-align: center;
    text-transform: uppercase;
    font-weight: bold;
    background: transparent;
    border: none;
    padding: 0;
    font-size: clamp(12px, 3.5vmin, 24px);
}
.dark .grid-cell input { color: #fff; }
.light .grid-cell input { color: #111827; }
.grid-cell input:focus { outline: none; }

.cell-number {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: clamp(6px, 1.5vmin, 10px);
    font-weight: bold;
}
.dark .cell-number { color: #a0aec0; }
.light .cell-number { color: #4a5568; }

.cell-highlight {
    background-color: rgba(var(--glow-color-rgb), 0.3);
}
.cell-active {
    background-color: rgba(var(--glow-color-rgb), 0.5);
    box-shadow: 0 0 10px 2px var(--glow-color) inset;
}
.cell-correct {
    background-color: rgba(74, 222, 128, 0.6) !important;
    color: #111827;
    font-weight: bold;
}
.cell-incorrect {
    background-color: rgba(248, 113, 113, 0.6);
}
.dark .cell-correct {
    color: #ffffff;
}
.clue-highlight {
    background-color: rgba(var(--glow-color-rgb), 0.2);
}
.clue-correct {
    text-decoration: line-through;
    opacity: 0.6;
}

#congrats-modal, .modal-overlay {
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--glow-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up, .modal-content {
    animation: fade-in-up 0.5s ease-out forwards;
}

