/* Design System: Solaris Escape Room CTF
   Color Palette: Deep Dark Blue and Forest/Tech Green (Inspired by spsknm.sk logo)
*/

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Color Tokens */
    --bg-darker: #040913;      /* Deep midnight blue-black */
    --bg-dark: #091426;        /* Sleek navy dark blue */
    --bg-card: rgba(15, 32, 59, 0.65); /* Glassmorphic blue card */
    --border-color: rgba(9, 163, 73, 0.25); /* Tech green glass border */
    
    --brand-green: #0de65a;    /* Glowing neon forest/tech green */
    --brand-green-muted: #078a35;
    --brand-blue: #1e70e6;     /* Glowing cyber blue */
    --brand-blue-muted: #0c4c9e;
    
    --text-primary: #f1f5f9;   /* Off-white */
    --text-secondary: #94a3b8; /* Slate grey */
    --text-muted: #64748b;
    
    --glow-green: 0 0 15px rgba(13, 230, 90, 0.4);
    --glow-blue: 0 0 15px rgba(30, 112, 230, 0.4);
    
    /* Font Families */
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Fira Code', 'Courier New', Courier, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--brand-green-muted) var(--bg-dark);
}

body {
    background-color: var(--bg-darker);
    background-image: 
        radial-gradient(at 10% 20%, rgba(9, 163, 73, 0.08) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(30, 112, 230, 0.08) 0px, transparent 50%);
    font-family: var(--font-sans);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
    background: var(--brand-green-muted);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--brand-green);
}

/* Header & Navigation */
header {
    background: rgba(4, 9, 19, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--brand-green), var(--brand-blue));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--bg-darker);
    box-shadow: var(--glow-green);
}

.logo-text {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, var(--brand-green), #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    list-style: none;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

.nav-link:hover, .nav-link.active {
    color: var(--brand-green);
    background: rgba(13, 230, 90, 0.08);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(30, 112, 230, 0.15);
    border: 1px solid rgba(30, 112, 230, 0.3);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
}

.user-badge span.score {
    color: var(--brand-green);
    font-weight: 700;
    text-shadow: 0 0 5px rgba(13, 230, 90, 0.3);
}

.btn {
    background: linear-gradient(135deg, var(--brand-green-muted), var(--brand-blue-muted));
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--glow-blue);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-green), var(--glow-blue);
    background: linear-gradient(135deg, var(--brand-green), var(--brand-blue));
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--brand-blue);
    color: var(--brand-blue);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(30, 112, 230, 0.1);
    color: white;
    border-color: var(--brand-green);
}

/* Landing Page */
.landing-hero {
    min-height: calc(100vh - 73px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}

.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 0 20px rgba(9, 163, 73, 0.05);
    position: relative;
    overflow: hidden;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-green), var(--brand-blue));
}

.landing-title {
    font-size: 2.2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff, var(--brand-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.landing-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    background: rgba(4, 9, 19, 0.8);
    border: 1px solid rgba(30, 112, 230, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: white;
    font-family: var(--font-sans);
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--brand-green);
    box-shadow: 0 0 10px rgba(13, 230, 90, 0.15);
}

/* Dashboard Map */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.dashboard-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.dashboard-desc {
    color: var(--text-secondary);
    max-width: 600px;
    margin-top: 0.5rem;
}

.room-map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 2rem;
}

.room-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 2rem;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 280px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.room-card.locked {
    opacity: 0.5;
    border-color: rgba(255,255,255,0.05);
    background: rgba(4, 9, 19, 0.4);
}

.room-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--brand-blue);
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
    transition: all 0.3s ease;
}

.room-card:not(.locked):hover {
    transform: translateY(-5px);
    border-color: var(--brand-green);
    box-shadow: var(--glow-green);
}

.room-card:not(.locked):hover::after {
    background: var(--brand-green);
    box-shadow: var(--glow-green);
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.room-number {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--brand-green);
}

.room-status-badge {
    background: rgba(30, 112, 230, 0.15);
    color: var(--brand-blue);
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

.room-card.completed .room-status-badge {
    background: rgba(13, 230, 90, 0.15);
    color: var(--brand-green);
}

.room-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: white;
}

