/* Copyright (c) 2026 Josue Pablo Cantoya Di Benedetto. All rights reserved. */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-primary: #ffffff;
    --bg-secondary: rgba(0, 20, 40, 0.65);
    --accent-purple: #00ffff;
    --accent-purple-glow: rgba(0, 255, 255, 0.3);
    --accent-teal: #58a6ff;
    --accent-teal-glow: rgba(88, 166, 255, 0.3);
    --accent-red: #f43f5e;
    --text-main: #e0ffff;
    --text-muted: #aae5ff;
    --border-glow: rgba(0, 255, 255, 0.4);
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: #ffffff;
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Home Logo */
.home-logo-link {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.home-logo-link:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 15px rgba(0, 255, 255, 0.8));
}

.home-logo {
    width: 80px;
    height: auto;
    border-radius: 8px;
}

@keyframes floatHologram {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-12px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.2), inset 0 0 20px rgba(0, 255, 255, 0.1);
        border-color: rgba(0, 255, 255, 0.4);
    }

    100% {
        box-shadow: 0 0 25px rgba(0, 255, 255, 0.5), inset 0 0 40px rgba(0, 255, 255, 0.2);
        border-color: rgba(0, 255, 255, 0.8);
    }
}

.app-container {
    width: 95vw;
    max-width: 900px;
    height: 85vh;
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 8px;
    border: 2px solid rgba(0, 255, 255, 0.4);
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    box-shadow:
        0 0 15px rgba(0, 255, 255, 0.2),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    animation: floatHologram 6s ease-in-out infinite, pulseGlow 4s infinite alternate;
}

/* Header */
header {
    padding: 16px 28px;
    border-bottom: 1px solid var(--border-glow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(8, 8, 12, 0.5);
}

header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff 30%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header h1 .subtitle {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--accent-teal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-left: 6px;
}

.controls-section {
    display: flex;
    gap: 12px;
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 48px;
    right: 0;
    background: rgba(0, 20, 40, 0.95);
    border: 1px solid var(--accent-purple);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 220px;
    z-index: 1001;
    box-shadow: 0 0 15px var(--accent-purple-glow);
    display: flex;
    flex-direction: column;
}

.dropdown-menu.hidden {
    display: none;
}

.menu-item {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 10px 16px;
    text-align: left;
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    width: 100%;
    transition: var(--transition-smooth);
}

.menu-item:hover {
    background: rgba(0, 255, 255, 0.15);
    color: #fff;
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
}

.disabled-menu-item {
    opacity: 0.5;
    cursor: not-allowed;
}

.disabled-menu-item:hover {
    background: transparent;
    color: var(--text-main);
}

.menu-lang-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.lang-options {
    display: flex;
    flex-direction: column;
    background: rgba(0, 10, 20, 0.4);
    border-top: 1px solid rgba(0, 255, 255, 0.1);
    border-bottom: 1px solid rgba(0, 255, 255, 0.1);
    padding: 4px 0;
    transition: max-height 0.3s ease;
}

.lang-options.hidden {
    display: none;
}

.lang-option-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 24px;
    text-align: left;
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    width: 100%;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lang-option-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    color: #fff;
}

.lang-option-btn.active {
    color: #00ffff;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
}

.lang-option-btn.active::after {
    content: "✓";
    font-size: 0.85rem;
    color: #00ffff;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
}

.icon-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glow);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.icon-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--accent-purple);
    box-shadow: 0 0 12px var(--accent-purple-glow);
}

/* Content Area Wrapper */
.content-area {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Landing Page & Cards */
.main-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    overflow-y: auto;
    position: relative;
}

.hero-section {
    text-align: center;
    max-width: 800px;
    margin: auto;
}

.hero-section h2 {
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #fff;
}

.hero-section p {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 40px;
}

.mode-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.mode-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glow);
    padding: 32px 24px;
    border-radius: 16px;
    text-align: left;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.mode-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-purple);
    transform: scaleY(0);
    transition: var(--transition-smooth);
}

.mode-card.active:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(20, 184, 166, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.mode-card.active:hover::before {
    background: var(--accent-teal);
    transform: scaleY(1);
}

.mode-card.locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.mode-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-glow);
}

.mode-badge.active {
    background: rgba(20, 184, 166, 0.15);
    color: var(--accent-teal);
    border-color: rgba(20, 184, 166, 0.3);
}

.mode-card h3 {
    font-size: 1.3rem;
    margin-bottom: 12px;
    color: #fff;
}

.mode-card p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    header {
        padding: 6px 12px;
    }

    header h1 {
        font-size: 1.02rem;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
    }

    .main-workspace {
        padding: 0px 12px;
    }

    .hero-section h2 {
        font-size: 1.1rem;
        margin-bottom: 4px;
    }

    .hero-section p {
        font-size: 0.75rem;
        margin-bottom: 8px;
        line-height: 1.25;
    }

    .mode-selector {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .mode-card {
        padding: 8px 12px;
        padding-top: 25px;
        border-radius: 10px;
    }

    .mode-card h3 {
        font-size: 0.92rem;
        margin-bottom: 2px;
    }

    .mode-card p {
        font-size: 0.68rem;
        line-height: 1.15;
    }

    .mode-badge {
        top: 8px;
        right: 8px;
        font-size: 0.55rem;
        padding: 1px 5px;
    }
}

/* Chat view */
.game-viewport {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 300px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

@media (max-width: 768px) {
    .game-viewport {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    border-right: 1.5px solid var(--border-glow);
}

.chat-viewport-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    min-height: 0;
    width: 100%;
}

.chat-indicators {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px 6px;
    background: rgba(10, 10, 15, 0.45);
    border: none;
    border-left: 1.5px solid var(--border-glow);
    width: 46px;
    flex-shrink: 0;
    height: 100%;
    box-sizing: border-box;
    cursor: pointer;
    transition: var(--transition-smooth);
    outline: none;
}

.chat-indicators:hover {
    background: rgba(139, 92, 246, 0.08);
    box-shadow: inset 0 0 10px rgba(139, 92, 246, 0.1);
}

.indicator-num {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 700;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-smooth);
    user-select: none;
    pointer-events: none;
    /* Let click pass to the parent button container */
}

