/* Chat Interface Styles - Extracted from scenario.html */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body,
button,
input,
select,
textarea {
    font-family: var(--chat-font-family, 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    height: 100dvh;
    height: 100%;
    overflow: hidden;
    /* Lock body scroll to prevent jitter */
    overscroll-behavior: none;
}

:root {
    --chat-primary: #9d0a0e;
    --chat-secondary: #f15a22;
    --chat-gradient: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-secondary) 100%);
    --chat-font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --primary: var(--chat-primary);
    --primary-dark: var(--chat-primary);
    --primary-light: #d71921;
    --secondary: var(--chat-secondary);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --gray-900: #0f172a;
    --gray-800: #1e293b;
    --gray-700: #334155;
    --gray-600: #475569;
    --gray-500: #64748b;
    --gray-400: #94a3b8;
    --gray-300: #cbd5e1;
    --gray-200: #e2e8f0;
    --gray-100: #f1f5f9;
    --gray-50: #f8fafc;
    --white: #ffffff;
    --gradient: var(--chat-gradient);
    --gradient-2: var(--chat-gradient);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

body {
    background-color: #f8fafc;
    background-image: url('../../img/bgg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    height: 100vh;
    width: 100%;
    min-height: -webkit-fill-available;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    color: var(--gray-800);
    line-height: 1.6;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    -webkit-overflow-scrolling: touch;
}

.app-container {
    width: 100%;
    max-width: 800px;
    height: 100dvh;
    /* Modern mobile browsers */
    height: calc(var(--vh, 1vh) * 100);
    /* Fallback */
    background: var(--white);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    animation: slideUp 0.5s ease-out;
}

@media (max-width: 768px) {
    .app-container {
        height: 100vh;
        /* Fallback */
        height: 100dvh;
        border-radius: 0;
        max-width: none;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Tab Navigation */
.tab-navigation {
    display: flex;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    color: var(--gray-600);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--chat-primary);
}

.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
    /* Fixed: only individual tabs control their scroll */
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

#analytics-tab,
#docs-tab {
    overflow-y: auto;
}

/* FontAwesome Icon Rendering - CRITICAL */
.fas,
.fa-solid,
.fa,
i[class*="fa-"] {
    font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Brands' !important;
    font-weight: 900 !important;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.chat-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    margin: 0;
    margin-bottom: 0;
    position: relative;
    z-index: 20;
}

@media (max-width: 480px) {
    .chat-header {
        margin: 0;
        padding: 0.75rem 1rem;
        border-radius: 0;
    }
}

@media (max-width: 375px) {
    .chat-header {
        margin: 0.25rem 0.25rem 0 0.25rem;
        padding: 0.5rem 0.75rem;
    }

    .bot-avatar {
        width: 30px;
        height: 30px;
    }

    .header-actions {
        gap: 0.4rem;
    }

    .header-btn {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bot-avatar {
    width: clamp(32px, 10vw, 40px);
    height: clamp(32px, 10vw, 40px);
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.bot-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    border-radius: 0 !important;
}

.bot-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.bot-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.01em;
}

.bot-status {
    font-size: 0.75rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.language-selector {
    padding: 0.5rem 0.875rem;
    background: #f2f4f7;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.language-selector:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.language-selector:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(157, 10, 14, 0.1);
}

.header-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: #f2f4f7;
    border: none;
    border-radius: 50%;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 1rem;
}

.header-btn:hover {
    background: #e5e7eb;
    color: var(--gray-700);
    transform: scale(1.08);
}

/* Messages Area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    padding-bottom: 3rem;
    /* Increased bottom padding */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    background-image: url('../../img/chatttbackground.png');
    background-size: contain;
    background-color: rgba(255, 255, 255, 0.6);
    background-blend-mode: lighten;
    scroll-padding-bottom: 120px;
}

/* Mobile: Reduce padding */
@media (max-width: 480px) {
    .messages-area {
        padding: 1rem;
        padding-bottom: 5rem;
        /* More space for response sheet */
        gap: 0.75rem;
        scroll-padding-bottom: 140px;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .messages-area {
        padding: 1.2rem;
        padding-bottom: 1.8rem;
        gap: 0.9rem;
    }
}

.messages-area::-webkit-scrollbar {
    width: 4px;
}

.messages-area::-webkit-scrollbar-track {
    background: transparent;
}

.messages-area::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 75%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Mobile: Wider messages */
@media (max-width: 480px) {
    .message {
        max-width: 88%;
        gap: 0.5rem;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .message {
        max-width: 85%;
        gap: 0.6rem;
    }
}

@keyframes bubble-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }

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

.bubble-in {
    animation: bubble-in 0.18s ease-out;
}

.message.bot {
    align-self: flex-start;
}

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

[dir="rtl"] .message {
    direction: rtl;
}

[dir="rtl"] .message.user {
    flex-direction: row;
    align-self: flex-start;
}

[dir="rtl"] .message.bot {
    flex-direction: row-reverse;
    align-self: flex-end;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    overflow: hidden;
}

.message-avatar.has-image {
    background: transparent;
    color: inherit;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.bot-message-avatar {
    background: var(--chat-primary);
    color: var(--white);
}

.bot-message-avatar.has-image {
    background: transparent;
}

.user-message-avatar {
    background: var(--gray-200);
    color: var(--gray-700);
}

.user-message-avatar.has-image {
    background: transparent;
}

.message-content {
    flex: 1;
}

.message-bubble {
    padding: 0.85rem 1.15rem;
    border-radius: 20px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    word-wrap: break-word;
    overflow-wrap: anywhere;
    /* Handle long medical terms/URLs */
    white-space: pre-wrap;
    line-height: 1.45;
}

.message.bot .message-bubble {
    background: #ffffff;
    color: var(--gray-800);
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.message.user .message-bubble {
    background: var(--chat-primary);
    color: #ffffff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 10px rgba(157, 10, 14, 0.15);
}

/* Mobile: Adjust padding */
@media (max-width: 480px) {
    .message-bubble {
        padding: 0.65rem 0.9rem;
        font-size: 0.9rem;
        border-radius: 16px;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .message-bubble {
        padding: 0.7rem 0.95rem;
        font-size: 0.92rem;
    }
}

/* Already handled above */

.message-bubble:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.message-text {
    font-size: 1rem;
    line-height: 1.6;
    letter-spacing: -0.011em;
}

/* Clinical Info Card Utility */
.clinical-card {
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 0.75rem;
    margin: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.clinical-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--chat-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.clinical-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gray-900);
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.message.bot .message-time {
    color: var(--gray-500);
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Enhanced Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.typing-indicator.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

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

.typing-dots {
    display: flex;
    gap: 0.3rem;
    padding: 0.75rem 1rem;
    background: var(--white);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--gray-100);
}

.typing-dots::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(5, 150, 105, 0.08), transparent);
    animation: shimmer 2.5s infinite;
}

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

    100% {
        transform: translateX(100%);
    }
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.2s infinite ease-in-out;
    position: relative;
    z-index: 1;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

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

    30% {
        transform: translateY(-6px) scale(1.1);
        opacity: 1;
    }
}

.typing-status {
    font-size: 0.75rem;
    color: var(--primary);
    font-style: italic;
    font-weight: 500;
    animation: pulse 2s infinite;
}

/* Response Area */
.response-handle {
    width: 40px;
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    margin: -8px auto 12px auto;
    display: none;
}

@media (max-width: 768px) {
    .response-handle {
        display: block;
    }
}

.response-container {
    padding: 1.5rem;
    background: var(--white);
    border-top: 1px solid var(--gray-100);
    display: block;
    visibility: visible;
    min-height: auto;
    position: relative;
    z-index: 30;
    /* Increased to be above messages */
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    max-height: none;
    overflow: visible;
}

/* Mobile: Reduce padding and adjust height */
@media (max-width: 480px) {
    .response-container {
        padding: 1.25rem 1rem 1rem 1rem;
        /* Improved safe area handling */
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
        min-height: 80px;
        max-height: 45vh;
        /* Prevent it from covering everything */
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
    }
}

@media (max-width: 375px) {
    .response-container {
        padding: 1rem 0.75rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }

    .response-label {
        margin-bottom: 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .response-container {
        padding: 1.2rem;
        min-height: 75px;
        max-height: 100vh;
    }
}

.response-container::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to bottom, transparent, var(--white));
    pointer-events: none;
}

.response-container.has-scroll-above::after {
    content: '↑ Scroll up to see more messages';
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0.8;
    animation: fadeInOut 3s ease-in-out;
    pointer-events: none;
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0;
    }

    20%,
    80% {
        opacity: 0.8;
    }
}