.room-level-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.level-node {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(4, 9, 19, 0.6);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    text-decoration: none;
}

.level-node.unlocked {
    border-color: var(--brand-blue-muted);
    color: var(--brand-blue);
}

.level-node.current {
    border-color: var(--brand-green);
    background: rgba(13, 230, 90, 0.15);
    color: var(--brand-green);
    box-shadow: 0 0 8px rgba(13, 230, 90, 0.3);
}

.level-node.completed {
    border-color: var(--brand-green-muted);
    background: var(--brand-green-muted);
    color: var(--bg-darker);
}

/* Play/Game Console Split Layout */
.play-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100vh - 73px);
    overflow: hidden;
}

@media (max-width: 1024px) {
    .play-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        height: auto;
    }
}

.play-sidebar {
    background: var(--bg-dark);
    border-right: 1px solid var(--border-color);
    padding: 2.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.level-title-group {
    margin-bottom: 1.5rem;
}

.level-badge {
    color: var(--brand-green);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.level-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
    margin-top: 0.25rem;
}

/* Narrative Story & Tabs */
.tabs-container {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 1.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: var(--brand-green);
    border-bottom-color: var(--brand-green);
}

.tab-content {
    flex-grow: 1;
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.story-box {
    background: rgba(4, 9, 19, 0.4);
    border-left: 3px solid var(--brand-blue);
    padding: 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
    font-style: italic;
    color: var(--text-primary);
}

.instruction-box h3, .reference-box h3 {
    color: white;
    margin: 1.5rem 0 0.5rem 0;
    font-size: 1.1rem;
}

.instruction-box ul {
    padding-left: 1.25rem;
    margin-bottom: 1rem;
}

.instruction-box li {
    margin-bottom: 0.5rem;
}

code {
    font-family: var(--font-mono);
    background: rgba(4, 9, 19, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #e2e8f0;
}

pre {
    background: rgba(4, 9, 19, 0.7);
    border: 1px solid rgba(30, 112, 230, 0.2);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
}

pre code {
    background: transparent;
    border: none;
    padding: 0;
}

.flag-submission-box {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* Console Window */
.console-container {
    background: var(--bg-darker);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.console-header {
    background: #060d1b;
    border-bottom: 1px solid rgba(9, 163, 73, 0.15);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.console-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--brand-green);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.console-circle {
    width: 8px;
    height: 8px;
    background: var(--brand-green);
    border-radius: 50%;
    box-shadow: var(--glow-green);
}

.console-dots {
    display: flex;
    gap: 0.4rem;
}

.console-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #1e293b;
}

.console-body {
    flex-grow: 1;
    padding: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.5;
    overflow-y: auto;
    color: #a7f3d0; /* Muted tech green text */
    position: relative;
}

/* CRT Scanline Effect Overlay */
.console-body::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 10;
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
}

.terminal-line {
    margin-bottom: 0.4rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.terminal-line.input-line {
    display: flex;
    align-items: center;
}

.prompt {
    color: var(--brand-blue);
    font-weight: 700;
    margin-right: 0.5rem;
    white-space: nowrap;
}

.prompt .user {
    color: var(--brand-green);
}

.terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    flex-grow: 1;
    width: 100%;
}

/* Interactive Vi Editor Simulation */
.vi-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #020617;
    z-index: 100;
    display: flex;
    flex-direction: column;
    font-family: var(--font-mono);
    padding: 1rem;
    color: #e2e8f0;
}

.vi-body {
    flex-grow: 1;
    outline: none;
    white-space: pre;
    line-height: 1.5;
    overflow-y: auto;
}

.vi-tilde {
    color: var(--brand-blue-muted);
}

.vi-statusbar {
    height: 25px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-top: 0.25rem;
}

.vi-mode-indicator {
    color: var(--brand-green);
    font-weight: 700;
}

/* Leaderboard Page */
.leaderboard-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, white, var(--brand-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.leaderboard-table-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    margin-top: 2rem;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.leaderboard-table th {
    background: rgba(4, 9, 19, 0.8);
    padding: 1rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--brand-green);
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table td {
    padding: 1.2rem 1.5rem;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.leaderboard-table tr:hover {
    background: rgba(30, 112, 230, 0.05);
}

.leaderboard-table tr.current-user {
    background: rgba(13, 230, 90, 0.08);
    border-left: 4px solid var(--brand-green);
}

.rank-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.rank-badge.gold {
    background: gold;
    color: black;
    box-shadow: 0 0 10px rgba(255,215,0,0.5);
}

.rank-badge.silver {
    background: silver;
    color: black;
    box-shadow: 0 0 10px rgba(192,192,192,0.5);
}

.rank-badge.bronze {
    background: #cd7f32;
    color: black;
    box-shadow: 0 0 10px rgba(205,127,50,0.5);
}

.rank-badge.other {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

/* Notifications and Alerts */
.alert {
    background: rgba(30, 112, 230, 0.15);
    border: 1px solid rgba(30, 112, 230, 0.3);
    padding: 1rem;
    border-radius: 8px;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.alert-success {
    background: rgba(13, 230, 90, 0.15);
    border-color: rgba(13, 230, 90, 0.3);
    color: #a7f3d0;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Highlight text selection */
::selection {
    background: var(--brand-green);
    color: var(--bg-darker);
    text-shadow: none;
}
::-moz-selection {
    background: var(--brand-green);
    color: var(--bg-darker);
    text-shadow: none;
}

/* Make sure elements in console are selectable */
.console-body, .terminal-line, .prompt, span.path, span.user {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Glowing Restart Level Button in Console Header */
.btn-reset-terminal {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-reset-terminal:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: white;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* --- SOLY CYBER DRAGON MASCOT & 6 NPC ANIMATIONS SYSTEM --- */

/* 1. Mascot Floating Container */
.soly-mascot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    gap: 1.25rem;
    pointer-events: none; /* Let background clicks pass through */
    font-family: var(--font-sans);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* 2. Drag/Position Classes (e.g. Left/Right toggle or minimized) */
.soly-mascot-container.minimized {
    transform: translateY(120px) scale(0.85);
    opacity: 0.7;
}
.soly-mascot-container.minimized:hover {
    transform: translateY(105px) scale(0.9);
    opacity: 1;
}
.soly-mascot-container.minimized .soly-speech-bubble-floating {
    display: none !important;
}

.soly-mascot-container.pos-left {
    left: 30px;
    right: auto;
    flex-direction: row-reverse;
}
.soly-mascot-container.pos-left .soly-speech-bubble-floating {
    border-radius: 14px 14px 0px 14px;
    transform-origin: bottom right;
}
.soly-mascot-container.pos-left .soly-speech-bubble-floating::after {
    left: auto;
    right: -8px;
    border-width: 8px 0 0 8px;
    border-color: var(--border-color) transparent transparent transparent;
}

/* 3. The RPG Glassmorphic Dialogue Window */
.soly-speech-bubble-floating {
    background: rgba(9, 20, 38, 0.93);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(13, 230, 90, 0.25);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.75), 
                inset 0 0 20px rgba(13, 230, 90, 0.08);
    padding: 1.2rem 1.4rem;
    border-radius: 14px 14px 14px 0px;
    width: 320px;
    max-width: 90vw;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    position: relative;
    pointer-events: auto;
    animation: bubblePop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
    transform-origin: bottom left;
    user-select: none;
    border-left: 4px solid var(--brand-green);
}

.soly-speech-bubble-floating::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 8px 0 0;
    border-color: rgba(13, 230, 90, 0.25) transparent transparent transparent;
}

/* 4. Mascot SVG Core Container */
.soly-avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(13, 230, 90, 0.12) 0%, rgba(8, 10, 15, 0.85) 75%);
    border: 2px solid var(--brand-green);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(13, 230, 90, 0.2);
    pointer-events: auto;
    cursor: pointer;
    overflow: visible;
    transition: all 0.3s ease;
}

.soly-avatar-wrapper:hover {
    border-color: var(--brand-blue);
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(30, 112, 230, 0.35);
}

.soly-svg-mascot {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

/* 5. Online Pulsing Status Marker */
.soly-online-dot {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background: var(--brand-green);
    border: 2px solid #080a0f;
    border-radius: 50%;
    box-shadow: var(--glow-green);
    z-index: 10;
}

.soly-online-dot::after {
    content: '';
    position: absolute;
    top: -2px; left: -2px; width: 14px; height: 14px;
    border: 2px solid var(--brand-green);
    border-radius: 50%;
    animation: solyOnlinePulse 2.5s infinite ease-out;
}

/* 6. Soundwaves Ripple behind Mascot (Talking state) */
.soly-soundwave-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid var(--brand-green);
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* 7. Confetti Sparkles container (Happy state) */
.soly-sparks-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 2;
}
.soly-sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--brand-green);
    border-radius: 50%;
    opacity: 0;
}

/* --- MASCOT PNG IMAGE & NEON HOVER OVERLAYS STYLING --- */

.soly-avatar-img, .soly-retro-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    pointer-events: none;
    transition: all 0.3s ease;
}

.soly-avatar-img {
    object-fit: cover;
    border: 1px solid rgba(13, 230, 90, 0.15);
    z-index: 1;
}

.soly-retro-canvas {
    z-index: 2;
    background: radial-gradient(circle, rgba(13, 230, 90, 0.12) 0%, rgba(8, 10, 15, 0.8) 80%);
}

/* 1. Hologram Gear Overlay (Thinking state) */
.soly-holo-gear-overlay {
    position: absolute;
    top: -24px;
    left: 46px; /* centered over 120px avatar wrapper */
    display: none;
    z-index: 5;
    pointer-events: none;
    filter: drop-shadow(0 0 4px #ffb700);
}

/* 2. Laser Pointer Beam (Explaining state) */
.soly-laser-beam-overlay {
    position: absolute;
    top: 75px;
    left: 95px;
    width: 160px;
    height: 2px;
    background: #00f0ff;
    box-shadow: 0 0 6px #00f0ff, 0 0 12px #00f0ff;
    transform-origin: left center;
    display: none;
    z-index: 5;
    pointer-events: none;
}

/* 3. Digital Teardrop (Sad state) */
.soly-teardrop-overlay {
    position: absolute;
    top: 40px;
    left: 32px;
    font-size: 1.25rem;
    display: none;
    z-index: 5;
    pointer-events: none;
    filter: drop-shadow(0 0 3px #1e70e6);
}



/* --- KEYFRAME ANIMATIONS FOR MASCOT STATES --- */

/* Universal Float (Idle) */
@keyframes solyFloat {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-7px) rotate(0.8deg) scale(1.01); }
    100% { transform: translateY(0px) rotate(0deg); }
}

/* Talking Squeezes & Fast Float */
@keyframes solyFloatFast {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(-1deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes solyMouthFlapPNG {
    0% { transform: scale(1.0); }
    100% { transform: scale(1.05, 0.95) rotate(0.8deg); }
}

/* Online status pulsing */
@keyframes solyOnlinePulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}

/* Pop bubble animation */
@keyframes bubblePop {
    0% { transform: scale(0.6) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Happy Bouncing & Spin */
@keyframes solyHappyJump {
    0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
    25% { transform: translateY(-30px) scale(1.1, 0.9) rotate(6deg); }
    50% { transform: translateY(0) scale(0.9, 1.1) rotate(-6deg); }
    75% { transform: translateY(-15px) scale(1.05) rotate(360deg); }
}

/* Sad Shaking */
@keyframes solySadShake {
    0%, 100% { transform: translateX(0) translateY(3px) rotate(-2deg); }
    20%, 60% { transform: translateX(-5px) translateY(3px) rotate(-3deg); }
    40%, 80% { transform: translateX(5px) translateY(3px) rotate(-1deg); }
}

/* Tear Falling */
@keyframes tearDropFall {
    0% { transform: translateY(0px) scale(0.6); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: translateY(40px) scale(1.1); opacity: 0; }
}

/* Retro Mouth Open/Close (handled by Canvas Renderer) */

/* Thinking Tilt */
@keyframes solyThinkingTilt {
    0%, 100% { transform: rotate(-3deg) translateY(0); }
    50% { transform: rotate(4deg) translateY(-4px); }
}

/* Hologram rotation */
@keyframes holoRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hologram gear pulse */
@keyframes holoPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.95; filter: drop-shadow(0 0 6px #ffb700); }
}

/* Explaining Lean */
@keyframes solyExplainLean {
    0%, 100% { transform: translateY(0) rotate(1deg) scale(1.03); }
    50% { transform: translateY(-3px) rotate(-1deg) scale(1.05, 0.97); }
}

/* Laser grid sweeping */
@keyframes laserSweep {
    0% { transform: rotate(-5deg) scaleX(0.85); opacity: 0.6; }
    100% { transform: rotate(15deg) scaleX(1.15); opacity: 1; filter: drop-shadow(0 0 5px #00f0ff); }
}

/* Soundwave ripple */
@keyframes soundWaveRipple {
    0% { transform: translate(-50%, -50%) scale(0.85); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; }
}

/* Sparkle Burst */
@keyframes sparkleBurst {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* --- STATE TRIGGERS FOR AVATAR AND OVERLAYS --- */

/* 1. STATE: IDLE */
.soly-state-idle .soly-avatar-img,
.soly-state-idle .soly-retro-canvas {
    animation: solyFloat 4.5s ease-in-out infinite;
}

/* 2. STATE: TALKING */
.soly-state-talking .soly-avatar-img,
.soly-state-talking .soly-retro-canvas {
    animation: solyFloatFast 1.5s ease-in-out infinite, solyMouthFlapPNG 0.28s infinite alternate;
}
.soly-state-talking .soly-soundwave-ripple {
    animation: soundWaveRipple 1.2s infinite;
}

/* 3. STATE: HAPPY (SUCCESS) */
.soly-state-happy .soly-avatar-img,
.soly-state-happy .soly-retro-canvas {
    animation: solyHappyJump 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite;
}
.soly-state-happy .soly-avatar-wrapper {
    border-color: #10b981 !important;
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.4), 0 0 25px rgba(16, 185, 129, 0.3);
}

/* 4. STATE: SAD (ERROR) */
.soly-state-sad .soly-avatar-img,
.soly-state-sad .soly-retro-canvas {
    animation: solySadShake 0.45s ease-in-out infinite;
    filter: sepia(0.25) saturate(1.8) hue-rotate(320deg) brightness(0.9); /* Intensive red warning crash-out tint! */
}
.soly-state-sad .soly-avatar-wrapper {
    border-color: #ef4444 !important;
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.4), 0 0 25px rgba(239, 68, 68, 0.3);
}
.soly-state-sad .soly-teardrop-overlay {
    display: block !important;
    animation: tearDropFall 1.5s infinite linear;
}

/* 5. STATE: THINKING */
.soly-state-thinking .soly-avatar-img,
.soly-state-thinking .soly-retro-canvas {
    animation: solyThinkingTilt 3s ease-in-out infinite;
    filter: saturate(0.8) contrast(1.05);
}
.soly-state-thinking .soly-avatar-wrapper {
    border-color: #ffb700 !important;
    box-shadow: 0 8px 30px rgba(255, 183, 0, 0.35), 0 0 25px rgba(255, 183, 0, 0.25);
}
.soly-state-thinking .soly-holo-gear-overlay {
    display: block !important;
    animation: holoRotate 6s linear infinite, holoPulse 2s ease-in-out infinite;
}

/* 6. STATE: EXPLAINING */
.soly-state-explaining .soly-avatar-img,
.soly-state-explaining .soly-retro-canvas {
    animation: solyExplainLean 2s ease-in-out infinite;
}
.soly-state-explaining .soly-avatar-wrapper {
    border-color: #00f0ff !important;
    box-shadow: 0 8px 30px rgba(0, 240, 255, 0.35), 0 0 25px rgba(0, 240, 255, 0.25);
}
.soly-state-explaining .soly-laser-beam-overlay {
    display: block !important;
    animation: laserSweep 1.6s infinite alternate;
}

/* Blinking animation for typewriter caret */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Dynamic Neon Campaign Colors */
.theme-green {
    --theme-color: #0de65a;
    --theme-color-muted: #078a35;
    --theme-glow: 0 0 15px rgba(13, 230, 90, 0.4);
    --theme-border: rgba(13, 230, 90, 0.25);
    --theme-bg-glow: rgba(13, 230, 90, 0.08);
    --theme-badge: rgba(13, 230, 90, 0.15);
}
.theme-blue {
    --theme-color: #1e70e6;
    --theme-color-muted: #0c4c9e;
    --theme-glow: 0 0 15px rgba(30, 112, 230, 0.4);
    --theme-border: rgba(30, 112, 230, 0.25);
    --theme-bg-glow: rgba(30, 112, 230, 0.08);
    --theme-badge: rgba(30, 112, 230, 0.15);
}
.theme-cyan {
    --theme-color: #00f5ff;
    --theme-color-muted: #008b8b;
    --theme-glow: 0 0 15px rgba(0, 245, 255, 0.4);
    --theme-border: rgba(0, 245, 255, 0.25);
    --theme-bg-glow: rgba(0, 245, 255, 0.08);
    --theme-badge: rgba(0, 245, 255, 0.15);
}
.theme-purple {
    --theme-color: #bd00ff;
    --theme-color-muted: #7c00b3;
    --theme-glow: 0 0 15px rgba(189, 0, 255, 0.4);
    --theme-border: rgba(189, 0, 255, 0.25);
    --theme-bg-glow: rgba(189, 0, 255, 0.08);
    --theme-badge: rgba(189, 0, 255, 0.15);
}
.theme-red {
    --theme-color: #ff0055;
    --theme-color-muted: #b3003b;
    --theme-glow: 0 0 15px rgba(255, 0, 85, 0.4);
    --theme-border: rgba(255, 0, 85, 0.25);
    --theme-bg-glow: rgba(255, 0, 85, 0.08);
    --theme-badge: rgba(255, 0, 85, 0.15);
}

/* Glass panel room-card themed elements */
.room-card.dynamic-theme {
    border-color: var(--theme-border) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), inset 0 0 20px var(--theme-bg-glow) !important;
}
.room-card.dynamic-theme .dynamic-glow-bg {
    background: radial-gradient(circle, var(--theme-bg-glow) 0%, transparent 60%) !important;
}
.room-card.dynamic-theme .dynamic-text-glow {
    color: var(--theme-color) !important;
    text-shadow: 0 0 10px var(--theme-color) !important;
}
.room-card.dynamic-theme .dynamic-badge {
    background: var(--theme-badge) !important;
    color: var(--theme-color) !important;
    border: 1px solid var(--theme-border) !important;
}
.room-card.dynamic-theme .dynamic-btn {
    background: linear-gradient(135deg, var(--theme-color-muted), var(--theme-color)) !important;
    box-shadow: var(--theme-glow) !important;
    border: 1px solid var(--theme-border) !important;
}
.room-card.dynamic-theme .dynamic-btn:hover {
    background: linear-gradient(135deg, var(--theme-color), #ffffff) !important;
    color: var(--bg-darker) !important;
}
.room-card.dynamic-theme .dynamic-progress-bar {
    background: linear-gradient(90deg, var(--theme-color-muted), var(--theme-color)) !important;
    box-shadow: var(--theme-glow) !important;
}

/* Premium Level Illustration & Diagrams */
.level-illustration-container {
    margin: 1.25rem 0;
    padding: 0.75rem;
    background: rgba(4, 9, 19, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}
.level-illustration-container:hover {
    border-color: var(--brand-blue);
    box-shadow: 0 4px 25px rgba(30, 112, 230, 0.2);
}
.level-illustration {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.level-illustration-caption {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-style: italic;
    letter-spacing: 0.5px;
    display: block;
}
.level-illustration-container svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}