.indicator-num.positive {
    color: #38bdf8;
    /* Blue */
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.indicator-num.negative {
    color: #ef4444;
    /* Red */
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Chat bubbles */
.message-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 85%;
    animation: messagePop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes messagePop {
    0% {
        transform: translateY(10px) scale(0.98);
        opacity: 0;
    }

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

.message-wrapper.ai {
    align-self: flex-start;
    flex-direction: row;
}

.message-wrapper.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-wrapper.system {
    align-self: center;
    max-width: 90%;
    flex-direction: row;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
    position: relative;
}

.message-wrapper.ai .message-bubble {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glow);
    color: var(--text-main);
    border-top-left-radius: 0;
}

.message-wrapper.ai .message-bubble::before {
    content: "";
    position: absolute;
    top: -1px;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 10px 0;
    border-color: transparent var(--border-glow) transparent transparent;
}

.message-wrapper.user .message-bubble {
    background: linear-gradient(to right, var(--accent-purple), #6b54ef);
    color: #fff;
    border-top-right-radius: 0;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.message-wrapper.user .message-bubble::after {
    content: "";
    position: absolute;
    top: 0;
    right: -7px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 10px 8px;
    border-color: transparent transparent transparent #6b54ef;
}

.message-wrapper.system .message-bubble {
    background: rgba(20, 184, 166, 0.06);
    border: 1px dashed rgba(20, 184, 166, 0.3);
    color: var(--accent-teal);
    font-size: 0.85rem;
    border-radius: 10px;
    text-align: center;
}

.message-wrapper.scenario-header .message-bubble {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.18) 0%, rgba(139, 92, 246, 0.18) 100%) !important;
    border: 1.5px solid var(--accent-teal) !important;
    color: #fff !important;
    font-size: 0.95rem !important;
    border-radius: 12px !important;
    box-shadow: 0 0 15px rgba(20, 184, 166, 0.25) !important;
    text-align: justify !important;
    padding: 16px 20px !important;
}

.analyst-feedback {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%) !important;
    border: 1.5px solid var(--accent-teal) !important;
    color: #fff !important;
    font-size: 1rem !important;
    font-weight: 500;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.2) !important;
    text-align: left !important;
}

.analyst-feedback.red-feedback {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%) !important;
    border: 1.5px solid var(--accent-red) !important;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.2) !important;
}

.play-msg-btn {
    float: right;
    margin-left: 10px;
    margin-bottom: 5px;
    shape-outside: circle(50%);
    background: rgba(11, 26, 48, 0.8);
    border: 1px solid var(--accent-teal);
    color: var(--text-main);
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
    opacity: 0.3;
    flex-shrink: 0;
    outline: none;
}

.message-wrapper:hover .play-msg-btn {
    opacity: 1;
}

.play-msg-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px var(--accent-purple-glow);
    transform: scale(1.1);
}

/* Chat Input Bar */
.input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border-glow);
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(8, 8, 12, 0.3);
}

.input-area textarea {
    width: 100%;
    height: 64px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 12px 16px;
    resize: none;
    outline: none;
    transition: var(--transition-smooth);
    box-sizing: border-box;
}

.input-actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    width: 100%;
}

.input-actions-row button {
    height: 42px;
}

.input-area textarea:focus {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px var(--accent-purple-glow);
}

.input-area textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-area button {
    background: var(--accent-teal);
    border: none;
    color: #000;
    font-weight: 600;
    padding: 0 24px;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.input-area button:hover {
    background: #2dd4bf;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-teal-glow);
}

.input-area button:disabled {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
}

.input-area .mic-btn {
    height: 42px !important;
    width: 42px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(11, 26, 48, 0.8) !important;
    border: 1px solid var(--accent-teal) !important;
    color: var(--text-main) !important;
    cursor: pointer !important;
    font-size: 1.15rem !important;
    transition: var(--transition-smooth) !important;
    box-shadow: none !important;
    transform: none !important;
}

.input-area .mic-btn:hover {
    background: rgba(139, 92, 246, 0.15) !important;
    border-color: var(--accent-purple) !important;
    box-shadow: 0 0 10px var(--accent-purple-glow) !important;
}

.input-area .mic-btn.recording {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    animation: micPulse 1.2s infinite alternate !important;
}

.mic-btn:not(:disabled) .mic-icon-svg {
    stroke: url(#mic-gradient) !important;
}

.mic-btn:disabled .mic-icon-svg {
    stroke: var(--text-muted) !important;
}

#send-btn {
    height: 42px !important;
    width: 42px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(11, 26, 48, 0.8) !important;
    border: 1px solid var(--accent-teal) !important;
}

#send-btn .send-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    transition: var(--transition-smooth);
}

#send-btn:disabled .send-icon-img {
    opacity: 0.3;
}

.loading-hourglass {
    width: 20px;
    height: 20px;
    animation: hourglass-spin 1.2s infinite ease-in-out;
}

@keyframes hourglass-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(180deg);
    }
}

@keyframes micPulse {
    0% {
        box-shadow: 0 0 5px rgba(239, 68, 68, 0.4);
    }

    100% {
        box-shadow: 0 0 15px rgba(239, 68, 68, 0.8);
    }
}

/* Sidebar Dashboard */
.sidebar {
    padding: 16px;
    background: rgba(10, 10, 15, 0.2);
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
}

.scenario-info {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glow);
    padding: 16px;
    border-radius: 12px;
}

