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

:root {
    --color-primary: #FF6B35;
    --color-secondary: #F7931E;
    --color-accent: #FDC500;
    --color-success: #4ECDC4;
    --color-info: #5B5FFF;
    --color-danger: #FF5E78;
    --color-purple: #9D4EDD;
    --color-lime: #90EE90;

    --gradient-main: linear-gradient(135deg, #FF6B35 0%, #F7931E 50%, #FDC500 100%);
    --gradient-cool: linear-gradient(135deg, #4ECDC4 0%, #5B5FFF 100%);
    --gradient-warm: linear-gradient(135deg, #FF5E78 0%, #9D4EDD 100%);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.2);

    --glow-orange: 0 0 30px rgba(255, 107, 53, 0.4);
    --glow-blue: 0 0 30px rgba(91, 95, 255, 0.4);
    --glow-purple: 0 0 30px rgba(157, 78, 221, 0.4);
    --glow-success: 0 0 30px rgba(78, 205, 196, 0.4);
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 25%, #FDC500 50%, #4ECDC4 75%, #5B5FFF 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 107, 53, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(91, 95, 255, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(253, 197, 0, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.98);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
    border-bottom: 4px solid var(--color-accent);
    position: relative;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.hub-btn {
    padding: 12px 28px;
    background: var(--gradient-cool);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1em;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.hub-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.hub-btn:hover::before {
    width: 300px;
    height: 300px;
}

.hub-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg), var(--glow-blue);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.lang-switch {
    position: relative;
}

.lang-btn {
    padding: 8px 15px;
    background: #f0f0f0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: #e0e0e0;
}

.tooltip {
    position: fixed;
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 30px;
    box-shadow: var(--shadow-xl);
    padding: 50px;
    max-width: 900px;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 1;
    animation: containerEntrance 0.6s ease-out;
}

.container::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    background: var(--gradient-main);
    border-radius: 36px;
    z-index: -1;
    opacity: 0.3;
}

.container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-radius: 30px;
    z-index: 0;
}

.container > * {
    position: relative;
    z-index: 1;
}

@keyframes containerEntrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

h1 {
    font-family: 'Fredoka', sans-serif;
    color: transparent;
    background: var(--gradient-main);
    background-clip: text;
    -webkit-background-clip: text;
    margin-bottom: 40px;
    font-size: 3.5em;
    font-weight: 700;
    letter-spacing: -1px;
    text-shadow: 0 4px 20px rgba(255, 107, 53, 0.2);
    animation: titleBounce 0.8s ease-out;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 6px;
    background: var(--gradient-accent);
    border-radius: 3px;
}

@keyframes titleBounce {
    0% {
        opacity: 0;
        transform: translateY(-50px) scale(0.8);
    }
    60% {
        transform: translateY(10px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 18px 36px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.3em;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    background: var(--gradient-main);
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.mode-btn:hover::before {
    left: 100%;
}

.mode-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-xl), var(--glow-orange);
}

.mode-btn:active {
    transform: translateY(-2px) scale(1.02);
}

.mode-btn:disabled {
    background: linear-gradient(135deg, #ccc, #999);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: var(--shadow-sm);
}

.mode-btn:disabled:hover {
    transform: none;
}

.mode-btn.active {
    background: var(--gradient-warm);
    box-shadow: var(--shadow-lg), var(--glow-purple);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: var(--shadow-lg), var(--glow-purple);
    }
    50% {
        box-shadow: var(--shadow-xl), 0 0 40px rgba(157, 78, 221, 0.6);
    }
}

/* Creator Buttons Container */
.creator-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.creator-json-btns {
    width: 100%;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.json-btn {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1.5px solid #ccc;
    background: transparent;
    color: #999;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}
.json-btn:hover {
    border-color: #888;
    color: #555;
}

.mode-btn.secondary-btn {
    background: linear-gradient(135deg, #718096, #4A5568);
    font-size: 1.1em;
    padding: 14px 28px;
    box-shadow: var(--shadow-md);
}

.mode-btn.secondary-btn:hover {
    background: linear-gradient(135deg, #4A5568, #2D3748);
    transform: translateY(-3px) scale(1.03);
    box-shadow: var(--shadow-lg);
}

.mode-btn.secondary-btn:active {
    transform: translateY(-1px) scale(1.01);
}

/* Game Areas */
.game-area {
    display: none;
}

.game-area.active {
    display: block;
}

/* Creator Mode Styles */
.creator-mode {
    text-align: left;
    padding: 30px;
    background: #fafafa;
    border-radius: 20px;
}

/* Creator layout improvements */
.creator-mode .creator-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Primary action when starting from creator */
.start-from-creator {
    background: var(--gradient-warm);
    animation: startFromCreatorPulse 2s ease-in-out infinite;
}
.start-from-creator:hover {
    background: linear-gradient(135deg, #9D4EDD, #FF5E78);
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-xl), var(--glow-purple);
}

@keyframes startFromCreatorPulse {
    0%, 100% {
        box-shadow: var(--shadow-md);
    }
    50% {
        box-shadow: var(--shadow-lg), var(--glow-purple);
    }
}

/* Start button in question screen */
.start-btn {
    padding: 20px 50px;
    background: var(--gradient-warm);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8em;
    font-weight: 700;
    box-shadow: var(--shadow-xl), var(--glow-purple);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: startBtnEntrance 1s ease-out, startBtnPulse 2s ease-in-out 1s infinite;
}

.start-btn:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: var(--shadow-xl), 0 0 50px rgba(255, 94, 120, 0.8);
}

@keyframes startBtnEntrance {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    60% {
        transform: scale(1.1) rotate(5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes startBtnPulse {
    0%, 100% {
        box-shadow: var(--shadow-xl), var(--glow-purple);
    }
    50% {
        box-shadow: var(--shadow-xl), 0 0 50px rgba(157, 78, 221, 0.8);
    }
}

.creator-section {
    margin-bottom: 25px;
}

.creator-section h3 {
    font-family: 'Fredoka', sans-serif;
    margin-bottom: 20px;
    color: transparent;
    background: var(--gradient-main);
    background-clip: text;
    -webkit-background-clip: text;
    font-size: 1.6em;
    font-weight: 700;
}

.input-group {
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.05em;
}

.input-group input, .input-group select, .input-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    font-family: 'DM Sans', sans-serif;
    font-size: 1em;
    transition: all 0.3s ease;
    background: white;
    box-sizing: border-box;
    max-width: 100%;
}

.input-group input:focus, .input-group select:focus, .input-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
    transform: translateY(-2px);
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
}

.input-group input[type="color"] {
    height: 40px; /* Match height of other inputs */
    padding: 5px;
}

.hidden {
    display: none;
}

hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

.add-question-btn {
    padding: 14px 32px;
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.15em;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.add-question-btn:hover {
    background: linear-gradient(135deg, #44A08D, #2d8b73);
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg), var(--glow-success);
}

.questions-list {
    margin-top: 20px;
    max-height: none;
    overflow-y: visible;
}

.question-item {
    background: linear-gradient(135deg, #fff9f0, #fff3e0);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 15px;
    border-left: 6px solid var(--color-primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.question-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--gradient-main);
}

.question-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.question-item h4 {
    font-family: 'Fredoka', sans-serif;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.question-item p {
    color: #555;
    margin: 5px 0;
    font-size: 0.95em;
}

.delete-btn {
    background: linear-gradient(135deg, #FF5E78, #ff4757);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-sm);
}

.delete-btn:hover {
    background: linear-gradient(135deg, #ff4757, #ee5a6f);
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-md);
}

.question-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.question-item-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.reorder-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reorder-btn {
    background: linear-gradient(135deg, #4ECDC4, #3ab5ad);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 600;
    font-family: 'Fredoka', sans-serif;
    transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 2px 6px rgba(78, 205, 196, 0.3);
    min-width: 32px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reorder-btn:hover {
    background: linear-gradient(135deg, #3ab5ad, #2a9d96);
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(78, 205, 196, 0.5);
}

.reorder-btn:active {
    transform: scale(0.95);
}

.reorder-btn-placeholder {
    width: 32px;
    height: 28px;
    display: block;
}

/* Consecutive Mode Styles */
#consecutiveMode.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.question-screen, .answer-screen {
    width: 100%;
    padding: 20px;
    border: 2px solid #eee;
    border-radius: 15px;
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.question-screen.active, .answer-screen.active {
    display: flex; /* Show when active */
}

.question-text {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.2em;
    font-weight: 600;
    color: #2c3e50;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, #fff5e1, #ffe8cc);
    padding: 30px;
    border-radius: 20px;
    border: 4px solid var(--color-accent);
    box-shadow: var(--shadow-md), inset 0 2px 10px rgba(253, 197, 0, 0.2);
    animation: questionEntrance 0.6s ease-out;
    width: 100%;
}

/* Question Media Layouts */
.question-content-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

/* Layout: Text only */
.question-content-wrapper.layout-text-only .question-media {
    display: none;
}

/* Layout: Media only */
.question-content-wrapper.layout-media-only .question-text-content {
    display: none;
}

/* Layout: Text top, Media bottom */
.question-content-wrapper.layout-text-top {
    flex-direction: column;
}

/* Layout: Media top, Text bottom */
.question-content-wrapper.layout-media-top {
    flex-direction: column-reverse;
}

/* Layout: Text left, Media right */
.question-content-wrapper.layout-text-left {
    flex-direction: row;
    align-items: center;
}

/* Layout: Media left, Text right */
.question-content-wrapper.layout-media-left {
    flex-direction: row-reverse;
    align-items: center;
}

.question-text-content {
    flex: 1;
    font-size: 1em;
    padding: 10px;
}

.question-media {
    flex: 1;
    max-width: 100%;
    max-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.question-media img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: 15px;
}

.question-media video {
    max-width: 100%;
    max-height: 500px;
    border-radius: 15px;
}

.question-media audio {
    width: 100%;
    border-radius: 15px;
}

/* Responsive adjustments for media layouts */
@media (max-width: 768px) {
    .question-content-wrapper.layout-text-left,
    .question-content-wrapper.layout-media-left {
        flex-direction: column !important;
    }

    .question-media {
        max-height: 300px;
    }

    .question-media img,
    .question-media video {
        max-height: 300px;
    }
}

@keyframes questionEntrance {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.timer {
    font-family: 'Fredoka', sans-serif;
    font-size: 3em;
    font-weight: 700;
    color: white;
    background: var(--gradient-warm);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 6px solid white;
    box-shadow: var(--shadow-lg), var(--glow-purple), inset 0 0 20px rgba(0, 0, 0, 0.2);
    animation: timerPulse 1s ease-in-out infinite;
    position: relative;
}

.timer::before {
    content: '';
    position: absolute;
    top: -12px;
    left: -12px;
    right: -12px;
    bottom: -12px;
    border-radius: 50%;
    background: var(--gradient-warm);
    opacity: 0.3;
    z-index: -1;
    animation: timerGlow 2s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes timerGlow {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

.skip-btn, .show-answer-btn, .next-btn, .back-btn {
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.skip-btn {
    background: linear-gradient(135deg, #FDC500, #F7931E);
    color: white;
}
.skip-btn:hover {
    background: linear-gradient(135deg, #F7931E, #FF6B35);
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(253, 197, 0, 0.5);
}

.show-answer-btn {
    background: var(--gradient-cool);
    color: white;
}
.show-answer-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg), var(--glow-blue);
}

.next-btn {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
}
.next-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg), var(--glow-success);
}

.back-btn {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
    margin-top: 10px;
}
.back-btn:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c7a7b);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Table Mode Info Toggle */
.table-info-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: #0369a1;
    border: 1px solid #7dd3fc;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.table-info-toggle-btn:hover,
.table-info-toggle-btn.active {
    background: linear-gradient(135deg, #bae6fd, #7dd3fc);
    box-shadow: var(--shadow-sm);
}

/* Welcome screen shown as inline info strip (no overlay, no action buttons) */
#tableWelcomeScreen.info-only {
    position: static;
    background: transparent;
    padding: 0;
    min-height: unset;
    margin-bottom: 12px;
    animation: fadeInDown 0.2s ease;
}

#tableWelcomeScreen.info-only .welcome-content {
    margin: 0;
    padding: 14px 20px;
    border-radius: 16px;
}

#tableWelcomeScreen.info-only .welcome-actions {
    display: none;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Answer Screen Styles */
.answer-screen {
    gap: 10px;
}

.small-question {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.05em;
    color: #666;
    background: linear-gradient(135deg, #f9f9f9, #f0f0f0);
    padding: 12px 20px;
    border-radius: 15px;
    width: 100%;
    text-align: center;
    border: 2px solid #e0e0e0;
    font-style: italic;
}

.answer-text {
    font-family: 'Fredoka', sans-serif;
    font-size: 3em;
    font-weight: 700;
    color: #2d8b73;
    margin: 20px 0;
    padding: 30px;
    border-radius: 25px;
    background: linear-gradient(135deg, #e8f8f5, #d5f4e6);
    box-shadow: var(--shadow-lg), inset 0 2px 15px rgba(78, 205, 196, 0.2);
    animation: answerReveal 0.8s ease-out;
    position: relative;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.answer-text::before {
    content: '✓';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5em;
    color: var(--color-success);
    background: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    animation: checkmarkBounce 0.6s ease-out 0.3s;
}

@keyframes answerReveal {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-5deg);
    }
    60% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes checkmarkBounce {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0) rotate(-180deg);
    }
    60% {
        transform: translateX(-50%) scale(1.2) rotate(10deg);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1) rotate(0deg);
    }
}

.time-up-message {
    font-family: 'Fredoka', sans-serif;
    color: white;
    background: var(--gradient-warm);
    padding: 15px 30px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.4em;
    box-shadow: var(--shadow-lg), var(--glow-purple);
    animation: timeUpShake 0.5s ease-in-out;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@keyframes timeUpShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px) rotate(-2deg);
    }
    75% {
        transform: translateX(10px) rotate(2deg);
    }
}

/* Table Creator Styles */
.table-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    padding: 12px 24px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1em;
    font-weight: 600;
    background: var(--gradient-cool);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.control-btn:hover {
    background: linear-gradient(135deg, #5B5FFF, #4947d4);
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-md), var(--glow-blue);
}


#tableEditorContainer {
    overflow-x: auto;
    max-width: 100%;
}

.table-editor {
    border-collapse: collapse;
    width: 100%;
    margin-top: 20px;
    min-width: auto;
}

.table-editor th, .table-editor td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    position: relative;
}

.table-editor th {
    background-color: #f2f2f2;
}

.table-editor th input {
    width: calc(100% - 20px);
    border: none;
    background: transparent;
    text-align: center;
    font-weight: bold;
    min-width: 80px;
    box-sizing: border-box;
}

.table-editor td {
    cursor: pointer;
    min-width: 100px;
    height: 60px;
    background-color: #f9f9f9;
}

.table-editor td:hover {
    background-color: #e9e9e9;
}

.table-editor td.filled {
    background-color: #d4edda;
    font-weight: bold;
}

.table-editor td.disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    color: #fff;
}


.delete-icon {
    cursor: pointer;
    color: #ff6b6b;
    font-weight: bold;
    font-size: 1.2em;
    padding: 0 5px;
}
.delete-icon:hover {
    color: #ff0000;
}


/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    animation: modalFadeIn 0.3s ease-out;
    padding: 20px;
    box-sizing: border-box;
}

.modal.active {
    display: flex;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    padding: 35px;
    border: none;
    width: 85%;
    max-width: 550px;
    border-radius: 25px;
    position: relative;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.4s ease-out;
    border: 5px solid transparent;
    background-clip: padding-box;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 85vh;
    box-sizing: border-box;
}

.modal-content > * {
    max-width: 100%;
}

.modal-content .input-group,
.modal-content .creator-section {
    overflow-x: visible;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: var(--gradient-main);
    border-radius: 25px;
    z-index: -1;
    opacity: 0.5;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content h3 {
    font-family: 'Fredoka', sans-serif;
    color: transparent;
    background: var(--gradient-main);
    background-clip: text;
    -webkit-background-clip: text;
    font-size: 2em;
    margin-bottom: 25px;
    font-weight: 700;
}

.modal .input-group {
    margin-bottom: 15px;
}

.modal .input-group input,
.modal .input-group select,
.modal .input-group textarea {
    box-sizing: border-box;
    max-width: 100%;
}

.close-btn {
    color: #999;
    float: right;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f0f0f0;
    line-height: 1;
}

.close-btn:hover,
.close-btn:focus {
    color: white;
    background: var(--color-danger);
    transform: rotate(90deg) scale(1.1);
    text-decoration: none;
    cursor: pointer;
}

/* Teams Management */
.game-controls {
    margin-bottom: 20px;
}

.teams-display {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.team-card {
    padding: 15px 25px;
    border-radius: 50px;
    color: white;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.team-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.team-card:hover::before {
    left: 100%;
}

.team-card:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-xl);
}

.team-card.winner {
    animation: winnerGlow 1.5s ease-in-out infinite;
    transform: scale(1.1);
}

@keyframes winnerGlow {
    0%, 100% {
        box-shadow: 0 0 30px gold, 0 0 60px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 50px gold, 0 0 80px rgba(255, 215, 0, 0.8);
    }
}

.team-score {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: 700;
    backdrop-filter: blur(5px);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.scoring-controls {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.scoring-controls .input-group {
    max-width: 200px;
}


#teamScoringButtons {
    display: flex;
    gap: 10px;
}

.team-score-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 50px;
    color: white;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-sm);
    font-size: 1em;
}

.team-score-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-md);
}

.teams-list {
    margin-bottom: 20px;
}

.team-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.color-palette {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.color-box {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-sm);
}

.color-box:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: var(--shadow-md);
}

.color-box.selected {
    border-color: #2c3e50;
    transform: scale(1.15);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 0, 0, 0.3);
}


/* Footer Styles */
footer {
    background: rgba(255, 255, 255, 0.98);
    padding: 40px 20px 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    border-top: 4px solid var(--color-accent);
    position: relative;
    z-index: 10;
}

.footer-content {
    display: flex;
    justify-content: space-around;
    max-width: 1200px;
    margin: 0 auto 30px;
    gap: 40px;
    flex-wrap: wrap;
}

.footer-section {
    flex: 1;
    min-width: 200px;
}

.footer-section h4 {
    font-family: 'Fredoka', sans-serif;
    color: transparent;
    background: var(--gradient-main);
    background-clip: text;
    -webkit-background-clip: text;
    font-size: 1.3em;
    margin-bottom: 15px;
    font-weight: 700;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: #555;
    text-decoration: none;
    font-size: 1em;
    transition: all 0.3s ease;
    display: inline-block;
    position: relative;
}

.footer-section ul li a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-main);
    transition: width 0.3s ease;
}

.footer-section ul li a:hover {
    color: var(--color-primary);
    transform: translateX(5px);
}

.footer-section ul li a:hover::after {
    width: 100%;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    margin-top: 20px;
}

.footer-bottom p {
    color: #666;
    font-size: 0.95em;
    margin: 5px 0;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 30px;
    }

    .footer-section {
        text-align: center;
    }
}

