:root {
    /* Ultra Premium Palette */
    --bg-deep: #050505;
    /* True Black/Obsidian */
    --bg-mesh-1: #1a1a2e;
    /* Deep Midnight */
    --bg-mesh-2: #16213e;
    /* Dark Navy */
    --bg-mesh-3: #2a0a18;
    /* Deep Velvet */

    --accent-gold: #ffd700;
    --accent-cyan: #00f2ff;
    --accent-purple: #bd00ff;

    --glass-surface: rgba(20, 20, 25, 0.6);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);

    --shadow-premium: 0 20px 40px -10px rgba(0, 0, 0, 0.5);

    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
}

body {
    background: #050505;
    color: #e2e8f0;
    font-family: var(--font-body);
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* Premium Mesh Background */
/* Premium Mesh Background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 50% 50%, rgba(76, 29, 149, 0.15), transparent 50%),
        radial-gradient(circle at 10% 10%, rgba(56, 189, 248, 0.1), transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(236, 72, 153, 0.1), transparent 40%);
    z-index: -1;
    pointer-events: none;
    /* Key Fix: Prevent overlay blocking */
    animation: meshFlow 20s ease-in-out infinite alternate;
}

@keyframes meshFlow {
    0% {
        transform: rotate(0deg) scale(1);
    }

    100% {
        transform: rotate(5deg) scale(1.1);
    }
}

/* 3D Glass Card - Academic Style */
/* Ultra Glass Card */
.glass-card {
    background: var(--glass-surface);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: none;
    border-radius: 24px;
    box-shadow:
        var(--shadow-premium),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 0 rgba(0, 0, 0, 0.2);
    padding: 2rem;
    max-width: 600px;
    width: 95%;
    margin: 0 auto;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.glass-card:hover {
    box-shadow:
        0 30px 60px -12px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.25),
        inset 0 -1px 0 0 rgba(0, 0, 0, 0.1);
}

/* Premium Text Effects */
.premium-title {
    font-family: var(--font-heading);
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    text-shadow: 0 10px 30px rgba(165, 180, 252, 0.2);
}

.instructor-name {
    font-weight: 300;
    color: #94a3b8;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.assistant-name {
    font-weight: 400;
    color: var(--accent-cyan);
    font-size: 0.85rem;
    margin-top: 0.2rem;
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}

h1,
h2,
h3 {
    font-weight: 300;
    letter-spacing: 1px;
}

/* Gem Buttons */
.btn-glass {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: none;
    box-shadow:
        0 2px 5px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 0 rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: white;
    font-weight: 500;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn-glass:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    transform: translateY(-2px);
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.25),
        inset 0 -1px 0 0 rgba(0, 0, 0, 0.1);
}

/* Glow Variants */
.glass-glow-success {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.05) 100%);
    color: #4ade80;
}

.glass-glow-success:hover {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.25) 0%, rgba(34, 197, 94, 0.1) 100%);
    color: #86efac;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.glass-glow-warning {
    background: linear-gradient(180deg, rgba(234, 179, 8, 0.15) 0%, rgba(234, 179, 8, 0.05) 100%);
    color: #facc15;
}

.glass-glow-warning:hover {
    background: linear-gradient(180deg, rgba(234, 179, 8, 0.25) 0%, rgba(234, 179, 8, 0.1) 100%);
    color: #fde047;
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.glass-glow-danger {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
    color: #f87171;
}

.glass-glow-danger:hover {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0.1) 100%);
    color: #fca5a5;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.glass-glow-info {
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.15) 0%, rgba(6, 182, 212, 0.05) 100%);
    color: #22d3ee;
}

.glass-glow-info:hover {
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.25) 0%, rgba(6, 182, 212, 0.1) 100%);
    color: #67e8f9;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.glass-glow-primary {
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
    color: #60a5fa;
}

.glass-glow-primary:hover {
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0.1) 100%);
    color: #93c5fd;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.glass-glow-secondary {
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.15) 0%, rgba(148, 163, 184, 0.05) 100%);
    color: #cbd5e1;
}

.glass-glow-secondary:hover {
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.25) 0%, rgba(148, 163, 184, 0.1) 100%);
    color: #f1f5f9;
    box-shadow: 0 0 15px rgba(148, 163, 184, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Answer Card (Thumb-Optimized) */
.answer-card {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.15), inset 0 -1px 0 0 rgba(0, 0, 0, 0.2);
    border-radius: 18px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: left;
}

.answer-card:active {
    transform: scale(0.98);
}

.answer-card.selected {
    background: rgba(20, 184, 166, 0.15);
    /* Teal tint */
    box-shadow: 0 0 15px rgba(20, 184, 166, 0.2), inset 0 1px 0 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.answer-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    /* Minimal accent stripe */
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.2s;
}

.answer-card.selected::before {
    background: var(--accent-teal);
}

/* Confidence Slider */
.confidence-wrapper {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    border: none;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.15), inset 0 -1px 0 0 rgba(0, 0, 0, 0.2);
}

/* Energy Pulse Visualization */
.energy-wave {
    height: 4px;
    background: linear-gradient(90deg, var(--accent-teal), var(--accent-success), var(--accent-teal));
    width: 100%;
    animation: pulseWave 2s infinite linear;
    opacity: 0.8;
    border-radius: 2px;
    /* Flattened */
}

