/* Unified readable type scale for the published application. */
:root {
  --font-heading: "Prata", Georgia, "Times New Roman", serif;
  --font-body: "Onest", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --text-xs: 13.5px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: clamp(21px, 1.65vw, 26px);
  --text-2xl: clamp(29px, 2.45vw, 38px);
  --line-tight: 1.18;
  --line-heading: 1.25;
  --line-body: 1.6;
  --line-relaxed: 1.7;
  --serif: var(--font-heading);
  --sans: var(--font-body);
  --text-secondary: #c1c0bb;
  --text-muted: #969a9d;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { line-height: var(--line-body); }
p, li, dd, td, th, label, blockquote, .message-text { overflow-wrap: anywhere; word-break: normal; hyphens: auto; }
h1, h2, h3, h4, .card-title { line-height: var(--line-heading); text-wrap: balance; overflow-wrap: normal; }
.page, .card, .rich-tab-panel, .training-lesson, .message > div, .level-main, .profile-meta { min-width: 0; }
.card p, .card li, .card dd { font-size: 13px; line-height: var(--line-body); }
.card small { font-size: 13px; line-height: 1.45; }
.secondary, .muted { color: var(--text-secondary); }
.muted { font-size: max(12px, 1em); line-height: 1.4; }
span.muted { font-size: max(12px, 1em) !important; }
small { font-size: 13.5px; line-height: 1.45; }

/* Global hierarchy and controls. */
.page-title h1 { font-size: var(--text-2xl); line-height: var(--line-tight); }
.page-title p, .page-subtitle { max-width: 78ch; font-size: var(--text-base); line-height: 1.55; }
.card-title { font-size: 24px; overflow-wrap: anywhere; }
.card-subtitle { font-size: 15px; line-height: 1.55; }
.eyebrow { font-size: var(--text-sm); line-height: 1.4; }
.breadcrumbs { font-size: 13px; line-height: 1.45; }
.btn { min-height: 36px; height: auto; padding: 8px 14px; font-size: 13px; line-height: 1.3; white-space: normal; text-align: center; }
.btn-sm { min-height: 32px; height: auto; font-size: var(--text-sm) !important; }
.link-gold, .link-button { min-height: 36px; font-size: var(--text-sm); line-height: 1.35; }
.chip, .status-pill, .type-badge, .file-size { font-size: var(--text-xs); line-height: 1.35; }
.type-badge { letter-spacing: .055em; }
.form-hint, .field-error { font-size: var(--text-sm) !important; line-height: 1.55; }
input, textarea, select, .search-input, .select-control { font-size: var(--text-base); line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #9a9ea1; opacity: 1; }
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table th, .data-table td { height: auto; min-height: 44px; padding: 11px 13px; font-size: var(--text-sm); line-height: 1.45; white-space: normal; }
.data-table th { color: #b4b6b5; font-weight: 600; }

/* Navigation, account and news panel. */
.nav-label { font-size: 14px; line-height: 1.35; }
.profile-meta strong { font-size: 13px; line-height: 1.2; }
.profile-meta span { font-size: 12px; line-height: 1.2; }
.profile-header-card { max-width: 260px; white-space: normal; }
.profile-header-card .profile-meta strong, .profile-header-card .profile-meta span { white-space: normal; overflow-wrap: anywhere; }
.premium-card p { font-size: var(--text-sm); line-height: 1.6; }
.sidebar-news-category, .sidebar-news-badge { font-size: var(--text-xs); }
.sidebar-news p { font-size: var(--text-sm); line-height: 1.55; }
.sidebar-news-action { min-height: 44px; font-size: var(--text-sm); }

/* Dashboard and level lists. */
.route-copy h2 { font-size: 32px; line-height: var(--line-tight); }
.dashboard-top .progress-note, .progress-note, .legend { font-size: var(--text-sm); line-height: 1.55; }
.progress-meta { font-size: 15px; }
.level-mini { min-height: 162px; padding: 10px; }
.level-mini h4 { min-height: 44px; font-size: var(--text-md); line-height: 1.2; }
.level-mini .status-text { font-size: 13px; line-height: 1.4; }
.level-mini .mini-action { min-height: 44px; height: auto; padding: 9px 10px; font-size: var(--text-sm); line-height: 1.25; }
.diagnosis-block, .dossier-card p { font-size: 15px; line-height: var(--line-body); }
.artifact-small { min-height: 64px; padding: 10px; }
.artifact-small strong { font-size: var(--text-sm); line-height: 1.35; }
.artifact-small span { font-size: var(--text-xs); line-height: 1.4; }
.metric-label { font-size: var(--text-sm); }
.metric-change { font-size: 13px; }
.level-main h3 { font-size: var(--text-lg); line-height: 1.2; }
.row-status, .row-time, .row-artifact { font-size: var(--text-sm); line-height: 1.45; }
.row-artifact span, .level-meta-block span { font-size: 13px; line-height: 1.4; }
.level-meta-block strong { font-size: 15px; line-height: 1.4; }
.current-level-card p { font-size: 15px; line-height: var(--line-body); }

/* Level headings, tabs and teaching content. */
.level-hero h1 { font-size: clamp(34px, 3vw, 44px); line-height: var(--line-tight); }
.level-hero p { max-width: 75ch; font-size: var(--text-base); line-height: 1.6; }
.content-stepper .step, .stepper .step { min-height: 72px; height: auto; padding: 10px 8px; font-size: var(--text-sm); line-height: 1.35; }
.step .step-num, .content-stepper .step-num { font-size: var(--text-base); }
.source-section-label, .field-section { font-size: var(--text-xs); line-height: 1.4; letter-spacing: .08em; }
.source-scene-card h2, .lesson-overview h2, .rich-practice-card h2, .materials-intro h2, .ai-level-card h2, .artifact-builder h2, .case-card h2, .quiz-card h2, .simulation-card h2 { font-size: clamp(25px, 2vw, 31px); line-height: 1.2; }
.lead-copy { max-width: 75ch; font-size: var(--text-base); line-height: var(--line-relaxed); }
.scene-visual-note { max-width: 75ch; font-size: var(--text-sm); line-height: 1.55; }
.formula-box span { font-size: var(--text-xs); }
.formula-box p, .text-card p, .text-card li, .lesson-extra ul, .lesson-overview p { max-width: 75ch; font-size: var(--text-base); line-height: var(--line-relaxed); }
.text-card h3 { font-size: 23px; line-height: 1.25; }
.lesson-extra > strong { font-size: var(--text-sm); }
.training-lesson p, .training-lesson li, .training-lesson td, .training-lesson th { max-width: 75ch; font-size: var(--text-md); line-height: var(--line-relaxed); }
.training-lesson h3 { font-size: 26px; line-height: 1.3; }
.training-lesson h4 { font-size: 19px; }
.training-lesson .training-flow li, .training-lesson .quiz-option, .training-sim-option, .training-question legend, .training-feedback { font-size: var(--text-base); line-height: 1.65; }
.training-flow li::before { font-size: 13px; }
.quiz-question legend { font-size: var(--text-base); line-height: 1.55; }
.quiz-option { min-height: 48px; padding: 11px 13px; font-size: 15px; line-height: 1.5; }
.quiz-feedback, .simulation-option p, .simulation-explanation { font-size: 15px; line-height: 1.6; }
.simulation-option h3 { font-size: var(--text-lg); }

/* Practice, media and analysis. */
.rich-field { padding: 16px; }
.rich-field label { font-size: 15px; line-height: 1.5; }
.rich-field textarea, .rich-field input, .rich-field select { min-height: 46px; font-size: var(--text-base); line-height: 1.5; }
.check-choice { min-height: 44px; font-size: var(--text-sm); line-height: 1.5; }
.dynamic-mentor .mentor-stats { font-size: var(--text-xs); line-height: 1.4; }
.media-card-rich > p { font-size: 15px; line-height: 1.6; }
.media-card-rich h3 { font-size: 22px; line-height: 1.25; }
.source-text-preview pre, .document-reader { font-size: var(--text-sm); line-height: 1.65; }
.answer-summary dt { font-size: var(--text-sm); line-height: 1.45; }
.answer-summary dd { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.empty-analysis p, .saved-analysis p, .analysis-recommendations ul, .recommendation-list { font-size: var(--text-base); line-height: 1.65; }
.filter-chip { min-height: 44px; height: auto; padding: 9px 12px; font-size: var(--text-sm); }
.media-load-error { font-size: var(--text-sm); line-height: 1.55; }

/* Mentor rail and AI workspace. */
.mentor-card h2 { font-size: 24px; line-height: 1.2; }
.mentor-section h3 { font-size: 19px; line-height: 1.3; }
.mentor-section p, .mentor-section li { font-size: var(--text-sm) !important; line-height: 1.65; }
.tabs { min-height: 48px; height: auto; overflow-x: auto; }
.tab { min-height: 48px; height: auto; font-size: 15px; white-space: nowrap; }
.message-head strong { font-size: var(--text-sm); }
.message-head span { font-size: var(--text-xs); }
.message-text { max-width: 75ch; font-size: var(--text-base); line-height: 1.65; }
.message-text h4 { font-size: 19px; line-height: 1.35; }
.ai-action-card h4 { font-size: 18px; }
.ai-action-card p { min-height: 0; font-size: var(--text-sm); line-height: 1.55; }
.quick-prompts button { min-height: 44px; height: auto; padding: 9px 14px; font-size: var(--text-sm); line-height: 1.35; }
.composer textarea, #ai-input { min-height: 84px; height: auto; font-size: var(--text-base); line-height: 1.55; }
.composer-tools { font-size: var(--text-xs); line-height: 1.4; }
.role-row { min-height: 64px; height: auto; grid-template-columns: 34px minmax(0,1fr) auto; padding: 9px 10px; }
.role-row strong { font-size: var(--text-sm); line-height: 1.35; }
.role-row small, .role-row > span:last-child { font-size: 13px; line-height: 1.4; }

/* Settings, authentication, onboarding, modals and notifications. */
.setting-row { min-height: 54px; font-size: var(--text-sm); line-height: 1.45; }
.setting-label { font-size: var(--text-sm); }
.setting-value { font-size: 15px; overflow-wrap: anywhere; }
.select-row { min-height: 52px; font-size: var(--text-sm); line-height: 1.45; }
.plan-list div, .security-row { font-size: var(--text-sm); line-height: 1.5; }
.integration { min-height: 96px; height: auto; font-size: var(--text-sm) !important; line-height: 1.4; }
.integration span { font-size: var(--text-xs); }
.settings-layout .secondary, .settings-layout .integrations-link { font-size: var(--text-sm) !important; }
.artifact-all-link { font-size: var(--text-sm) !important; }
.dossier-updated { font-size: var(--text-xs) !important; }
.composer-tools button { min-height: 44px; font-size: var(--text-sm); line-height: 1.35; }
.auth-brand span { font-size: var(--text-xs); line-height: 1.4; }
.auth-form label, .onboarding-form .field label, .form-grid label { font-size: var(--text-sm); line-height: 1.45; }
.auth-form input, .onboarding-form input, .onboarding-form textarea, .form-grid input, .form-grid textarea, .form-grid select { font-size: var(--text-base); line-height: 1.5; }
.modal h2 { font-size: 28px; line-height: 1.25; }
.modal p, .notification-list span { font-size: 15px; line-height: 1.6; }
.toast { max-width: min(420px, calc(100vw - 24px)); font-size: var(--text-sm); line-height: 1.5; }

@media (max-width: 1200px) {
  .levels-layout { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .page-title h1 { font-size: clamp(30px, 7vw, 38px); }
  .page-title p, .page-subtitle { font-size: var(--text-base); }
  .rich-level-layout, .level-page-layout { grid-template-columns: 1fr; }
  .mentor-card { position: relative; top: auto; min-height: 0; }
  .levels-layout .side-stack { grid-template-columns: 1fr; }
  .ai-actions { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .main { padding: 14px; }
  .card { padding: 18px 16px; }
  .page-title h1, .level-hero h1 { font-size: clamp(28px, 9vw, 35px); }
  .source-scene-card h2, .lesson-overview h2, .rich-practice-card h2, .materials-intro h2, .ai-level-card h2, .artifact-builder h2, .case-card h2, .quiz-card h2, .simulation-card h2 { font-size: clamp(23px, 7vw, 28px); }
  .card p, .card li, .card dd { font-size: var(--text-base); }
  .nav-label { font-size: var(--text-base); }
  .btn, .btn-sm { min-height: 44px; font-size: 15px; }
  .source-section-label, .field-section, .type-badge, .file-size, .status-pill { font-size: 13px; }
  .training-lesson p, .training-lesson li, .training-lesson td, .training-lesson th, .text-card p, .text-card li, .lesson-extra ul, .lead-copy { font-size: var(--text-base); line-height: 1.68; }
  .training-lesson h3, .text-card h3 { font-size: 22px; }
  .content-stepper .step, .stepper .step { min-width: 140px; font-size: var(--text-sm); }
  .rich-practice-grid, .lesson-blocks, .profile-concepts, .level-media-grid, .media-library-grid, .simulation-options, .quiz-options { grid-template-columns: 1fr; }
  .rich-field label { font-size: 15px; }
  .mentor-section p, .mentor-section li { font-size: 15px; }
  .settings-layout, .settings-pair, .settings-right, .integration-grid { grid-template-columns: 1fr; }
  .setting-row { grid-template-columns: 1fr; gap: 7px; padding: 10px 0; }
  .setting-value { grid-column: auto; }
  .data-table { min-width: 680px; }
  .data-table th, .data-table td { font-size: var(--text-sm); }
  .modal { padding: 20px 17px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 150px; }
}

@media (max-width: 360px) {
  .main { padding: 12px; }
  .card { padding: 16px 14px; }
  .page-title h1, .level-hero h1 { font-size: 28px; }
  .header-actions, .profile-header-group { width: 100%; flex-wrap: wrap; }
  .profile-header-card { max-width: none; flex: 1 1 180px; }
  .materials-toolbar, .prologue-strip { gap: 14px; }
}