.scenario-info h4 {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--accent-teal);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.scenario-info p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.stat-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    cursor: help;
    padding: 6px;
    transition: var(--transition-smooth);
}

.stat-group:hover {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.stat-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    transform: translateY(10px);
    width: 100%;
    padding: 12px;
    background: rgba(10, 20, 30, 0.98);
    border: 1px solid var(--border-glow);
    border-radius: 8px;
    font-size: 0.78rem;
    color: var(--text-main);
    line-height: 1.45;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 255, 255, 0.3);
    pointer-events: none;
    opacity: 0;
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-tooltip strong {
    color: var(--accent-purple);
    display: block;
    margin-bottom: 4px;
}

.stat-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: rgba(0, 255, 255, 0.4) transparent transparent transparent;
}

.stat-group:hover .stat-tooltip,
.stat-group.active-tooltip .stat-tooltip {
    opacity: 1;
    transform: translateY(0);
}

/* For positive stats (top ones), position tooltip below */
.positive-stats .stat-tooltip {
    bottom: auto;
    top: calc(100% + 10px);
}

.positive-stats .stat-tooltip::after {
    bottom: auto;
    top: -6px;
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent rgba(0, 255, 255, 0.4) transparent;
}


.stat-label {
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    font-weight: 500;
}

.stat-bar-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-bar.health {
    background: linear-gradient(90deg, var(--accent-purple), #a78bfa);
}

.stat-bar.karma {
    background: linear-gradient(90deg, var(--accent-teal), #2dd4bf);
}

.stat-bar.sanity {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.stat-bar.control {
    background: linear-gradient(90deg, #00b4db, #0083b0);
}

.stat-bar.manip {
    background: linear-gradient(90deg, #ec008c, #fc6767);
}

.stat-bar.punitiveness {
    background: linear-gradient(90deg, #cb2d3e, #ef473a);
}

.stat-bar.passive {
    background: linear-gradient(90deg, #f12711, #f5af19);
}

.stat-bar.victim {
    background: linear-gradient(90deg, #8a2387, #e94057);
}

.action-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glow);
    color: var(--text-main);
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.action-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent-purple);
}

.action-btn.secondary {
    opacity: 0.7;
    margin-top: auto;
}

.action-btn.secondary:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: var(--transition-smooth);
}

.modal-content {
    background: #0f0f18;
    border: 1px solid var(--border-glow);
    padding: 32px;
    border-radius: 16px;
    max-width: 450px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    font-size: 1.25rem;
    color: #fff;
}

.modal-content p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.modal-content input {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glow);
    padding: 12px;
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-mono);
    outline: none;
    font-size: 0.9rem;
}

.modal-content input:focus {
    border-color: var(--accent-purple);
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9rem;
    border: none;
    background: var(--accent-purple);
    color: #fff;
    transition: var(--transition-smooth);
}

.modal-btn:hover {
    background: #7c3aed;
}

.modal-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glow);
    color: var(--text-main);
}

.modal-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Auth Modal */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-glow);
    margin-bottom: 8px;
}

.auth-tab {
    flex: 1;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.auth-tab:hover {
    color: #fff;
}

.auth-tab.active {
    color: var(--accent-purple);
    border-bottom-color: var(--accent-purple);
}

.auth-btn {
    width: 100%;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.auth-btn.primary {
    background: var(--accent-purple);
    color: #000;
}

.auth-btn.primary:hover {
    background: #7c3aed;
    color: #fff;
    box-shadow: 0 0 20px var(--accent-purple-glow);
}

.auth-btn.secondary {
    background: #2dd4bf;
    color: #022c22;
    box-shadow: 0 0 15px rgba(45, 212, 191, 0.35);
}

.auth-btn.secondary:hover {
    background: #14b8a6;
    box-shadow: 0 0 25px rgba(45, 212, 191, 0.5);
}

.small-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.small-text a {
    color: var(--accent-teal);
    text-decoration: none;
}

/* Helper utility classes */
.hidden {
    display: none !important;
}

.mobile-action-buttons {
    display: none;
}

/* Footer */
footer {
    padding: 12px 28px;
    border-top: 1px solid var(--border-glow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(8, 8, 12, 0.5);
    font-size: 0.8rem;
    color: var(--text-muted);
}

#status-indicator {
    font-family: var(--font-mono);
    color: var(--accent-teal);
}

#status-indicator.error {
    color: var(--accent-red);
}

#status-indicator.loading {
    color: var(--accent-purple);
}

.sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
        justify-content: flex-start;
        overflow-y: hidden;
        padding: 0;
    }

    .home-logo-link {
        position: relative;
        top: 0;
        left: 0;
        margin: calc(12px + env(safe-area-inset-top, 0px)) auto -8px auto;
        display: block;
        width: 70px;
        z-index: 1050;
    }

    .app-container {
        width: 100%;
        height: calc(100vh - (95px + env(safe-area-inset-top, 0px)));
        height: calc(100svh - (95px + env(safe-area-inset-top, 0px)));
        margin-bottom: 0px;
        position: relative;
        animation: none !important;
        /* Disable floating hologram animation on mobile to fix text blurriness */
    }

    .game-viewport {
        grid-template-columns: 1fr !important;
        grid-template-rows: 1fr !important;
        position: relative;
    }

    .stats-close-btn {
        display: block !important;
        align-self: flex-end;
        background: transparent;
        border: none;
        color: #fff;
        font-size: 1.6rem;
        cursor: pointer;
        padding: 4px;
        line-height: 1;
        margin-bottom: 12px;
        outline: none;
        transition: var(--transition-smooth);
    }

    .stats-close-btn:hover {
        color: var(--accent-purple);
        transform: scale(1.1);
    }

    .sidebar {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 300px !important;
        height: 100% !important;
        background: #0b0f19 !important;
        border-right: 1.5px solid var(--border-glow) !important;
        padding: 24px 20px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        z-index: 1200 !important;
        transform: translate3d(-100%, 0, 0) !important;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
        overflow-y: auto !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        will-change: transform;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }

    .sidebar.open {
        transform: translate3d(0, 0, 0) !important;
    }

    .chat-indicators {
        display: flex !important;
        justify-content: flex-start !important;
        width: 32px !important;
        padding: 4px 2px !important;
        gap: 4px !important;
        border-left: 1px solid var(--border-glow) !important;
    }

    .chat-indicators .indicator-num {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.75rem !important;
    }

    .stats-wrapper {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        width: 100% !important;
        position: static !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
    }

    .stats-column {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .stats-column.positive-stats {
        border-right: none !important;
        padding-right: 0 !important;
        border-bottom: 1px solid rgba(0, 255, 255, 0.1);
        padding-bottom: 16px;
    }

    .stat-group {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 6px !important;
        margin: 0 !important;
        background: transparent !important;
        cursor: help !important;
    }

    .stat-label {
        font-size: 0.8rem !important;
        display: flex !important;
        justify-content: space-between !important;
        font-weight: 500 !important;
        color: var(--text-main) !important;
    }

    .stat-label span:first-child {
        display: inline !important;
        /* Restore name visibility */
    }

    .stat-bar-container {
        width: 100% !important;
        height: 6px !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border-radius: 3px !important;
    }

    .stat-tooltip {
        display: block !important;
        position: absolute !important;
        background: #0f1322 !important;
        border: 1px solid var(--accent-purple) !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9), 0 0 15px rgba(139, 92, 246, 0.4) !important;
        z-index: 15000 !important;
        pointer-events: none;
    }

    .sidebar-buttons {
        display: none !important;
    }

    .mobile-action-buttons {
        display: flex !important;
        gap: 6px !important;
        padding: 6px 8px !important;
        background: rgba(8, 8, 12, 0.45) !important;
        border-top: 1px solid var(--border-glow) !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .mobile-action-buttons .action-btn {
        flex: 1 !important;
        padding: 6px 4px !important;
        font-size: 0.75rem !important;
        text-align: center !important;
        white-space: nowrap !important;
    }

    .mobile-action-buttons .action-btn.glow-button-white,
    body.lab-theme .mobile-action-buttons .action-btn.glow-button-white {
        animation: buttonPulseWhiteMobile 1.5s infinite alternate !important;
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
        border-color: #ffffff !important;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.35) 100%) !important;
        color: #ffffff !important;
    }

    @keyframes buttonPulseWhiteMobile {
        0% {
            transform: scale(1);
            box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
        }
        100% {
            transform: scale(1.03);
            box-shadow: 0 0 25px rgba(255, 255, 255, 0.95);
    }
}

/* Ocultar el logo flotante de Google reCAPTCHA v3 por defecto */
.grecaptcha-badge {
    visibility: hidden !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.auth-modal-open .grecaptcha-badge {
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 999999 !important;
}


    footer {
        font-size: 0.6rem !important;
        flex-direction: column !important;
        gap: 4px !important;
        padding: 8px 12px !important;
        text-align: center !important;
    }

    footer span:first-child {
        font-size: 0.52rem !important;
        opacity: 0.55 !important;
        line-height: 1.2 !important;
    }

}

.glow-button {
    animation: buttonPulse 1.5s infinite alternate;
    box-shadow: 0 0 15px var(--accent-purple-glow);
    border-color: var(--accent-purple) !important;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.4) 0%, rgba(88, 166, 255, 0.4) 100%) !important;
}

@keyframes buttonPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 5px var(--accent-purple-glow);
    }

    100% {
        transform: scale(1.03);
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
    }
}

.glow-button-lilac {
    animation: buttonPulseLilac 1.5s infinite alternate;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
    border-color: #a855f7 !important;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.4) 0%, rgba(192, 132, 252, 0.4) 100%) !important;
    color: #ffffff !important;
}

@keyframes buttonPulseLilac {
    0% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(168, 85, 247, 0.4);
    }

    100% {
        transform: scale(1.03);
        box-shadow: 0 0 20px rgba(168, 85, 247, 0.8);
    }
}

.glow-button-white {
    animation: buttonPulseWhite 1.5s infinite alternate;
    box-shadow: 0 0 15px rgba(100, 116, 139, 0.3);
    border-color: #ffffff !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.3) 100%) !important;
    color: #ffffff !important;
}

@keyframes buttonPulseWhite {
    0% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(100, 116, 139, 0.3);
    }

    100% {
        transform: scale(1.03);
        box-shadow: 0 0 20px rgba(148, 163, 184, 0.7);
    }
}

/* Voice Recorder HUD */
.voice-recorder-hud {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 16px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px dashed rgba(239, 68, 68, 0.4);
    border-radius: 12px;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
}

.voice-recorder-hud.hidden {
    display: none !important;
}

.recording-status {
    color: #ef4444;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: textBlink 1.5s infinite alternate;
}

@keyframes textBlink {
    0% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

.audio-wave {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 24px;
}

.audio-wave .stroke {
    display: block;
    width: 3px;
    height: 100%;
    background: #ef4444;
    border-radius: 2px;
    animation: wavePulse 1.2s infinite ease-in-out;
}

.audio-wave .stroke:nth-child(1) {
    animation-delay: 0.1s;
    height: 30%;
}

.audio-wave .stroke:nth-child(2) {
    animation-delay: 0.3s;
    height: 60%;
}

.audio-wave .stroke:nth-child(3) {
    animation-delay: 0.6s;
    height: 100%;
}

.audio-wave .stroke:nth-child(4) {
    animation-delay: 0.4s;
    height: 80%;
}

.audio-wave .stroke:nth-child(5) {
    animation-delay: 0.2s;
    height: 50%;
}

.audio-wave .stroke:nth-child(6) {
    animation-delay: 0.5s;
    height: 75%;
}

.audio-wave .stroke:nth-child(7) {
    animation-delay: 0.15s;
    height: 40%;
}

@keyframes wavePulse {

    0%,
    100% {
        transform: scaleY(0.3);
    }

    50% {
        transform: scaleY(1);
    }
}



.error-msg {
    color: #ef4444;
    font-size: 0.8rem;
    text-align: center;
    margin: 0;
    font-family: var(--font-mono);
}

/* Deep Analysis v1.2 premium styles */
.analysis-modal-content {
    position: relative;
    background: rgba(15, 15, 24, 0.85) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-radius: 16px !important;
    animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    max-height: 85vh;
    overflow-y: auto;
}

#deep-analysis-modal .analysis-modal-content {
    overflow: hidden !important;
}

