/* World-Class Premium Design System */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:root {
    /* Sophisticated Palette */
    --primary-color: #4f46e5;
    /* Indigo 600 */
    --primary-hover: #4338ca;
    /* Indigo 700 */
    --primary-light: #eef2ff;
    /* Indigo 50 */
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);

    --secondary-color: #10b981;
    /* Emerald 500 */
    --accent-color: #f59e0b;
    /* Amber 500 */

    --bg-color: #f8fafc;
    /* Slate 50 */
    --surface-color: #ffffff;

    --text-primary: #0f172a;
    /* Slate 900 */
    --text-secondary: #475569;
    /* Slate 600 */
    --text-tertiary: #94a3b8;
    /* Slate 400 */

    --border-color: #e2e8f0;
    /* Slate 200 */

    /* Elevation & Depth */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    background-image: radial-gradient(circle at top right, #e0e7ff, transparent 40%), radial-gradient(circle at bottom left, #f0fdf4, transparent 40%);
}

/* Main Container */
.container {
    width: 100%;
    max-width: 1200px;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    padding: 24px 40px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 10;
}

.header-title {
    order: 1;
    margin-right: auto;
    /* Push others to right */
    text-align: left;
}

.header h1 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 4px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.header p {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.qr-container {
    order: 2;
    margin-right: 12px;
}

.header-buttons {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
}

.hamburger-button {
    order: 3;
    /* Reset absolute positioning from previous styles if any */
    position: static;
    transform: none;

    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-button:hover,
.hamburger-button:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.hamburger-button.active {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    border: 1px solid rgba(255, 255, 255, 0.5);
    overflow: hidden;
    max-width: 90%;
}

.qr-modal-content {
    width: 360px;
    text-align: center;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.close-button {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
    line-height: 1;
}

.close-button:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#qrcode {
    padding: 16px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

#qrcode img {
    display: block;
    /* Remove extra space */
}

.qr-text {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
}

.qr-link {
    font-family: monospace;
    background: var(--bg-color);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    color: var(--primary-color);
    font-size: 14px;
    word-break: break-all;
}

/* Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}

/* Sidebar */
.conversation-sidebar {
    width: 320px;
    background: var(--surface-color);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    /* Smoother bezier */
    z-index: 20;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.05);
}

.conversation-sidebar.hidden {
    display: flex !important;
    /* Override global hidden */
    transform: translateX(100%);
    pointer-events: none;
}

.conversation-sidebar:not(.hidden) {
    transform: translateX(0);
    pointer-events: auto;
}

.conversation-sidebar-header {
    padding: 24px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.95);
}

.conversation-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.conversation-sidebar-item {
    padding: 20px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

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

.conversation-sidebar-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.2s;
}

.conversation-sidebar-item:hover::before {
    opacity: 1;
}

.conversation-sidebar-item h5 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.conversation-sidebar-item .info {
    font-size: 13px;
    color: var(--text-secondary);
}

.conversation-sidebar-item .score {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 10px;
    display: inline-block;
    background: var(--primary-light);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

/* Case Selection */
.case-selection {
    flex: 1;
    padding: 48px;
    overflow-y: auto;
    background: transparent;
    height: 100%;
}

.case-selection.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    height: 100%;
}

.case-selection.loading h2 {
    display: none;
}

.case-selection .loading {
    font-size: 18px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 16px;
    font-weight: 500;
}

.case-selection .loading::before {
    content: "";
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.case-selection h2 {
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 40px;
    letter-spacing: -0.02em;
}

.case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
}

.case-grid.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    grid-template-columns: none;
}

.case-item {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    padding: 32px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    text-align: center;
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.case-item:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
    background: white;
}

.random-button-container {
    text-align: center;
    margin-top: 56px;
}

.random-select-button {
    padding: 16px 40px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s;
}

.random-select-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

/* Difficulty Selection */
.difficulty-selection {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    padding: 48px;
}

.difficulty-selection h2 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 64px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.difficulty-buttons {
    display: flex;
    gap: 32px;
}

.difficulty-button {
    width: 180px;
    height: 180px;
    border-radius: var(--radius-xl);
    border: none;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.difficulty-button:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: white;
}

.back-button {
    position: absolute;
    top: 40px;
    left: 40px;
    background: white;
    border: 1px solid var(--border-color);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.back-button:hover {
    background: var(--bg-color);
    color: var(--text-primary);
    transform: translateX(-3px);
}

/* Chat Area */
#chatArea {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    position: relative;
    height: 100%;
    overflow: hidden;
}