.response-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.response-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 40px;
    width: 100%;
    max-height: 30vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Mobile: Horizontal scroll for response buttons */
@media (max-width: 480px) {
    .response-options {
        flex-direction: column;
        flex-wrap: nowrap;
        overflow-x: hidden;
        overflow-y: auto;
        gap: 0.75rem;
        padding: 0.5rem 0 1rem 0;
    }

    .response-options::-webkit-scrollbar {
        display: none;
    }

    .response-btn {
        padding: 1rem 1.25rem;
        font-size: 0.95rem;
        width: 100%;
        min-height: 56px;
        background: #ffffff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        border: 1.5px solid rgba(0, 0, 0, 0.04);
        border-radius: 18px;
        line-height: 1.4;
        color: var(--gray-800);
        font-weight: 500;
        transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .response-btn:active {
        transform: scale(0.97);
        border-color: var(--chat-primary);
        background: #fffcfc;
    }
}

/* Scroll to Bottom Button */
.scroll-to-bottom {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: var(--chat-primary);
    color: var(--white);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    opacity: 0;
    transform: translateY(10px);
}

.scroll-to-bottom.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.scroll-to-bottom:hover {
    background: var(--chat-secondary);
    transform: translateY(-3px);
}

/* Tablet: Allow wrapping */
@media (max-width: 768px) and (min-width: 481px) {
    .response-options {
        flex-wrap: wrap;
        gap: 0.6rem;
    }
}

.response-btn {
    padding: 0.5rem 1rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    color: var(--gray-700);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    text-align: center;
}

.response-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    /*background: var(--chat-primary);*/
    transition: left 0.3s ease;
    z-index: 0;
    pointer-events: none;
}