/* Landing Page Styles */
.landing-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    text-align: center;
}


.create-game-btn, .show-games-btn {
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    text-decoration: none;
    color: white;
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: none;
    cursor: pointer;
    text-align: center;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: var(--shadow-xl);
}

.create-game-btn::before,
.show-games-btn::before {
    content: '';
    position: absolute;
    top: 25%;
    left: 25%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.create-game-btn:hover::before,
.show-games-btn:hover::before {
    width: 400px;
    height: 400px;
}

.create-game-btn {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    animation: buttonSlideIn 0.6s ease-out;
    font-size: 1.6em;
    padding: 20px 40px;
    width: 100%;
    max-width: 400px;
}

.create-game-btn:hover {
    background: linear-gradient(135deg, #44A08D, #2d8b73);
    transform: translateY(-5px) scale(1.05);
    box-shadow: var(--shadow-xl), var(--glow-success);
}

.show-games-btn {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    animation: buttonSlideIn 0.6s ease-out 0.1s backwards;
    font-size: 1em;
    padding: 12px 28px;
    width: auto;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.show-games-btn:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c7a7b);
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

@keyframes buttonSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-50px) rotate(-5deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) rotate(0deg);
    }
}

/* Slide Panel Animation */
.slide-panel {
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding-top 0.4s ease-out, padding-bottom 0.4s ease-out, opacity 0.3s ease-out;
    opacity: 0;
    background: white;
    border-radius: 10px;
    margin-top: 20px;
    width: 100%;
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
}