.output-area {
    flex: 1;
    padding: 32px;
    padding-bottom: 120px;
    /* Reduced from 160px to bring messages closer */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

/* Messages */
.message {
    max-width: 75%;
    padding: 16px 24px;
    border-radius: 24px;
    font-size: 16px;
    line-height: 1.6;
    position: relative;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

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

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

/* Doctor (User) */
.message.doctor {
    align-self: flex-end;
    background: var(--primary-gradient);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-md);
}

/* Patient (Bot) */
.message.patient {
    align-self: flex-start;
    background: white;
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

/* System Message */
.message.system {
    align-self: center;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(4px);
    color: var(--text-secondary);
    font-size: 14px;
    padding: 8px 20px;
    border-radius: var(--radius-full);
    text-align: center;
    max-width: 90%;
    margin: 16px 0;
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.error {
    align-self: center;
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fee2e2;
}

.message.loading {
    align-self: center;
    background: transparent;
    color: var(--text-secondary);
    box-shadow: none;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Input Area */
.input-area {
    position: absolute;
    bottom: 24px;
    /* Moved slightly down */
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    max-width: 900px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    padding: 8px;
    /* Reduced from 12px */
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-area.sidebar-open {
    transform: translateX(calc(-50% - 160px));
    width: calc(85% - 320px);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
    /* Reduced padding */
}

.input-group input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px;
    /* Reduced from 16px */
    font-size: 16px;
    /* Prevent auto-zoom on mobile */
    font-family: inherit;
    color: var(--text-primary);
}

.input-group input:focus {
    outline: none;
}

.input-group button {
    width: 40px;
    /* Reduced from 48px */
    height: 40px;
    /* Reduced from 48px */
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#sendButton {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

#sendButton:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

#voiceButton {
    background: var(--bg-color);
    color: var(--text-secondary);
}

#voiceButton:hover {
    background: var(--border-color);
    color: var(--text-primary);
    transform: scale(1.1);
}

#voiceButton.recording {
    background: #ef4444;
    color: white;
    animation: pulse 1.5s infinite;
}

.eval-button {
    background: var(--bg-color);
    color: var(--text-secondary);
}

.eval-button:hover {
    background: var(--border-color);
    color: var(--primary-color);
    transform: scale(1.1);
}

/* Situation Instruction */
.situation-instruction {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 24px 0;
    box-shadow: var(--shadow-sm);
}

.situation-instruction h4 {
    color: #b45309;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 700;
}

.situation-instruction p {
    color: #92400e;
    font-size: 15px;
    line-height: 1.6;
}

/* Progress Steps */
.progress-steps {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin: 24px 0;
    align-self: center;
    width: 100%;
    max-width: 480px;
}

.progress-step {
    padding: 10px 0;
    font-size: 15px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-step.active {
    color: var(--primary-color);
    font-weight: 700;
}

.progress-step.completed {
    color: var(--secondary-color);
}

/* Loading Progress */
.loading-message-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-width: 280px;
}

.loading-progress-container {
    width: 100%;
    height: 6px;
    background-color: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.loading-progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    width: 0%;
    border-radius: 10px;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.3);
}

/* Loading Spinner (Legacy support if needed, or for other areas) */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Evaluation Result */
.evaluation-result {
    background: white;
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-xl);
    margin: 32px 0;
    border: 1px solid var(--border-color);
}

.evaluation-result h3 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 32px;
    text-align: center;
    font-weight: 800;
}

.evaluation-result .score {
    font-size: 56px;
    font-weight: 900;
    color: var(--primary-color);
    text-align: center;
    margin: 32px 0;
    text-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.evaluation-summary {
    background: var(--bg-color);
    padding: 32px;
    border-radius: var(--radius-lg);
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 16px;
}

/* Feedback Area */
.feedback-area {
    margin-top: 32px;
    background: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.feedback-area textarea {
    width: 100%;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-top: 16px;
    font-family: inherit;
    resize: vertical;
    font-size: 15px;
    transition: all 0.2s;
}

.feedback-area textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Modal */
.conversation-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    /* Darker overlay */
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.conversation-detail-modal {
    background: var(--surface-color);
    width: 100%;
    max-width: 900px;
    height: 85vh;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-2xl);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.conversation-detail-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
}

.conversation-detail-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.close-modal-button {
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-button:hover {
    color: var(--text-primary);
    background: var(--bg-color);
    transform: rotate(90deg);
}

.conversation-detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* QR Popover Styles */
.qr-popover {
    position: absolute;
    top: 60px;
    right: 0;
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    z-index: 1000;
    width: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.2s ease-out;
}

.qr-popover::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 54px;
    /* Align with button */
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
}

.qr-popover.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 0;
        background-image: none;
        background-color: var(--bg-color);
    }

    .container {
        border-radius: 0;
        border: none;
        box-shadow: none;
        height: 100vh;
    }

    .header {
        padding: 12px 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .header-title {
        order: 2;
        flex: 1;
        text-align: center;
        margin: 0 8px;
        overflow: hidden;
    }

    .header h1 {
        font-size: 18px;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header p {
        display: none;
    }

    .qr-container {
        order: 1;
    }

    .hamburger-button {
        order: 3;
        position: static;
        /* Reset absolute positioning */
        transform: none;
    }

    .case-selection {
        padding: 16px;
    }

    .case-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .case-item {
        padding: 20px;
        font-size: 16px;
    }

    .difficulty-selection {
        padding: 20px;
    }

    .difficulty-buttons {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .difficulty-button {
        width: 100%;
        height: 80px;
        flex-direction: row;
        gap: 12px;
        font-size: 18px;
    }

    .input-area {
        width: 95%;
        bottom: 12px;
        padding: 6px;
    }

    .input-group {
        gap: 4px;
        /* Tighter gap */
        padding: 0 2px;
    }

    .input-group input {
        min-width: 0;
        /* Allow shrinking */
        padding: 10px;
    }

    .input-group button {
        flex-shrink: 0;
        width: 36px;
        /* Smaller buttons */
        height: 36px;
    }

    .input-area.sidebar-open {
        transform: translateX(-50%);
        width: 95%;
    }

    .conversation-sidebar {
        width: 100%;
        border-left: none;
    }

    .conversation-sidebar.hidden {
        transform: translateX(100%);
    }

    .message {
        max-width: 90%;
        font-size: 15px;
        padding: 10px 14px;
    }

    .output-area {
        padding: 16px;
        padding-bottom: 80px;
        /* Adjusted for mobile input */
    }

    .evaluation-result {
        padding: 24px;
        margin: 16px 0;
    }

    .evaluation-result .score {
        font-size: 40px;
        margin: 20px 0;
    }

    .qr-popover {
        left: 0;
        /* Align left edge to container's left edge */
        right: auto;
        /* Allow expanding to the right */
        width: 220px;
        top: 50px;
        /* Adjust top position */
    }

    .qr-popover::before {
        left: 14px;
        /* Arrow on the left side */
        right: auto;
    }
}