:root {
    --primary-green: #10b981;
    --primary-teal: #0ea5e9;
    --accent-orange: #f59e0b;
    --bg-primary: #f0f9ff;
    --bg-card: #ffffff;
    --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-light: #e0f2fe;
    --border-medium: #bae6fd;
    --bubble-student: #dcfce7;
    --bubble-ai: #dbeafe;
    --bubble-scaffold: #fef3c7;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --gradient-primary: linear-gradient(135deg, var(--primary-green), var(--primary-teal));
    --gradient-accent: linear-gradient(135deg, var(--accent-orange), #fb923c);
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    font-family: 'Poppins', 'Noto Sans SC', sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header"
        "main";
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    gap: 1.5rem;
    padding: 1.5rem;
}

/* Header */
.header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2.5rem;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    color: white;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-10px, -10px) rotate(5deg); }
}

.header-content {
    position: relative;
    z-index: 1;
}

.header-content h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    font-family: 'Noto Sans SC', sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content p {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.header-actions {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

/* Mode Buttons */
.mode-buttons {
    display: flex;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
}

.mode-buttons.small {
    gap: 0.5rem;
    padding: 0.375rem;
}

.mode-buttons.small .mode-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.7rem;
}

.mode-btn {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    background-color: transparent;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.mode-btn:hover::before {
    left: 100%;
}

.mode-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.mode-btn.active {
    background-color: white;
    color: var(--primary-teal);
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.mode-btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.mode-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Main Content */
.main-content {
    grid-area: main;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    flex: 1;
    align-items: start;
}

/* Recognition Box */
.recognition-box {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.recognition-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
}

/* Chat Section */
.chat-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-left: 4px solid var(--primary-teal);
    position: relative;
    overflow: hidden;
}

.status-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.05), transparent);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.status {
    display: none; /* JS toggles this */
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

.status.active { 
    display: flex;
    animation: fadeIn 0.3s ease-in-out;
}

.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #f1f5f9;
    border-radius: 50%;
    border-top: 2px solid var(--primary-teal);
    animation: spin 1s linear infinite;
}

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

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.section-icon {
    width: 24px;
    height: 24px;
    background-color: var(--primary-teal);
    color: white;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Textbox Container */
.textbox-container {
    width: 100%;
    min-height: 100px;
    border: 1px solid var(--border-light);
    border-radius: 0.5rem;
    padding: 1rem;
    background-color: #fefefe;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-y: auto;
    white-space: pre-wrap;
    transition: all 0.2s;
}

.textbox-container:focus-within {
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

/* Chat Container */
.chat-container {
    flex: 1;
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
    min-height: 700px;
    position: relative;
    overflow: hidden;
}

.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.chat-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: #bae6fd;
    opacity: 0.6;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.empty-state p {
    font-size: 1.125rem;
    line-height: 1.5;
    max-width: 80%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.speech-bubble {
    position: relative;
    padding: 1rem;
    border-radius: 1rem;
    max-width: 80%;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease-in-out;
}

.student-bubble {
    background-color: var(--bubble-student);
    margin-left: auto;
    border-bottom-right-radius: 0.25rem;
    border-left: 4px solid var(--primary-green);
}

.ai-bubble {
    background-color: var(--bubble-ai);
    margin-right: auto;
    border-bottom-left-radius: 0.25rem;
    border-left: 4px solid var(--primary-teal);
}

.scaffold-bubble {
    background-color: var(--bubble-scaffold);
    margin-right: auto;
    border-bottom-left-radius: 0.25rem;
    border-left: 4px solid var(--accent-orange);
}

.bubble-sender {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.scaffold-tag {
    background-color: var(--accent-orange);
    color: white;
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    margin-left: 0.5rem;
    font-weight: normal;
}

/* Summary Container */
.summary-container {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    display: none; /* JS toggles */
    border: 1px solid var(--border-light);
    animation: slideUp 0.4s ease-out;
    position: relative;
    overflow: hidden;
}

.summary-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-accent);
}

.summary-container.active { 
    display: block;
}

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

.summary-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.summary-icon {
    width: 32px;
    height: 32px;
    background: var(--gradient-accent);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.summary-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: white;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.btn:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: var(--gradient-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.btn-secondary {
    background: var(--gradient-accent);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Custom Scrollbar */
.chat-container::-webkit-scrollbar, .textbox-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track, .textbox-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb, .textbox-container::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: var(--transition);
}

.chat-container::-webkit-scrollbar-thumb:hover, .textbox-container::-webkit-scrollbar-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 5px rgba(14, 165, 233, 0.3);
}

/* Markdown-like formatting in chat */
.text-amber { color: var(--accent-orange); font-weight: 500; }
.text-bold { font-weight: 700; }
.text-green-bold { color: var(--primary-green); font-weight: 700; }

.user-panel {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
}

.user-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary-teal);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.user-logout {
    padding: 0.7rem 1rem;
}

.auth-body {
    background:
        radial-gradient(circle at top left, rgba(16, 185, 129, 0.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.18), transparent 32%),
        linear-gradient(135deg, #edfdf8 0%, #e0f2fe 52%, #f8fafc 100%);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2rem;
    align-items: stretch;
    max-width: 1320px;
    margin: 0 auto;
    padding: 2rem;
}

.auth-hero {
    position: relative;
    overflow: hidden;
    border-radius: 2rem;
    padding: 3rem;
    background:
        linear-gradient(145deg, rgba(15, 23, 42, 0.92), rgba(14, 165, 233, 0.9)),
        linear-gradient(120deg, rgba(16, 185, 129, 0.55), rgba(245, 158, 11, 0.18));
    box-shadow: 0 30px 60px -30px rgba(14, 165, 233, 0.55);
    color: white;
    display: flex;
    align-items: flex-end;
}

.auth-hero::before {
    content: "";
    position: absolute;
    inset: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 1.5rem;
}

.auth-hero-register {
    background:
        linear-gradient(145deg, rgba(6, 78, 59, 0.94), rgba(14, 116, 144, 0.9)),
        linear-gradient(120deg, rgba(16, 185, 129, 0.48), rgba(251, 146, 60, 0.18));
}

.auth-copy {
    position: relative;
    z-index: 1;
    max-width: 540px;
}

.eyebrow {
    display: inline-flex;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 1.25rem;
}

.auth-copy h1 {
    font-size: clamp(2.3rem, 4vw, 4rem);
    line-height: 1.04;
    margin: 0 0 1rem;
    font-family: "Noto Sans SC", sans-serif;
}

.auth-copy p {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.84);
}

.auth-card {
    position: relative;
    border-radius: 2rem;
    padding: 2.25rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(186, 230, 253, 0.95);
    box-shadow: 0 22px 60px -34px rgba(15, 23, 42, 0.36);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.45), rgba(14, 165, 233, 0.34), rgba(245, 158, 11, 0.32));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.auth-card-top {
    margin-bottom: 1.5rem;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.auth-card h2 {
    margin: 0 0 0.5rem;
    font-size: 2rem;
    color: var(--text-primary);
}

.auth-card p {
    margin: 0;
    color: var(--text-secondary);
}

.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-label {
    display: grid;
    gap: 0.45rem;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 600;
}

.auth-label input,
.auth-label select {
    width: 100%;
    border: 1px solid rgba(186, 230, 253, 0.95);
    border-radius: 1rem;
    background: rgba(248, 250, 252, 0.9);
    padding: 0.95rem 1rem;
    font: inherit;
    color: var(--text-primary);
    transition: var(--transition);
}

.auth-label input:focus,
.auth-label select:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
    background: white;
}

.auth-error {
    min-height: 1.25rem;
    margin: 0;
    color: #dc2626;
    font-size: 0.85rem;
}

.auth-submit {
    justify-content: center;
    margin-top: 0.35rem;
}

.auth-footnote {
    margin-top: 1.4rem;
    text-align: center;
    font-size: 0.92rem;
    color: var(--text-secondary);
}

.auth-footnote a {
    color: #0284c7;
    font-weight: 700;
    text-decoration: none;
}

.history-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.history-item,
.dashboard-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
    padding: 1.5rem;
    margin-bottom: 2rem;
    transition: var(--transition);
}