.response-btn:hover,
.response-btn:active {
    /*color: var(--white);*/
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.response-btn:hover::before,
.response-btn:active::before {
    left: 0;
}

/* Mobile touch feedback */
@media (hover: none) and (pointer: coarse) {
    .response-btn:active {
        transform: translateY(-1px) scale(0.98);
        box-shadow: var(--shadow-sm);
    }
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Center content for a splash screen feel */
    height: 100%;
    width: 100%;
    padding: 2rem 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    overflow: hidden;

    /* Absolute overlay to cover parent padding and background */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;

    background-color: #ffffff;
    background-image: url('../../img/chatttbackground.png');
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
    scroll-behavior: smooth;
}

.welcome-screen::-webkit-scrollbar {
    display: none;
}

/* Mobile: Adjust padding and spacing */
@media (max-width: 480px) {
    .welcome-screen {
        padding: 1rem;
        justify-content: center;
        padding-top: 1rem;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .welcome-screen {
        padding: 2rem 1.5rem;
    }
}

.welcome-icon {
    width: 100px;
    height: 100px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    background: white;
    padding: 15px;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.welcome-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: floatingLogo 3s ease-in-out infinite;
    transition: transform 0.3s ease;
}

.welcome-logo-img:hover {
    transform: scale(1.05);
}

@keyframes floatingLogo {
    0% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-15px) rotate(2deg);
    }

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

/* Global fix to ensure no red text or other overlays appear on images */
.role-icon::after {
    display: none !important;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    background: white;
    color: var(--gray-700);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 50px;
    /* Modern pill style */
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.back-btn:hover {
    background: var(--gray-200);
    transform: translateX(-4px);
}

@media (max-width: 480px) {
    .back-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }
}

.welcome-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes float {

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

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

.welcome-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
    display: none;
}

.welcome-description {
    font-size: 1rem;
    color: var(--gray-600);
    max-width: 450px;
    margin-bottom: 2rem;
}

/* Role Selection */
.role-selection {
    width: 100%;
    max-width: 600px;
}

.role-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 2rem;
    letter-spacing: -0.01em;
}

@media (max-width: 480px) {
    .role-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
}

.role-cards {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem;
    width: 100% !important;
    max-width: 600px;
    margin: 0 auto;
    overflow-y: auto;
    max-height: 100%;
}

@media (max-width: 768px) {
    .role-selection {
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow: hidden;
        height: 100%;
        width: 100%;
    }

    .role-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        /* Force 2 columns beside each other */
        align-content: start !important;
        /* Prevents rows from stretching */
        gap: 1rem !important;
        padding: 1rem !important;
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
        overflow-y: auto !important;
        /* Internal scroll */
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }

    .role-card {
        padding: 0 !important;
        height: min-content !important;
        /* Fix: prevents cards from stretching tall */
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background: #fff;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    }

    .role-icon {
        width: 100% !important;
        height: 140px !important;
        /* Slightly taller for better face display */
        margin-bottom: 0 !important;
        border-radius: 12px 12px 0 0 !important;
        border: none !important;
        overflow: hidden;
    }

    .role-icon img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center 15%;
        /* Fix: focus on face */
    }

    .role-card:active {
        transform: scale(0.98);
        background: #fdfdfd;
    }

    .role-name {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.95rem !important;
        font-weight: 700 !important;
    }

    .scenario-card {
        padding: 0 !important;
    }
}