.slide-panel.active {
    opacity: 1;
    padding-top: 20px;
    padding-bottom: 20px;
}

/* Show Games Panel specific styles */
.show-games-panel {
    background: white;
    border-radius: 10px;
    margin-top: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.games-section {
    padding: 15px;
}

.games-section h3 {
    margin-top: 0;
    color: #333;
    text-align: center;
}

#gamesListContainer {
    text-align: left;
}

/* Custom Alert/Confirm Dialog */
.custom-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: modalFadeIn 0.3s ease-out;
}

.custom-dialog-overlay.active {
    display: flex;
}

.custom-dialog {
    background: white;
    padding: 40px;
    border-radius: 25px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.4s ease-out;
    border: 5px solid transparent;
    background-clip: padding-box;
    position: relative;
}

.custom-dialog::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: var(--gradient-main);
    border-radius: 25px;
    z-index: -1;
    opacity: 0.5;
}

.custom-dialog-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    animation: iconBounce 0.6s ease-out;
}

.custom-dialog-icon.alert {
    background: linear-gradient(135deg, #FDC500, #F7931E);
    color: white;
    box-shadow: var(--shadow-lg), 0 0 30px rgba(253, 197, 0, 0.5);
}

.custom-dialog-icon.confirm {
    background: var(--gradient-cool);
    color: white;
    box-shadow: var(--shadow-lg), var(--glow-blue);
}

.custom-dialog-icon.success {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
    box-shadow: var(--shadow-lg), var(--glow-success);
}

.custom-dialog-icon.error {
    background: var(--gradient-warm);
    color: white;
    box-shadow: var(--shadow-lg), var(--glow-purple);
}

@keyframes iconBounce {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    60% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.custom-dialog-title {
    font-family: 'Fredoka', sans-serif;
    color: transparent;
    background: var(--gradient-main);
    background-clip: text;
    -webkit-background-clip: text;
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
}

.custom-dialog-message {
    font-size: 1.1em;
    color: #555;
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.6;
}

.custom-dialog-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.custom-dialog-btn {
    padding: 14px 32px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 120px;
}

.custom-dialog-btn-primary {
    background: var(--gradient-main);
    color: white;
}

.custom-dialog-btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg), var(--glow-orange);
}