.analysis-scroll-area {
    max-height: 72vh;
    overflow-y: auto;
}

/* Premium scrollbar for the analysis modal and scroll areas */
.analysis-modal-content::-webkit-scrollbar,
.analysis-scroll-area::-webkit-scrollbar {
    width: 6px;
}

.analysis-modal-content::-webkit-scrollbar-track,
.analysis-scroll-area::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.analysis-modal-content::-webkit-scrollbar-thumb,
.analysis-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.3);
    border-radius: 8px;
}

.analysis-modal-content::-webkit-scrollbar-thumb:hover,
.analysis-scroll-area::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 85, 247, 0.5);
}

.analysis-modal-content #close-analysis-btn {
    position: absolute;
    top: 20px;
    right: 24px;
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s;
}

.analysis-modal-content #close-analysis-btn:hover {
    color: #fff;
}
@media (max-width: 768px) {
    .analysis-modal-content #close-analysis-btn {
        top: 14px;
        right: 16px;
        font-size: 2rem !important;
    }
    
    #deep-analysis-modal .analysis-modal-content {
        max-height: 80vh !important;
        margin: auto 10px !important;
        width: 92% !important;
    }
    
    #deep-analysis-modal .analysis-scroll-area {
        max-height: 66vh !important;
    }
}

@keyframes modalSlideIn {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

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

.analysis-section {
    margin-bottom: 1.25rem;
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid rgba(168, 85, 247, 0.6);
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease;
}

.analysis-section:hover {
    background: rgba(255, 255, 255, 0.04);
}

.analysis-section h4 {
    margin-top: 0;
    margin-bottom: 0.6rem;
    color: #c084fc;
    font-size: 1.05rem;
    font-family: var(--font-display);
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-section p {
    margin: 0;
    font-size: 0.92rem !important;
    color: var(--text-main) !important;
    line-height: 1.55;
}

.analysis-section.alternativa-section {
    border-left-color: #2dd4bf;
    background: rgba(45, 212, 191, 0.03);
}

.analysis-section.alternativa-section h4 {
    color: #2dd4bf;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Mobile Dictation Tip */
.dictation-tip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    background: rgba(11, 26, 48, 0.95);
    border: 1px solid var(--border-glow);
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 30px 12px 15px;
    color: #fff;
    font-size: 0.85rem;
    font-family: var(--font-body);
    margin-bottom: 10px;
    z-index: 100;
    text-align: left;
}

.dictation-tip .close-tip {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
}

.input-area {
    position: relative;
}

@media (max-width: 768px) {
    #mic-btn {
        display: none !important;
    }
}

/* Input Wrapper (Desktop & Mobile) */
.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

@media (max-width: 768px) {
    .input-wrapper {
        flex-direction: row;
        align-items: flex-end;
        gap: 8px;
    }

    .input-actions-row {
        width: auto !important;
        margin: 0 !important;
    }

    #user-input {
        flex: 1;
        height: 42px;
        min-height: 42px;
        max-height: 150px;
        overflow-y: hidden;
        /* Hide scrollbar until max height is reached */
        padding-top: 11px;
        padding-bottom: 11px;
        line-height: 1.2;
    }

    /* Hide scrollbars on mobile globally */
    *::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    * {
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
    }

    /* Optimize scenario header for mobile */
    .message-wrapper.scenario-header {
        max-width: none !important;
        width: calc(100% + 40px) !important;
        margin-top: -20px !important;
        margin-left: -20px !important;
        margin-right: -20px !important;
        position: relative !important;
        display: block !important;
    }

    .message-wrapper.scenario-header .message-bubble {
        width: 100% !important;
        border-radius: 0 !important;
        /* Completely straight corners to match edge-to-edge layout */
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
        padding-top: 25px !important;
        padding-left: 30px !important;
        padding-right: 20px !important;
        margin: 0 !important;
    }

    .play-msg-btn {
        display: none !important;
    }

    /* Optimize chat space */
    .message-bubble {
        padding: 8px 12px !important;
        font-size: 0.88rem !important;
        line-height: 1.35 !important;
    }

    .chat-messages {
        padding: 10px !important;
        gap: 8px !important;
    }

    .chat-container {
        padding-top: 0px !important;
    }

    .analysis-section {
        padding: 0.8rem !important;
        margin-bottom: 0.8rem !important;
    }

    .analysis-section h4 {
        margin-bottom: 0.4rem !important;
        font-size: 0.95rem !important;
    }

    .analysis-section p {
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
    }

    #analysis-results-content {
        gap: 10px !important;
    }

    .modal-content {
        padding: 16px !important;
    }
}

/* Prevent logo overlap on smaller desktop screens */
@media (max-width: 1250px) and (min-width: 769px) {
    .home-logo-link {
        position: relative;
        top: auto;
        left: auto;
        align-self: flex-start;
        margin-top: 20px;
        margin-right: 20px;
        margin-left: 20px;
    }

    .app-container {
        width: 100%;
        margin-right: 20px;
    }
}

@media (max-width: 768px) {
    .message-wrapper {
        max-width: 98% !important;
    }

    .lab-mode-cards {
        flex-direction: column;
        gap: 12px !important;
    }
}

