.crossword-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.crossword-board {
    display: grid;
    gap: 1px;
    background-color: #333;
    border: 2px solid #333;
}

/* Active Clue Highlight Area */
.active-clue-display {
    width: 100%;
    max-width: 800px;
    background: var(--card-bg);
    /* Use theme card background */
    color: var(--text-color);
    /* Use theme text color */
    padding: 15px 20px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--glass-shadow);
    text-align: center;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    margin-bottom: 5px;
}

.active-clue-display .clue-label {
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--text-color);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.active-clue-display .clue-text {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
}

.active-clue-display .clue-hint {
    display: block;
    font-size: 0.95rem;
    font-style: italic;
    color: var(--link-color);
    /* Use link color for specific accent */
    margin-top: 5px;
    opacity: 0.9;
}

.cell {
    width: 40px;
    height: 40px;
    background-color: white;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    /* largely irrelevant for Hangul but good practice */
}

.cell.black {
    background-color: #333;
    cursor: default;
}

.cell input.correct {
    color: white;
    background-color: #2e7d32;
    /* Dark Green */
}

.cell input.incorrect {
    color: white;
    background-color: #c62828;
    /* Red */
}

.controls {
    margin: 20px 0;
}

.btn-check {
    padding: 10px 20px;
    font-size: 1rem;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-check:hover {
    background-color: #45a049;
}

.btn-solution {
    padding: 10px 20px;
    font-size: 1rem;
    background-color: #0288d1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-left: 10px;
}

.btn-solution:hover {
    background-color: #0277bd;
}

.btn-selection {
    padding: 10px 20px;
    font-size: 1rem;
    background-color: #7b1fa2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s;
    margin-left: 10px;
}

.btn-selection:hover {
    background-color: #6a1b9a;
    color: white;
}

.cell input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 1.2rem;
    background-color: transparent;
    /* Ensure transparent */
    outline: none;
    font-family: inherit;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 1;
    /* Input below number */
}

.cell .number {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 0.75rem;
    /* Slightly larger */
    font-weight: bold;
    color: #444;
    /* Darker */
    pointer-events: none;
    z-index: 10;
    /* Number on top */
}

.cell.active {
    background-color: #e3f2fd;
    /* Light Blue highlight */
    border: 2px solid #2196f3;
    z-index: 5;
}

/* Clues */
.crossword-clues {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    max-width: 800px;
    justify-content: center;
}

.clue-column {
    flex: 1;
    min-width: 300px;
    background: var(--card-bg);
    padding: 15px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

.clue-column h3 {
    margin-top: 0;
    border-bottom: 2px solid var(--glass-border);
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.clue-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.clue-column li {
    padding: 4px 0;
    font-size: 0.95rem;
}

.legal-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    color: var(--text-color);
    opacity: 0.8;
    font-size: 0.85rem;
    width: 100%;
}

.legal-footer .warning {
    color: #c62828;
    font-weight: bold;
    font-size: 0.8rem;
    margin-top: 5px;
}

/* Victory Celebration */
@keyframes rainbowGlow {
    0% {
        background-color: #FFADAD;
        transform: scale(1);
        box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.5);
    }

    25% {
        background-color: #CAFFBF;
    }

    50% {
        background-color: #9BF6FF;
    }

    75% {
        background-color: #FFD6A5;
    }

    100% {
        background-color: #BDB2FF;
        transform: scale(1.08);
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    }
}

.cell.celebrate {
    animation: rainbowGlow 0.8s ease-in-out infinite alternate;
    z-index: 20;
    border: none !important;
}

.cell.celebrate input {
    background-color: transparent !important;
    color: #000 !important;
    /* Ensure high contrast */
    font-weight: 900;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* Victory Modal */
.victory-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.5s ease-out;
}

.victory-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--accent-color);
    max-width: 90%;
    transform: scale(0.8);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.victory-content h1 {
    font-size: 3rem;
    background: linear-gradient(45deg, #FFD700, #FFA500, #FFD700);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
}

.victory-content p {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.victory-content .time-display {
    font-weight: bold;
    color: var(--accent-color);
    font-size: 2rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popIn {
    to {
        transform: scale(1);
    }
}