.custom-dialog-btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.custom-dialog-btn-secondary:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c7a7b);
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.custom-dialog-btn-success {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
}

.custom-dialog-btn-success:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg), var(--glow-success);
}

.custom-dialog-btn-danger {
    background: var(--gradient-warm);
    color: white;
}

.custom-dialog-btn-danger:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg), var(--glow-purple);
}

/* Decorative Floating Elements */
body::after {
    content: '';
    position: fixed;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(253, 197, 0, 0.15), transparent);
    border-radius: 50%;
    top: 10%;
    right: 5%;
    pointer-events: none;
    animation: float1 20s ease-in-out infinite;
    z-index: 0;
}

@keyframes float1 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -50px) scale(1.1);
    }
    66% {
        transform: translate(-30px, -30px) scale(0.9);
    }
}

/* Additional decorative elements */
.main-content::before {
    content: '';
    position: fixed;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(91, 95, 255, 0.12), transparent);
    border-radius: 50%;
    bottom: 15%;
    left: 8%;
    pointer-events: none;
    animation: float2 15s ease-in-out infinite;
    z-index: 0;
}

@keyframes float2 {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    50% {
        transform: translate(-20px, 40px) rotate(180deg);
    }
}

.main-content::after {
    content: '';
    position: fixed;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(78, 205, 196, 0.15), transparent);
    border-radius: 50%;
    top: 60%;
    right: 12%;
    pointer-events: none;
    animation: float3 18s ease-in-out infinite;
    z-index: 0;
}

@keyframes float3 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(40px, -40px) scale(1.2);
    }
}

/* Final Results Screen */
.final-results-screen {
    display: none;
    width: 100%;
    padding: 40px 20px;
    text-align: center;
}

.final-results-screen.active {
    display: block;
    animation: containerEntrance 0.6s ease-out;
}