/* Laboratory setup styles */
.lab-mode-card {
    transition: all 0.3s ease;
}

.lab-mode-card.active {
    border-color: #2dd4bf !important;
    background: rgba(45, 212, 191, 0.08) !important;
    box-shadow: 0 0 15px rgba(45, 212, 191, 0.25) !important;
}

.lab-mode-card.active h4 {
    color: #2dd4bf !important;
}

.lab-mode-card:not(.active):hover {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.lab-mode-card:not(.active) h4 {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Custom white styling for Modo Laboratorio card */
#mode-laboratorio {
    border-color: rgba(255, 255, 255, 0.6) !important;
}

#mode-laboratorio h3 {
    color: #ffffff !important;
}

#mode-laboratorio p {
    color: rgba(255, 255, 255, 0.9) !important;
}

#mode-laboratorio .mode-badge {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

#mode-laboratorio::before {
    background: #ffffff !important;
}

#mode-laboratorio.active:hover {
    border-color: rgba(255, 255, 255, 1) !important;
    box-shadow: 0 12px 30px rgba(255, 255, 255, 0.15) !important;
}

#mode-laboratorio.active:hover::before {
    background: #ffffff !important;
}

/* 2x2 grid structure for Laboratory Mode */
.lab-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 25px auto;
}

@media (max-width: 768px) {
    .lab-grid {
        gap: 8px !important;
        margin: 0 auto 12px auto !important;
    }
}

.lab-menu-buttons-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.lab-menu-buttons-container .lab-grid {
    margin-bottom: 0 !important;
}

@media (max-width: 768px) {
    .lab-menu-buttons-container {
        gap: 12px;
    }
}

/* Warning storage info button */
.storage-info-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    font-family: var(--font-body);
    transition: all 0.2s;
    border: 2px solid;
    margin: 0;
    padding: 0;
    line-height: 1;
}

/* Positioned inside main-workspace top-left */
#lab-menu-page .storage-info-btn {
    position: absolute;
    top: 12px;
    left: 12px;
}

body.lab-theme .storage-info-btn {
    background: transparent;
    border-color: #94a3b8;
    color: #64748b;
}

body.lab-theme .storage-info-btn:hover {
    background: #e2e8f0;
    border-color: #475569;
    color: #334155;
}

/* 
===========================================
   GLOBAL THEME: LABORATORY (MODO BLANCO)
===========================================
*/
body.lab-theme {
    background-color: #f1f5f9;
}

body.lab-theme .app-container {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #bae6fd;
    box-shadow: 0 0 25px rgba(2, 132, 199, 0.1), inset 0 0 20px rgba(2, 132, 199, 0.05);
}

body.lab-theme header {
    background: rgba(248, 250, 252, 0.95) !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

body.lab-theme header h1 {
    background: linear-gradient(135deg, #0f172a 30%, #0ea5e9 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

body.lab-theme header h1 .subtitle {
    background: #0284c7 !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

body.lab-theme .icon-btn {
    color: #334155;
    background: #ffffff;
    border: 1px solid #cbd5e1;
}

body.lab-theme .icon-btn:hover {
    background: #e0f2fe;
    border-color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
    color: #0284c7;
}

body.lab-theme footer {
    background: rgba(248, 250, 252, 0.95) !important;
    border-top: 1px solid #e2e8f0 !important;
    color: #475569 !important;
}

body.lab-theme footer a {
    color: #0ea5e9 !important;
}

/* Rediseño tarjetas de Modo (Ataque / Defensa) */
body.lab-theme .lab-mode-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #334155 !important;
    box-shadow: none !important;
}

body.lab-theme .lab-mode-card h4 {
    color: #0f172a !important;
}

body.lab-theme .lab-mode-card p {
    color: #64748b !important;
}

body.lab-theme .lab-mode-card.active {
    background: #ffffff !important;
    border: 2px solid #0ea5e9 !important;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.15) !important;
}

body.lab-theme .lab-mode-card.active h4 {
    color: #0284c7 !important;
}



/* Exit Confirm Modal - Default Game Style (Red) */
.exit-modal-content {
    max-width: 480px;
    border: 2px solid #ef4444;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.45);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.exit-modal-title {
    margin-top: 0;
    margin-bottom: 8px;
    color: #ef4444;
    font-family: var(--font-display);
    font-size: 1.3rem;
}

.exit-modal-desc {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-align: center;
}

.exit-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.exit-modal-cancel {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid;
    font-family: var(--font-body);
    font-weight: 600;
}

.exit-modal-accept {
    background: #ef4444;
    color: #fff;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
}

/* Exit Confirm Modal - Lab Theme (White/Blue) */
body.lab-theme .exit-modal-content {
    border-color: var(--accent-teal);
    box-shadow: 0 0 25px var(--accent-teal-glow);
    background: #ffffff;
}

body.lab-theme .exit-modal-title {
    color: #0f172a;
}

body.lab-theme .exit-modal-desc {
    color: #475569;
}

body.lab-theme .exit-modal-cancel {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

body.lab-theme .exit-modal-accept {
    background: #2dd4bf;
    color: #022c22;
}

/* Menu User Info */
.menu-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: #c084fc;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-weight: 600;
    text-align: left;
}

.user-info-icon {
    font-size: 1rem;
}

#user-info-text {
    flex: 1;
}

/* Menu Logout Button */
.menu-logout-btn {
    color: #ef4444 !important;
    font-weight: 700;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 4px;
}

.menu-logout-btn:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ff6b6b !important;
}

/* Account Modal */
.account-modal-content {
    max-width: 460px;
    border: 2px solid var(--accent-purple);
    box-shadow: 0 0 25px var(--accent-purple-glow);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-modal-title {
    margin-top: 0;
    margin-bottom: 4px;
    color: var(--accent-purple);
    font-family: var(--font-display);
    font-size: 1.3rem;
    text-align: center;
}

.account-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.account-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    font-size: 0.9rem;
}

.account-field-label {
    color: var(--text-muted);
    font-weight: 600;
}

.account-action-btn {
    background: rgba(108, 99, 255, 0.15);
    color: #c084fc;
    border: 1px solid rgba(108, 99, 255, 0.3);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    width: 100%;
    transition: var(--transition-smooth);
}

.account-action-btn:hover {
    background: rgba(108, 99, 255, 0.25);
    border-color: rgba(108, 99, 255, 0.5);
}

.account-danger-zone {
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.05);
}