.role-card {
    padding: 0;
    /* Remove default padding for image flush */
    background: var(--white);
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    /* Important for border-radius on children */
    z-index: 1;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(157, 10, 14, 0.05) 0%, rgba(241, 90, 34, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.role-card:hover {
    border-color: #d1d5db;
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.role-card:hover::before {
    opacity: 1;
}

.role-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, #fef2f2 0%, #fef5f3 100%);
    box-shadow: 0 8px 20px rgba(157, 10, 14, 0.15);
}

.role-icon {
    width: 100%;
    height: clamp(140px, 20vw, 200px);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 0;
    background-color: #f3f4f6;
    border: none;
    background-size: cover;
    background-position: center;
    position: relative;
    /* Font size 0 and color transparent to hide any accidental text nodes */
    font-size: 0 !important;
    color: transparent !important;
}

.role-icon img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 0 !important;
    /* Forces rectangular cover image */
}

.role-name {
    padding: 0.85rem 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
}

.role-desc {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.role-skeletons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.role-skeleton-card {
    height: 180px;
    border-radius: 16px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Mobile: Horizontal scroll (default for all mobile sizes) */
.scenario-selector {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem 1rem;
    /* Added horizontal padding to prevent cards from being cut off */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.scenario-selector::-webkit-scrollbar {
    display: none;
}

/* Desktop: Horizontal Scroll for scenarios */
@media (min-width: 769px) {
    .scenario-selector {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 1.5rem;
        width: 100%;
        max-width: 850px;
        /* Wider container for 2 large cards */
        margin: 0 auto 1.5rem auto;
        padding: 1.5rem 2rem;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        min-height: 360px;
    }
}

.scenario-selector-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    /* Slightly larger */
    height: 50px;
    border-radius: 50%;
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Softer border */
    color: var(--chat-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    /* Ensure on top */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
    /* More prominent shadow */
}

.scroll-arrow:hover {
    background: var(--chat-primary);
    color: var(--white);
    border-color: var(--chat-primary);
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 12px 24px rgba(157, 10, 14, 0.25);
}

.scroll-arrow:active {
    transform: translateY(-50%) scale(0.9);
}

.scroll-arrow.prev {
    left: -25px;
    /* Move slightly outside to look better */
}

.scroll-arrow.next {
    right: -25px;
}

@media (max-width: 900px) {
    .scroll-arrow.prev {
        left: 10px;
    }

    .scroll-arrow.next {
        right: 10px;
    }
}

/* Hide arrows on mobile by default, show on desktop */
@media (max-width: 768px) {
    .scroll-arrow {
        display: none;
    }

    .scenario-selector {
        padding: 1rem 5vw !important;
    }
}

.scenario-selector::-webkit-scrollbar {
    height: 6px;
}

.scenario-selector::-webkit-scrollbar-track {
    background: transparent;
}

.scenario-selector::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 999px;
}

.scenario-selector::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

[dir="rtl"] .scenario-selector {
    direction: rtl;
}

.scenario-card {
    padding: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: left;
    scroll-snap-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    outline: none;
    position: relative;
    overflow: hidden;
    z-index: 1;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    flex-direction: column;
}

/* Mobile: Horizontal scroll card sizing with fixed page */
@media (max-width: 768px) {
    .scenario-selection {
        display: flex;
        flex-direction: column;
        height: auto;
        width: 100%;
        max-width: 95vw;
        overflow: hidden;
        justify-content: center;
    }

    .back-btn {
        flex-shrink: 0;
        margin-top: 5px;
    }

    .scenario-title {
        flex-shrink: 0;
        margin-bottom: 0.5rem !important;
    }

    .scenario-selector {
        display: flex !important;
        flex-direction: row !important;
        /* BACK TO HORIZONTAL */
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-snap-type: x mandatory;
        padding: 1rem 10vw !important;
        /* Space for centering first/last cards */
        gap: 1.25rem !important;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
        align-items: stretch;
        /* Center cards vertically in the row */
    }

    .scenario-selector::-webkit-scrollbar {
        display: none;
    }

    .scenario-card {
        min-width: 280px;
        max-width: 85vw;
        width: 80vw;
        flex-shrink: 0;
        scroll-snap-align: center;
        border-radius: 24px;
        box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
        background: #fff;
        border: 1px solid rgba(0, 0, 0, 0.05);
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 280px;
        /* Ensure space for title */
        overflow: hidden;
    }

    .scenario-image {
        height: 200px !important;
        width: 100% !important;
        border-radius: 24px 24px 0 0 !important;
        flex-shrink: 0;
        object-fit: cover;
    }

    .scenario-info {
        padding: 1.25rem 1.5rem !important;
        background: white;
        flex-shrink: 0;
        /* Don't squash the title area */
        min-height: 80px;
        display: flex;
        align-items: center;
    }

    .scenario-card .scenario-title {
        font-size: 1.3rem !important;
        font-weight: 800 !important;
        color: #1a202c !important;
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1.2 !important;
        display: block !important;
        text-align: left;
    }

    .scenario-desc {
        display: none !important;
        /* Matches simple card look in image */
    }

    .welcome-icon {
        margin-top: 10px;
        flex-shrink: 0;
    }
}

/* Desktop: Vertical Card Layout (Image Top, Text Bottom) */
@media (min-width: 769px) {
    .scenario-card {
        flex-direction: column !important;
        flex: 0 0 calc(45% - 1rem) !important;
        width: auto !important;
        height: auto !important;
        min-height: 340px;
        /* Increased to fit title comfortably */
        padding: 0;
        align-items: stretch;
        border-radius: 24px;
        scroll-snap-align: center;
        flex-shrink: 0 !important;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
        overflow: hidden;
        border: 1px solid rgba(0, 0, 0, 0.04);
    }

    .scenario-image {
        width: 100% !important;
        height: 220px !important;
        /* Fixed desktop size */
        margin: 0 !important;
        border-radius: 24px 24px 0 0 !important;
        flex-shrink: 0;
        object-fit: cover;
    }

    .scenario-info {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 1.25rem 1.5rem !important;
        text-align: left;
        background: white;
        min-height: 90px;
        flex-shrink: 0;
    }

    .scenario-card .scenario-title {
        padding: 0 !important;
        font-size: 1.4rem !important;
        font-weight: 800 !important;
        letter-spacing: -0.02em !important;
        color: #1a202c !important;
        line-height: 1.2 !important;
    }

    .scenario-desc {
        display: none !important;
        /* Matches clean card look in image */
    }
}

.scenario-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.scenario-card.selected {
    border-color: transparent;
    background: var(--chat-primary);
    color: var(--white);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.15);
}

.scenario-card.selected .scenario-desc {
    opacity: 0.9;
}

.scenario-card.selected .scenario-icon,
.scenario-card.selected .scenario-title {
    color: var(--white);
}

.scenario-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    border-color: var(--gray-200);
}

.scenario-card .scenario-badge {
    display: inline-block;
    margin-top: 0.5rem;
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 1.25rem;
    margin-bottom: 1.25rem;
}

.scenario-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
}

.scenario-icon-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.scenario-image {
    width: 100%;
    height: 180px;
    /* Increased height to show more of the face */
    margin: 0;
    border-radius: 18px 18px 0 0;
    overflow: hidden;
    background: var(--gray-100);
}

.scenario-image-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    /* Focus on faces to prevent head cropping */
    display: block;
}

