:root {
    --primary: #1e3a5f;
    --accent: #2563eb;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --light: #f8fafc;
    --border: #e2e8f0;
}

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

body {
    font-family: "標楷體", "DFKai-SB", "BiauKai", "Kaiti TC", "Kaiti SC", "KaiTi", -apple-system, BlinkMacSystemFont, serif;
    background: var(--light);
    color: #1e293b;
    line-height: 1.6;
}

/* 英文、按鈕使用無襯線字體 */
.en, .subtitle, .btn, .score-badge, .progress-step, .grading-modal, .time-warning-bar {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 主要內容區域使用標楷體 */
.card, .feedback, .report-section, textarea, input, .report-answer, th, td, .label {
    font-family: "標楷體", "DFKai-SB", "BiauKai", "Kaiti TC", "Kaiti SC", "KaiTi", serif;
}

/* ★ v11.20: 英文模式 Latin 字元用 Arial，CJK 保持標楷體（font-family fallback 機制） */
html[lang="en-GB"] body {
    font-family: Arial, "Helvetica Neue", "標楷體", "DFKai-SB", "BiauKai", "Kaiti TC", "Kaiti SC", "KaiTi", serif;
}
html[lang="en-GB"] .card,
html[lang="en-GB"] .feedback,
html[lang="en-GB"] .report-section,
html[lang="en-GB"] textarea,
html[lang="en-GB"] input,
html[lang="en-GB"] .report-answer,
html[lang="en-GB"] th,
html[lang="en-GB"] td,
html[lang="en-GB"] .label {
    font-family: Arial, "Helvetica Neue", "標楷體", "DFKai-SB", "BiauKai", "Kaiti TC", "Kaiti SC", "KaiTi", serif;
}

.header {
    background: var(--primary);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.header h1 { font-size: 1.4rem; margin-bottom: 0.3rem; }
.header .subtitle { opacity: 0.9; font-size: 0.9rem; }

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Progress Bar */
.progress-bar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border-bottom: 1px solid var(--border);
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #94a3b8;
    background: #f1f5f9;
}

.progress-step.active {
    background: var(--accent);
    color: white;
}

.progress-step.done {
    background: var(--success);
    color: white;
}

.progress-step .num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
}

/* Pages */
.page { display: none; }
.page.active { display: block; }

/* Card Styles */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, var(--primary), #2d4a6f);
    color: white;
    padding: 1rem 1.5rem;
}

