/* The course. Same look and format as the level check (mint canvas on the left, paper panel on the right, chunky tiles),
   with a path of modules in place of the map. Builds on the tokens and shared classes in index.html. */
#course { position: fixed; inset: 0; z-index: 40; overflow: hidden; background: radial-gradient(ellipse 70% 60% at 40% 48%, #E8F5F4 0%, var(--sea) 55%, var(--sea-2) 100%); color: var(--ink); font-family: var(--body); --c-done: #4F8468; --c-bad: #9A5A1A; --c-panel: 440px; }
#course h1, #course h2, #course h3 { margin: 0; font-family: var(--display); font-weight: 400; line-height: 1.08; text-wrap: balance; }
.c-screen { position: absolute; inset: 0; overflow-y: auto; }
.c-screen.wide { --c-panel: min(640px, 56vw); }
.c-screen.wide .c-panel { animation: none; }
.c-mid { min-height: 100%; display: grid; place-items: center; padding: 92px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
#course .purpose-wrap h2 { font-size: clamp(34px, 4.6vw, 56px); }
.c-mid .sub { max-width: 560px; }
.c-own { width: 100%; display: grid; gap: 10px; }
.c-think { display: grid; gap: 14px; justify-items: center; color: var(--ink-2); font-weight: 600; text-align: center; width: min(520px, 100%); }
.c-think .bar { width: 100%; height: 6px; border-radius: 3px; background: rgba(255,255,255,.7); overflow: hidden; }
.c-think .bar::after { content: ""; display: block; width: 40%; height: 100%; background: var(--glow); border-radius: 3px; animation: slide 1.2s ease-in-out infinite; }

/* top bar, as in the level check */
.c-top { position: fixed; inset: 0 0 auto 0; z-index: 30; height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding-top: env(safe-area-inset-top, 0px); padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); pointer-events: none; }
.c-top > * { pointer-events: auto; }
.c-top .logo { border: 0; background: none; padding: 0; }
.c-top .bar-center { grid-column: 2; }
.c-top .bar-right { grid-column: 3; justify-self: end; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.c-count { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; color: var(--amber-ink); background: rgba(255,255,255,.75); padding: 7px 12px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.c-count i { width: 15px; height: 15px; background: var(--glow); clip-path: polygon(50% 0, 63% 35%, 100% 38%, 71% 60%, 82% 96%, 50% 76%, 18% 96%, 29% 60%, 0 38%, 37% 35%); }

/* canvas left, paper panel right */
.c-canvas { position: absolute; inset: 0 var(--c-panel) 0 0; overflow-y: auto; padding: 88px max(16px, env(safe-area-inset-left, 0px)) 56px; }
.c-panel { position: absolute; top: 0; right: 0; bottom: 0; width: var(--c-panel); background: var(--paper); box-shadow: -10px 0 40px rgba(33,73,133,.12); display: flex; flex-direction: column; z-index: 20; animation: c-slide .45s cubic-bezier(.3,.7,.2,1); }
@keyframes c-slide { from { transform: translateX(40px); opacity: 0; } }
.c-panel-in { flex: 1; overflow-y: auto; padding: 92px 30px calc(28px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.c-panel-in h2 { font-size: 36px; }
.c-panel-in p { margin: 0; }
.c-meta { color: var(--ink-3); font-weight: 600; }
.c-block { display: grid; gap: 8px; }
.c-block p { color: var(--ink-2); line-height: 1.45; }
.c-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 14px; margin: 0; font-size: 14px; }
.c-kv dt { color: var(--ink-3); font-weight: 600; }
.c-kv dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.c-amber { background: #FFF4DA; border-radius: 16px; padding: 14px 16px; display: grid; gap: 8px; font-size: 14px; line-height: 1.45; }
.c-amber b { font-size: 15px; }
.c-amber ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.c-amber .row, .c-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.c-input { width: 100%; border: 0; outline: 0; font: inherit; font-size: 15px; padding: 11px 13px; border-radius: 12px; background: #fff; color: var(--ink); box-shadow: 0 0 0 1.5px var(--line); }
.c-input:focus { box-shadow: 0 0 0 2.5px var(--navy-2); }
textarea.c-input { min-height: 78px; resize: vertical; line-height: 1.45; }
.c-field { display: grid; gap: 6px; font-weight: 700; font-size: 13px; color: var(--ink-2); min-width: 0; }
.c-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.c-pick { border: 0; padding: 10px 14px; border-radius: 13px; background: #fff; font-weight: 700; font-size: 14px; box-shadow: 0 0 0 1.5px var(--line), 0 3px 0 rgba(33,73,133,.08); color: var(--ink); }
/* Hover only where there is a pointer that hovers: on a phone a tapped button would keep it. Taps show with :active. */
@media (hover: hover) and (pointer: fine) { .c-pick:hover { box-shadow: 0 0 0 2px var(--navy-2), 0 3px 0 rgba(33,73,133,.08); } }
.c-pick, .c-stop, #course .opt, #course .hs-chip { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.c-pick:active { box-shadow: 0 0 0 2px var(--navy-2), 0 1px 0 rgba(33,73,133,.08); transform: translateY(2px); }
#course .btn-primary.small { font-size: 16px; padding: 10px 20px; }
#course .btn-primary.full { width: 100%; font-size: 18px; }

/* the path */
.c-path-head { width: min(620px, 100%); margin: 0 auto 8px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.c-path-head h1 { font-size: clamp(30px, 3.6vw, 46px); text-shadow: 0 2px 18px rgba(255,255,255,.9); }
.c-path-head p { margin: 0; color: var(--ink-2); font-weight: 600; background: rgba(255,255,255,.6); padding: 4px 12px; border-radius: 999px; }
.c-path { position: relative; width: 100%; max-width: 640px; margin: 0 auto; }
.c-path svg.trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.c-stop { position: absolute; width: 220px; margin-left: -110px; display: grid; justify-items: center; gap: 5px; border: 0; background: none; padding: 0; color: var(--ink); text-align: center; }
.c-node { width: 76px; height: 72px; border-radius: 48% 52% 50% 50% / 52% 50% 50% 48%; display: grid; place-items: center; box-shadow: inset 0 -5px 0 rgba(0,0,0,.08), 0 5px 0 rgba(33,73,133,.14), 0 12px 22px rgba(33,73,133,.12); transition: transform .14s; background: #EDF3F5; color: #8A938F; position: relative; }
@media (hover: hover) and (pointer: fine) { .c-stop:hover .c-node { transform: translateY(-3px); } }
.c-stop:active .c-node { transform: translateY(2px); }
.c-node svg { width: 28px; height: 28px; }
.c-stop.done .c-node { background: var(--sage); color: #3D6B53; }
.c-stop.skip .c-node { background: #E2EBCF; color: #5C6F3A; }
.c-stop.ready .c-node { background: var(--blue); color: var(--navy); }
.c-stop.now .c-node { background: var(--amber); color: var(--amber-ink); box-shadow: inset 0 -5px 0 rgba(0,0,0,.08), 0 5px 0 rgba(138,90,18,.25), 0 0 0 7px rgba(243,177,63,.28), 0 0 36px rgba(243,177,63,.65); }
.c-lab { font-weight: 700; font-size: 15px; line-height: 1.2; text-shadow: 0 0 6px #F3F9F9, 0 0 6px #F3F9F9; }
.c-tag { font-weight: 800; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--amber-ink); text-shadow: 0 0 6px #F3F9F9, 0 0 6px #F3F9F9; }
.c-stop:not(.now):not(.done):not(.ready):not(.skip) .c-lab { color: var(--ink-2); }
.c-flag { position: absolute; top: -14px; left: 50%; transform: translate(-50%, -100%); background: var(--navy); color: #fff; font-weight: 800; font-size: 12px; padding: 5px 11px; border-radius: 8px; white-space: nowrap; }
.c-flag::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 9px; height: 9px; margin-left: -4px; background: var(--navy); transform: rotate(45deg); }

/* module canvas */
.c-mod-left { min-height: 100%; display: grid; place-content: center; justify-items: center; gap: 18px; text-align: center; padding-bottom: 40px; }
.c-mod-left h1 { font-size: clamp(34px, 3.8vw, 54px); text-shadow: 0 2px 18px rgba(255,255,255,.9); max-width: 460px; }
.c-mod-left .c-node { width: 96px; height: 90px; }
.c-mod-left .c-node svg { width: 38px; height: 38px; }
.c-cpbar { display: flex; gap: 8px; }
.c-cpbar i { width: 24px; height: 24px; background: rgba(138,90,18,.22); clip-path: polygon(50% 0, 63% 35%, 100% 38%, 71% 60%, 82% 96%, 50% 76%, 18% 96%, 29% 60%, 0 38%, 37% 35%); }
.c-cpbar i.on { background: var(--glow); }
.c-cpbar i.miss { background: #A9A296; }
.c-mod-left small { font-weight: 600; color: var(--ink-2); background: rgba(255,255,255,.6); padding: 3px 10px; border-radius: 999px; }

/* reading steps: a plain page on the paper panel */
.c-read { font-size: 17px; line-height: 1.6; gap: 16px; }
#course .c-read h2 { font-family: var(--body); font-weight: 800; font-size: 25px; line-height: 1.2; }
.c-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.c-ex { background: #F2F6F9; border-radius: 12px; padding: 12px 14px; color: var(--ink-2); font-size: 16px; overflow-wrap: anywhere; }
.c-tbl-wrap { overflow-x: auto; }
.c-tbl { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.c-tbl th, .c-tbl td { text-align: left; vertical-align: top; padding: 9px 11px; border: 1px solid var(--line); }
.c-tbl th { background: #EEF3F8; font-size: 13px; }
.c-saved { color: var(--c-done); font-weight: 700; font-size: 15px; }
.c-tutor { display: grid; gap: 8px; font-size: 15px; }
.c-tutor-out { white-space: pre-wrap; color: var(--ink-2); line-height: 1.5; }
.c-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 4px; }
.c-adapt { background: #E7F0FC; border-radius: 16px; padding: 14px 16px; font-size: 16px; line-height: 1.45; }

/* checkpoints reuse the level check's answers */
#course .opt.right { background: var(--sage); box-shadow: 0 0 0 2.5px var(--c-done); }
#course .opt.wrong { background: #F9E9D8; box-shadow: 0 0 0 2.5px var(--c-bad); }
@media (hover: hover) and (pointer: fine) { #course .opt:not(:disabled):hover { box-shadow: 0 0 0 2px var(--navy-2), 0 3px 0 rgba(33,73,133,.1); } }
#course .opt:not(:disabled):active { box-shadow: 0 0 0 2px var(--navy-2), 0 1px 0 rgba(33,73,133,.1); transform: translateY(2px); }
.c-fbk { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 16px; animation: rise .25s ease-out; }
.c-fbk > div { flex: 1 1 200px; min-width: 0; font-size: 14px; line-height: 1.45; }
.c-fbk b { display: block; font-size: 16px; margin-bottom: 2px; }
.c-fbk.ok { background: #FFF4DA; }
.c-fbk.no { background: #EEF1F2; }
.c-stars-big { display: flex; gap: 8px; }
.c-stars-big i { width: 36px; height: 36px; background: rgba(138,90,18,.2); clip-path: polygon(50% 0, 63% 35%, 100% 38%, 71% 60%, 82% 96%, 50% 76%, 18% 96%, 29% 60%, 0 38%, 37% 35%); }
.c-stars-big i.on { background: var(--glow); }

/* dialogs reuse the level check's modal */
.c-back { position: fixed; inset: 0; z-index: 60; background: rgba(32,30,29,.28); display: grid; place-items: center; padding: 16px; animation: fade .2s; overflow-y: auto; }
.c-back .modal { max-height: calc(100% - 8px); }
.c-diff { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.c-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70; background: var(--navy); color: #fff; font-weight: 700; font-size: 14px; padding: 10px 16px; border-radius: 14px; width: max-content; max-width: calc(100% - 32px); box-shadow: 0 10px 24px rgba(23,52,95,.3); animation: rise .2s ease-out; }
.c-log { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 4px; max-height: 190px; overflow-y: auto; color: var(--ink-2); }
.c-topics { display: grid; gap: 6px; }
.c-topics label { display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 14px; }

@media (max-width: 860px) {
  #course .c-screen { position: absolute; overflow-y: auto; }
  .c-screen.wide, #course { --c-panel: 100%; }
  .c-canvas { position: static; overflow: visible; padding: 84px 16px 24px; }
  .c-panel { position: static; width: 100%; box-shadow: none; border-radius: 22px 22px 0 0; animation: none; }
  .c-panel-in { overflow: visible; padding: 22px 16px calc(28px + env(safe-area-inset-bottom, 0px)); }
  .c-mod-left { padding: 0; min-height: 0; gap: 10px; }
  .c-mod-left .c-node { display: none; }
  .c-mod-left h1 { font-size: 26px; }
  .c-top { grid-template-columns: auto 1fr; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .c-top .bar-center { display: none; }
  .c-top .bar-right { grid-column: 2; }
  .c-fields { grid-template-columns: 1fr; }
}

/* the line under the last stop on the path */
.c-more { position: absolute; left: 50%; transform: translateX(-50%); width: min(320px, 90%); margin: 0; text-align: center; font-weight: 600; font-size: 14px; color: var(--ink-2); background: rgba(255, 255, 255, .7); padding: 8px 14px; border-radius: 14px; }

/* Question 1: picking topics from the whole subject */
.c-pickwrap { width: min(760px, 100%); }
.c-picklist { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; }
.c-pickrow { display: flex; gap: 12px; align-items: flex-start; background: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: 0 0 0 1.5px var(--line), 0 3px 0 rgba(33,73,133,.06); cursor: pointer; }
.c-pickrow:has(input:checked) { box-shadow: 0 0 0 2.5px var(--navy-2), 0 3px 0 rgba(33,73,133,.12); background: #F4F8FE; }
.c-pickrow input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--navy-2); }
.c-pickrow span { display: grid; gap: 2px; flex: 1; min-width: 0; }
.c-pickrow b { font-size: 15px; }
.c-pickrow small { color: var(--ink-3); font-size: 13px; line-height: 1.35; }
.c-pickrow em { flex: none; font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--amber-ink); background: var(--amber); padding: 3px 8px; border-radius: 8px; }
.c-picknote { margin: 0; text-align: center; color: var(--ink-3); font-size: 14px; font-weight: 600; }
@media (max-width: 640px) { .c-picklist { grid-template-columns: 1fr; } }

/* ---------- Help inside a lesson ---------- */
#course .hs-part { color: var(--navy); }
#course .hs-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 26px 0 0; padding: 14px 18px; border-radius: 16px; background: #EEF4FB; box-shadow: 0 0 0 1.5px #D5E3F3; }
#course .hs-bar p { margin: 0; font-weight: 600; color: var(--ink-2); font-size: 15px; }
#course .hs-open { border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 15px; color: #fff; background: var(--navy); padding: 10px 18px; border-radius: 999px; }
#course .hs-fixnote { margin: 0 0 12px; padding: 9px 12px; border-radius: 10px; background: #EAF5EE; color: #2F5B43; font-size: 14px; line-height: 1.4; }
#course .m-teach.hs-new { animation: hs-glow 2.4s ease-out; border-radius: 14px; }
@keyframes hs-glow { 0% { box-shadow: 0 0 0 3px rgba(243,177,63,.75); } 100% { box-shadow: 0 0 0 3px rgba(243,177,63,0); } }
#course .hs-panel { position: fixed; top: 64px; right: 16px; bottom: 16px; width: min(400px, calc(100% - 32px)); z-index: 60; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 20px; background: var(--paper, #fff); box-shadow: 0 18px 50px rgba(23,52,95,.25), 0 0 0 1.5px var(--line); animation: rise .2s ease-out; }
#course .hs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
#course .hs-head h3 { margin: 2px 0 0; font-size: 18px; line-height: 1.25; color: var(--ink); }
#course .hs-eyebrow { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
#course .hs-x { flex: none; width: 34px; height: 34px; border: 0; border-radius: 999px; background: #F0F3F7; color: var(--ink-2); font-size: 15px; cursor: pointer; }
#course .hs-chips, #course .hs-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#course .hs-actions { margin-top: 10px; }
#course .hs-chip { border: 0; cursor: pointer; font: inherit; font-size: 14px; font-weight: 700; padding: 8px 12px; border-radius: 999px; background: #fff; color: var(--ink); box-shadow: 0 0 0 1.5px var(--line); }
@media (hover: hover) and (pointer: fine) { #course .hs-chip:hover:not(:disabled) { box-shadow: 0 0 0 1.5px var(--navy); } }
#course .hs-chip:active:not(:disabled) { box-shadow: 0 0 0 1.5px var(--navy); background: #ECF4FE; }
#course .hs-chip:disabled, #course .hs-form button:disabled { opacity: .5; cursor: default; }
#course .hs-thread { flex: 1; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
#course .hs-msg { padding: 10px 13px; border-radius: 14px; font-size: 15px; line-height: 1.5; color: var(--ink); max-width: 92%; overflow-wrap: anywhere; }
#course .hs-msg p { margin: 0 0 8px; } #course .hs-msg p:last-child { margin-bottom: 0; }
#course .hs-me { align-self: flex-end; background: #E6EEF9; }
#course .hs-me small { display: block; font-size: 12px; font-weight: 700; color: var(--ink-3); margin-bottom: 2px; }
#course .hs-ai { align-self: flex-start; background: #F6F4EF; }
#course .hs-small { font-size: 13px; color: var(--ink-3); margin-top: 6px !important; }
#course .hs-done { margin: 8px 0 0; font-size: 13px; font-weight: 700; color: var(--ink-3); }
#course .hs-form { display: flex; gap: 8px; align-items: flex-end; }
#course .hs-panel, #course .hs-panel * { box-sizing: border-box; }
#course .hs-form textarea { flex: 1; min-width: 0; resize: none; min-height: 46px; max-height: 140px; }
#course .hs-form button { flex: none; }
#course .hs-busy { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-2); }
#course .hs-wishes { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
#course .hs-wishes li { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; padding: 8px 12px; border-radius: 12px; box-shadow: 0 0 0 1.5px var(--line); font-size: 14px; color: var(--ink); }
@media (max-width: 640px) {
  #course .hs-panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: min(78vh, 640px); border-radius: 20px 20px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}