.account-delete-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    width: 100%;
    transition: var(--transition-smooth);
}

.account-delete-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
}

.account-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 4px;
}

.account-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    font-family: var(--font-body);
    box-sizing: border-box;
}

.account-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px var(--accent-purple-glow);
}

.account-feedback {
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
}

body.lab-theme .account-modal-content {
    border-color: var(--accent-teal);
    box-shadow: 0 0 25px var(--accent-teal-glow);
    background: #ffffff;
}

body.lab-theme .account-modal-title {
    color: #0f172a;
}

body.lab-theme .account-field {
    background: #f8fafc;
}

body.lab-theme .account-field-label {
    color: #475569;
}

body.lab-theme .account-input {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

body.lab-theme .account-input:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 10px var(--accent-teal-glow);
}

/* Lab Builder Titles Border */
#lbl-build-attack-title,
#lbl-build-defense-title,
#lbl-play-attack-title,
#lbl-play-defense-title,
#lbl-lab-setup-title,
#lbl-lab-attack-title,
#lbl-lab-defense-title,
#lbl-lab-menu-title {
    text-shadow: none;
    font-weight: 800;
    color: #0f172a !important;
}

body.lab-theme #lbl-lab-setup-desc {
    color: #0f172a !important;
    font-weight: 600;
    text-shadow: none;
}

body.lab-theme .mode-card {
    background: #ffffff;
    border: 2px solid #cbd5e1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

body.lab-theme .mode-card:hover {
    border-color: #f472b6;
    box-shadow: 0 8px 25px rgba(244, 114, 182, 0.2);
}

body.lab-theme .mode-card p {
    color: #475569;
}

body.lab-theme #lbl-lab-menu-desc {
    color: #0f172a !important;
    font-weight: 600;
    text-shadow: none;
}

/* Animacion Zoom Rebote para transiciones de Laboratorio */
@keyframes bounceZoom {
    0% {
        transform: scale(0.96);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.015);
        opacity: 1;
    }

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

.animate-bounce {
    animation: bounceZoom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Custom Lab Tooltip Balloon */
.lab-balloon {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5), 0 0 10px rgba(168, 85, 247, 0.3);
    z-index: 1000;
    white-space: nowrap;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    border: 1px solid rgba(168, 85, 247, 0.5);
    animation: balloonFloat 2s infinite alternate ease-in-out;
}

@keyframes balloonFloat {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-4px);
    }
}

.lab-balloon::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 40px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #7c3aed;
}

/* Lab Setup Inline Tooltips */
.lab-inline-stat-group {
    position: relative;
    cursor: help;
}

.lab-inline-stat-group .stat-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translate(-50%, 8px);
    width: 220px;
    padding: 10px;
    background: rgba(10, 15, 30, 0.98);
    border: 1px solid rgba(168, 85, 247, 0.5);
    border-radius: 8px;
    font-size: 0.76rem;
    color: #ffffff;
    line-height: 1.4;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 10px rgba(168, 85, 247, 0.3);
    pointer-events: none;
    opacity: 0;
    z-index: 10000;
    transition: all 0.25s ease;
    white-space: normal;
    text-align: left;
}

.lab-inline-stat-group .stat-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0 5px;
    border-style: solid;
    border-color: rgba(10, 15, 30, 0.98) transparent transparent transparent;
}

.lab-inline-stat-group:hover .stat-tooltip {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Custom Play and Custom Defense Light Mode (White Theme) inside Lab Mode */

body.lab-theme #game-page {
    background: #f8fafc !important;
    color: #0f172a !important;
}

body.lab-theme .chat-container {
    background: #ffffff !important;
    border-right: 1px solid #e2e8f0 !important;
}

body.lab-theme .chat-messages {
    background: #ffffff !important;
}

/* AI opponent bubble in custom modes under lab-theme */
body.lab-theme .message-wrapper.ai .message-bubble {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}

body.lab-theme .message-wrapper.ai .message-bubble::before {
    border-color: transparent #cbd5e1 transparent transparent !important;
}

body.lab-theme .message-wrapper.ai .message-bubble::after {
    border-color: transparent #f1f5f9 transparent transparent !important;
}

/* User bubble - keep purple but make it a clean solid color or nice gradient */
body.lab-theme .message-wrapper.user .message-bubble {
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2) !important;
}

/* System feedback bubble in custom modes under lab-theme */
body.lab-theme .message-wrapper.system .message-bubble {
    color: #0f766e !important;
}

body.lab-theme .message-wrapper.system.red-feedback .message-bubble {
    background: #fff5f5 !important;
    border: 1px dashed #ef4444 !important;
    color: #b91c1c !important;
}