@keyframes pulseWave {
    0% {
        background-position: 0% 50%;
        box-shadow: 0 0 5px var(--accent-teal);
    }

    50% {
        background-position: 100% 50%;
        box-shadow: 0 0 10px var(--accent-success);
    }

    100% {
        background-position: 0% 50%;
        box-shadow: 0 0 5px var(--accent-teal);
    }
}

.form-control-glass {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.15), inset 0 -1px 0 0 rgba(0, 0, 0, 0.2);
    color: white;
}

.form-control-glass:focus {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.3), inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

.form-control-glass::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Tone Chip Active State */
.tone-chip.active {
    box-shadow: 0 0 15px var(--accent-cyan);
    background: rgba(0, 242, 255, 0.1);
    color: white;
}

/* Select Dropdown override */
select.form-control-glass option {
    background-color: #333;
    /* Fallback for select options */
    color: white;
}

#qrcode {
    margin: 1rem 0;
    /* Reduced margin */
}

#qrcode img {
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    max-width: 100%;
    /* Key fix: Limit height to 35% of viewport height to ensure fit */
    max-height: 35vh;
    width: auto;
    height: auto;
}

/* Compact Headings for mobile */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    .glass-card {
        padding: 1.5rem;
    }

    #current-token {
        font-size: 2.5rem !important;
        /* Override bootstrap display-3 */
        letter-spacing: 2px !important;
    }
}

.pulse-btn {
    position: relative;
    overflow: hidden;
}

.pulse-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 1;
    }

    20% {
        transform: scale(25, 25);
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

.pulse-btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

.section-hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#instructor-activity-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#map-container {
    height: 250px;
    width: 100%;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.15), inset 0 -1px 0 0 rgba(0, 0, 0, 0.2);
    display: none;
    /* Hidden until location checked */
}

/* --- Live Feed Animations --- */
.emoji-bubble {
    position: fixed;
    bottom: -50px;
    font-size: 2rem;
    animation: floatUp 3s ease-out forwards;
    pointer-events: none;
    z-index: 1000;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 1;
        transform: translateY(-20px) scale(1.2);
    }

    100% {
        transform: translateY(-80vh) scale(1);
        opacity: 0;
    }
}

/* --- Mobile Native Feel --- */
.swipe-handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    margin: 8px auto;
    cursor: grab;
}

/* --- Multiplayer Presence (Figma-style) --- */
#live-presence-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    height: 40px;
    position: relative;
    z-index: 10;
}

.avatar-stack {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row-reverse;
    /* Stack overlap direction */
}

.avatar-bubble {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--glass-surface);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.15), inset 0 -1px 0 0 rgba(0, 0, 0, 0.2);
    margin-left: -10px;
    /* Overlap */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    backdrop-filter: blur(10px);
}

.avatar-bubble:hover {
    transform: translateY(-5px) scale(1.1);
    z-index: 10;
    border-color: var(--accent-cyan);
}

.avatar-typing::after {
    content: '';
    position: absolute;
    top: 0px;
    right: 0px;
    width: 8px;
    height: 8px;
    background: var(--accent-gold);
    border-radius: 50%;
    animation: typePulse 1s infinite;
    border: 1px solid black;
}

@keyframes typePulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 4px rgba(255, 215, 0, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
    }
}

/* --- Team Selector (Unicorn Upgrade) --- */
.team-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.15), inset 0 -1px 0 0 rgba(0, 0, 0, 0.2);
    display: inline-flex;
    /* Center it */
}

.team-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    /* Explicitly remove Bootstrap overrides if any */
    padding: 0;
    appearance: none;
}

.team-btn:hover {
    transform: scale(1.2);
}

.team-btn.active {
    transform: scale(1.2);
    box-shadow: 0 0 15px currentColor;
    box-shadow: 0 0 15px currentColor;
}

/* Define Team Colors explicitly */
.team-red {
    background: #FF6B6B;
    color: #FF6B6B;
}

.team-blue {
    background: #4ECDC4;
    color: #4ECDC4;
}

.team-gold {
    background: #FFEEAD;
    color: #FFEEAD;
}


/* --- Animated Eraser Divider --- */
.emoji-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    height: 80px;
    margin: 1rem 0;
}

.emoji-char {
    display: inline-block;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
    animation: float-pulse 3s ease-in-out infinite;
}

/* Bell Curve Sizing */
.emoji-char:nth-child(1),
.emoji-char:nth-child(5) {
    font-size: 1.2rem;
    opacity: 0.8;
}

.emoji-char:nth-child(2),
.emoji-char:nth-child(4) {
    font-size: 1.8rem;
    opacity: 0.9;
}

.emoji-char:nth-child(3) {
    font-size: 2.5rem;
    opacity: 1;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.6));
    animation: float-pulse-center 3s ease-in-out infinite;
    animation-delay: 0.4s;
}

@keyframes float-pulse-center {

    0%,
    100% {
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.6));
    }

    50% {
        transform: translateY(-8px) scale(1.25);
        filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.9));
    }
}

/* Wave Delays */
.emoji-char:nth-child(1) {
    animation-delay: 0s;
}

.emoji-char:nth-child(2) {
    animation-delay: 0.2s;
}

.emoji-char:nth-child(3) {
    animation-delay: 0.4s;
}

.emoji-char:nth-child(4) {
    animation-delay: 0.6s;
}

.emoji-char:nth-child(5) {
    animation-delay: 0.8s;
}

@keyframes float-pulse {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-6px) scale(1.15);
    }
}