.history-item:hover,
.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

.history-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.history-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.history-content {
    margin-bottom: 1.5rem;
}

.history-summary {
    border-top: 1px solid var(--border-light);
    padding-top: 1.5rem;
}

.summary-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.empty-history {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
}

.empty-history i {
    font-size: 4rem;
    color: #bae6fd;
    opacity: 0.6;
    margin-bottom: 1.5rem;
}

.empty-history p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
}

.teacher-dashboard {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 1.5rem;
}

.student-list {
    display: grid;
    gap: 0.85rem;
}

.student-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    border: 1px solid var(--border-light);
    background: linear-gradient(135deg, rgba(240, 249, 255, 0.92), rgba(236, 253, 245, 0.9));
    color: var(--text-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.student-row:hover {
    transform: translateY(-2px);
    border-color: var(--border-medium);
    box-shadow: var(--shadow-md);
}

/* Responsive design */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        grid-template-areas:
            "header"
            "sidebar"
            "main";
        gap: 1rem;
        padding: 1rem;
    }
    
    .sidebar {
        display: flex;
        gap: 2rem;
        overflow-x: auto;
        padding: 1rem;
    }
    
    .sidebar-section {
        min-width: 200px;
        margin-bottom: 0;
    }
    
    .chat-container {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1.5rem;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    .sidebar {
        flex-direction: column;
        gap: 1rem;
        overflow-x: visible;
    }
    
    .sidebar-section {
        min-width: auto;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    .chat-container {
        min-height: 300px;
        padding: 1rem;
    }
    
    .recognition-box,
    .summary-container {
        padding: 1rem;
    }
    
    .speech-bubble {
        max-width: 90%;
        padding: 0.75rem;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .auth-hero,
    .auth-card {
        padding: 1.5rem;
        border-radius: 1.5rem;
    }

    .auth-copy h1 {
        font-size: 2.2rem;
    }

    .teacher-dashboard {
        grid-template-columns: 1fr;
    }
}

/* Animation for buttons */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.btn-primary:active, .btn-secondary:active {
    transform: translateY(0);
}

/* Focus styles */
.btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.switch-label input:focus + .switch-radio {
    outline: 2px solid var(--primary-teal);
    outline-offset: 2px;
}

/* Hover effects */
.chat-container:hover,
.recognition-box:hover,
.summary-container:hover {
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.3s;
}

/* Gradient background for header */
.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-green), var(--primary-teal));
    border-radius: 1rem;
    z-index: -1;
    opacity: 0.95;
}