/* News Bar / Disclaimer Bar Styles */
.news-bar {
    width: 100%;
    background: #f8fafc;
    border-top: 1px solid var(--gray-200);
    padding: 0.6rem 0;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.news-bar-content {
    display: inline-flex;
    white-space: nowrap;
    animation: newsTicker 95s linear infinite;
    gap: 3rem;
    padding-left: 100%;
}

.news-bar-text {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 500;
}

.news-bar-text b {
    color: var(--gray-700);
    font-weight: 700;
}

.news-bar:hover .news-bar-content {
    animation-play-state: paused;
}

@keyframes newsTicker {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Mobile: Responsive scenario image */
@media (max-width: 480px) {
    .scenario-image {
        height: clamp(80px, 20vw, 120px);
        margin: 0;
    }
}

.scenario-selection {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.scenario-selection::-webkit-scrollbar {
    display: none;
}

/* Tablet: Responsive scenario image */
@media (min-width: 481px) and (max-width: 768px) {
    .scenario-image {
        height: clamp(100px, 22vw, 140px);
    }
}

/* Desktop: Responsive scenario image */
@media (min-width: 769px) {
    .scenario-image {
        height: clamp(120px, 25vw, 180px);
    }
}

.scenario-skeletons {
    display: none;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-200) 50%, var(--gray-100) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.scenario-skeleton-card {
    height: 160px;
    border-radius: 18px;
    flex: 0 0 240px;
}

.skeleton-line {
    width: 180px;
    height: 14px;
    border-radius: 999px;
    margin-bottom: 0.5rem;
}

.skeleton-message {
    opacity: 1;
    pointer-events: none;
}

.skeleton-message .message-bubble {
    background: var(--gray-100);
    min-width: 200px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.scenario-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--gray-900);
    padding: 1rem 1.25rem 0.25rem 1.25rem;
}

.scenario-desc {
    padding: 0 1.25rem 1rem 1.25rem;
    font-size: 0.95rem;
    color: var(--gray-600);
    line-height: 1.4;
    flex-grow: 1;
}

.scenario-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Mobile: Responsive text sizes */
@media (max-width: 480px) {
    .scenario-title {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
        padding: 1rem 1rem 0.25rem 1rem;
    }

    .scenario-desc {
        font-size: 0.8rem;
        padding: 0 1rem 1rem 1rem;
    }
}

/* Tablet: Responsive text sizes */
@media (min-width: 481px) and (max-width: 768px) {
    .scenario-title {
        font-size: 0.98rem;
        padding: 1.1rem 1.1rem 0.4rem 1.1rem;
    }

    .scenario-desc {
        font-size: 0.82rem;
        padding: 0 1.1rem 1.1rem 1.1rem;
    }
}

.start-btn {
    padding: 0.75rem 1.5rem;
    background: var(--chat-primary);
    color: var(--white);
    border: none;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

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

.start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Score Modal - Enhanced Responsive Design */
.score-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    z-index: 1000;
    animation: fadeIn 0.4s ease;
    padding: 1rem;
    overflow-y: auto;
}

.score-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.score-content {
    background: var(--white);
    border-radius: 24px;
    padding: 3rem;
    max-width: 650px;
    width: 95%;
    min-height: 600px;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-2xl);
    animation: slideInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
    position: relative;
    border: 1px solid var(--gray-100);
}

/* Mobile: Adjust padding and sizing */
@media (max-width: 480px) {
    .score-content {
        padding: 1.5rem 1rem;
        border-radius: 16px;
        min-height: auto;
        max-height: 90vh;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .score-content {
        padding: 2rem 1.5rem;
        border-radius: 20px;
        min-height: auto;
        max-height: 88vh;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(60px) scale(0.9);
    }

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

.score-icon {
    width: 80px;
    height: 80px;
    background: var(--chat-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 2rem;
    margin: 0 auto 1.5rem;
    animation: celebrationBounce 2s ease-in-out infinite;
    box-shadow: 0 8px 32px rgba(5, 150, 105, 0.3);
    will-change: transform;
    padding: 15px;
}

@keyframes celebrationBounce {

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

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

.score-title {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.score-value {
    font-size: clamp(3rem, 15vw, 4.5rem);
    font-weight: 900;
    background: var(--chat-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 1.5rem 0;
    line-height: 1;
    text-shadow: 0 4px 8px rgba(5, 150, 105, 0.2);
    transition: all 0.5s ease;
}

/* Score level styling */
.score-value.score-excellent {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-value.score-great {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-value.score-good {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-value.score-fair {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-value.score-poor {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-message {
    color: var(--gray-700);
    margin-bottom: 1rem;
    line-height: 1.7;
    font-size: 1.1rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    font-weight: 500;
}

.score-duration-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gray-100);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: var(--gray-600);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2rem;
}

.score-duration-wrap i {
    color: var(--chat-primary);
}

.score-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

/* Mobile: Stack stats vertically or 2 columns */
@media (max-width: 480px) {
    .score-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .score-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.2rem;
        margin-bottom: 2rem;
    }
}

.stat-item {
    padding: 1.75rem 1.25rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    border-radius: 18px;
    border: 1px solid var(--gray-100);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--chat-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.stat-item:hover::before {
    opacity: 1;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.score-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* Mobile: Stack buttons vertically */
@media (max-width: 480px) {
    .score-actions {
        flex-direction: column;
        gap: 1rem;
        margin-top: 1.5rem;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .score-actions {
        gap: 1.2rem;
        margin-top: 1.8rem;
    }
}

.btn {
    padding: 1rem 2rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    min-width: 140px;
    justify-content: center;
    min-height: 48px;
}

/* Mobile: Full width buttons */
@media (max-width: 480px) {
    .btn {
        padding: 0.9rem 1.5rem;
        font-size: 0.95rem;
        width: 100%;
        min-width: auto;
        min-height: 44px;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .btn {
        padding: 0.95rem 1.75rem;
        font-size: 0.98rem;
        min-height: 46px;
    }
}

.btn-primary {
    background: var(--chat-primary);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

/* Tag Breakdown Styles */
.insight-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

.insight-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.insight-title i {
    color: var(--primary);
}

.tag-breakdown-item {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.tag-breakdown-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

/* Tag Performance Colors - Based on Performance Level */

/* Excellent Performance (85%+) - Green */
.tag-breakdown-item.tag-excellent,
.tag-breakdown-item[data-performance="excellent"] {
    border-left: 4px solid #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.tag-breakdown-item.tag-excellent .tag-percentage,
.tag-breakdown-item[data-performance="excellent"] .tag-percentage {
    color: #065f46;
}

/* Good Performance (70-84%) - Blue */
.tag-breakdown-item.tag-good,
.tag-breakdown-item[data-performance="good"] {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.tag-breakdown-item.tag-good .tag-percentage,
.tag-breakdown-item[data-performance="good"] .tag-percentage {
    color: #1e40af;
}

/* Fair Performance (50-69%) - Amber/Orange */
.tag-breakdown-item.tag-fair,
.tag-breakdown-item[data-performance="fair"] {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.tag-breakdown-item.tag-fair .tag-percentage,
.tag-breakdown-item[data-performance="fair"] .tag-percentage {
    color: #92400e;
}

/* Poor Performance (<50%) - Red */
.tag-breakdown-item.tag-poor,
.tag-breakdown-item[data-performance="poor"] {
    border-left: 4px solid #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
}

.tag-breakdown-item.tag-poor .tag-percentage,
.tag-breakdown-item[data-performance="poor"] .tag-percentage {
    color: #991b1b;
}

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

.tag-info {
    flex: 1;
}

.tag-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

/* Tag name colors based on performance level */
.tag-breakdown-item.tag-excellent .tag-name {
    color: #065f46;
}

.tag-breakdown-item.tag-good .tag-name {
    color: #1e40af;
}

.tag-breakdown-item.tag-fair .tag-name {
    color: #92400e;
}

.tag-breakdown-item.tag-poor .tag-name {
    color: #991b1b;
}

.tag-link {
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.tag-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.tag-link i {
    font-size: 0.875rem;
    opacity: 0.7;
}

.tag-description {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin: 0;
}

.tag-score {
    text-align: right;
    flex-shrink: 0;
}

.tag-percentage {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-800);
    display: block;
}

.tag-responses {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

.tag-breakdown-bars {
    margin-top: 1rem;
}

.breakdown-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    margin-bottom: 0.75rem;
}

.bar-segment {
    height: 100%;
    transition: all 0.3s ease;
}

.bar-segment.good {
    background: #10b981;
}

.bar-segment.medium {
    background: #3b82f6;
}

.bar-segment.bad {
    background: #ef4444;
}

.breakdown-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

.legend-item::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-item.good::before {
    background: #10b981;
}

.legend-item.medium::before {
    background: #3b82f6;
}

.legend-item.bad::before {
    background: #ef4444;
}

.legend-item.good {
    color: #065f46;
}

.legend-item.medium {
    color: #1e40af;
}

.legend-item.bad {
    color: #991b1b;
}

/* Responsive Tag Breakdown Styles */
@media (max-width: 768px) {
    .tag-header {
        flex-direction: column;
        gap: 1rem;
    }

    .tag-score {
        text-align: left;
    }

    .tag-percentage {
        font-size: 1.25rem;
    }

    .breakdown-legend {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .tag-breakdown-item {
        padding: 1rem;
    }

    .insight-section {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
}

@media (max-width: 480px) {
    .tag-name {
        font-size: 1rem;
    }

    .tag-description {
        font-size: 0.85rem;
    }

    .breakdown-legend {
        font-size: 0.8rem;
    }

    .legend-item::before {
        width: 10px;
        height: 10px;
    }

    /* Enhanced mobile styles for small screens */
    .app-container {
        padding: 0;
        border-radius: 0;
    }

    .chat-header {
        padding: 0.75rem 1rem;
    }

    .bot-name {
        font-size: 0.95rem;
    }

    .header-btn {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .messages-area {
        padding: 0.5rem;
    }

    .message-bubble {
        padding: 0.65rem 0.9rem;
        font-size: 0.85rem;
        max-width: calc(100vw - 100px);
    }

    .message-time {
        font-size: 0.6rem;
        margin-top: 0.25rem;
    }

    .response-container {
        padding: 0.75rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }

    .response-btn {
        padding: 0.9rem 1rem;
        font-size: 0.85rem;
        min-height: 48px;
        text-align: left;
    }

    .welcome-screen {
        padding: 0.75rem;
    }

    .welcome-title {
        font-size: 1.25rem;
    }

    .welcome-description {
        font-size: 0.85rem;
    }

    .scenario-card {
        padding: 0.75rem;
    }

    .scenario-title {
        font-size: 0.95rem;
    }

    .scenario-desc {
        font-size: 0.8rem;
    }

    .start-btn {
        padding: 0.9rem 1.25rem;
        font-size: 0.85rem;
    }
}

/* Insight Section - Enhanced Responsive Design */
.insight-section {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    border-radius: 18px;
    border: 1px solid var(--gray-100);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    text-align: left;
}

.insight-section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.insight-title {
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.insight-title i {
    color: var(--primary);
    background: rgba(5, 150, 105, 0.1);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.insight-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    font-size: 1rem;
    color: var(--gray-600);
    background: var(--white);
    border-radius: 14px;
    padding: 1.5rem 1.75rem;
    border: 1px solid var(--gray-100);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    min-height: 70px;
}

.insight-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--chat-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.insight-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.insight-item:hover::before {
    opacity: 1;
}

.insight-item:last-child {
    margin-bottom: 0;
}

.insight-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    flex: 1;
}

.insight-icon {
    color: var(--primary);
    background: rgba(5, 150, 105, 0.12);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.insight-item:hover .insight-icon {
    background: var(--primary);
    color: var(--white);
    transform: scale(1.1);
}

.insight-metrics {
    text-align: right;
    font-size: 0.95rem;
    color: var(--gray-500);
    font-weight: 500;
    line-height: 1.5;
}

.insight-metrics div:first-child {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}

/* Mobile Responsive for Insight Section */
@media (max-width: 768px) {
    .insight-section {
        padding: 1.25rem;
        margin-top: 1.25rem;
    }

    .insight-title {
        font-size: 0.9rem;
        margin-bottom: 0.875rem;
    }

    .insight-item {
        padding: 1rem;
        gap: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .insight-label {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .insight-metrics {
        width: 100%;
        text-align: left;
        font-size: 0.8rem;
    }

    .insight-icon {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .insight-section {
        padding: 1rem;
        border-radius: 12px;
    }

    .insight-title {
        font-size: 0.85rem;
        gap: 0.5rem;
    }

    .insight-title i {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }

    .insight-item {
        padding: 0.875rem;
        border-radius: 10px;
    }

    .insight-icon {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(15, 23, 42, 0.92);
    color: var(--white);
    border-radius: 999px;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.toast-success {
    background: var(--success);
}

.toast.toast-error {
    background: var(--danger);
}

.toast.toast-warning {
    background: var(--warning);
    color: var(--gray-900);
}

/* Analytics Styles */
.analytics-header {
    padding: 1.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
}

.analytics-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.analytics-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.analytics-actions {
    display: flex;
    gap: 0.75rem;
}

.analytics-export-btn {
    padding: 0.75rem 1.5rem;
    background: var(--chat-primary);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.analytics-export-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--primary-dark);
}

.analytics-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--gray-50);
}

/* Documentation Styles */
.docs-header {
    padding: 1.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.docs-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.docs-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: var(--white);
}

/* Mobile Text Wrapping and Layout Fixes */
.message-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    white-space: pre-wrap;
}

.response-btn {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    text-overflow: ellipsis;
    text-align: left;
}

/* Ensure proper mobile viewport handling */
@supports (-webkit-touch-callout: none) {
    .app-container {
        height: -webkit-fill-available;
    }
}

/* Enhanced Mobile Responsive */
@media (max-width: 768px) {
    .app-container {
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        max-width: 100%;
        margin: 0;
        display: flex;
        flex-direction: column;
    }

    .tab-navigation {
        padding: 0.5rem;
    }

    .tab-btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .chat-header {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .header-left {
        flex: 1;
        min-width: 200px;
    }

    .bot-avatar {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .bot-name {
        font-size: 1rem;
    }

    .bot-status {
        font-size: 0.75rem;
    }

    .header-actions {
        gap: 0.25rem;
    }

    .header-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .messages-area {
        padding: 0.75rem;
        padding-bottom: 2rem;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        min-height: 0;
    }

    .message {
        max-width: 85%;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .message.bot {
        align-self: flex-start;
    }

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

    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .message-bubble {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        max-width: calc(100vw - 120px);
    }

    .message.bot .message-bubble {
        background: var(--white);
        border: 1px solid var(--gray-200);
        border-radius: 18px 18px 18px 4px;
    }

    .message.user .message-bubble {
        background: var(--gradient);
        color: var(--white);
        border-radius: 18px 18px 4px 18px;
    }

    .message-time {
        font-size: 0.65rem;
    }

    .welcome-screen {
        padding: 1rem;
    }

    .welcome-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .welcome-title {
        font-size: 1.5rem;
    }

    .welcome-description {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .response-container {
        padding: 1rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        background: var(--white);
        border-top: 2px solid var(--gray-100);
        position: sticky;
        bottom: 0;
        z-index: 100;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    }

    .response-label {
        font-size: 0.9rem;
        margin-bottom: 1rem;
        font-weight: 600;
        color: var(--gray-700);
    }

    .response-options {
        gap: 0.75rem;
        flex-direction: column;
        max-height: 35vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .response-btn {
        padding: 1rem 1.25rem;
        font-size: 0.9rem;
        line-height: 1.5;
        width: 100%;
        text-align: left;
        min-height: 52px;
        border-radius: 12px;
        box-shadow: var(--shadow-sm);
        transition: all 0.2s ease;
        border: 1px solid var(--gray-200);
        background: var(--white);
        color: var(--gray-800);
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }

    .response-btn:hover,
    .response-btn:active {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
        background: var(--primary);
        color: var(--white);
    }

    .scenario-selector {
        flex-direction: row;
        flex-wrap: nowrap;
        width: 100%;
        gap: 0.75rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.5rem 0;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    .scenario-card {
        min-width: 200px;
        max-width: 280px;
        flex-shrink: 0;
        padding: 1rem;
        text-align: center;
        scroll-snap-align: start;
    }

    .start-btn {
        padding: 1rem 1.5rem;
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
    }

    .typing-indicator {
        padding: 0.5rem 0;
    }

    .typing-dots {
        padding: 0.5rem 0.75rem;
    }

    .score-modal {
        padding: 1rem;
        align-items: center;
        justify-content: center;
    }

    .score-content {
        width: 100%;
        max-width: none;
        padding: 2.5rem 2rem;
        margin: 0;
        border-radius: 20px;
        max-height: 90vh;
        overflow-y: auto;
        min-height: auto;
    }

    .score-icon {
        width: 75px;
        height: 75px;
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .score-title {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }

    .score-value {
        font-size: 3.5rem;
        margin: 1rem 0;
    }

    .score-message {
        font-size: 1rem;
        margin-bottom: 2rem;
        line-height: 1.6;
    }

    .score-stats {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin-bottom: 2rem;
    }

    .stat-item {
        padding: 1.5rem 1.25rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        min-height: 80px;
    }

    .stat-value {
        font-size: 1.75rem;
        margin-bottom: 0;
    }

    .stat-label {
        font-size: 0.9rem;
    }

    .score-actions {
        flex-direction: column;
        gap: 1.25rem;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 1.25rem 1.5rem;
        font-size: 1.05rem;
        border-radius: 12px;
        min-height: 50px;
    }

    .insight-section {
        padding: 1.75rem;
        margin-top: 1.75rem;
    }

    .insight-title {
        font-size: 1rem;
        margin-bottom: 1.25rem;
    }

    .insight-item {
        padding: 1.25rem;
        gap: 1rem;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        min-height: 80px;
    }

    .insight-label {
        width: 100%;
        margin-bottom: 0.75rem;
    }

    .insight-metrics {
        width: 100%;
        text-align: left;
        font-size: 0.9rem;
    }

    .insight-icon {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }

    .analytics-header,
    .docs-header {
        padding: 1rem;
    }

    .analytics-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .analytics-export-btn {
        width: 100%;
        justify-content: center;
    }

    .analytics-header-top {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .toast {
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
        padding: 0.75rem 1rem;
        display: none;
    }

    .docs-content {
        padding: 1rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .app-container {
        min-height: 100vh;
        min-height: 100dvh;
    }

    .response-container {
        padding: 0.75rem;
        padding-bottom: 1.5rem;
        /*position: fixed;*/
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--white);
        border-top: 2px solid var(--primary);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
        z-index: 1000;
    }

    .messages-area {
        padding-bottom: 120px;
    }

    .response-btn {
        padding: 1rem;
        font-size: 0.85rem;
        min-height: 44px;
        border-radius: 10px;
    }

    .tab-btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }

    .chat-header {
        padding: 0.75rem;
    }

    .messages-area {
        padding: 0.5rem;
    }

    .response-container {
        padding: 0.75rem;
    }

    .welcome-screen {
        padding: 0.75rem;
    }

    .welcome-title {
        font-size: 1.25rem;
    }

    .scenario-card {
        padding: 0.75rem;
    }

    .response-btn {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    /* Score Modal for Extra Small Devices */
    .score-modal {
        padding: 0.5rem;
        align-items: center;
        justify-content: center;
    }

    .score-content {
        border-radius: 16px;
        height: auto;
        max-height: 95vh;
        min-height: auto;
        padding: 2rem 1.5rem;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow-y: auto;
    }

    .score-icon {
        width: 65px;
        height: 65px;
        font-size: 1.6rem;
        margin-bottom: 1.25rem;
    }

    .score-title {
        font-size: 1.75rem;
        margin-bottom: 0.75rem;
    }

    .score-value {
        font-size: 3rem;
        margin: 1rem 0;
    }

    .score-message {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
        line-height: 1.5;
    }

    .score-stats {
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .stat-item {
        padding: 1.25rem 1rem;
        border-radius: 14px;
        min-height: 70px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    .score-actions {
        gap: 1rem;
        margin-top: 1rem;
    }

    .btn {
        padding: 1rem 1.25rem;
        font-size: 0.95rem;
        border-radius: 12px;
        min-height: 48px;
    }

    .insight-section {
        padding: 1.5rem;
        margin-top: 1.5rem;
    }

    .insight-title {
        font-size: 0.95rem;
        gap: 0.5rem;
    }

    .insight-title i {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
    }

    .insight-item {
        padding: 1rem;
        border-radius: 12px;
        min-height: 70px;
    }

    .insight-icon {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }
}

/* Loading and Warning Messages */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--gray-600);
    font-style: italic;
}

.warning-message {
    background: #fff3cd;
    color: #856404;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    text-align: center;
    border: 1px solid #ffeaa7;
    font-size: 0.9rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

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


/* ============================================
   CLEANUP: Removed redundant duplicate sections
   ============================================ */

/* Scenario Skeletons */
.scenario-skeletons {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 1.5rem;
    overflow: hidden;
    padding: 1rem 2rem;
    width: 100%;
    margin: 0 auto;
    max-width: 800px;
}

.scenario-skeleton-card {
    min-width: 280px;
    height: 300px;
    border-radius: 20px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .scenario-skeletons {
        padding: 1rem 5vw;
    }

    .scenario-skeleton-card {
        min-width: 240px;
        height: 260px;
    }
}