@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* Word Scramble Game Styles */
:root {
    --primary: #bb86fc; /* Updated to match template */
    --secondary: #4286f5;
    --accent: #9c42f5;
    --dark: #121212; /* Updated to match template */
    --bg-secondary: #1e1e1e;
    --bg-card: #2a2a2a;
    --text-color: #e0e0e0; /* Updated to match template */
    --text-light: #a0a0a0;
    --text-white: #ffffff;
    --correct-color: #00b894;
    --wrong-color: #d63031;
    --hint-color: #fdcb6e;
    --border-radius: 12px;
    --shadow-light: 0 3px 10px rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

body.dark-theme {
    font-family: 'Poppins', sans-serif;
    background-color: var(--dark);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Game Page Header */
.game-page-header {
    background-color: #1f1f1f;
    padding: 0.8rem 0;
    border-bottom: 1px solid #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.back-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--text-color);
}

/* Main Game Content Area */
.game-content {
    padding: 2rem 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-title {
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 10px rgba(187, 134, 252, 0.3);
    background: linear-gradient(to right, var(--primary), #9d70d8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* The Game Container */
#game-container {
    width: 100%;
    max-width: 800px;
    min-height: 500px;
    background-color: var(--bg-card);
    border: 2px solid #444;
    border-radius: 8px;
    margin: 0 auto 2rem auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
}

/* Game Instructions Area */
.game-instructions {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 1rem 1.5rem;
    max-width: 700px;
    width: 90%;
    margin: 0 auto;
    text-align: center;
}

.game-instructions h2 {
    font-size: 1.3rem;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.game-instructions p {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.7;
}

/* Footer Styles */
.site-footer {
    background-color: #1f1f1f;
    color: var(--text-light);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
    font-size: 0.9rem;
    border-top: 1px solid #333;
    flex-shrink: 0;
}

.site-footer p {
    margin: 0;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .game-title {
        font-size: 1.8rem;
    }
    #game-container {
        min-height: 400px;
    }
    .game-instructions {
        width: 95%;
        padding: 0.8rem 1rem;
    }
    .game-instructions h2 {
        font-size: 1.2rem;
    }
    .game-instructions p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.6rem;
    }
    #game-container {
        min-height: 300px;
        border-width: 1px;
    }
    .back-link {
        font-size: 0.9rem;
    }
}

/* ================= Game-specific styles below ================= */

.game-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 15px;
    background: #1a1a1a;
    border-radius: 15px;
    padding: 15px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    flex-wrap: wrap;
    gap: 10px;
}

.score-container, .time-container, .level-container {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-color);
}

#score, #time, #level {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    text-shadow: 0 0 5px rgba(187, 134, 252, 0.3);
}

#game-area {
    position: relative;
    min-height: 350px;
    background-color: #222;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 20px;
    width: 100%;
}

#word-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    flex-grow: 1;
}

.word-area {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    min-height: 80px;
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
    position: relative;
}

.letter {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
    margin: 5px;
    background: linear-gradient(135deg, #2a2a2a, #1e1e1e);
    border-radius: 10px;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    cursor: grab;
    user-select: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    animation: bounce 0.5s ease;
    position: relative;
    z-index: 5;
}

.letter:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(187, 134, 252, 0.3);
}

.letter.dragging {
    opacity: 0.8;
    transform: scale(1.1);
    cursor: grabbing;
    z-index: 10;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.letter.correct {
    background: linear-gradient(135deg, rgba(0, 184, 148, 0.7), rgba(0, 184, 148, 0.4));
    color: white;
}

.letter-spacer {
    width: 60px;
    height: 60px;
    margin: 5px;
    background-color: transparent;
    position: relative;
    z-index: 0;
    transition: all 0.2s ease;
}

.letter-spacer.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 2px dashed rgba(187, 134, 252, 0.5);
}

@keyframes bounce {
    0% { transform: translateY(-20px); opacity: 0; }
    50% { transform: translateY(10px); opacity: 0.7; }
    100% { transform: translateY(0); opacity: 1; }
}

#hint-text {
    font-size: 1.1rem;
    color: var(--hint-color);
    font-style: italic;
    min-height: 30px;
    text-align: center;
    opacity: 0.9;
    margin-top: 10px;
}

#input-area {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.primary-btn {
    background: linear-gradient(90deg, var(--primary), #9d70d8);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(187, 134, 252, 0.3);
    font-family: 'Poppins', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(187, 134, 252, 0.4);
}

.primary-btn:active {
    transform: translateY(1px);
}

#hint-button {
    background: linear-gradient(90deg, var(--hint-color), #e17055);
}

#hint-button:hover {
    background: linear-gradient(90deg, #e17055, var(--hint-color));
    box-shadow: 0 8px 20px rgba(253, 203, 110, 0.4);
}

#shuffle-button {
    background: linear-gradient(90deg, #74b9ff, #0984e3);
}

#shuffle-button:hover {
    background: linear-gradient(90deg, #0984e3, #74b9ff);
    box-shadow: 0 8px 20px rgba(116, 185, 255, 0.4);
}

#start-screen, #game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(18, 18, 18, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 100;
    backdrop-filter: blur(5px);
    padding: 30px;
    text-align: center;
}

.hidden {
    display: none !important;
}

h2 {
    font-size: 2rem;
    color: var(--primary);
    text-shadow: 0 2px 10px rgba(187, 134, 252, 0.3);
}

#message-display {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 1.2rem;
    border-radius: 30px;
    z-index: 1000;
    animation: fadeMessage 1.5s forwards;
    backdrop-filter: blur(10px);
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

@keyframes fadeMessage {
    0% { opacity: 0; transform: translate(-50%, -20px); }
    10% { opacity: 1; transform: translate(-50%, 0); }
    90% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -20px); }
}

.correct {
    color: var(--correct-color);
}

.wrong {
    color: var(--wrong-color);
}

.letter-reveal {
    animation: reveal 0.5s ease-out;
}

@keyframes reveal {
    0% { transform: rotateY(90deg); opacity: 0; }
    100% { transform: rotateY(0); opacity: 1; }
}

.success-animation {
    animation: success 0.5s ease;
}

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

@media (max-width: 600px) {
    .game-info {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .letter {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
        margin: 3px;
    }
    
    .letter-spacer {
        width: 45px;
        height: 45px;
        margin: 3px;
    }
    
    #input-area {
        flex-direction: column;
        width: 100%;
    }
    
    .primary-btn {
        width: 100%;
        padding: 10px 15px;
        font-size: 0.9rem;
        position: relative;
    }
}

/* Particle animation for level up */
.particle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.8;
    z-index: 0;
} 