:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f4f6f9;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 52px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.brand-wrap { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-logo { width: clamp(180px, 23vw, 255px); height: auto; display: block; object-fit: contain; }
.brand-divider { width: 1px; height: 50px; background: #d9dee8; flex: 0 0 auto; }
.product-name { font-size: clamp(22px, 3vw, 34px); font-weight: 760; letter-spacing: -.025em; white-space: nowrap; color: #172033; }
h1 { font-size: clamp(25px, 4vw, 38px); margin: 3px 0 0; letter-spacing: -.03em; }
h2 { margin: 4px 0 12px; font-size: 20px; }
.card { background: #fff; border: 1px solid #e1e6ef; border-radius: 20px; padding: 24px; box-shadow: 0 8px 30px rgba(25, 35, 55, .05); }
.pair-card { max-width: 650px; margin: 65px auto 0; text-align: center; }
.pair-mark { width: 92px; height: 92px; object-fit: contain; margin-bottom: 16px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .11em; color: #6a7180; margin-bottom: 8px; text-transform: none; }
.muted { color: #6b7484; }
.hidden { display: none !important; }
.badge { padding: 8px 12px; border-radius: 999px; background: #eaf8ef; color: #17653a; font-size: 13px; font-weight: 700; white-space: nowrap; }
.pair-form { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }
.pair-form input { width: 220px; text-align: center; letter-spacing: .30em; font-size: 24px; font-weight: 750; text-transform: uppercase; }
input, select, textarea { width: 100%; border: 1px solid #cfd6e2; border-radius: 12px; padding: 12px 14px; background: #fff; color: #172033; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #7259e5; box-shadow: 0 0 0 3px rgba(114, 89, 229, .12); }
label { display: block; font-size: 13px; font-weight: 700; margin: 2px 0 7px; }
button { border: 0; border-radius: 12px; padding: 12px 17px; background: #5d45d6; color: #fff; font-weight: 750; }
button:hover { filter: brightness(.97); }
button:disabled { opacity: .35; cursor: not-allowed; }
button.secondary { background: #edf0f6; color: #283247; }
button.compact { padding: 9px 12px; }
button.text-button { background: transparent; color: #5d45d6; padding: 4px 0; font-size: 12px; }
.secondary-link { display: inline-flex; align-items: center; padding: 9px 12px; border-radius: 10px; background: #edf0f6; text-decoration: none; color: #283247; font-size: 13px; font-weight: 700; }
.description-wrap { margin-top: 18px; }
.lesson-description { line-height: 1.58; max-height: 7.3em; overflow: hidden; position: relative; }
.lesson-description.expanded { max-height: none; overflow: visible; }
.lesson-description p { margin: 0 0 10px; }
.lesson-description strong { color: #303a50; }
.project-tools { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; padding-top: 17px; border-top: 1px solid #edf0f4; }

.components-inline { margin: 18px 0 20px; }
.components-inline h3 { margin: 0 0 10px; font-size: 15px; color: #303a50; }
.components-table-wrap { width: 100%; overflow-x: auto; border: 1px solid #e1e6ef; border-radius: 12px; background: #fff; }
.components-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.components-table th, .components-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #edf0f4; vertical-align: top; }
.components-table th { background: #f7f8fb; color: #4b5568; font-size: 12px; font-weight: 800; }
.components-table th:last-child, .components-table td:last-child { width: 135px; white-space: nowrap; }
.components-table tbody tr:last-child td { border-bottom: 0; }
.materials-stack { display: grid; gap: 18px; margin-top: 18px; }
.material-card { overflow: hidden; }
.pdf-shell { width: 100%; height: clamp(680px, 82vh, 1000px); border: 1px solid #e3e7ee; border-radius: 14px; overflow: hidden; background: #eef1f5; }
.pdf-shell iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.video-shell { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px; background: #111; }
.video-shell iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
textarea { resize: vertical; line-height: 1.5; }
form > button { margin-top: 10px; }
#debugCard { margin-top: 18px; }
#debugForm { display: grid; gap: 9px; }
#debugForm button { justify-self: start; }
.answer { margin-top: 17px; min-height: 72px; border-radius: 14px; background: #f7f8fb; padding: 15px; line-height: 1.55; }
.answer p { margin: 0 0 9px; }
.answer ul { margin: 6px 0 8px 20px; padding: 0; }
.answer code { font-family: "SFMono-Regular", Consolas, monospace; background: #eceef4; border-radius: 5px; padding: 1px 4px; }
.codebox, .resource-text { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 13px; }
#resourceCard { margin-top: 18px; }
.resource-head, .footer-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.resource-text { overflow: auto; max-height: 560px; background: #101522; color: #e8edf6; border-radius: 14px; padding: 17px; white-space: pre-wrap; }
.footer-actions { margin-top: 15px; padding: 10px 4px; font-size: 13px; flex-wrap: wrap; }
.link-button { padding: 7px 0; background: transparent; color: #a32424; }
.error { margin-top: 13px; color: #a32424; font-weight: 650; }
.loading { opacity: .62; pointer-events: none; }
.pdf-fallback { margin: 10px 2px 0; font-size: 12px; }

/* Course-first landing view */
.course-picker { padding: 6px 0 2px; }
.course-picker-head { margin-bottom: 18px; padding: 0 3px; }
.course-picker-head h2 { font-size: 27px; margin-bottom: 7px; }
.course-picker-head p { margin: 0; }
.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.course-tile { padding: 0; overflow: hidden; text-align: left; background: #fff; color: #172033; border: 1px solid #e1e6ef; border-radius: 18px; box-shadow: 0 7px 24px rgba(25, 35, 55, .05); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.course-tile:hover { transform: translateY(-2px); border-color: #cfd5e2; box-shadow: 0 12px 30px rgba(25, 35, 55, .09); filter: none; }
.course-thumb-wrap { display: block; width: 100%; aspect-ratio: 16 / 9; background: #eef1f5; overflow: hidden; }
.course-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.course-tile-copy { display: flex; flex-direction: column; gap: 5px; padding: 15px 16px 17px; }
.course-tile-copy strong { font-size: 16px; line-height: 1.3; }
.course-tile-copy span { color: #727b8a; font-size: 12px; font-weight: 650; }
.empty-state { grid-column: 1 / -1; text-align: center; }

.course-context { display: flex; align-items: center; gap: 18px; padding: 14px 18px; margin-bottom: 18px; }
.back-button { background: #edf0f6; color: #283247; flex: 0 0 auto; padding: 10px 13px; }
.course-context-main { display: flex; align-items: center; gap: 13px; min-width: 0; }
.selected-course-thumb { width: 64px; height: 48px; border-radius: 9px; object-fit: cover; background: #eef1f5; border: 1px solid #e3e7ee; }
.course-context-title { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-context-main .eyebrow { margin-bottom: 3px; }
.lesson-selector { width: 100%; }
.workspace-top { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr); gap: 18px; align-items: start; }
.workspace-top.theory-mode { grid-template-columns: minmax(0, 1fr); }
.ask-card { position: sticky; top: 18px; }
#askForm { display: grid; gap: 9px; }
#askForm button { justify-self: start; }

@media (max-width: 900px) {
  .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-top { grid-template-columns: 1fr; }
  .ask-card { position: static; }
}
@media (max-width: 650px) {
  .shell { width: min(100% - 22px, 1180px); padding-top: 20px; }
  .topbar { align-items: flex-start; }
  .brand-wrap { gap: 10px; }
  .brand-logo { width: 155px; }
  .brand-divider { height: 42px; }
  .product-name { font-size: 20px; }
  .badge { font-size: 11px; padding: 7px 9px; }
  .course-grid { grid-template-columns: 1fr; gap: 14px; }
  .course-context { align-items: flex-start; flex-wrap: wrap; }
  .course-context-main { width: 100%; }
  .pair-form { flex-direction: column; }
  .pair-form input { width: 100%; }
  .pdf-shell { min-height: 520px; height: 72vh; }
}