.final-results-content {
    max-width: 800px;
    margin: 0 auto;
}

.results-podium {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 10px 15px;
        flex-direction: column;
        gap: 10px;
    }

    .header-left, .header-right {
        width: 100%;
        justify-content: center;
    }

    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2.5em;
    }

    h1::after {
        width: 80px;
        height: 4px;
    }

    .mode-selector {
        flex-direction: column;
        align-items: center;
    }

    .mode-btn {
        width: 100%;
        max-width: 300px;
    }

    .button-panel {
        max-width: 100%;
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .create-game-btn {
        padding: 18px 30px;
        font-size: 1.3em;
        width: 90%;
        max-width: 350px;
    }

    .show-games-btn {
        padding: 10px 24px;
        font-size: 0.9em;
        width: auto;
    }

    .timer {
        width: 100px;
        height: 100px;
        font-size: 2.5em;
    }

    .question-text {
        font-size: 1.8em;
        padding: 20px;
    }

    .answer-text {
        font-size: 2.2em;
        padding: 20px;
    }

    .start-btn {
        font-size: 1.4em;
        padding: 16px 40px;
    }

    .modal-content {
        padding: 25px;
        width: 90%;
    }

    .creator-mode {
        padding: 20px;
    }

    /* Hide decorative floating elements on mobile */
    body::after,
    .main-content::before,
    .main-content::after {
        display: none;
    }
}

/* ========================================
   PROGRESS MAP - Geometric Level Selector
   ======================================== */

.progress-map {
    position: fixed;
    right: 15px;
    top: calc(15% + 120px);
    max-height: calc(100vh - 30% - 140px);
    max-width: 120px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 245, 235, 0.98));
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 28px;
    box-shadow:
        0 12px 48px rgba(255, 107, 53, 0.25),
        0 6px 24px rgba(0, 0, 0, 0.12),
        inset 0 2px 0 rgba(255, 255, 255, 0.9),
        inset 0 -2px 8px rgba(255, 107, 53, 0.1);
    border: 3px solid transparent;
    background-image:
        linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 245, 235, 0.98)),
        linear-gradient(135deg, #FF6B35, #F7931E, #FDC500);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-map:hover {
    transform: translateX(-5px) scale(1.03);
    box-shadow:
        0 16px 64px rgba(255, 107, 53, 0.35),
        0 8px 32px rgba(0, 0, 0, 0.18),
        inset 0 2px 0 rgba(255, 255, 255, 0.9),
        inset 0 -2px 12px rgba(255, 107, 53, 0.15);
}

/* Custom scrollbar for progress map */
.progress-map::-webkit-scrollbar {
    width: 6px;
}

.progress-map::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.progress-map::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 10px;
}

.progress-map::-webkit-scrollbar-thumb:hover {
    background: var(--color-secondary);
}

.progress-map-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.75em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    padding-bottom: 12px;
    margin-bottom: 8px;
    position: relative;
}

.progress-map-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
    border-radius: 2px;
}

.progress-map-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

/* Connecting Line */
.progress-map-items::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 20px;
    bottom: 20px;
    width: 3px;
    background: linear-gradient(
        to bottom,
        rgba(78, 205, 196, 0.6) 0%,
        rgba(91, 95, 255, 0.4) 50%,
        rgba(157, 78, 221, 0.3) 100%
    );
    transform: translateX(-50%);
    border-radius: 2px;
    z-index: 0;
}

.progress-map-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1;
}

/* Diamond/Hexagonal Shape Container */
.progress-map-item-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(45deg);
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.progress-map-item-content {
    transform: rotate(-45deg);
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 0.95em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: all 0.3s ease;
}

/* State: Locked (Future Question) */
.progress-map-item.locked {
    cursor: not-allowed;
    opacity: 0.5;
}

.progress-map-item.locked .progress-map-item-inner {
    background: linear-gradient(135deg, #E0E0E0 0%, #BDBDBD 100%);
    border: 2px solid #9E9E9E;
}

.progress-map-item.locked .progress-map-item-content {
    color: #757575;
}

/* State: Completed (Past Question) */
.progress-map-item.completed {
    cursor: pointer;
}

.progress-map-item.completed .progress-map-item-inner {
    background: linear-gradient(135deg, var(--color-success) 0%, #3DBDB4 100%);
    border: 3px solid #2EAD9F;
}

.progress-map-item.completed .progress-map-item-content {
    color: white;
    font-size: 1.2em;
}

.progress-map-item.completed:hover {
    transform: scale(1.15);
}

.progress-map-item.completed:hover .progress-map-item-inner {
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.5);
    transform: rotate(45deg) scale(1.05);
}

/* State: Current (Active Question) */
.progress-map-item.current {
    cursor: default;
}

.progress-map-item.current .progress-map-item-inner {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 50%, var(--color-accent) 100%);
    border: 4px solid white;
    box-shadow:
        0 0 0 2px var(--color-accent),
        0 6px 20px rgba(255, 107, 53, 0.4);
    animation: progressPulse 2s ease-in-out infinite;
}

.progress-map-item.current .progress-map-item-content {
    color: white;
    font-size: 1.15em;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: contentGlow 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% {
        transform: rotate(45deg) scale(1);
        box-shadow:
            0 0 0 2px var(--color-accent),
            0 6px 20px rgba(255, 107, 53, 0.4);
    }
    50% {
        transform: rotate(45deg) scale(1.12);
        box-shadow:
            0 0 0 3px var(--color-accent),
            0 10px 32px rgba(255, 107, 53, 0.7),
            0 0 40px rgba(253, 197, 0, 0.5);
    }
}

