/* --- GLOBAL VARIABLES --- */
:root {
    /* The LingoBlox Palette */
    --blox-blue: #1e90ff;   /* WHO */
    --blox-red: #ff4757;    /* ACTION */
    --blox-green: #2ed573;  /* WHAT */
    --blox-orange: #ffa502; /* TIME/PLACE */
    --blox-purple: #9b59b6; /* BRIDGE */
    
    /* UI Colors */
    --bg-light: #f4f7f6;
    --text-dark: #2f3542;
    --text-muted: #747d8c;
    --white: #ffffff;

    /* ELITE ANIMATION PHYSICS CURVES */
    --spring-heavy: cubic-bezier(0.34, 1.56, 0.64, 1);
    --spring-light: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --smooth-glide: cubic-bezier(0.16, 1, 0.3, 1);
    --swift-out: cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- RESET & APP FEEL --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Nunito', sans-serif;
    user-select: none; /* Prevents text highlighting when tapping */
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden; /* Prevents bouncing/scrolling */
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    background: var(--bg-light); /* Fills the whole browser window */
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px; /* Gives depth to screen transitions */
}

/* --- SCREEN MANAGER --- */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    padding: 20px;
    overflow-y: auto; /* ENABLES SCROLLING */
    -webkit-overflow-scrolling: touch; /* Smooth buttery iOS scrolling */
    will-change: transform, opacity;
}
.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Prevents top cut-off on small screens */
    align-items: center; 
    /* ELITE ANIMATION: Smooth 3D Slide up on load */
    animation: eliteScreenEntry 0.7s var(--smooth-glide) forwards;
}

/* --- LOGIN UI --- */
.login-box {
    width: 100%;
    max-width: 420px; /* Keeps inputs from stretching on desktop monitors */
    background: var(--white);
    padding: 50px 40px;
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.08); /* Soft floating shadow */
    text-align: center;
    /* ELITE ANIMATION */
    animation: popInBounce 0.8s var(--spring-heavy) both;
}

.logo {
    font-size: 42px;
    font-weight: 900;
    color: var(--text-dark);
    margin-bottom: 5px;
    /* ELITE ANIMATION */
    animation: float 6s ease-in-out infinite;
}
.logo span {
    color: var(--blox-red);
    display: inline-block;
    transition: transform 0.3s var(--spring-heavy);
}
.logo:hover span {
    transform: scale(1.1) rotate(5deg);
}

.subtitle {
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 40px;
}

.input-group input {
    width: 100%;
    padding: 16px 20px;
    margin-bottom: 15px;
    border: 2px solid #dfe4ea;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    outline: none;
    /* ELITE ANIMATION */
    transition: all 0.3s var(--smooth-glide);
}
.input-group input:focus {
    border-color: var(--blox-blue);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 144, 255, 0.12);
}

/* --- BUTTONS --- */
.btn-primary {
    width: 100%;
    background-color: var(--blox-green);
    color: var(--white);
    padding: 18px;
    font-size: 20px;
    font-weight: 900;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 6px 0px #168c48; /* The 3D Game Button Effect */
    /* ELITE ANIMATION */
    transition: transform 0.2s var(--spring-heavy), box-shadow 0.2s var(--spring-heavy), filter 0.2s;
    position: relative;
    overflow: hidden;
    will-change: transform;
}
/* ELITE ANIMATION: Shimmer effect */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    transition: left 0.7s var(--smooth-glide);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0px #168c48, 0 15px 25px rgba(46, 213, 115, 0.3);
    filter: brightness(1.05);
}
.btn-primary:hover::after {
    left: 200%;
}
.btn-primary:active {
    transform: translateY(6px);
    box-shadow: 0 0px 0px #168c48;
    transition: transform 0.1s, box-shadow 0.1s;
}

/* --- DASHBOARD UI --- */
.dashboard-container {
    width: 100%;
    max-width: 900px; /* Expands nicely on desktop */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header & HUD */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 15px;
    /* ELITE ANIMATION */
    animation: slideUpFade 0.6s 0.1s both var(--smooth-glide);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}