.header {
    position: relative;
    overflow: hidden;
}

/* Subtle background pattern */
.sidebar {
    background-image: radial-gradient(var(--primary-teal) 1px, transparent 1px);
    background-size: 20px 20px;
    background-opacity: 0.05;
}

/* Sidebar tips section */
.sidebar-section:last-child {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.sidebar-section:last-child div {
    font-size: 0.65rem;
    line-height: 1.3;
}

/* Main content emphasis */
.main-content {
    grid-area: main;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-container {
    flex: 1;
    min-height: 700px;
}

/* 调整识别框和总结框的布局 */
.recognition-box {
    padding: 1.25rem;
    border-radius: 0.75rem;
}

.summary-container {
    padding: 1.25rem;
    border-radius: 0.75rem;
}

/* 增加主内容区域的视觉权重 */
.main-content > * {
    box-shadow: var(--shadow-md);
}

.chat-container {
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        grid-template-areas:
            "header"
            "sidebar"
            "main";
        gap: 1rem;
        padding: 1rem;
    }
    
    .sidebar {
        display: flex;
        gap: 1.5rem;
        overflow-x: auto;
        padding: 1rem;
        align-items: flex-start;
    }
    
    .sidebar-section {
        min-width: 150px;
        margin-bottom: 0;
    }
    
    .chat-container {
        min-height: 500px;
    }
}
