/* Letter Bloom - Game Components Styles */

/* Crossword Container */
.crossword-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.crossword-grid {
    display: inline-block;
}

.crossword-row {
    display: flex;
}

.crossword-cell {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    margin: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.crossword-cell.filled {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    box-shadow: 
        0 4px 15px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Normal word completion animation - only when NOT from hint */
.crossword-cell.filled:not(.no-animation):not(.hint-reveal) {
    animation: cellReveal 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Skip animation for hint-revealed cells transitioning to filled */
.crossword-cell.filled.no-animation {
    animation: none !important;
}

.crossword-cell.filled::after {
    animation: pulse 1s ease-out;
}

@keyframes cellReveal {
    0% { 
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    50% { 
        transform: scale(1.3) rotate(90deg);
    }
    100% { 
        transform: scale(1.05) rotate(0deg);
        opacity: 1;
    }
}

/* Special animation for hint-revealed letters */
@keyframes hintReveal {
    0% { 
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    40% { 
        transform: scale(1.3) rotate(-90deg);
        background: linear-gradient(135deg, #ffd700, #ffed4e);
    }
    60% {
        transform: scale(1.1) rotate(-45deg);
        background: linear-gradient(135deg, #ffd700, #ffed4e);
    }
    100% { 
        transform: scale(1.05) rotate(0deg);
        opacity: 1;
        background: linear-gradient(135deg, #667eea, #764ba2);
    }
}

/* Hint reveal class - golden animation that transitions to purple */
.crossword-cell.hint-reveal {
    animation: hintReveal 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    color: white;
    border-color: transparent;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.6),
        0 4px 15px rgba(102, 126, 234, 0.4);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    100% {
        box-shadow: 0 0 0 20px rgba(102, 126, 234, 0);
    }
}

.crossword-cell.empty {
    background: transparent;
    border: none;
    box-shadow: none;
}

.crossword-cell.intersection.filled {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    box-shadow: 
        0 4px 15px rgba(240, 147, 251, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Current Word Display */
.current-word {
    text-align: center;
    font-size: 2em;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    min-height: 45px;
    letter-spacing: 6px;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
}

.current-word::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
}

/* Premium Letter Circle */
.letter-circle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    position: relative;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    padding: 10px;
}

.letter-circle {
    position: relative;
    width: 180px;
    height: 180px;
}

/* REMOVED the ::before pseudo-element that was creating the circle outline */
/* This eliminates the horizontal line issue in the center */

.letter-button {
    position: absolute;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 5px 15px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.letter-button:hover {
    transform: scale(1.15) translateZ(20px);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(102, 126, 234, 0.4);
}

.letter-button.selected {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    transform: scale(1.2);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 
        0 0 30px rgba(245, 87, 108, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    animation: glow 0.5s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 20px rgba(245, 87, 108, 0.6); }
    to { box-shadow: 0 0 30px rgba(245, 87, 108, 0.8), 0 0 40px rgba(245, 87, 108, 0.4); }
}

/* Premium Glass Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 15px;
}

.controls button {
    padding: 12px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.controls button:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.controls button:active {
    transform: translateY(-1px);
}

/* Shuffle button with special styling */
#shuffleBtn {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border-color: rgba(102, 126, 234, 0.3);
}

#shuffleBtn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
}

.hint-button {
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.2), rgba(245, 87, 108, 0.2));
    border-color: rgba(240, 147, 251, 0.3);
}

.hint-button:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.3), rgba(245, 87, 108, 0.3));
}

.hint-button:disabled,
.hint-button[style*="opacity: 0.5"] {
    cursor: not-allowed;
    transform: none;
    filter: grayscale(50%);
    opacity: 0.5;
}

.skip-button {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.2), rgba(255, 69, 0, 0.2));
    border-color: rgba(255, 165, 0, 0.3);
}

.skip-button:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.3), rgba(255, 69, 0, 0.3));
    box-shadow: 
        0 8px 25px rgba(255, 165, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.skip-button:disabled,
.skip-button[style*="opacity: 0.5"] {
    cursor: not-allowed;
    transform: none;
    filter: grayscale(50%);
    opacity: 0.5;
}

/* SVG Line with Glow */
.svg-line {
    stroke: url(#lineGradient);
    stroke-width: 4;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.9;
    filter: drop-shadow(0 0 6px rgba(245, 87, 108, 0.6));
}

#connectionLine {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}