@keyframes contentGlow {
    0%, 100% {
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    50% {
        text-shadow:
            0 0 8px rgba(255, 255, 255, 0.6),
            0 0 16px rgba(253, 197, 0, 0.4),
            0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

/* Tooltip on Hover */
.progress-map-item::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 20px);
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: rgba(40, 40, 40, 0.95);
    color: white;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 0.85em;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.progress-map-item::before {
    content: '';
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 8px;
    border-color: transparent transparent transparent rgba(40, 40, 40, 0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
}

.progress-map-item:hover::after,
.progress-map-item:hover::before {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.progress-map-item.locked:hover::after,
.progress-map-item.locked:hover::before {
    opacity: 0;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .progress-map {
        right: 10px;
        top: calc(50% + 80px);
        max-height: calc(100vh - 50% - 100px);
        padding: 16px 12px;
        border-radius: 20px;
        gap: 6px;
        max-width: 100px;
    }

    .progress-map:hover {
        transform: translateX(-3px) scale(1.02);
    }

    .progress-map-title {
        font-size: 0.6em;
        padding-bottom: 6px;
    }

    .progress-map-items {
        gap: 10px;
    }

    .progress-map-item {
        width: 36px;
        height: 36px;
    }

    .progress-map-item-content {
        font-size: 0.85em;
    }

    /* Hide tooltips on mobile */
    .progress-map-item::after,
    .progress-map-item::before {
        display: none;
    }
}

@media (max-width: 480px) {
    .progress-map {
        right: 5px;
        top: calc(50% + 60px);
        max-height: calc(100vh - 50% - 80px);
        padding: 12px 8px;
        gap: 4px;
        max-width: 90px;
    }

    .progress-map:hover {
        transform: translateX(-2px) scale(1.01);
    }

    .progress-map-item {
        width: 30px;
        height: 30px;
    }

    .progress-map-item-inner {
        border-radius: 6px;
    }

    .progress-map-item-content {
        font-size: 0.75em;
    }
}

/* ========================================
   CUSTOM CONFIRMATION DIALOG
   ======================================== */

.confirm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.confirm-dialog-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-dialog {
    background: linear-gradient(145deg, #ffffff 0%, #fff5f0 100%);
    border-radius: 32px;
    padding: 48px 40px;
    max-width: 500px;
    width: 90%;
    box-shadow:
        0 20px 80px rgba(255, 107, 53, 0.3),
        0 10px 40px rgba(0, 0, 0, 0.2),
        inset 0 2px 0 rgba(255, 255, 255, 0.9);
    border: 3px solid transparent;
    background-image:
        linear-gradient(145deg, #ffffff, #fff5f0),
        linear-gradient(135deg, #FF6B35, #F7931E, #FDC500);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    transform: scale(0.8) translateY(-40px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.confirm-dialog-overlay.active .confirm-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.confirm-dialog-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow:
        0 8px 24px rgba(255, 107, 53, 0.4),
        inset 0 2px 8px rgba(255, 255, 255, 0.3);
    animation: iconPulse 2s ease-in-out infinite;
}

.confirm-dialog-icon svg {
    width: 48px;
    height: 48px;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 8px 24px rgba(255, 107, 53, 0.4),
            inset 0 2px 8px rgba(255, 255, 255, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow:
            0 12px 32px rgba(255, 107, 53, 0.6),
            inset 0 2px 8px rgba(255, 255, 255, 0.3),
            0 0 40px rgba(253, 197, 0, 0.3);
    }
}

.confirm-dialog-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8em;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.confirm-dialog-message {
    font-size: 1.1em;
    text-align: center;
    color: #444;
    line-height: 1.6;
    margin-bottom: 32px;
}

.confirm-dialog-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.confirm-dialog-btn {
    padding: 16px 40px;
    border: none;
    border-radius: 16px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    min-width: 140px;
}

.confirm-dialog-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.confirm-dialog-btn:active::before {
    width: 300px;
    height: 300px;
}

.confirm-dialog-btn-cancel {
    background: linear-gradient(135deg, #e0e0e0, #bdbdbd);
    color: #444;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.confirm-dialog-btn-cancel:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.confirm-dialog-btn-confirm {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.confirm-dialog-btn-confirm:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 6px 24px rgba(220, 38, 38, 0.5),
        0 0 32px rgba(220, 38, 38, 0.3);
}

/* ========================================
   GAMES MODAL POPUP
   ======================================== */

.games-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    padding: 20px;
}

.games-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.games-modal {
    background: linear-gradient(145deg, #ffffff 0%, #fef3e7 100%);
    border-radius: 32px;
    max-width: 900px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 24px 100px rgba(255, 107, 53, 0.35),
        0 12px 50px rgba(0, 0, 0, 0.25),
        inset 0 2px 0 rgba(255, 255, 255, 0.9);
    border: 4px solid transparent;
    background-image:
        linear-gradient(145deg, #ffffff, #fef3e7),
        linear-gradient(135deg, #FF6B35, #F7931E, #FDC500, #4ECDC4);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    transform: scale(0.85) translateY(-60px);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.games-modal-overlay.active .games-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.games-modal-header {
    padding: 32px 40px;
    border-bottom: 3px solid rgba(255, 107, 53, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(247, 147, 30, 0.1));
    border-radius: 28px 28px 0 0;
}

.games-modal-header h2 {
    font-family: 'Fredoka', sans-serif;
    font-size: 2em;
    font-weight: 700;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.games-modal-close {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ff5e78, #dc2626);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.games-modal-close svg {
    width: 24px;
    height: 24px;
}

.games-modal-close:hover {
    transform: rotate(90deg) scale(1.1);
    box-shadow:
        0 6px 20px rgba(220, 38, 38, 0.5),
        0 0 32px rgba(220, 38, 38, 0.3);
}

.games-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
}

.games-modal-content::-webkit-scrollbar {
    width: 10px;
}

.games-modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    margin: 10px 0;
}

.games-modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    border-radius: 10px;
}

.games-modal-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #F7931E, #FDC500);
}

/* ========================================
   WELCOME SCREEN
   ======================================== */

.welcome-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 400px;
    text-align: center;
}

.welcome-screen.active {
    display: flex;
}

.welcome-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px 50px;
    box-shadow: var(--shadow-xl), 0 0 60px rgba(255, 107, 53, 0.15);
    border: 2px solid rgba(255, 107, 53, 0.2);
    max-width: 600px;
    width: 100%;
    margin-bottom: 30px;
}

.welcome-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.5em;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
}

.welcome-description {
    font-size: 1.2em;
    color: #555;
    line-height: 1.6;
    margin-bottom: 25px;
}

.welcome-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.welcome-stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.1), rgba(91, 95, 255, 0.1));
    border-radius: 50px;
    font-weight: 600;
    color: #5B5FFF;
    font-size: 1em;
}

.welcome-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.welcome-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 28px;
    border: none;
    border-radius: 16px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    box-shadow: var(--shadow-md);
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.welcome-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.welcome-btn.primary {
    background: var(--gradient-main);
    color: white;
    border: none;
    box-shadow: var(--shadow-md), var(--glow-orange);
}

.welcome-btn.primary:hover {
    box-shadow: var(--shadow-lg), 0 0 40px rgba(255, 107, 53, 0.5);
    transform: translateY(-3px) scale(1.02);
}

.welcome-btn svg {
    flex-shrink: 0;
}

/* Device button in game controls */
.device-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.device-btn svg {
    flex-shrink: 0;
}

/* ========================================
   COLLAPSIBLE BUTTON PANEL
   ======================================== */

.button-panel {
    position: relative;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
}

/* When game is active, make buttons smaller and collapsible */
body.game-active .button-panel {
    position: fixed;
    top: 15%;
    transform: translateY(-50%);
    right: 15px;
    z-index: 900;
    max-width: 200px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 250, 245, 0.98));
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 14px;
    border-radius: 20px;
    box-shadow:
        0 8px 32px rgba(255, 107, 53, 0.35),
        0 4px 16px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    border: 2px solid rgba(255, 107, 53, 0.4);
    gap: 10px;
}