.avatar {
    width: 65px;
    height: 65px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 26px; /* Icon size */
    color: var(--blox-blue); /* Professional accent color */
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    flex-shrink: 0; /* Prevents the circle from squishing on small screens */
    /* ELITE ANIMATION */
    transition: transform 0.4s var(--spring-heavy);
}
.avatar:hover {
    transform: scale(1.1) rotate(-10deg);
}

.user-details h2 { font-size: 22px; font-weight: 900; }
.user-details p { color: var(--text-muted); font-weight: 700; }

.dash-stats {
    display: flex;
    gap: 10px;
}
.stat-badge {
    margin-right: 4px;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 900;
    font-size: 14px;
    /* ELITE ANIMATION */
    transition: transform 0.3s var(--spring-heavy);
}
.stat-badge:hover {
    transform: translateY(-3px) scale(1.05);
}
.stat-badge.streak { background: #ffeaa7; color: #d35400; }
/* ELITE ANIMATION: Fire pulsing */
.stat-badge.streak i { animation: flamePulse 1.5s infinite alternate ease-in-out; }
.stat-badge.xp { background: #81ecec; color: #00b894; }

/* Dashboard Cards */
.dash-card {
    background: var(--white);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    /* ELITE ANIMATION */
    transition: transform 0.4s var(--spring-heavy), box-shadow 0.4s var(--smooth-glide);
    will-change: transform;
}
.dash-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}
/* Staggered Load for Dashboard Grid */
.dash-grid .dash-card:nth-child(1) { animation: slideUpFade 0.6s 0.3s both var(--smooth-glide); }
.dash-grid .dash-card:nth-child(2) { animation: slideUpFade 0.6s 0.4s both var(--smooth-glide); }

.hero-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--blox-blue), #0984e3);
    color: var(--white);
    /* ELITE ANIMATION */
    animation: slideUpFade 0.6s 0.2s both var(--smooth-glide);
}
.hero-content h3 { font-size: 24px; font-weight: 900; }
.hero-content p { font-size: 16px; opacity: 0.9; }
.hero-card .btn-primary { width: auto; padding: 15px 40px; background: var(--blox-green); box-shadow: 0 5px 0px #168c48; }

/* Grid Layout (Bottom Modules) */
.dash-grid {
    display: flex;
    flex-direction: column; /* Stack on mobile */
    gap: 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #f1f2f6;
    padding-bottom: 10px;
}
.card-header h3 { font-size: 18px; font-weight: 900; }
.badge { padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 900; color: var(--white); }
.badge.red { background: var(--blox-red); }
.badge.blue { background: var(--blox-blue); }

/* Progress & Leaderboard Lists */
.homework-item p { font-size: 16px; font-weight: 700; margin-bottom: 5px; }
.sub-text { color: var(--text-muted); font-size: 14px; }
.progress-bar { width: 100%; height: 10px; background: #dfe4ea; border-radius: 10px; margin-top: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blox-green); border-radius: 10px; transition: width 0.6s cubic-bezier(0.65, 0, 0.35, 1); }

.leaderboard-list { list-style: none; }
.leaderboard-list li { 
    display: flex; 
    justify-content: space-between; 
    padding: 12px 10px; 
    border-bottom: 1px dashed #dfe4ea; 
    font-size: 16px; 
    font-weight: 700; 
    /* ELITE ANIMATION */
    border-radius: 8px;
    transition: all 0.3s var(--spring-heavy);
}
.leaderboard-list li:last-child { border-bottom: none; }
.leaderboard-list li strong { color: var(--blox-green); }

/* ELITE ANIMATION: Leaderboard Hover Logic */
.leaderboard-list li:hover {
    transform: translateX(10px) scale(1.02);
    background: #f8faff;
    border-bottom-color: transparent;
    box-shadow: -4px 4px 15px rgba(9, 132, 227, 0.08);
}
/* Stagger Leaderboard load */
.leaderboard-list li:nth-child(1) { animation: slideRightFade 0.5s 0.5s both var(--spring-light); }
.leaderboard-list li:nth-child(2) { animation: slideRightFade 0.5s 0.6s both var(--spring-light); }
.leaderboard-list li:nth-child(3) { animation: slideRightFade 0.5s 0.7s both var(--spring-light); }

/* --- DESKTOP MEDIA QUERY --- */
@media (min-width: 768px) {
    .dash-grid {
        flex-direction: row; /* Side by side on desktop! */
    }
    .dash-grid .dash-card {
        flex: 1; /* Makes both cards equal width */
    }
}

/* --- GAME ARENA UI --- */
.arena-container {
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Arena Top HUD */
.arena-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 5px;
    /* ELITE ANIMATION */
    animation: slideDownFade 0.5s both var(--smooth-glide);
}

.nav-btn-back {
    background: var(--white);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 18px;
    color: var(--text-dark);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
    display: flex;
    justify-content: center;
    align-items: center;
    /* ELITE ANIMATION */
    transition: transform 0.2s var(--spring-heavy), box-shadow 0.2s var(--smooth-glide);
}
.nav-btn-back:hover { transform: scale(1.1) translateY(-2px); box-shadow: 0 8px 15px rgba(0,0,0,0.1); }
.nav-btn-back:active { transform: scale(0.9); box-shadow: 0 2px 4px rgba(0,0,0,0.05); transition: transform 0.1s; }

.level-indicator {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.level-indicator span { font-size: 14px; font-weight: 900; color: var(--text-dark); }
.level-progress-bar { width: 100%; height: 8px; background: #dfe4ea; border-radius: 10px; overflow: hidden; }
.level-progress-fill { 
    height: 100%; 
    background: var(--blox-green); 
    border-radius: 10px; 
    /* ELITE ANIMATION: Flowing shine inside the bar */
    position: relative;
}
.level-progress-fill::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%);
    animation: loadingSweep 2s infinite linear;
}

/* Coach Hint Card */
.coach-card {
    background: #f1f8ff;
    border: 2px solid #ced6e0;
    padding: 16px 20px;
    border-radius: 16px;
    /* ELITE ANIMATION */
    animation: slideUpFade 0.5s 0.2s both var(--spring-light);
    transition: transform 0.3s var(--smooth-glide), border-color 0.3s;
}
.coach-card:hover { transform: scale(1.01); border-color: var(--blox-blue); }

.coach-card-header { display: flex; align-items: center; gap: 8px; color: var(--blox-blue); font-weight: 900; margin-bottom: 5px; }
.coach-card p { font-size: 15px; font-weight: 700; color: #57606f; line-height: 1.4; }

/* Formula Banner */
.formula-banner {
    background: var(--text-dark);
    color: var(--white);
    padding: 12px 18px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
    font-weight: 800;
    /* ELITE ANIMATION */
    animation: slideUpFade 0.5s 0.3s both var(--spring-light);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
.formula-banner i { opacity: 0.6; font-size: 11px; }

.blox-tag { padding: 4px 10px; border-radius: 6px; display: inline-block; }
.tag-blue { background: var(--blox-blue); }
.tag-red { background: var(--blox-red); }
.tag-green { background: var(--blox-green); }
.tag-orange { background: var(--blox-orange); }
.tag-purple { background: var(--blox-purple); color: var(--white); }

/* Arena Zones */
.zone-label {
    font-size: 13px;
    font-weight: 900;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.5s 0.4s both;
}

.arena-drop-zone {
    min-height: 110px;
    background: #ffffff;
    border: 3px dashed #ced6e0;
    border-radius: 18px;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    /* ELITE ANIMATION */
    transition: all 0.3s var(--smooth-glide);
    animation: slideUpFade 0.5s 0.4s both var(--spring-light);
}
.arena-drop-zone:hover {
    background: #f8fbff;
    border-color: var(--blox-blue);
    box-shadow: inset 0 0 15px rgba(30, 144, 255, 0.1);
}

.arena-word-bank {
    min-height: 110px;
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid #e4e7eb;
    border-radius: 18px;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    /* ELITE ANIMATION */
    transition: all 0.3s var(--smooth-glide);
    animation: slideUpFade 0.5s 0.5s both var(--spring-light);
}

/* --- THE 3D TACTILE LINGOBLOX --- */
.blox-item {
    padding: 12px 20px;
    font-size: 18px;
    font-weight: 900;
    color: var(--white);
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    position: relative;
    top: 0;
    touch-action: manipulation;
    
    /* Layout for Translation Alignment */
    display: inline-flex;
    align-items: center;
    justify-content: center;

    /* ELITE ANIMATION: Heavy premium spring physics for float and shadow */
    transition: transform 0.4s var(--spring-heavy), box-shadow 0.4s var(--spring-heavy), filter 0.3s;
    /* Smooth physical slide-in with no wait time */
    animation: smoothBlockEntry 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    will-change: transform, box-shadow;
}

.blox-text {
    pointer-events: none; /* Let the block handle the text click */
}

/* THE NEW PLUS BUTTON (Translation Trigger) */
.tr-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: var(--white);
    border: 2px solid var(--blox-blue);
    color: var(--blox-blue);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
    z-index: 20;
    transition: transform 0.2s var(--spring-heavy);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}
.tr-btn:hover { transform: scale(1.2); }
.tr-btn:active { transform: scale(0.9); }

/* Tactile Hover: Lifts off the desk, UNLESS hovering the translation button */
.blox-item:hover:not(:has(.tr-btn:hover)) { 
    transform: translateY(-5px) scale(1.03); 
    filter: brightness(1.08);
    z-index: 10;
}

/* Mechanical Switch Click: Fast snap down, UNLESS tapping the translation button */
.blox-item:active:not(:has(.tr-btn:hover)):not(:has(.tr-btn:active)) {
    top: 5px;
    transform: translateY(0) scale(0.98);
    filter: brightness(0.9);
    box-shadow: 0 0px 0px rgba(0,0,0,0.2) !important;
    transition: transform 0.05s, top 0.05s, box-shadow 0.05s;
}

/* Block Colors & 3D Shadow Layers */
.blox-item.sub { background-color: var(--blox-blue); box-shadow: 0 5px 0px #0959a8, 0 8px 15px rgba(30,144,255,0.2); }
.blox-item.verb { background-color: var(--blox-red); box-shadow: 0 5px 0px #b81220, 0 8px 15px rgba(255,71,87,0.2); }
.blox-item.obj { background-color: var(--blox-green); box-shadow: 0 5px 0px #168c48, 0 8px 15px rgba(46,213,115,0.2); }
.blox-item.extra { background-color: var(--blox-orange); box-shadow: 0 5px 0px #b07202, 0 8px 15px rgba(255,165,2,0.2); }
.blox-item.conj { background-color: var(--blox-purple); box-shadow: 0 5px 0px #622f77, 0 8px 15px rgba(155,89,182,0.2); }

/* Drag and Drop Ghost Styling */
.blox-item.dragging {
    opacity: 0.9;
    transform: scale(1.1) rotate(3deg) translateY(-10px);
    box-shadow: 0 15px 25px rgba(0,0,0,0.25) !important;
    cursor: grabbing;
    z-index: 100;
}

/* TRANSLATION TOOLTIP BUBBLE */
.blox-tooltip {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.9);
    background: var(--text-dark);
    color: var(--white);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 900;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s var(--spring-heavy);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 1000;
}
.blox-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: var(--text-dark) transparent transparent transparent;
}
.blox-item.show-tooltip .blox-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

/* Control Buttons */
.arena-controls {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    align-items: flex-start; /* Forces all buttons to hang from the exact same top line */
    /* ELITE ANIMATION */
    animation: slideUpFade 0.5s 0.7s both var(--spring-light);
}

.btn-control {
    margin: 0 !important; /* Kills invisible margins from global classes */
    padding: 0 20px;
    height: 60px !important; /* The great equalizer */
    font-size: 17px;
    font-weight: 900;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    position: relative;
    top: 0 !important; /* Stops the button from sinking */
    transform: translateY(0) !important; /* Overrides any stray global transforms */
    transition: transform 0.2s var(--spring-heavy), box-shadow 0.2s var(--smooth-glide), filter 0.2s;
}

.btn-control:hover { 
    transform: translateY(-4px) !important; 
    filter: brightness(1.05); 
}

.btn-control:active {
    transform: translateY(4px) !important;
    box-shadow: 0 0px 0px transparent !important;
}

.btn-secondary {
    background: #e2e8f0;
    color: var(--text-dark);
    box-shadow: 0 5px 0px #cbd5e1, 0 8px 15px rgba(0,0,0,0.05) !important;
    flex: 0.4;
}

.btn-primary-game {
    background: var(--blox-green);
    color: var(--white);
    box-shadow: 0 5px 0px #168c48, 0 10px 20px rgba(46, 213, 115, 0.25) !important;
    flex: 1;
}

/* Feedback Message */
.feedback-msg {
    text-align: center;
    font-size: 18px;
    font-weight: 900;
    min-height: 25px;
}

/* --- HARD MODE OVERRIDES --- */
.arena-container.hard-mode .coach-card,
.arena-container.hard-mode .formula-banner {
    display: none !important;
}
.arena-container.hard-mode .blox-item {
    background-color: #2f3542 !important;
    box-shadow: 0 5px 0px #1e272e, 0 10px 15px rgba(0,0,0,0.15) !important;
    color: #ffffff !important;
}
.arena-container.hard-mode .blox-item:active:not(:has(.tr-btn:hover)):not(:has(.tr-btn:active)) { 
    box-shadow: 0 0px 0px transparent !important; 
}

/* --- ELITE MICROPHONE UI --- */
.mic-container {
    display: none; 
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 15px;
    background: #f1f8ff;
    border-radius: 16px;
    border: 2px dashed #1e90ff;
}
.mic-container.active { 
    display: flex; 
    /* ELITE ANIMATION */
    animation: popInBounce 0.6s var(--spring-heavy) forwards;
}

.btn-mic {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: #ff4757;
    color: white;
    font-size: 24px;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 0px #b81220, 0 10px 20px rgba(255, 71, 87, 0.3);
    display: flex; 
    justify-content: center;
    align-items: center;
    flex-shrink: 0; 
    position: relative;
    top: 0;
    z-index: 2;
    /* ELITE ANIMATION */
    transition: transform 0.3s var(--spring-heavy), box-shadow 0.2s var(--smooth-glide), top 0.1s;
}
.btn-mic:hover { transform: scale(1.1) translateY(-4px); box-shadow: 0 8px 0px #b81220, 0 15px 30px rgba(255, 71, 87, 0.4); }
.btn-mic:active:not(:disabled) { top: 6px; transform: scale(0.95); box-shadow: 0 0px 0px transparent; }

/* Anti-Spam Disabled States */
.btn-control:disabled, .btn-mic:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(50%);
}

/* ELITE ANIMATION: Multi-Layer Sonar Pulse */
.btn-mic.recording {
    background: #e84118;
    box-shadow: none;
    top: 6px;
    transform: scale(1);
    animation: eliteSonar 1.8s var(--swift-out) infinite;
}

.mic-status { font-weight: 800; color: #1e90ff; font-size: 15px; }

/* Center Wrappers */
.dashboard-container, .arena-container, .login-box { margin-top: auto; margin-bottom: auto; }

/* Global Loading Overlay */
#global-loader { 
    transition: opacity 0.4s var(--smooth-glide), visibility 0.4s; 
    backdrop-filter: blur(5px);
}


/* ==========================================================================
   LINGOBLOX ELITE KEYFRAMES LIBRARY
   ========================================================================== */

@keyframes eliteScreenEntry {
    0% { opacity: 0; transform: translateY(30px) scale(0.96) rotateX(-4deg); }
    100% { opacity: 1; transform: translateY(0) scale(1) rotateX(0); }
}

@keyframes popInBounce {
    0% { opacity: 0; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes smoothBlockEntry {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideRightFade {
    0% { opacity: 0; transform: translateX(-20px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes flamePulse {
    0% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 2px #d35400); }
    50% { transform: scale(1.15) rotate(5deg); filter: drop-shadow(0 0 8px #ff7675); }
    100% { transform: scale(1) rotate(-5deg); filter: drop-shadow(0 0 2px #d35400); }
}

@keyframes loadingSweep {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

@keyframes eliteSonar {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7), 
                    0 0 0 0 rgba(255, 71, 87, 0.5);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(255, 71, 87, 0), 
                    0 0 0 40px rgba(255, 71, 87, 0.2);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0), 
                    0 0 0 60px rgba(255, 71, 87, 0);
    }
}

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

/* HARD-MODE SAFE HINT GLOW */
@keyframes hintPulseElite {
    0% { transform: scale(1); filter: drop-shadow(0 0 0px var(--blox-orange)); outline: 0px solid transparent; }
    50% { transform: scale(1.06) rotate(2deg); filter: drop-shadow(0 0 15px var(--blox-orange)) brightness(1.2); outline: 3px solid var(--blox-orange); }
    100% { transform: scale(1); filter: drop-shadow(0 0 0px var(--blox-orange)); outline: 0px solid transparent; }
}
.hint-glow {
    animation: hintPulseElite 1.2s infinite !important;
    z-index: 50;
}

/* MODERN XP POPUP ANIMATION */
.xp-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    background: linear-gradient(135deg, var(--blox-green), #00b894);
    color: var(--white);
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 28px;
    font-weight: 900;
    box-shadow: 0 10px 30px rgba(46, 213, 115, 0.4);
    z-index: 9999;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: floatUpXp 1.2s forwards;
}
@keyframes floatUpXp {
    0% { opacity: 0; transform: translate(-50%, 20px) scale(0.5); }
    15% { opacity: 1; transform: translate(-50%, -20px) scale(1.1); }
    80% { opacity: 1; transform: translate(-50%, -30px) scale(1); filter: blur(0px); }
    100% { opacity: 0; transform: translate(-50%, -60px) scale(0.8); filter: blur(4px); }
}

/* --- SMART HINT BUTTON & BADGE --- */
.hint-btn {
    position: absolute;
    top: -15px;
    right: -10px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--text-dark);
    color: var(--blox-orange);
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s var(--spring-heavy), filter 0.2s;
}
.hint-btn:hover {
    transform: scale(1.1) rotate(5deg);
    filter: brightness(1.2);
}
.hint-btn:active {
    transform: scale(0.9);
}
.hint-btn:disabled {
    background: #ced6e0;
    color: #ffffff;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.hint-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--blox-red);
    color: white;
    font-size: 12px;
    font-weight: 900;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--bg-light);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.hint-btn:disabled .hint-badge {
    display: none;
}

/* --- WRONG BLOCK ANIMATION (RED SHAKE) --- */
@keyframes hintPulseError {
    0% { transform: scale(1); filter: drop-shadow(0 0 0px var(--blox-red)); outline: 0px solid transparent; }
    10%, 30%, 50%, 70%, 90% { transform: scale(1.05) translateX(-4px); filter: drop-shadow(0 0 12px var(--blox-red)) brightness(1.1); outline: 3px solid var(--blox-red); }
    20%, 40%, 60%, 80% { transform: scale(1.05) translateX(4px); filter: drop-shadow(0 0 12px var(--blox-red)) brightness(1.1); outline: 3px solid var(--blox-red); }
    100% { transform: scale(1) translateX(0); filter: drop-shadow(0 0 0px var(--blox-red)); outline: 0px solid transparent; }
}
.hint-glow-red {
    animation: hintPulseError 0.8s ease-in-out !important;
    z-index: 50;
}
/* ========================================== */
/* THE LINGOBLOX GRAMMAR RAINBOW EXPANSION    */
/* ========================================== */

/* New Draggable Block Colors (The Unified Vibe Palette) */
.blox-item.mod { background-color: #fb7185; color: white; box-shadow: 0 5px 0px #e11d48, 0 8px 15px rgba(251, 113, 133, 0.2); } /* Soft Rose: Modals/Helpers */
.blox-item.adj { background-color: #fbbf24; color: #2d3436; box-shadow: 0 5px 0px #d97706, 0 8px 15px rgba(251, 191, 36, 0.2); } /* Warm Amber: Adj/Adv */
.blox-item.prep { background-color: #2dd4bf; color: white; box-shadow: 0 5px 0px #0d9488, 0 8px 15px rgba(45, 212, 191, 0.2); } /* Calm Teal: Prepositions */
.blox-item.rel { background-color: #818cf8; color: white; box-shadow: 0 5px 0px #4f46e5, 0 8px 15px rgba(129, 140, 248, 0.2); } /* Slate Indigo: Relative/Wh- */

/* New Formula Hint Tag Colors (For the Coach Text) */
.tag-pink { color: #fb7185; font-weight: 900; }
.tag-yellow { color: #fbbf24; font-weight: 900; }
.tag-cyan { color: #2dd4bf; font-weight: 900; }
.tag-indigo { color: #818cf8; font-weight: 900; }