/* Jaquizy classroom design system */

:root {
    --color-paper: #f7f5f0;
    --color-surface: #ffffff;
    --color-board: #1b4965;
    --color-board-hover: #163a52;
    --color-sage: #2d6a6a;
    --color-chalk: #3d7a5f;
    --color-chalk-light: #e8f3ed;
    --color-wood: #b8956a;
    --color-wood-light: #f5ede3;
    --color-ink: #2c3333;
    --color-muted: #64748b;
    --color-border: #e8e4dc;
    --color-border-strong: #d4cfc4;
    --color-error-bg: #fef2f2;
    --color-error-text: #991b1b;
    --color-success-bg: #ecfdf5;
    --color-success-text: #065f46;
    --color-warn-bg: #fffbeb;
    --color-warn-text: #92400e;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 1px 3px rgba(44, 51, 51, 0.06), 0 1px 2px rgba(44, 51, 51, 0.04);
    --shadow-card-hover: 0 4px 14px rgba(44, 51, 51, 0.09);
    --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-serif: 'Source Serif 4', Georgia, serif;
    --layout-max: 90rem;
    --layout-gutter: clamp(1rem, 2vw, 1.75rem);
    --touch-min: 44px;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    color: var(--color-ink);
    background-color: var(--color-paper);
    background-image:
        linear-gradient(180deg, rgba(27, 73, 101, 0.03) 0%, transparent 120px),
        radial-gradient(circle at 100% 0%, rgba(184, 149, 106, 0.08), transparent 40%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-shell {
    max-width: var(--layout-max);
    margin: 0 auto;
    padding: var(--layout-gutter) var(--layout-gutter) 2.5rem;
}
.app-shell--wide { max-width: 110rem; }
.app-shell--home { max-width: 72rem; }
.content-narrow { max-width: 28rem; margin-left: auto; margin-right: auto; width: 100%; }
.content-medium { max-width: 40rem; width: 100%; }
.app-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 0 1.25rem; margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}
.app-logo {
    display: flex; align-items: center; gap: 0.625rem;
    cursor: pointer; border: none; background: none; padding: 0;
    font-family: var(--font-serif); font-size: 1.5rem; font-weight: 600;
    color: var(--color-board); letter-spacing: -0.02em;
}
.app-logo-mark {
    width: 2rem; height: 2rem; border-radius: var(--radius-sm);
    background: var(--color-board); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.875rem; font-weight: 700; font-family: var(--font-sans);
}
.app-user { display: flex; align-items: center; gap: 0.75rem; font-size: 0.875rem; color: var(--color-muted); }

.page-header { margin-bottom: 1.5rem; }
.page-header--dashboard {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
    gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--color-border);
}
.page-header--dashboard .page-subtitle { margin-top: 0.25rem; }
.page-header-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.page-title {
    font-family: var(--font-serif); font-size: 1.75rem; font-weight: 600;
    color: var(--color-ink); letter-spacing: -0.02em; line-height: 1.2;
}
.page-subtitle { margin-top: 0.375rem; font-size: 0.9375rem; color: var(--color-muted); }

.breadcrumb {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem;
    margin-bottom: 0.75rem; font-size: 0.8125rem; color: var(--color-muted);
}
.breadcrumb a, .breadcrumb button {
    color: var(--color-sage); background: none; border: none; padding: 0;
    cursor: pointer; font: inherit; text-decoration: none;
}
.breadcrumb a:hover, .breadcrumb button:hover { text-decoration: underline; }
.breadcrumb-sep { opacity: 0.5; }