body.game-active .button-panel .mode-btn {
    font-size: 0.95em;
    font-weight: 600;
    padding: 12px 20px;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

body.game-active .button-panel.collapsed {
    max-width: 58px;
    padding: 10px;
    transform: translateY(-50%);
}

body.game-active .button-panel.collapsed .mode-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 0;
    border-radius: 50%;
    min-width: unset;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.game-active .button-panel.collapsed .mode-btn::before {
    font-size: 18px;
    display: block;
    transition: transform 0.3s ease;
}

body.game-active .button-panel.collapsed .create-game-btn::before {
    content: '✨';
}

body.game-active .button-panel.collapsed .show-games-btn::before {
    content: '🎮';
}

body.game-active .button-panel.collapsed .fullscreen-btn::before {
    content: '⛶';
}

body.game-active .button-panel.collapsed .fullscreen-btn.is-fullscreen::before {
    content: '⊡';
}

body.game-active .button-panel.collapsed .fullscreen-btn svg {
    display: none;
}

body.game-active .button-panel:not(.collapsed) .fullscreen-btn svg {
    display: block;
}

.fullscreen-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.fullscreen-btn svg {
    flex-shrink: 0;
}

/* Expand on hover */
body.game-active .button-panel.collapsed:hover {
    max-width: 200px;
    padding: 14px;
}

body.game-active .button-panel.collapsed:hover .mode-btn {
    width: auto;
    height: auto;
    padding: 12px 20px;
    font-size: 0.95em;
    border-radius: 12px;
}

body.game-active .button-panel.collapsed:hover .mode-btn::before {
    content: '';
    display: none;
}

/* Toggle button for collapsed panel */
.button-panel-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: white;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    transition: all 0.3s ease;
    position: absolute;
    bottom: -48px;
    left: 50%;
    transform: translateX(-50%);
}

body.game-active .button-panel.collapsed .button-panel-toggle {
    display: block;
}

.button-panel-toggle:hover {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

/* ========================================
   PROGRESS MAP VISIBILITY
   ======================================== */

/* Hide progress map only in table mode */
body.table-mode .progress-map {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(120px);
    transition: all 0.4s ease;
}

/* Show progress map by default and in consecutive mode */
.progress-map {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Show on landing page when no game is active */
body:not(.game-active) .progress-map {
    opacity: 0.8;
    pointer-events: none;
}

body:not(.game-active) .progress-map:hover {
    opacity: 1;
}

/* Add a hint when progress map is empty */
body:not(.game-active) .progress-map-items:empty::before {
    content: 'Start a game to see progress';
    display: block;
    font-size: 0.7em;
    color: #999;
    text-align: center;
    padding: 12px 8px;
    line-height: 1.4;
    font-style: italic;
}

/* ========================================
   GAME MODE STATE MANAGEMENT
   ======================================== */

/* Hide old games panel (now using modal) */
.show-games-panel.slide-panel {
    display: none !important;
}

/* Ensure smooth transitions between modes */
#consecutiveMode,
#tableMode {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#consecutiveMode:not(.active),
#tableMode:not(.active) {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

#consecutiveMode.active,
#tableMode.active {
    opacity: 1;
    transform: scale(1);
}

/* ========================================
   RESPONSIVE IMPROVEMENTS
   ======================================== */

@media (max-width: 768px) {
    .confirm-dialog {
        padding: 32px 24px;
        max-width: 90%;
    }

    .confirm-dialog-title {
        font-size: 1.5em;
    }

    .confirm-dialog-message {
        font-size: 1em;
    }

    .confirm-dialog-actions {
        flex-direction: column;
        gap: 12px;
    }

    .confirm-dialog-btn {
        width: 100%;
    }

    .games-modal {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 24px;
    }

    .games-modal-header {
        padding: 24px 20px;
    }

    .games-modal-header h2 {
        font-size: 1.5em;
    }

    .games-modal-content {
        padding: 20px;
    }

    body.game-active .button-panel {
        right: 10px;
        top: 15%;
        max-width: 160px;
    }

    body.game-active .button-panel.collapsed {
        max-width: 58px;
    }

    body.game-active .button-panel .mode-btn {
        font-size: 0.9em;
        padding: 10px 16px;
    }
}

/* ========================================
   ENHANCED ANIMATIONS
   ======================================== */

@keyframes modalSlideIn {
    from {
        transform: translateY(-100px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for game list items */
.games-modal-content > div > div {
    animation: fadeInUp 0.5s ease backwards;
}

.games-modal-content > div > div:nth-child(1) { animation-delay: 0.05s; }
.games-modal-content > div > div:nth-child(2) { animation-delay: 0.1s; }
.games-modal-content > div > div:nth-child(3) { animation-delay: 0.15s; }
.games-modal-content > div > div:nth-child(4) { animation-delay: 0.2s; }
.games-modal-content > div > div:nth-child(5) { animation-delay: 0.25s; }
.games-modal-content > div > div:nth-child(6) { animation-delay: 0.3s; }

/* ========================================
   AI QUESTION GENERATION
   ======================================== */

.creator-question-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 8px;
}

.ai-generate-btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 50px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-md);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.ai-generate-btn:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a3d96);
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(102, 126, 234, 0.4);
}

