:root {
    /* Vibrant Color Palette */
    --primary-color: #6C63FF;
    /* Vivid Purple */
    --secondary-color: #00F0FF;
    /* Electric Cyan */
    --accent-color: #FF00E6;
    /* Neon Pink */
    --warning-color: #FFD700;
    /* Bright Gold */
    --success-color: #00FF94;
    /* Neon Green */
    --danger-color: #FF2E63;
    /* Bright Red */

    --text-primary: #FFFFFF;
    --text-secondary: #E0E0E0;

    --bg-gradient-start: #0f0c29;
    --bg-gradient-mid: #302b63;
    --bg-gradient-end: #24243e;

    /* Glassmorphism Variables */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --blur-strength: 15px;

    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, #1A1A2E 0%, #16213E 50%, #0F3460 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Abstract Background Shapes */
body::before,
body::after {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    z-index: -1;
    filter: blur(80px);
    opacity: 0.4;
}

body::before {
    background: var(--primary-color);
    top: -150px;
    left: -150px;
}

body::after {
    background: var(--accent-color);
    bottom: -150px;
    right: -150px;
}

.game-container {
    width: 100%;
    max-width: 900px;
    padding: 2.5rem;
    margin: 1rem;

    background: var(--glass-bg);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    border-radius: 20px;
    border: 1px solid var(--glass-border);

    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    transition: all 0.3s ease;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 1rem;
}

h1 {
    font-family: var(--font-heading);
    font-size: 4rem;
    background: linear-gradient(to right, var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
    letter-spacing: 4px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 0.5rem;
    transform: none;
    /* Reset skew from previous design */
    padding: 0;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

/* Topic Selection */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    perspective: 1000px;
}

.topic-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 180px;
    position: relative;
    overflow: hidden;
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.3s;
}

.topic-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(0, 240, 255, 0.2);
}

.topic-card:hover::before {
    opacity: 1;
}

.topic-card h3 {
    font-family: var(--font-heading);
    font-size: 2rem;
    letter-spacing: 1px;
    margin-bottom: 12px;
    color: var(--text-primary);
    z-index: 1;
}

.topic-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    z-index: 1;
}

/* Stats Area */
.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    margin-bottom: 1rem;
}

.lives-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    margin-right: 30px;
}

.lives-container span {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

#lives-count {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.heart-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    width: 100%;
    max-width: 250px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.heart-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--danger-color), #FF7675);
    border-radius: 6px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(255, 46, 99, 0.5);
}

/* Buttons */
.btn {
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 700;
    transition: all 0.3s ease;
    border-radius: 12px;
    padding: 1rem 2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

#hint-btn {
    background: linear-gradient(135deg, #4A00E0, #8E2DE2);
    border: none;
    color: white;
    box-shadow: 0 4px 15px rgba(74, 0, 224, 0.4);
}

#hint-btn:hover {
    background: linear-gradient(135deg, #5A10F0, #9E3DF2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 0, 224, 0.6);
}

#back-to-menu-btn {
    margin-top: 20px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.7);
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
}

#back-to-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: white;
    transform: none;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), #8F00FF);
    color: white;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.4);
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(108, 99, 255, 0.6);
}

.icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-size: 0.9rem;
    margin-right: 8px;
    font-weight: bold;
}

/* Hint Box */
.hint-box {
    background: rgba(255, 215, 0, 0.15);
    border-left: 4px solid var(--warning-color);
    padding: 1.5rem;
    border-radius: 0 12px 12px 0;
    color: #fff;
    font-style: italic;
    animation: slideIn 0.5s ease;
    margin: 1rem 0;
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-left-width: 4px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Word Display */
.word-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 2rem 0;
    min-height: 80px;
}

.letter-slot {
    width: 50px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.2rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-primary);
    transition: all 0.3s;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.letter-slot.filled {
    border-color: var(--secondary-color);
    background: rgba(0, 240, 255, 0.1);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.8);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.letter-slot.space {
    background: transparent;
    border: none;
    box-shadow: none;
    width: 20px;
}

/* Keyboard */
.keyboard {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: auto;
    padding: 1rem;
}

.key {
    width: 45px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.key:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.key.correct {
    background: var(--success-color);
    border-color: var(--success-color);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 148, 0.4);
    transform: scale(0.95);
}

.key.wrong {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    border-color: transparent;
    cursor: not-allowed;
    transform: scale(0.95);
}

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

.modal-content {
    background: #1A1A2E;
    padding: 3rem;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent 0deg, var(--primary-color) 360deg);
    opacity: 0.1;
    animation: rotate 10s linear infinite;
    z-index: -1;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

#modal-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    background: linear-gradient(to right, #fff, var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

#modal-message {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.highlight {
    color: var(--secondary-color);
    font-weight: 800;
    font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.hidden {
    display: none !important;
}

.big-btn {
    width: 100%;
    margin-top: 2rem;
    padding: 1.2rem;
    font-size: 1.4rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 600px) {
    .game-container {
        padding: 1.5rem;
        margin: 0.5rem;
    }

    .word-display {
        gap: 6px;
    }

    .letter-slot {
        width: 35px;
        height: 45px;
        font-size: 1.6rem;
    }

    .key {
        width: 34px;
        height: 42px;
        font-size: 0.9rem;
    }

    h1 {
        font-size: 2.8rem;
    }

    .topic-card {
        min-height: 140px;
    }
}