/* Cards */
.card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.card-padded { padding: 1.25rem 1.5rem; }
.card-interactive {
    cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.card-interactive:hover {
    box-shadow: var(--shadow-card-hover); border-color: var(--color-border-strong);
    transform: translateY(-1px);
}
.card-section-title {
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--color-muted); margin-bottom: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
    font-family: var(--font-sans); font-size: 0.875rem; font-weight: 600;
    border-radius: var(--radius-sm); padding: 0.5rem 1rem;
    border: 1px solid transparent; cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
    line-height: 1.4;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { font-size: 0.8125rem; padding: 0.375rem 0.75rem; }
.btn-primary { background: var(--color-board); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-board-hover); }
.btn-secondary { background: var(--color-surface); color: var(--color-ink); border-color: var(--color-border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--color-paper); }
.btn-success { background: var(--color-chalk); color: #fff; }
.btn-success:hover:not(:disabled) { background: #326b52; }
.btn-danger { background: var(--color-error-bg); color: var(--color-error-text); border-color: #fecaca; }
.btn-danger:hover:not(:disabled) { background: #fee2e2; }
.btn-ghost { background: transparent; color: var(--color-muted); padding-left: 0; padding-right: 0; }
.btn-ghost:hover:not(:disabled) { color: var(--color-ink); }

/* Form controls */
.field { margin-bottom: 0.875rem; }
.field-label {
    display: block; font-size: 0.8125rem; font-weight: 600;
    color: var(--color-ink); margin-bottom: 0.375rem;
}
.input, .select, .textarea {
    width: 100%; font-family: var(--font-sans); font-size: 0.9375rem;
    color: var(--color-ink); background: var(--color-surface);
    border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm);
    padding: 0.625rem 0.75rem; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--color-board);
    box-shadow: 0 0 0 3px rgba(27, 73, 101, 0.12);
}
.input::placeholder, .textarea::placeholder { color: #94a3b8; }
.textarea { resize: vertical; min-height: 5rem; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.875rem; margin-bottom: 1rem; }
.alert-error { background: var(--color-error-bg); color: var(--color-error-text); border: 1px solid #fecaca; }
.alert-success { background: var(--color-success-bg); color: var(--color-success-text); border: 1px solid #a7f3d0; }

/* Badges & chips */
.badge {
    display: inline-flex; align-items: center; font-size: 0.6875rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem; border-radius: 999px;
}
.badge-teacher { background: var(--color-wood-light); color: #7c5c2e; }
.badge-student { background: #e0f2fe; color: #0369a1; }
.chip {
    display: inline-flex; align-items: center; font-size: 0.75rem; font-weight: 600;
    padding: 0.25rem 0.625rem; border-radius: 999px;
    background: var(--color-paper); border: 1px solid var(--color-border); color: var(--color-muted);
}
.chip-code { font-family: ui-monospace, monospace; letter-spacing: 0.08em; color: var(--color-board); }
.chip-correct { background: var(--color-chalk-light); color: #1e4d38; border-color: #a7d4bc; }
.chip-partial { background: #fff7ed; color: #9a3412; border-color: #fdba74; }
.chip-incorrect { background: var(--color-warn-bg); color: var(--color-warn-text); border-color: #fde68a; }
.model-answer-box {
    padding: 0.875rem 1rem; border-radius: var(--radius-md);
    background: var(--color-paper); border: 1px solid var(--color-border);
}

/* Lists & grids */
.list-grid {
    display: grid; gap: 0.875rem;
    grid-template-columns: 1fr;
}
@media (min-width: 640px) {
    .list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .list-grid--cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.list-item {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    padding: 1rem 1.125rem;
}
.list-item-title { font-weight: 600; color: var(--color-ink); }
.list-item-meta { font-size: 0.8125rem; color: var(--color-muted); margin-top: 0.125rem; }

/* Empty state */
.empty-state {
    text-align: center; padding: 2.5rem 1.5rem;
    background: var(--color-surface); border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-lg); color: var(--color-muted);
}
.empty-state-icon { font-size: 2rem; margin-bottom: 0.75rem; opacity: 0.7; }
.empty-state-title { font-weight: 600; color: var(--color-ink); margin-bottom: 0.375rem; }
.empty-state-text { font-size: 0.875rem; max-width: 22rem; margin: 0 auto 1rem; }

/* Practice */
.practice-progress {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.75rem; font-size: 0.8125rem; color: var(--color-muted);
}
.progress-track {
    flex: 1; height: 6px; background: var(--color-border); border-radius: 999px;
    margin-left: 1rem; overflow: hidden;
}
.progress-fill {
    height: 100%; background: var(--color-chalk); border-radius: 999px;
    transition: width 0.3s ease;
}
.option-btn {
    width: 100%; text-align: left; padding: 0.875rem 1rem;
    border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm);
    background: var(--color-surface); cursor: pointer; font-size: 0.9375rem;
    transition: border-color 0.15s, background 0.15s;
    min-height: var(--touch-min);
}
.option-btn:hover:not(:disabled) { background: var(--color-paper); }
.option-btn.selected { border-color: var(--color-board); background: #eef4f8; }
.option-btn.correct { border-color: var(--color-chalk); background: var(--color-chalk-light); }
.option-btn.incorrect { border-color: #f87171; background: #fef2f2; }
.option-btn:disabled { cursor: default; }

.feedback-box { margin-top: 1rem; padding: 0.875rem 1rem; border-radius: var(--radius-sm); font-size: 0.875rem; }
.hint-box {
    margin-top: 0.75rem;
    padding: 0.75rem 0.875rem;
    border-radius: var(--radius-sm);
    background: var(--color-chalk-light, #eef6f0);
    border: 1px solid color-mix(in srgb, var(--color-chalk) 35%, transparent);
}
.hint-box-text {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--color-ink);
}
.hint-box-text + .hint-box-text { margin-top: 0.5rem; }
.feedback-correct { background: var(--color-chalk-light); color: #1e4d38; border: 1px solid #a7d4bc; }
.feedback-partial { background: #fff7ed; color: #9a3412; border: 1px solid #fdba74; }
.feedback-incorrect { background: var(--color-warn-bg); color: var(--color-warn-text); border: 1px solid #fde68a; }

.score-display {
    font-family: var(--font-serif); font-size: 2.75rem; font-weight: 600;
    color: var(--color-board); line-height: 1;
}

/* Template picker */
.template-list {
    max-height: 12rem; overflow-y: auto;
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
}
.template-item {
    padding: 0.625rem 0.75rem; cursor: pointer; font-size: 0.875rem;
    border-bottom: 1px solid var(--color-border); transition: background 0.1s;
}
.template-item:last-child { border-bottom: none; }
.template-item:hover { background: var(--color-paper); }
.template-item.selected { background: #eef4f8; }

/* Notes editor (Quill) */
.note-editor-wrap {
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-surface);
}
.note-upload-zone { margin-bottom: 0.75rem; }
.note-upload-btn {
    display: flex; align-items: center; gap: 0.75rem; width: 100%;
    padding: 0.875rem 1rem; border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-sm); background: var(--color-paper);
    color: var(--color-ink); cursor: pointer; text-align: left;
    transition: border-color 0.15s, background 0.15s;
}
.note-upload-btn:hover:not(:disabled) {
    border-color: var(--color-chalk); background: var(--color-surface);
}
.note-upload-btn:disabled { opacity: 0.65; cursor: wait; }
.note-upload-icon { font-size: 1.25rem; line-height: 1; }
.note-upload-copy { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.note-upload-copy strong { font-size: 0.9375rem; }
.note-upload-copy span { font-size: 0.8125rem; color: var(--color-muted); }
.note-upload-or {
    margin: 0 0 0.75rem; font-size: 0.75rem; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--color-muted); text-align: center;
}
.note-file-badge {
    display: inline-block; margin-right: 0.35rem; padding: 0.1rem 0.35rem;
    border-radius: 0.25rem; font-size: 0.6875rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
    background: var(--color-paper); color: var(--color-muted);
    border: 1px solid var(--color-border);
}
.note-file-name { color: var(--color-muted); }

/* Chat panels (classroom + AI tutor) */
.chat-panel { display: flex; flex-direction: column; min-height: 20rem; overflow: hidden; }
.chat-panel--tutor { min-height: 18rem; }
.chat-panel-header {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border);
}
.chat-panel-hint {
    margin: 0; padding: 0.75rem 1.25rem 0;
    font-size: 0.8125rem; color: var(--color-muted); line-height: 1.45;
}
.chat-messages {
    flex: 1; min-height: 12rem; max-height: 24rem; overflow-y: auto;
    padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.75rem;
}
.chat-messages--tutor { max-height: 16rem; }
.chat-empty {
    margin: auto; text-align: center; color: var(--color-muted);
    font-size: 0.875rem; line-height: 1.5; padding: 1rem;
}
.chat-bubble {
    max-width: 92%; padding: 0.625rem 0.875rem; border-radius: var(--radius-sm);
    background: var(--color-paper); border: 1px solid var(--color-border);
}
.chat-bubble--own {
    align-self: flex-end; background: #eef4f8; border-color: #c5d9e8;
}
.chat-bubble--assistant {
    align-self: flex-start; background: var(--color-surface);
    border-color: var(--color-chalk);
}
.chat-mention {
    font-weight: 600; color: var(--color-chalk);
}
.chat-bubble-meta {
    display: block; font-size: 0.6875rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted);
    margin-bottom: 0.25rem;
}
.chat-bubble-text {
    margin: 0; font-size: 0.9375rem; line-height: 1.5; white-space: pre-wrap;
}
.chat-compose {
    display: flex; gap: 0.5rem; padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--color-border); background: var(--color-surface);
}
.chat-compose .input { flex: 1; min-width: 0; }

.note-editor-host { display: block; }
.note-editor-host .ql-toolbar {
    border: none !important; border-bottom: 1px solid var(--color-border) !important;
    background: var(--color-paper); font-family: var(--font-sans);
}
.note-editor-host .ql-container {
    height: auto !important;
    max-height: 10.5rem;
    font-size: 0.9375rem; font-family: var(--font-sans);
    border: none !important;
    overflow: hidden;
}
.note-editor-host .ql-editor {
    min-height: 6.5rem;
    max-height: 10.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.note-content h1, .note-content h2, .note-content h3 { font-weight: 600; margin: 0.5em 0 0.25em; }
.note-content p { margin: 0.4em 0; }
.note-content ul, .note-content ol { margin: 0.4em 0 0.4em 1.25em; }
.note-content blockquote {
    margin: 0.5em 0; padding-left: 0.875rem; border-left: 3px solid var(--color-border-strong);
    color: var(--color-muted);
}

/* Topic dashboard layout */
.topic-dashboard {
    display: grid; gap: 1.25rem; align-items: start;
}
@media (min-width: 900px) {
    .topic-dashboard {
        grid-template-columns: minmax(0, 1.4fr) minmax(18rem, 22rem);
    }
}
.topic-dashboard-main { min-width: 0; display: grid; gap: 1.25rem; }
.topic-dashboard-aside {
    display: grid; gap: 1.25rem; align-content: start;
}
@media (min-width: 900px) {
    .topic-dashboard-aside { position: sticky; top: var(--layout-gutter); }
}

/* Notes master–detail */
.notes-panel { overflow: hidden; }
.notes-panel-header {
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
}
.notes-panel-body {
    display: grid; min-height: 12rem;
}
@media (min-width: 768px) {
    .notes-panel-body { grid-template-columns: minmax(11rem, 16rem) minmax(0, 1fr); }
}
.notes-list {
    border-bottom: 1px solid var(--color-border);
    max-height: 22rem; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 768px) {
    .notes-list {
        border-bottom: none; border-right: 1px solid var(--color-border);
        max-height: 28rem;
    }
}
.note-list-item {
    display: block; width: 100%; text-align: left;
    padding: 0.875rem 1rem; border: none; border-bottom: 1px solid var(--color-border);
    background: var(--color-surface); cursor: pointer;
    font-family: var(--font-sans); transition: background 0.12s;
    min-height: var(--touch-min);
}
.note-list-item:last-child { border-bottom: none; }
.note-list-item:hover { background: var(--color-paper); }
.note-list-item.active {
    background: #eef4f8; box-shadow: inset 3px 0 0 var(--color-board);
}
.note-list-date { display: block; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); }
.note-list-preview {
    display: block; font-size: 0.875rem; color: var(--color-ink); margin-top: 0.25rem;
    line-height: 1.4; overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.note-list-meta { display: block; font-size: 0.75rem; color: var(--color-muted); margin-top: 0.375rem; }
.note-detail {
    padding: 1rem 1.25rem; overflow-y: auto; max-height: 28rem;
    -webkit-overflow-scrolling: touch;
}
.note-detail--empty {
    display: flex; align-items: center; justify-content: center;
    color: var(--color-muted); font-size: 0.875rem; text-align: center; padding: 2rem;
}
.note-detail-header {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 0.5rem; margin-bottom: 0.75rem; padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.8125rem; color: var(--color-muted);
}

/* Classroom overview grid */
.classroom-overview {
    display: grid; gap: 1.25rem;
}
@media (min-width: 900px) {
    .classroom-overview { grid-template-columns: minmax(0, 1.5fr) minmax(14rem, 20rem); }
}

/* Touch / tablet polish */
@media (pointer: coarse) {
    .btn { min-height: var(--touch-min); padding-top: 0.625rem; padding-bottom: 0.625rem; }
    .btn-sm { min-height: 2.5rem; }
    .wb-tool-btn { min-height: 2.5rem; min-width: 2.75rem; }
    .note-list-item { padding: 1rem 1.125rem; }
}
    border-left: 3px solid var(--color-wood); padding-left: 0.75rem; color: var(--color-muted);
}

/* Loading */
.loading-screen {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 4rem 1rem; color: var(--color-muted); gap: 1rem;
}
.spinner {
    width: 2rem; height: 2rem; border: 3px solid var(--color-border);
    border-top-color: var(--color-board); border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toolbar row */
.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1.25rem; }
.toolbar-grow { flex: 1; display: flex; gap: 0.5rem; min-width: 0; }

/* Section spacing */
.section { margin-bottom: 1.75rem; }
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.75rem;
}

.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.75rem; margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); padding: 1rem 1.125rem; text-align: center;
}
.stat-value {
    font-family: var(--font-serif); font-size: 1.75rem; font-weight: 600;
    color: var(--color-board); line-height: 1.1;
}
.stat-label { font-size: 0.75rem; color: var(--color-muted); margin-top: 0.25rem; }

.stats-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.stats-table th {
    text-align: left; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--color-muted); padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
}
.stats-table td {
    padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.stats-table tr:last-child td { border-bottom: none; }
.accuracy-bar {
    display: flex; align-items: center; gap: 0.5rem;
}
.accuracy-bar-track {
    flex: 1; height: 6px; background: var(--color-border); border-radius: 999px; overflow: hidden;
    min-width: 3rem;
}
.accuracy-bar-fill { height: 100%; background: var(--color-chalk); border-radius: 999px; }
.accuracy-bar-fill.low { background: #d97706; }
.accuracy-pct { font-size: 0.8125rem; font-weight: 600; min-width: 2.5rem; text-align: right; }

.live-badge {
    display: inline-flex; align-items: center; gap: 0.375rem;
    font-size: 0.75rem; font-weight: 600; color: var(--color-chalk);
    margin-bottom: 0.75rem;
}
.live-dot {
    width: 0.5rem; height: 0.5rem; border-radius: 50%;
    background: var(--color-chalk);
    box-shadow: 0 0 0 0 rgba(61, 122, 95, 0.5);
    animation: live-pulse 1.5s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(61, 122, 95, 0.45); }
    50% { box-shadow: 0 0 0 6px rgba(61, 122, 95, 0); }
}

.group-code {
    font-family: ui-monospace, monospace; font-size: 2rem; font-weight: 700;
    letter-spacing: 0.2em; color: var(--color-board); text-align: center;
    padding: 1rem; background: var(--color-paper); border-radius: var(--radius-md);
    border: 1px dashed var(--color-border-strong); margin: 1rem 0;
}
.participant-list { display: grid; gap: 0.5rem; }
.participant-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.625rem 0.75rem; background: var(--color-paper);
    border-radius: var(--radius-sm); font-size: 0.875rem;
}
.participant-row.answered { border-left: 3px solid var(--color-chalk); }
.participant-row.waiting { border-left: 3px solid var(--color-border-strong); }
.participant-row.result-row.correct { border-left-color: var(--color-chalk); }
.participant-row.result-row.partial { border-left-color: #fb923c; }
.participant-row.result-row.incorrect { border-left-color: var(--color-warn-text); }
.leaderboard-rank {
    width: 1.75rem; height: 1.75rem; border-radius: 50%;
    background: var(--color-board); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.leaderboard-rank.gold { background: #b8956a; }
.leaderboard-rank.silver { background: #94a3b8; }
.leaderboard-rank.bronze { background: #c4a882; }

.whiteboard-shell { max-width: var(--layout-max); margin: 0 auto; }
.whiteboard-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; margin-bottom: 0.75rem; flex-wrap: wrap;
}
.whiteboard-toolbar {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.wb-tool-btn {
    padding: 0.5rem 0.875rem; border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-strong); background: var(--color-surface);
    font-size: 0.8125rem; font-weight: 600; cursor: pointer;
}
.wb-tool-btn.active { border-color: var(--color-board); background: #eef4f8; color: var(--color-board); }
.wb-tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.wb-colors { display: flex; gap: 0.375rem; margin-left: 0.25rem; }
.wb-color-swatch {
    width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid transparent;
    cursor: pointer; padding: 0;
}
.wb-color-swatch.active { border-color: var(--color-ink); box-shadow: 0 0 0 2px var(--color-surface); }
.whiteboard-canvas-wrap { padding: 0; overflow: hidden; }
.whiteboard-canvas {
    display: block; width: 100%; touch-action: none; cursor: crosshair;
    background: #fffef9;
}

.collaborate-panel { border-color: var(--color-board); }
.collaborate-topic-name {
    font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600;
    color: var(--color-ink); margin: 0.375rem 0 0;
}
.collaborate-topic-meta { font-size: 0.875rem; color: var(--color-muted); margin: 0.125rem 0 0; }
.collaborate-topic-hint { font-size: 0.875rem; color: var(--color-muted); margin: 0.625rem 0 0; line-height: 1.45; }
.collaborate-live-banner {
    display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem;
    padding: 0.625rem 0.75rem; border-radius: var(--radius-sm);
    background: var(--color-chalk-light); color: #1e4d38; font-size: 0.875rem; font-weight: 500;
}
.quiz-context-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    flex-wrap: wrap; margin-bottom: 0.75rem; padding: 0.75rem 1rem !important;
}
.quiz-context-text { flex: 1; min-width: 0; }
.quiz-context-topic { font-weight: 600; margin: 0.125rem 0 0; font-size: 0.9375rem; }
.quiz-context-actions { display: flex; gap: 0.5rem; flex-shrink: 0; align-items: center; }
.quiz-wb-waiting { font-size: 0.8125rem; color: var(--color-muted); margin: 0; }

.quiz-with-whiteboard {
    display: grid; gap: 1.25rem; max-width: var(--layout-max); margin: 0 auto; align-items: start;
}
.quiz-with-whiteboard.has-whiteboard {
    grid-template-columns: minmax(0, 1fr) minmax(26rem, 46%);
}
.quiz-with-whiteboard.has-whiteboard.board-focus {
    grid-template-columns: 1fr;
}
.quiz-with-whiteboard.board-focus .whiteboard-pane { order: -1; }
.quiz-with-whiteboard.board-focus .quiz-pane {
    max-width: 42rem;
    width: 100%;
    justify-self: center;
}
.quiz-pane { min-width: 0; }
.whiteboard-pane {
    position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 0.75rem;
    border-color: var(--color-board);
    max-height: calc(100vh - 5rem);
    overflow: auto;
}
.whiteboard-pane-header {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    flex-wrap: wrap;
}
.whiteboard-pane-actions {
    display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center;
}
.whiteboard-toolbar-compact { margin-bottom: 0; }
.whiteboard-canvas-wrap-embedded {
    min-height: min(55vh, 32rem);
    flex: 1 1 auto;
}
.whiteboard-canvas-wrap-embedded .whiteboard-canvas {
    height: min(55vh, 32rem);
    min-height: 20rem;
}
.board-focus .whiteboard-canvas-wrap-embedded,
.board-focus .whiteboard-canvas-wrap-embedded .whiteboard-canvas {
    height: min(62vh, 38rem);
    min-height: 24rem;
}
.wb-attendees details { margin: 0; }
.wb-attendees summary {
    cursor: pointer; font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--color-muted); list-style: none;
}
.wb-attendees summary::-webkit-details-marker { display: none; }

.wb-attendees { margin: 0; }
.wb-attendees-sidebar { min-width: 12rem; }
.wb-attendee-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.375rem; }
.wb-attendee-row {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    font-size: 0.875rem; padding: 0.375rem 0;
}
.wb-attendee-empty { font-size: 0.8125rem; color: var(--color-muted); padding: 0.25rem 0; }

.whiteboard-layout-full {
    display: grid; grid-template-columns: minmax(0, 1fr) 14rem; gap: 1rem; align-items: start;
}
.whiteboard-main { min-width: 0; }

.badge-assistant { background: #ede9fe; color: #5b21b6; }

@media (max-width: 960px) {
    .quiz-with-whiteboard.has-whiteboard { grid-template-columns: 1fr; }
    .whiteboard-pane { position: static; }
    .whiteboard-layout-full { grid-template-columns: 1fr; }
}

.classroom-tabs {
    display: flex; gap: 0.25rem; margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border); padding-bottom: 0;
}
.classroom-tab {
    font-family: var(--font-sans); font-size: 0.875rem; font-weight: 600;
    padding: 0.5rem 1rem; border: none; background: none; cursor: pointer;
    color: var(--color-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.classroom-tab:hover { color: var(--color-ink); }
.classroom-tab.active { color: var(--color-board); border-bottom-color: var(--color-board); }

.auth-hero h2 {
    font-family: var(--font-serif); font-size: 1.5rem; font-weight: 600;
    color: var(--color-ink); margin-bottom: 0.375rem;
}
.auth-hero p { font-size: 0.9375rem; color: var(--color-muted); }

/* Marketing homepage */
.home-hero {
    text-align: center;
    padding: 2.5rem 1rem 2rem;
    margin-bottom: 2rem;
}
.home-hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 700;
    color: var(--color-board);
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
}
.home-hero-lead {
    font-size: 1.0625rem;
    color: var(--color-muted);
    max-width: 36rem;
    margin: 0 auto 1.5rem;
    line-height: 1.55;
}
.home-cta-row {
    display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center;
}
.home-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.home-feature-card { padding: 1.25rem; }
.home-feature-card h3 {
    font-size: 1rem; font-weight: 600; margin: 0.5rem 0 0.375rem; color: var(--color-ink);
}
.home-feature-card p {
    font-size: 0.875rem; color: var(--color-muted); margin: 0; line-height: 1.45;
}
.home-feature-icon { font-size: 1.5rem; }
.home-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.home-step {
    font-size: 0.875rem; color: var(--color-muted); line-height: 1.45;
}
.home-step strong { color: var(--color-ink); display: block; margin-bottom: 0.25rem; }

@media (min-width: 1100px) {
    .quiz-with-whiteboard.has-whiteboard:not(.board-focus) {
        grid-template-columns: minmax(0, 0.95fr) minmax(30rem, 1.05fr);
    }
}

/* Note week groups */
.note-week-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    width: 100%; padding: 0.625rem 1rem; border: none; border-bottom: 1px solid var(--color-border);
    background: var(--color-paper); font-family: var(--font-sans); font-size: 0.75rem;
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--color-muted); cursor: pointer; text-align: left;
    min-height: var(--touch-min);
}
.note-week-toggle:hover { background: #eef4f8; color: var(--color-board); }
.note-week-meta { font-weight: 600; text-transform: none; letter-spacing: 0; }

.note-swipe-hint {
    font-size: 0.75rem; color: var(--color-muted); margin: 0 0 0.75rem;
}

/* Topic mobile tab bar */
.app-shell--with-tabs { padding-bottom: 5.5rem; }
.topic-tab-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
    background: var(--color-surface); border-top: 1px solid var(--color-border);
    box-shadow: 0 -4px 20px rgba(44, 51, 51, 0.08);
    padding: 0.375rem var(--layout-gutter) calc(0.5rem + env(safe-area-inset-bottom, 0));
}
.topic-tab {
    font-family: var(--font-sans); font-size: 0.8125rem; font-weight: 600;
    padding: 0.625rem 0.5rem; border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--color-muted); cursor: pointer;
    min-height: var(--touch-min);
}
.topic-tab.active { color: var(--color-board); background: #eef4f8; }

/* Theme switcher */
.theme-select-wrap { display: inline-flex; }
.theme-select {
    font-family: var(--font-sans); font-size: 0.75rem; font-weight: 600;
    padding: 0.35rem 0.5rem; border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-strong); background: var(--color-surface);
    color: var(--color-muted); cursor: pointer;
}
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Dark theme */
[data-theme="dark"] {
    --color-paper: #12181d;
    --color-surface: #1a2229;
    --color-ink: #e8edf2;
    --color-muted: #94a3b8;
    --color-border: #2a3440;
    --color-border-strong: #3d4a57;
    --color-board: #5b9fd4;
    --color-board-hover: #7ab3de;
    --color-chalk-light: #1a2e24;
    --color-wood-light: #2a2418;
    --color-error-bg: #3b1515;
    --color-error-text: #fecaca;
    --color-success-bg: #142820;
    --color-success-text: #a7f3d0;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] body {
    background-image: linear-gradient(180deg, rgba(91, 159, 212, 0.06) 0%, transparent 120px);
}
[data-theme="dark"] .whiteboard-canvas,
[data-theme="dark"] .note-editor-host .ql-editor { background: #0f1419; color: #e8edf2; }
[data-theme="dark"] .option-btn.selected { background: #1e3a4f; }

/* High-contrast projector theme */
[data-theme="contrast"] {
    --color-paper: #000000;
    --color-surface: #0a0a0a;
    --color-ink: #ffffff;
    --color-muted: #d4d4d4;
    --color-border: #ffffff;
    --color-border-strong: #ffffff;
    --color-board: #ffff00;
    --color-board-hover: #ffff66;
    --color-chalk: #00ff66;
    --color-chalk-light: #003318;
    --color-wood-light: #332200;
    --shadow-card: none;
}
[data-theme="contrast"] body { background-image: none; }
[data-theme="contrast"] .card,
[data-theme="contrast"] .btn-secondary,
[data-theme="contrast"] .input,
[data-theme="contrast"] .note-editor-wrap {
    border-width: 2px;
}
[data-theme="contrast"] .btn-primary {
    background: #ffff00; color: #000; border: 2px solid #fff;
}
[data-theme="contrast"] .page-title,
[data-theme="contrast"] .card-section-title { color: #ffff00; }
[data-theme="contrast"] .whiteboard-canvas,
[data-theme="contrast"] .note-editor-host .ql-editor {
    background: #000; color: #fff;
}