.ai-generate-btn:active {
    transform: translateY(-2px) scale(1.02);
}

/* AI Modal */
.ai-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: modalFadeIn 0.3s ease-out;
}

.ai-modal-box {
    background: white;
    border-radius: 25px;
    padding: 35px;
    width: 85%;
    max-width: 520px;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.4s ease-out;
    max-height: 85vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.ai-modal-box h3 {
    margin: 0 0 20px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5em;
    font-weight: 700;
    color: transparent;
    background: linear-gradient(135deg, #667eea, #764ba2);
    background-clip: text;
    -webkit-background-clip: text;
}

.ai-modal-box textarea {
    width: 100%;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
}

.ai-modal-box input[type="number"] {
    width: 100px;
}

.ai-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Loading state */
.ai-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #667eea;
    font-size: 0.95rem;
    margin-top: 12px;
}

.ai-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(102, 126, 234, 0.25);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: ai-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

/* Two-step modal extras */
.ai-size-row {
    display: flex;
    gap: 20px;
}
.ai-size-row .input-group {
    flex: 1;
}

.ai-themes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.ai-themes-header label {
    margin-bottom: 0;
}

.ai-suggest-btn {
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 20px;
    border: 2px solid #667eea;
    background: transparent;
    color: #667eea;
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    transition: background 0.2s, color 0.2s;
}
.ai-suggest-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
}
.ai-suggest-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.ai-theme-inputs {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ai-theme-input {
    width: 100%;
    box-sizing: border-box;
}

.ai-loading-center {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
    gap: 14px;
    font-size: 1rem;
}
.ai-spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 4px;
}

.ai-limit-hint {
    margin: 4px 0 12px;
    font-size: 0.78rem;
    color: #888;
}


/* ================================================================
   BROADCAST POPUP — Quiz style overrides
   (quiz.css is only loaded on the quiz page, so no scoping needed)
   ================================================================ */

#broadcast-popup .bsp-panel {
    background: #fff;
    border: none;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.06);
}

#broadcast-popup .bsp-rail,
#broadcast-popup .bsp-texture { display: none; }

#broadcast-popup .bsp-header {
    background: linear-gradient(135deg, #FF6B35, #FF8C5A);
    border-bottom: none;
    border-radius: 24px 24px 0 0;
    padding: 16px 20px;
}

#broadcast-popup .bsp-onair-dot {
    background: #fff;
    box-shadow: 0 0 8px rgba(255,255,255,0.9), 0 0 20px rgba(255,255,255,0.4);
}
#broadcast-popup .bsp-onair-label {
    color: rgba(255,255,255,0.85);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.5rem;
    letter-spacing: 0.12em;
}

#broadcast-popup .bsp-title {
    color: #fff;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-shadow: none;
}
#broadcast-popup .bsp-subtitle {
    color: rgba(255,255,255,0.8);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0;
    margin-top: 2px;
}

#broadcast-popup .bsp-close,
#broadcast-popup .bsp-minimize {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
    border-radius: 8px;
}
#broadcast-popup .bsp-close:hover    { background: rgba(255,255,255,0.32); border-color: rgba(255,255,255,0.5); }
#broadcast-popup .bsp-minimize:hover { background: rgba(255,255,255,0.32); border-color: rgba(255,255,255,0.5); color: #fff; }

#broadcast-popup .bsp-qr-section { padding: 20px 20px 12px; }

#broadcast-popup .bsp-qr-frame {
    background: #fff;
    border: 2px solid #f0f0f0;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
#broadcast-popup .bsp-corner { display: none; }

#broadcast-popup .bsp-qr-label {
    font-family: 'DM Sans', sans-serif;
    color: #94a3b8;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
}

#broadcast-popup .bsp-url-btn {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: none;
}
#broadcast-popup .bsp-url-btn:hover { border-color: #FF6B35; }
#broadcast-popup .bsp-url-btn.bsp-copied { border-color: #27ae60; }

#broadcast-popup .bsp-url-text {
    font-family: 'DM Sans', sans-serif;
    color: #FF6B35;
    font-size: 0.72rem;
    text-shadow: none;
    letter-spacing: 0;
}
#broadcast-popup .bsp-url-btn.bsp-copied .bsp-url-text { color: #27ae60; text-shadow: none; }

#broadcast-popup .bsp-copy-badge {
    font-family: 'DM Sans', sans-serif;
    color: #94a3b8;
    border-color: #e2e8f0;
    border-radius: 6px;
    letter-spacing: 0.05em;
}
#broadcast-popup .bsp-url-btn:hover .bsp-copy-badge     { color: #FF6B35; border-color: rgba(255,107,53,0.3); }
#broadcast-popup .bsp-url-btn.bsp-copied .bsp-copy-badge { color: #27ae60; border-color: rgba(39,174,96,0.35); }

#broadcast-popup .bsp-open-tv-link {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0;
    color: #FF6B35;
}

#broadcast-popup .bsp-tv-row { padding: 0 18px 16px; }
#broadcast-popup .bsp-tv-label {
    font-family: 'DM Sans', sans-serif;
    color: #64748b;
    font-size: 0.8rem;
    letter-spacing: 0;
}
#broadcast-popup .bsp-tv-btn {
    border-radius: 20px;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

#broadcast-popup .bsp-footer {
    background: #f8fafc;
    border-top: 1px solid #e8ecf0;
    border-radius: 0 0 24px 24px;
}
#broadcast-popup .bsp-footer-text {
    font-family: 'DM Sans', sans-serif;
    color: #cbd5e1;
    font-size: 0.5rem;
    letter-spacing: 0.06em;
}
#broadcast-popup .bsp-bar { background: #FF6B35; }

/* Mini widget quiz overrides */
#bsp-mini-widget {
    border-radius: 16px;
    border-color: #e2e8f0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
#bsp-mini-widget .bsp-mini-expand {
    background: #fff;
    border-top-color: #e2e8f0;
    color: #FF6B35;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.06em;
}
#bsp-mini-widget .bsp-mini-expand:hover { background: #fff8f5; color: #e05020; }