.card-header h2 {
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header .marks {
    background: rgba(255,255,255,0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: normal;
}

.card-body { padding: 1.5rem; }

/* Question Prompt */
.prompt {
    background: #f8fafc;
    border-left: 4px solid var(--accent);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0 8px 8px 0;
}

.prompt h3 {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.prompt p {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.prompt ul {
    margin: 0.8rem 0 0.8rem 1.2rem;
    color: #475569;
}

.prompt li { margin-bottom: 0.3rem; }

.prompt .word-req {
    color: var(--accent);
    font-weight: 600;
    margin-top: 0.5rem;
}



.form-input {
    width: 100%;
    padding: 0.6rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-input:disabled {
    background: #f1f5f9;
    color: #64748b;
}

.form-input.correct { border-color: var(--success); background: #f0fdf4; }
.form-input.incorrect { border-color: var(--danger); background: #fef2f2; }

/* Writing Area */
.writing-area {
    margin-bottom: 1rem;
}

.writing-textarea {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.8;
    resize: vertical;
}

.writing-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.writing-textarea.long { min-height: 300px; }

.char-counter {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 0.5rem;
}

.char-counter .count { font-weight: 600; }
.char-counter .count.low { color: var(--danger); }
.char-counter .count.good { color: var(--success); }
.char-counter .count.high { color: var(--warning); }

/* Buttons */
.btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover { background: #1d4ed8; }

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

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

.btn-outline {
    background: white;
    color: var(--primary);
    border: 2px solid var(--border);
}

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

.btn-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}



/* Feedback Panel */
.feedback {
    background: #f8fafc;
    border: 2px solid var(--border);
    border-radius: 8px;
    margin-top: 1.5rem;
    overflow: hidden;
}

.feedback-header {
    background: white;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feedback-header h4 {
    font-size: 1rem;
    color: var(--primary);
}

.score-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    color: white;
}

.score-badge.high { background: var(--success); }
.score-badge.mid { background: var(--warning); }
.score-badge.low { background: var(--danger); }

.feedback-body { padding: 1rem; }

.feedback-item {
    padding: 0.8rem;
    background: white;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

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

.feedback-item .label {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.3rem;
}

.feedback-item .zh { color: #1e293b; margin-bottom: 0.2rem; }
.feedback-item .en { color: #64748b; font-size: 0.9rem; font-style: italic; }

.feedback-item.correct { border-left: 3px solid var(--success); }
.feedback-item.incorrect { border-left: 3px solid var(--danger); }

/* Score Breakdown */
.score-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    margin: 1rem 0;
}

.score-box {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.score-box .label {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.3rem;
}

.score-box .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

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

/* Start Page */
.start-card {
    text-align: center;
    padding: 2rem;
}

.start-card h2 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.start-card p {
    color: #64748b;
    margin-bottom: 1.5rem;
}

.name-input {
    width: 100%;
    max-width: 300px;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.name-input:focus {
    outline: none;
    border-color: var(--accent);
}

.exam-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
    text-align: center;
}

.start-buttons {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.start-buttons .btn {
    min-width: 140px;
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.exam-info-item {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.exam-info-item .label {
    font-size: 0.8rem;
    color: #64748b;
}

.exam-info-item .value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}

/* Report Page */
.report {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.report-header {
    text-align: center;
    border-bottom: 2px solid var(--border);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.report-header h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.report-header p {
    color: #64748b;
    font-size: 0.9rem;
}

.report-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.report-section-header {
    background: #f8fafc;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.report-section-header h3 {
    font-size: 1rem;
    color: var(--primary);
}

.report-section-body {
    padding: 1rem;
}

.report-answer {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    white-space: pre-wrap;
    line-height: 1.8;
}

.report-total {
    background: var(--primary);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    margin: 1.5rem 0;
}

.report-total .label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.report-total .value {
    font-size: 2.5rem;
    font-weight: 700;
}

.report-total .percent {
    font-size: 1.2rem;
    opacity: 0.9;
}

.report-feedback {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.report-feedback h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.report-feedback p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.report-feedback .en {
    color: #64748b;
    font-style: italic;
}

.print-btn {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
}

@media print {
    .btn, .header, .progress-bar { display: none; }
    .report { box-shadow: none; }
}

/* ═══════════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════ */

/* === 平板 (768px 以下) === */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .report {
        padding: 1.5rem;
    }
    
    /* 進度條 - 隱藏文字，只顯示數字 */
    .progress-step {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .progress-step span:not(.num) {
        display: none;
    }
    
    .progress-step .num {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }
}

/* === 手機 (600px 以下) === */
@media (max-width: 600px) {
    /* --- Header 優化 --- */
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.1rem;
        padding-right: 60px; /* 給語言按鈕留空間 */
    }
    
    .header .subtitle {
        font-size: 0.75rem;
    }
    
    .lang-toggle {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
        right: 0.5rem;
    }
    
    /* --- 進度條 - 極簡模式 --- */
    .progress-bar {
        padding: 0.6rem 0.5rem;
        gap: 0.3rem;
        overflow-x: auto;
    }
    
    .progress-step {
        padding: 0.3rem;
        min-width: auto;
    }
    
    .progress-step .num {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
    }
    
    /* --- 容器優化 --- */
    .container {
        padding: 0.8rem;
    }
    
    /* --- 卡片優化 --- */
    .card {
        border-radius: 8px;
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 0.8rem 1rem;
    }
    
    .card-header h2 {
        font-size: 0.95rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .card-header .marks {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* --- 題目說明優化 --- */
    .prompt {
        padding: 0.8rem;
        margin-bottom: 1rem;
    }
    
    .prompt h3 {
        font-size: 0.9rem;
    }
    
    .prompt p, .prompt li {
        font-size: 0.85rem;
    }
    
    .prompt ul {
        margin: 0.5rem 0 0.5rem 1rem;
    }
    

    
    .form-input {
        padding: 0.7rem;
        font-size: 16px; /* 防止 iOS 縮放 */
    }
    
    /* --- 寫作區優化 --- */
    .writing-textarea {
        min-height: 180px;
        padding: 0.8rem;
        font-size: 16px; /* 防止 iOS 縮放 */
        line-height: 1.7;
    }
    
    .writing-textarea.long {
        min-height: 250px;
    }
    
    .char-counter {
        font-size: 0.8rem;
        flex-direction: column;
        gap: 0.3rem;
        align-items: flex-start;
    }
    
    /* --- 按鈕優化 - 觸控友好 --- */
    .btn {
        padding: 0.9rem 1.5rem;
        font-size: 0.95rem;
        min-height: 48px; /* 觸控最小高度 */
        width: 100%;
    }
    
    .btn-row {
        flex-direction: column;
        gap: 0.8rem;
    }
    

    
    /* --- 考試資訊格優化 --- */
    .exam-info-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .exam-info-item {
        padding: 0.8rem;
    }
    
    .exam-info-item .value {
        font-size: 1.1rem;
    }
    
    /* --- 開始頁優化 --- */
    .start-card {
        padding: 1.5rem;
    }
    
    .start-card h2 {
        font-size: 1.1rem;
    }
    
    .name-input {
        max-width: 100%;
        font-size: 16px; /* 防止 iOS 縮放 */
    }
    
    /* --- 反饋面板優化 --- */
    .feedback {
        margin-top: 1rem;
    }
    
    .feedback-header {
        padding: 0.8rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .feedback-header h4 {
        font-size: 0.9rem;
    }
    
    .score-badge {
        padding: 0.3rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .feedback-body {
        padding: 0.8rem;
    }
    
    .feedback-item {
        padding: 0.7rem;
    }
    
    .feedback-item .zh, .feedback-item .en {
        font-size: 0.85rem;
    }
    
    /* --- 分數細項優化 --- */
    .score-breakdown {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .score-box {
        padding: 0.8rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .score-box .label {
        margin-bottom: 0;
    }
    
    .score-box .value {
        font-size: 1.3rem;
    }
    
    /* --- 報告頁優化 --- */
    .report {
        padding: 1rem;
        border-radius: 8px;
    }
    
    .report-header {
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }
    
    .report-header h2 {
        font-size: 1.1rem;
    }
    
    .report-section {
        margin-bottom: 1rem;
    }
    
    .report-section-header {
        padding: 0.8rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .report-section-header h3 {
        font-size: 0.9rem;
    }
    
    .report-section-body {
        padding: 0.8rem;
        overflow-x: auto; /* V7.38: 允許表格水平滾動 */
    }
    
    .report-answer {
        padding: 0.8rem;
        font-size: 0.9rem;
        line-height: 1.7;
    }
    
    .report-total {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .report-total .value {
        font-size: 2rem;
    }
    
    .report-total .percent {
        font-size: 1rem;
    }
    
    .report-feedback {
        padding: 0.8rem;
    }
    
    .report-feedback p {
        font-size: 0.85rem;
    }
    
    /* --- 語言選擇對話框優化 --- */
    .lang-dialog {
        padding: 1.5rem;
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .lang-dialog h2 {
        font-size: 1.2rem;
    }
    
    .lang-buttons {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .lang-btn {
        padding: 0.9rem 1.5rem;
        font-size: 1rem;
        min-width: auto;
        width: 100%;
    }
    
    /* --- 時間警告條優化 --- */
    .time-warning-bar {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}

/* === 超小螢幕 (380px 以下) === */
@media (max-width: 380px) {
    .header h1 {
        font-size: 1rem;
    }
    
    .progress-step .num {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    .card-body {
        padding: 0.8rem;
    }
    
    .prompt {
        padding: 0.6rem;
    }
    
    .btn {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
}

/* === 橫向手機優化 === */
@media (max-width: 900px) and (orientation: landscape) {
    .writing-textarea {
        min-height: 150px;
    }
    
    .writing-textarea.long {
        min-height: 200px;
    }
    
    .lang-dialog {
        padding: 1rem;
    }
    
    .lang-buttons {
        flex-direction: row;
    }
}

/* === 觸控設備優化 === */
@media (hover: none) and (pointer: coarse) {
    /* 移除 hover 效果，改用 active */
    .btn:hover {
        background: var(--accent);
    }
    
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    

    
    /* 增加可點擊區域 */
    .form-input, .writing-textarea, .name-input {
        min-height: 48px;
    }
}

/* ═══════════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════ */

/* === 強制手機版（即使在大螢幕上）=== */
body.force-mobile .container { padding: 0.8rem; }
body.force-mobile .card { border-radius: 8px; margin-bottom: 1rem; }
body.force-mobile .card-header { padding: 0.8rem 1rem; }
body.force-mobile .card-header h2 { font-size: 0.95rem; flex-direction: column; align-items: flex-start; gap: 0.3rem; }
body.force-mobile .card-body { padding: 1rem; }
body.force-mobile .prompt { padding: 0.8rem; margin-bottom: 1rem; }
body.force-mobile .prompt h3 { font-size: 0.9rem; }
body.force-mobile .prompt p, body.force-mobile .prompt li { font-size: 0.85rem; }

/* 強制手機版：進度條 */
body.force-mobile .progress-bar { padding: 0.6rem 0.5rem; gap: 0.3rem; }
body.force-mobile .progress-step { padding: 0.3rem; min-width: auto; }
body.force-mobile .progress-step span:not(.num) { display: none; }
body.force-mobile .progress-step .num { width: 26px; height: 26px; font-size: 0.8rem; }
       
/* 強制手機版：按鈕 */
body.force-mobile .btn { padding: 0.9rem 1.5rem; font-size: 0.95rem; min-height: 48px; width: 100%; }
body.force-mobile .btn-row { flex-direction: column; gap: 0.8rem; }

/* 強制手機版：分數/考試資訊 */
body.force-mobile .exam-info-grid { grid-template-columns: 1fr; gap: 0.5rem; }
body.force-mobile .score-breakdown { grid-template-columns: 1fr; gap: 0.5rem; }
body.force-mobile .score-box { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem; }
body.force-mobile .score-box .label { margin-bottom: 0; }

/* 強制手機版：反饋面板 */
body.force-mobile .feedback-header { flex-direction: column; gap: 0.5rem; align-items: flex-start; padding: 0.8rem; }

/* 強制手機版：語言對話框 */
body.force-mobile .lang-buttons { flex-direction: column; gap: 0.8rem; }
body.force-mobile .lang-btn { width: 100%; min-width: auto; }

/* === 強制電腦版（即使在小螢幕上）=== */
body.force-desktop .container { padding: 1.5rem; max-width: 800px; }
body.force-desktop .card { border-radius: 12px; margin-bottom: 1.5rem; }
body.force-desktop .card-header { padding: 1rem 1.5rem; }
body.force-desktop .card-header h2 { font-size: 1.1rem; flex-direction: row; justify-content: space-between; align-items: center; }
body.force-desktop .card-body { padding: 1.5rem; }
body.force-desktop .prompt { padding: 1rem; margin-bottom: 1.5rem; }
body.force-desktop .prompt h3 { font-size: 1rem; }
body.force-desktop .prompt p, body.force-desktop .prompt li { font-size: 0.9rem; }

/* 強制電腦版：進度條 */
body.force-desktop .progress-bar { padding: 1rem; gap: 0.5rem; }
body.force-desktop .progress-step { padding: 0.5rem 1rem; }
body.force-desktop .progress-step span:not(.num) { display: inline; }
body.force-desktop .progress-step .num { width: 24px; height: 24px; font-size: 0.8rem; }
      
/* 強制電腦版：按鈕 */
body.force-desktop .btn { padding: 0.8rem 2rem; font-size: 1rem; min-height: auto; width: auto; }
body.force-desktop .btn-row { flex-direction: row; gap: 1rem; }

/* 強制電腦版：分數/考試資訊 */
body.force-desktop .exam-info-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
body.force-desktop .score-breakdown { grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
body.force-desktop .score-box { display: block; text-align: center; padding: 1rem; }
body.force-desktop .score-box .label { margin-bottom: 0.3rem; }

/* 強制電腦版：反饋面板 */
body.force-desktop .feedback-header { flex-direction: row; justify-content: space-between; align-items: center; padding: 1rem; }

/* 強制電腦版：語言對話框 */
body.force-desktop .lang-buttons { flex-direction: row; gap: 1rem; }
body.force-desktop .lang-btn { width: auto; flex: 1; min-width: 120px; }

/* Time Warning Bar */
.time-warning-bar {
    display: none;
    background: linear-gradient(90deg, #fef3c7, #fde68a);
    color: #92400e;
    padding: 0.6rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    border-bottom: 1px solid #f59e0b;
}

.time-warning-bar.show {
    display: block;
}

.time-warning-bar.urgent {
    background: linear-gradient(90deg, #fee2e2, #fecaca);
    color: #991b1b;
    border-bottom-color: #ef4444;
}

.time-warning-bar .time-left {
    font-weight: 700;
}

.exam-timer-bar {
    background: linear-gradient(90deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    padding: 0.5rem 1rem;
    text-align: center;
    font-size: 0.9rem;
    border-bottom: 2px solid #3b82f6;
    position: sticky;
    top: 0;
    z-index: 100;
}

.exam-timer-bar.warning {
    background: linear-gradient(90deg, #fef3c7, #fde68a);
    color: #92400e;
    border-bottom-color: #f59e0b;
    animation: pulse-warning 1s ease-in-out infinite;
}

.exam-timer-bar.critical {
    background: linear-gradient(90deg, #fee2e2, #fecaca);
    color: #991b1b;
    border-bottom-color: #ef4444;
    animation: pulse-critical 0.5s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

@keyframes pulse-critical {
    0%, 100% { opacity: 1; background: linear-gradient(90deg, #fee2e2, #fecaca); }
    50% { opacity: 0.9; background: linear-gradient(90deg, #fecaca, #fca5a5); }
}

.exam-timer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.exam-timer-icon {
    font-size: 1.1rem;
}

.exam-timer-display {
    font-weight: 700;
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
    min-width: 80px;
}

/* ═══════════════════════════════════════════════════════ */
/* 語言選擇器 Language Selector                            */
/* ═══════════════════════════════════════════════════════ */

/* 初始語言選擇對話框 */
.lang-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10002;
}

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

.lang-dialog {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: langDialogIn 0.3s ease-out;
}

@keyframes langDialogIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lang-dialog h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.lang-dialog .subtitle {
    color: #64748b;
    margin-bottom: 1.5rem;
}

.lang-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.lang-btn {
    flex: 1;
    min-width: 120px;
    padding: 1rem 1.2rem;
    font-size: 1.1rem;
    border: 2px solid var(--primary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    color: var(--primary);
    font-weight: 600;
}

.lang-btn small {
    display: block;
    font-weight: 400;
    font-size: 0.72rem;
    color: inherit;
    opacity: 0.7;
    margin-top: 0.3rem;
}

/* 推薦選項（繁體中文）：深藍底白字 */
.lang-btn.traditional {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.lang-btn.traditional small {
    opacity: 0.85;
}

/* 簡體：淺藍背景 */
.lang-btn.simplified {
    background: #f0f4f8;
    color: var(--primary);
}

/* 英文：白底 */
.lang-btn.english {
    background: white;
    color: var(--primary);
}

.lang-btn:hover, .lang-btn:active {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
}

.lang-btn:active {
    transform: translateY(0);
}

/* Header 中的語言切換按鈕 */
.lang-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.lang-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.settings-toggle {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.settings-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 設定面板 Overlay */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.settings-overlay.hidden {
    display: none;
}

.settings-dialog {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    text-align: left;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: langDialogIn 0.3s ease-out;
}

.settings-dialog h2 {
    color: var(--primary);
    margin-bottom: 0.3rem;
    font-size: 1.3rem;
    text-align: center;
}

.settings-dialog .subtitle {
    color: #64748b;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section h3 {
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.provider-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.provider-btn {
    padding: 0.8rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.provider-btn:hover {
    border-color: var(--accent);
    background: #f0f7ff;
}

.provider-btn.active {
    border-color: var(--accent);
    background: #e0f2fe;
}

.provider-btn .provider-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e293b;
}

.provider-btn .provider-desc {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.2rem;
}

.provider-btn .provider-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-top: 0.3rem;
}

.provider-btn .badge-free {
    background: #dcfce7;
    color: #166534;
}

.provider-btn .badge-key {
    background: #fef3c7;
    color: #92400e;
}

.provider-btn .badge-builtin {
    background: #dbeafe;
    color: #1e40af;
}

.provider-btn .badge-cheap {
    background: #fef3c7;
    color: #b45309;
}

.api-key-section {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.api-key-section.show {
    display: block;
}

.api-key-section label {
    display: block;
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 0.5rem;
}

.api-key-input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: monospace;
}

.api-key-input:focus {
    outline: none;
    border-color: var(--accent);
}

.api-key-hint {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.5rem;
}

.api-key-hint a {
    color: var(--accent);
}

.settings-buttons {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.settings-btn {
    flex: 1;
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-btn.primary {
    background: var(--accent);
    color: white;
    border: none;
}

.settings-btn.primary:hover {
    background: #1d4ed8;
}

.settings-btn.secondary {
    background: white;
    color: #64748b;
    border: 1px solid var(--border);
}

.settings-btn.secondary:hover {
    background: #f1f5f9;
}

.settings-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.settings-toggle-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.settings-toggle-label .main {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e293b;
}

.settings-toggle-label .sub {
    font-size: 0.75rem;
    color: #64748b;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.settings-speed-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.settings-speed-row select {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
}

.current-provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin-left: 0.5rem;
}

.footer {
    background: #1e293b;
    color: #94a3b8;
    padding: 1rem;
    margin-top: 2rem;
    font-size: 0.85rem;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-copyright {
    opacity: 0.7;
}

.footer-layout-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-label {
    opacity: 0.7;
    margin-right: 0.3rem;
}

.layout-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #94a3b8;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.layout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.layout-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.footer-maintainer {
    width: 100%;
    text-align: center;
    padding-top: 0.8rem;
    margin-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    opacity: 0.8;
}

.footer-maintainer a {
    color: #60a5fa;
    text-decoration: none;
    cursor: pointer;
}

.footer-maintainer a:hover {
    text-decoration: underline;
    color: #93c5fd;
}

.feedback-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 1rem;
}

.feedback-modal-overlay.hidden {
    display: none;
}

.feedback-modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.feedback-modal-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feedback-modal-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1.1rem;
}

.feedback-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.feedback-modal-close:hover {
    color: #1e293b;
}

.feedback-modal-body {
    padding: 1.5rem;
}

.feedback-form-group {
    margin-bottom: 1.2rem;
}

.feedback-form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.feedback-form-group label span {
    font-weight: 400;
    color: #6b7280;
    font-size: 0.85rem;
}

.feedback-form-group input,
.feedback-form-group textarea,
.feedback-form-group select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.feedback-form-group input:focus,
.feedback-form-group textarea:focus,
.feedback-form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.feedback-form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.feedback-submit-btn {
    width: 100%;
    padding: 0.9rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.feedback-submit-btn:hover {
    background: #1d4ed8;
}

@media (max-width: 600px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-layout-toggle {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .footer-maintainer {
        font-size: 0.75rem;
    }
}

.header {
    position: relative;
}

.api-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.api-toast {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: toastSlideIn 0.3s ease-out;
    position: relative;
}

.api-toast.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
}

.api-toast.info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
}

.api-toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.api-toast-content {
    flex: 1;
    font-size: 0.85rem;
    color: #1f2937;
    line-height: 1.4;
}

.api-toast-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.api-toast-message {
    opacity: 0.85;
    font-size: 0.8rem;
}

.api-toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.5;
    padding: 0;
    line-height: 1;
    color: #1f2937;
}

.api-toast-close:hover {
    opacity: 1;
}

.api-toast-action {
    margin-top: 8px;
}

.api-toast-action button {
    background: rgba(0,0,0,0.1);
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    color: #1f2937;
}

.api-toast-action button:hover {
    background: rgba(0,0,0,0.2);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes toastFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}

.api-toast.hiding {
    animation: toastSlideOut 0.3s ease-in forwards;
}

/* 手機版調整 */
@media (max-width: 480px) {
    .api-toast-container {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
    }
}

.notification-center-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 9999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-center-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.notification-center-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-center-btn .badge.hidden {
    display: none;
}

.notification-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 340px;
    max-height: 400px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 9998;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.notification-panel.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
}

.notification-panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-panel-header h3 {
    margin: 0;
    font-size: 0.95rem;
}

.notification-panel-header button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.notification-panel-header button:hover {
    background: rgba(255,255,255,0.3);
}

.notification-list {
    max-height: 340px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: #f0f9ff;
}

.notification-item-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1f2937;
    margin-bottom: 2px;
}

.notification-item-body {
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.4;
}

.notification-item-time {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 4px;
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}

.notification-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

@media (max-width: 480px) {
    .notification-center-btn {
        bottom: 10px;
        left: 10px;
        width: 42px;
        height: 42px;
    }
    
    .notification-panel {
        left: 10px;
        right: 10px;
        width: auto;
        bottom: 65px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
 * 評分小劇場樣式已提取到外部檔案: css/theatre.css
 * 包含: .grading-theatre, .examiner-card, .speech-bubble, .mood-*, 等
 * v10.0 架構重構 - 2026-02-03
 * ═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════
 * Fallback: 與 theatre.css 相同的預設隱藏樣式
 * 確保即使 theatre.css 載入延遲或失敗，元素也不會閃爍
 * ═══════════════════════════════════════════════════════════════════ */
.grading-overlay {
    position: fixed;
    opacity: 0;
    visibility: hidden;
}
.grading-overlay.show {
    opacity: 1;
    visibility: visible;
}
.grading-theatre {
    display: none;
}
.grading-theatre.show {
    display: block;
}
.theatre-backdrop {
    display: none;
}
.theatre-backdrop.show {
    display: block;
}

/* ==================== Landing Page Styles v4.44 ==================== */
.landing-hero {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, #2d4a6f 100%);
    color: white;
    border-radius: 16px;
    margin-bottom: 1.5rem;
}
.landing-hero h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.landing-hero .subtitle { opacity: 0.9; font-size: 1rem; }

.selector-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ★ v11.23 BUG-9: 逐步替換過渡動畫 */
.selector-section,
.start-section {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.selector-section.selector-hidden,
.start-section.selector-hidden {
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    position: absolute;
    left: 0; right: 0;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}
.selector-section.selector-entering,
.start-section.selector-entering {
    opacity: 0;
    transform: translateY(12px);
}

/* Breadcrumb */
.selector-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 12px;
    min-height: 28px;
    flex-wrap: wrap;
}
.selector-breadcrumb .bc-crumb {
    font-size: 0.75rem;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--accent, #3b82f6);
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.15);
    transition: background 0.2s;
}
.selector-breadcrumb .bc-crumb:hover {
    background: rgba(59,130,246,0.18);
}
.selector-breadcrumb .bc-sep {
    color: #94a3b8;
    font-size: 14px;
    margin: 0 2px;
    user-select: none;
}
.selector-breadcrumb .bc-current {
    font-size: 0.75rem;
    padding: 4px 10px;
    color: #334155;
    background: rgba(59,130,246,0.12);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 4px;
    cursor: default;
}
.selector-section h3 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.selector-section h3 .step-num {
    width: 24px; height: 24px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.8rem;
}
.option-card {
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.option-card:hover {
    border-color: var(--accent);
    background: #f0f7ff;
}
.option-card.selected {
    border-color: var(--accent);
    background: #e0f0ff;
}
.option-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}
.option-card .icon { font-size: 1.5rem; margin-bottom: 0.3rem; }
.option-card .icon-img { 
    width: 60px; height: 60px; 
    border-radius: 8px; 
    object-fit: cover; 
    margin-bottom: 0.3rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ★ v4.46: 課程輪播大圖樣式 ★ */
.syllabus-carousel {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.carousel-track {
    display: flex;
    transition: transform 0.4s ease;
}
.carousel-slide {
    min-width: 100%;
    position: relative;
    cursor: pointer;
    aspect-ratio: 4/3;
}
.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.carousel-slide .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 60px 20px 20px;
    color: white;
}
.carousel-slide .overlay .code {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 4px;
}
.carousel-slide .overlay .name {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 8px;
}
.carousel-slide .overlay .badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}
.carousel-slide .overlay .badge.ready { background: #10b981; }
.carousel-slide .overlay .badge.planned { background: #f59e0b; }
.carousel-slide.active {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
}
.carousel-slide.selected {
    outline: 4px solid #10b981;
    outline-offset: -4px;
}
.carousel-slide.selected .overlay {
    background: linear-gradient(transparent, rgba(16, 185, 129, 0.9));
}
.carousel-slide.selected::after {
    content: '✓ 已選擇';
    position: absolute;
    top: 15px;
    right: 15px;
    background: #10b981;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
}
/* ★ v11.20: 英文模式顯示 "Selected" */
html[lang="en-GB"] .carousel-slide.selected::after {
    content: '✓ Selected';
}

/* 輪播箭頭 */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.carousel-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }

/* 輪播指示點 */
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}
.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
}
.carousel-dot:hover { background: #94a3b8; }
.carousel-dot.active {
    background: var(--accent);
    width: 28px;
    border-radius: 5px;
}
.carousel-hint {
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
    margin-top: 10px;
}

/* Fallback 漸變背景樣式 */
.fallback-bg {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.fallback-code {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    opacity: 0.95;
}
.fallback-name {
    font-size: 1.1rem;
    opacity: 0.85;
    margin-top: 8px;
}
}

/* 選擇提示 */
.carousel-hint {
    text-align: center;
    margin-top: 12px;
    color: #64748b;
    font-size: 0.85rem;
}

/* 手機觸控提示 */
@media (max-width: 600px) {
    .carousel-btn { display: none; }
    .syllabus-carousel { max-width: 100%; }
}
.option-card .label { font-size: 0.9rem; font-weight: 500; }
.option-card .sublabel { font-size: 0.75rem; color: #64748b; margin-top: 0.2rem; }
.option-card .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-top: 0.4rem;
}
.option-card .badge.ready { background: #d1fae5; color: #059669; }
.option-card .badge.planned { background: #fef3c7; color: #d97706; }

.year-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.year-chip {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.year-chip:hover { border-color: var(--accent); }
.year-chip.selected { background: var(--accent); color: white; border-color: var(--accent); }

.season-toggle {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}
.season-btn {
    flex: 1;
    padding: 0.8rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: white;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}
.season-btn:hover { border-color: var(--accent); }
.season-btn.selected { background: var(--accent); color: white; border-color: var(--accent); }
.season-btn .icon { font-size: 1.2rem; }

.variant-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.variant-pill {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.variant-pill:hover { border-color: var(--accent); }
.variant-pill.selected { background: var(--accent); color: white; border-color: var(--accent); }

.start-section {
    text-align: center;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.selected-summary {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.selected-summary .code {
    font-family: monospace;
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
}

.hidden { display: none !important; }

/* Loading state */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ═══════════════════════════════════════════════════════════════════════════
 * V7.0 多軌制系統樣式
 * ═══════════════════════════════════════════════════════════════════════════ */

/* 軌道容器 */
#track-container {
    position: relative;
}

.exam-track {
    display: none;
}

.exam-track.active,
#track-0547 {
    display: block;
}

/* V7 軌道樣式 */
.V7-track {
    min-height: 60vh;
}
     
.V7-loading {
    animation: fadeIn 0.3s ease;
}      
      
/* V7 卡片樣式 */
.V7-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.V7-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.V7-card-header {
    background: linear-gradient(135deg, var(--primary, #1e3a5f), #2d4a6f);
    color: white;
    padding: 1rem 1.5rem;
}

.V7-card-body {
    padding: 1.5rem;
}

/* 載入動畫 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
        
/* ═══════════════════════════════════════════════════════════════ */
/* V7 通用樣式 */
/* ═══════════════════════════════════════════════════════════════ */
.v7-prompt-text {
    white-space: pre-line;
    line-height: 1.6;
}

/* ★ V7.9：評語折疊樣式 */
.v7-comment-collapsible {
    max-height: 4.8em;  /* 約 3 行 */
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.v7-comment-collapsible.v7-expanded {
    max-height: none;
}

/* ═══════════════════════════════════════════════════════════════════
   ★ v7.8: 遞迴題組樣式
   ═══════════════════════════════════════════════════════════════════ */

/* 題組容器 */
.question-group {
    margin-bottom: 1.5rem;
    border-left: 3px solid #3b82f6;
    padding-left: 1rem;
}

.question-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.question-group-header .question-number {
    font-weight: 700;
    color: #1e40af;
    font-size: 1.1rem;
}

.question-group-header .question-marks {
    color: #64748b;
    font-size: 0.9rem;
}

.question-group-children {
    margin-top: 1rem;
}

/* 葉節點（可作答題目）*/
.question-leaf {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
}

.question-leaf-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.question-leaf-header .question-number {
    font-weight: 600;
    color: #334155;
}

.question-leaf-header .question-marks {
    color: #3b82f6;
    font-weight: 600;
}

/* 題目文字 */
.question-prompt {
    margin-bottom: 0.75rem;
}

.question-prompt .prompt-zh {
    color: #1e293b;
    line-height: 1.6;
    margin: 0 0 0.25rem 0;
}

.question-prompt .prompt-en {
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

/* 答案輸入區 */
.question-answer-area {
    margin-top: 0.5rem;
}

.leaf-answer-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.leaf-answer-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.leaf-answer-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.leaf-answer-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 深度樣式（0-5 層）*/
.question-depth-0 { margin-left: 0; }
.question-depth-1 { margin-left: 1rem; }
.question-depth-2 { margin-left: 2rem; }
.question-depth-3 { margin-left: 3rem; }
.question-depth-4 { margin-left: 4rem; }
.question-depth-5 { margin-left: 5rem; }

/* 結果顯示 */
.result-group {
    margin-bottom: 1rem;
    border-left: 3px solid #059669;
    padding-left: 1rem;
}

.result-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px dashed #e2e8f0;
}

.result-group-header .result-number {
    font-weight: 600;
    color: #1e293b;
}

.result-group-header .result-score {
    font-weight: 700;
    font-size: 1.1rem;
}

.result-leaf {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.result-leaf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.result-leaf-header .result-number {
    font-weight: 600;
    color: #334155;
}

.result-leaf-header .result-score {
    font-weight: 700;
}

.result-comment {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
}

.result-comment .comment-zh {
    color: #334155;
    line-height: 1.6;
    margin: 0 0 0.25rem 0;
}

.result-comment .comment-en {
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

/* 結果深度樣式 */
.result-depth-0 { margin-left: 0; }
.result-depth-1 { margin-left: 1rem; }
.result-depth-2 { margin-left: 2rem; }
.result-depth-3 { margin-left: 3rem; }
.result-depth-4 { margin-left: 4rem; }
.result-depth-5 { margin-left: 5rem; }

/* ═══════════════════════════════════════════════════════════════
   ★ v9.05: 分屏拖拽分隔條樣式
   ═══════════════════════════════════════════════════════════════ */
.split-container {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
    position: relative;
}

.split-pane-left {
    display: flex;
    flex-direction: column;
    background: #fffbeb;
    min-width: 250px;
    max-width: 70%;
    overflow: hidden;
}

.split-pane-right {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    background: white;
    min-width: 300px;
}

.split-resizer {
    width: 8px;
    background: linear-gradient(to right, #f59e0b, #d97706);
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    transition: background 0.2s;
}

.split-resizer:hover,
.split-resizer.dragging {
    background: linear-gradient(to right, #d97706, #b45309);
}

.split-resizer::before {
    content: '⋮';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ★ v9.05: 互動式表格樣式 */
.form-table-container {
    max-width: 650px;
    margin: 0 auto;
}

.form-table-scenario {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8fafc;
    border-left: 4px solid #3b82f6;
    border-radius: 0 8px 8px 0;
}

.form-table-scenario .scenario-zh {
    margin: 0 0 8px;
    font-weight: 600;
    color: #1e40af;
}

.form-table-scenario .scenario-en {
    margin: 0;
    color: #64748b;
    font-size: 0.9rem;
}

.form-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.form-table td {
    border: 1px solid #d1d5db;
    padding: 12px 16px;
    vertical-align: middle;
}

.form-table .label-cell {
    background: #f9fafb;
    width: 35%;
}

.form-table .label-zh {
    font-weight: 500;
}

.form-table .label-en {
    color: #6b7280;
    font-size: 0.85rem;
}

.form-table .label-note {
    color: #9ca3af;
    font-size: 0.8rem;
    margin-top: 4px;
}

.form-table .static-cell {
    background: #e5e7eb;
    color: #374151;
}

.form-table .input-cell {
    padding: 8px 12px;
}

.form-table input[type="text"],
.form-table textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-table input[type="text"]:focus,
.form-table textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.form-table textarea {
    min-height: 80px;
    resize: vertical;
}

.form-table .multi-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-table .multi-input-container input {
    flex: 1;
}

.form-table .multi-input-separator {
    color: #9ca3af;
}

/* ═══════════════════════════════════════════════════════════════════
 * 重播 iframe 容器樣式（v10.05）
 * ═══════════════════════════════════════════════════════════════════ */
.replay-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
}

.replay-overlay.show {
    display: flex;
}

.replay-overlay iframe {
    width: 100%;
    height: 100%;
    max-width: 900px;
    max-height: 100%;
    border: none;
    border-radius: 0;
}

@media (min-width: 768px) {
    .replay-overlay iframe {
        max-height: 90%;
        border-radius: 16px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    }
}

/* ★ Provider 狀態燈 + 摘要列 */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.status-ok { background: #22c55e; box-shadow: 0 0 4px #22c55e; }
.status-degraded { background: #f59e0b; box-shadow: 0 0 4px #f59e0b; }
.status-down { background: #ef4444; box-shadow: 0 0 4px #ef4444; }

#api-status-bar {
    text-align: center;
    padding: 8px 16px;
    margin: 10px auto 0;
    max-width: 500px;
    font-size: 0.82rem;
    color: #64748b;
    background: rgba(241,245,249,0.6);
    border-radius: 20px;
    backdrop-filter: blur(4px);
}
#api-status-bar .status-text { font-weight: 500; }
#api-status-bar .status-time { margin-left: 8px; color: #94a3b8; font-size: 0.78rem; }

@media (max-width: 640px) {
    #api-status-bar { font-size: 0.75rem; padding: 6px 12px; }
}

/* ═══════════════════════════════════════════════════════════
   Settings Panel v2 — 手風琴式三區塊重建 (v11.19)
   ═══════════════════════════════════════════════════════════ */

.settings-rebuilt {
    max-width: 720px;
    max-height: 85vh;
    overflow-y: auto;
}

.settings-header {
    position: relative;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1rem;
}

.settings-subtitle {
    color: #6b7280;
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

.settings-close-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.3rem;
}

/* Status bar */
.status-bar {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    user-select: none;
}

.status-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: #374151;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}

.dot-green { background: #22c55e; }
.dot-yellow { background: #eab308; }
.dot-red { background: #ef4444; }

.status-expand {
    color: #2563eb;
    font-size: 0.75rem;
    margin-left: auto;
}

.status-detail {
    display: none;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.status-detail.open {
    display: block;
}

.status-group { margin-bottom: 0.5rem; }
.status-group-title { font-size: 0.75rem; color: #6b7280; margin-bottom: 0.4rem; }
.status-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.status-chip {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 3px;
}
.chip-ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.chip-warn { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.chip-down { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Summary bar */
.summary-bar {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.summary-stat { text-align: center; }
.summary-num { font-size: 1.3rem; font-weight: 700; }
.summary-label { font-size: 0.7rem; color: #6b7280; }
.num-green { color: #16a34a; }
.num-yellow { color: #ca8a04; }
.num-blue { color: #2563eb; }

/* Accordion sections */
.settings-section-accordion {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.settings-section-accordion .section-header {
    padding: 0.9rem 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.15s;
}

.settings-section-accordion .section-header:hover {
    background: #f8fafc;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
}

.section-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: #dbeafe;
    color: #2563eb;
    margin-left: 8px;
    vertical-align: middle;
}

.section-arrow {
    color: #9ca3af;
    transition: transform 0.2s;
    font-size: 1rem;
}

.section-arrow.open {
    transform: rotate(180deg);
}

.section-body {
    padding: 0 1.2rem 1.2rem;
    display: none;
}

.section-body.open {
    display: block;
}

/* Override section */
.override-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.override-label {
    font-size: 0.85rem;
    color: #6b7280;
    white-space: nowrap;
}

.override-select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #1e293b;
    font-size: 0.85rem;
    cursor: pointer;
}

.override-select:focus {
    outline: none;
    border-color: #2563eb;
}

/* Model detail panel */
.model-detail-panel {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 0.75rem;
    overflow: hidden;
}

.model-detail-header {
    padding: 0.7rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.model-count {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 400;
}

.model-list {
    max-height: 240px;
    overflow-y: auto;
}

.model-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.82rem;
}

.model-item:last-child { border-bottom: none; }
.model-item.locked { opacity: 0.4; }

.model-name {
    flex: 1;
    color: #374151;
}

.model-cost {
    color: #6b7280;
    font-size: 0.72rem;
    margin: 0 0.75rem;
    font-family: monospace;
    min-width: 70px;
    text-align: right;
}

.model-tag {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

.tag-available { background: #dcfce7; color: #166534; }
.tag-locked { background: #fef2f2; color: #dc2626; }
.tag-byok { background: #dbeafe; color: #2563eb; }

.upgrade-hint {
    padding: 0.6rem 1rem;
    background: #fffbeb;
    border-top: 1px solid #fde68a;
    font-size: 0.75rem;
    color: #b45309;
}

/* BYOK section */
.byok-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    align-items: stretch;
}

.byok-select {
    width: 180px;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #1e293b;
    font-size: 0.82rem;
}

.byok-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #1e293b;
    font-size: 0.82rem;
    font-family: monospace;
}

.byok-input::placeholder { color: #9ca3af; }

.byok-save-btn {
    padding: 0.5rem 1rem;
    background: #2563eb;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.82rem;
    cursor: pointer;
    white-space: nowrap;
}

.byok-save-btn:hover { background: #1d4ed8; }

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #1e293b;
    font-size: 0.82rem;
    margin-bottom: 0.5rem;
}

.search-input::placeholder { color: #9ca3af; }
.search-input:focus { outline: none; border-color: #2563eb; }

.byok-keys-list { margin-top: 0.75rem; }

.byok-key-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
}

.byok-key-del {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.byok-key-del:hover { background: #fef2f2; }

.byok-key-url {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 0.75rem;
    text-decoration: underline;
    padding: 2px 6px;
}

/* Info box */
.info-box {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.6;
}

.info-box strong { color: #374151; }

.note-text {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.3rem;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Temperature slider */
.slider-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.slider-label {
    font-size: 0.85rem;
    color: #6b7280;
    min-width: 90px;
}

.slider-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.slider-input {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #d1d5db;
    outline: none;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.slider-value {
    font-size: 0.95rem;
    font-weight: 600;
    min-width: 36px;
    text-align: center;
    color: #1e293b;
}

.slider-desc {
    font-size: 0.72rem;
    color: #6b7280;
    margin-top: 0.3rem;
}

.temp-preset-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f8fafc;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.15s;
}

.temp-preset-btn:hover { background: #eff6ff; border-color: #93c5fd; }
.temp-preset-btn.active { background: #dbeafe; color: #2563eb; border-color: #93c5fd; }

.admin-only-section { /* shown/hidden by JS */ }

@media (max-width: 480px) {
    .byok-row { flex-direction: column; }
    .byok-select { width: 100%; }
    .summary-bar { justify-content: center; }
    .override-row { flex-direction: column; align-items: stretch; }
}