/* Scenario Header bubble */
body.lab-theme .message-wrapper.scenario-header .message-bubble {
    background: linear-gradient(135deg, #e0f2fe 0%, #f3e8ff 100%) !important;
    border: 1.5px solid #0ea5e9 !important;
    color: #0f172a !important;
}

body.lab-theme .message-wrapper.scenario-header .message-bubble strong {
    color: #0f172a !important;
}

/* Input area */
body.lab-theme .input-area {
    background: #ffffff !important;
    border-top: 1px solid #e2e8f0 !important;
}

body.lab-theme .input-area textarea {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

body.lab-theme .input-area textarea::placeholder {
    color: #94a3b8 !important;
}

body.lab-theme .input-area textarea:focus {
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15) !important;
}

body.lab-theme .input-area .mic-btn {
    border-color: #cbd5e1 !important;
    color: #475569 !important;
}

body.lab-theme .input-area .mic-btn:hover {
    background: #f1f5f9 !important;
    border-color: #7c3aed !important;
}

body.lab-theme #send-btn {
    background: linear-gradient(135deg, #0f5052 0%, #421475 100%) !important;
    box-shadow: none !important;
}

body.lab-theme #send-btn:hover {
    background: #6d28d9 !important;
}

body.lab-theme #send-btn:disabled {
    background: #e2e8f0 !important;
    color: #94a3b8 !important;
}

/* Bottom buttons row in game page */
body.lab-theme .action-btn {
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    color: #475569 !important;
}

body.lab-theme .action-btn:not(.glow-button):not(.glow-button-lilac):not(.glow-button-white) {
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}

body.lab-theme .action-btn.glow-button-white {
    border-color: #cbd5e1 !important;
    background: #ffffff !important;
    color: #0f172a !important;
}

body.lab-theme .action-btn:hover {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

body.lab-theme #mobile-btn-retry-scenario,
body.lab-theme #btn-retry-scenario {
    border-color: #0ea5e9 !important;
    color: #0284c7 !important;
}

body.lab-theme #mobile-btn-retry-scenario:hover,
body.lab-theme #btn-retry-scenario:hover {
    background: #f0f9ff !important;
    border-color: #0ea5e9 !important;
}

body.lab-theme #mobile-btn-next-scenario,
body.lab-theme #btn-next-scenario {
    background: #0ea5e9 !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
}

body.lab-theme #mobile-btn-next-scenario:hover,
body.lab-theme #btn-next-scenario:hover {
    background: #0284c7 !important;
}

body.lab-theme .action-btn.secondary {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #475569 !important;
}

body.lab-theme .action-btn.secondary:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Sidebar and Stat Groups */
body.lab-theme .sidebar {
    background: #f8fafc !important;
    border-left: 1px solid #e2e8f0 !important;
}

body.lab-theme .sidebar h3 {
    color: #0f172a !important;
}

body.lab-theme .stat-group {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02) !important;
}

body.lab-theme .stat-group:hover {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
}

body.lab-theme .stat-label {
    color: #334155 !important;
}

body.lab-theme .stat-value {
    color: #0f172a !important;
}

body.lab-theme .stat-bar-container {
    background: #e2e8f0 !important;
}

body.lab-theme .chat-indicators {
    background: #f8fafc !important;
    border-left: 1px solid #e2e8f0 !important;
}

body.lab-theme .chat-indicators:hover {
    background: #f1f5f9 !important;
}

/* Stats History Modal Styles */
.stats-history-modal-content {
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(168, 85, 247, 0.4) !important;
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.25) !important;
    border-radius: 12px;
}

.stats-history-filters select {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.stats-history-filters select:focus {
    border-color: #c084fc;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

.stats-chart-wrapper {
    position: relative;
    width: 100%;
    margin-top: 10px;
}

.stats-table-wrapper {
    scrollbar-width: thin;
    scrollbar-color: rgba(168, 85, 247, 0.4) rgba(0, 0, 0, 0.1);
}

.stats-table-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.stats-table-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.stats-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.4);
    border-radius: 3px;
}

#stats-history-table th, #stats-history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#stats-history-table tbody tr:hover {
    background: rgba(168, 85, 247, 0.05);
}

.stats-pill {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.stats-pill.attack {
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.stats-pill.defense {
    background: rgba(45, 212, 191, 0.15);
    color: #2dd4bf;
    border: 1px solid rgba(45, 212, 191, 0.3);
}

.stats-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.stats-badge-item {
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.stats-badge-item.positive {
    color: #2dd4bf;
    background: rgba(45, 212, 191, 0.05);
}

.stats-badge-item.negative {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

@media (max-width: 768px) {
    .stats-history-modal-content {
        padding: 16px !important;
        margin: 10px !important;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .stats-chart-wrapper {
        height: 200px !important;
    }
    
    #stats-history-table thead {
        display: none;
    }
    
    #stats-history-table, #stats-history-table tbody, #stats-history-table tr, #stats-history-table td {
        display: block;
        width: 100%;
    }
    
    #stats-history-table tr {
        margin-bottom: 15px;
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid var(--border-glow);
        border-radius: 8px;
        padding: 10px;
        box-sizing: border-box;
    }
    
    #stats-history-table td {
        border: none;
        padding: 6px 0;
        text-align: right;
        position: relative;
        padding-left: 50%;
        min-height: 28px;
    }
    
    #stats-history-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        font-weight: 600;
        text-align: left;
        color: #c084fc;
    }
}

/* Defense mode deep analysis expandable bar */
#lab-defense-deep-bar:hover {
    background: rgba(168, 85, 247, 0.1) !important;
    border-color: rgba(168, 85, 247, 0.4) !important;
}

#lab-defense-deep-bar:active {
    background: rgba(168, 85, 247, 0.15) !important;
}

#lab-defense-deep-content {
    animation: deepSlideDown 0.25s ease-out;
}

/* Defense mode deep analysis expandable bar */
#lab-defense-deep-bar:hover {
    background: rgba(168, 85, 247, 0.1) !important;
    border-color: rgba(168, 85, 247, 0.4) !important;
}

#lab-defense-deep-bar:active {
    background: rgba(168, 85, 247, 0.15) !important;
}

#lab-defense-deep-content {
    animation: deepSlideDown 0.25s ease-out;
}

@keyframes deepSlideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 2000px; }
}

/* Duplicado de reCAPTCHA eliminado para evitar conflictos */
