/* boredprof: the board is the whole product. Everything else stays quiet. */
:root {
  --ink: #0a0a0b;      /* board and page are the same black: the board is the screen */
  --side: #0e0e10;
  --panel: #121215;
  --line: #26262b;
  --line-2: #36363d;
  --text: #ecebe6;
  --muted: #8a8a90;
  --faint: #5e5e64;
  --red: #ff4646;
  --blue: #4b82ff;
  --green: #72e872;
  --orange: #ff9a3c;
  --student: #7df0c4;
  --top: 52px;
  --dock: 74px;
  --cap: 58px;
  --study: 0px;
  --sidew: 248px;
  --vh: 100vh;
  color-scheme: dark;
}
@supports (height: 100dvh) { :root { --vh: 100dvh; } } /* phones: the visible height, not counting the URL bar */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--ink); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .45; }
[hidden] { display: none !important; }
.hw { display: block; height: 100%; width: auto; overflow: visible; }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 14px; font-size: 13px; color: var(--text); transition: border-color .15s, background .15s; }
.btn:hover:not(:disabled) { border-color: #5a5a62; background: #ffffff08; }
.btn.primary { background: var(--text); color: var(--ink); border-color: var(--text); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #fff; }
.btn.danger { color: #ff8a8a; border-color: #4a2a2a; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.link { color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--text); }
.txt { color: var(--muted); font-size: 13px; letter-spacing: .02em; }
.txt:hover { color: var(--text); }
.txt.warn { color: var(--red); }
.txt.green { color: var(--student); margin-left: 8px; }
.txt.green:hover { color: #b8ffe6; }
.ic { width: 38px; height: 38px; display: inline-grid; place-items: center; color: var(--muted); border-radius: 50%; cursor: pointer; transition: color .15s, background .15s; flex: none; }
.ic:hover:not(:disabled) { color: var(--text); background: #ffffff0f; }
.ic svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 30px; height: 30px; }
.ic.sm svg { width: 18px; height: 18px; }
.ic.on { color: var(--student); }

/* ---------- layout: sidebar + main column ---------- */
.app { display: flex; height: 100%; height: var(--vh); }
.scrim { display: none; }
.side { flex: none; width: var(--sidew); background: var(--side); border-right: 1px solid #18181b; display: flex; flex-direction: column; padding: 14px 10px 12px; min-height: 0; transition: margin-left .2s; }
.app.side-hidden .side { margin-left: calc(-1 * var(--sidew)); }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 12px; }
.logo { display: block; height: 30px; }
.side-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; color: var(--muted); text-align: left; }
.side-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.side-item:hover, .side-item.on { color: var(--text); background: #ffffff0a; }
.side-label { margin: 16px 10px 6px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.course-list { flex: 1; min-height: 0; overflow-y: auto; }
.side-empty { margin: 4px 10px; color: var(--faint); font-size: 13px; line-height: 1.5; }
.course-name { width: 100%; display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 8px; text-align: left; color: var(--text); }
.course-name:hover { background: #ffffff08; }
.course-name span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-name em, .lecture em { font-style: normal; font-size: 11px; color: var(--muted); flex: none; }
.chev { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .15s; flex: none; }
.course.open .chev { transform: rotate(90deg); }
.lectures { display: none; padding: 2px 0 8px 18px; }
.course.open .lectures { display: block; }
.lecture { width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; text-align: left; color: var(--muted); font-size: 13px; }
.lecture span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lecture:hover:not(:disabled) { color: var(--text); background: #ffffff08; }
.lecture.on { color: var(--text); background: #ffffff0d; box-shadow: inset 2px 0 0 var(--red); }
.lecture em.drawing, .lecture em.reading { color: var(--orange); }
.lecture em.error { color: var(--red); }
.course-more { display: block; margin: 2px 0 0 8px; padding: 4px 0; font-size: 12px; color: var(--faint); }
.course-more:hover { color: var(--text); }
.side-add { margin: 8px 6px 0; padding: 9px 10px; border: 1px dashed var(--line-2); border-radius: 8px; color: var(--muted); text-align: left; }
.side-add:hover { color: var(--text); border-color: #5a5a62; }
.side-bottom { border-top: 1px solid #1a1a1d; margin-top: 12px; padding: 12px 6px 0; }
.rank { width: 100%; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 10px; text-align: left; padding: 4px 4px 8px; border-radius: 8px; }
.rank:hover { background: #ffffff06; }
.rank-name { height: 26px; grid-row: span 2; }
.rank-meta { font-size: 11px; color: var(--muted); justify-self: end; }
.rank-bar { height: 3px; background: #222226; border-radius: 3px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--red); border-radius: 3px; }
.side-links { display: flex; gap: 16px; padding: 4px 4px 0; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { flex: none; height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 20px 0 12px; }
.side-open { display: none; }
.app.side-hidden .side-open { display: inline-grid; }
.context { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 8px; }
.context b { color: var(--text); font-weight: 500; }
.top-right { display: flex; align-items: center; gap: 18px; flex: none; }
.status { color: var(--muted); font-size: 13px; }
.status.live::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ---------- the board ---------- */
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.stage { position: relative; width: min(100%, calc((var(--vh) - var(--top) - var(--dock) - var(--cap) - var(--study)) * 16 / 9)); }
#board { display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--ink); touch-action: none; user-select: none; }
#board path, svg.mini path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
#board .hit, svg.mini .hit { fill: transparent; }
#board .el { cursor: pointer; }
#board.intro .el[data-id^="ex"]:hover path { opacity: .7; }
#board.pen-mode, #board.pen-mode .el { cursor: crosshair; }
#board .pen-tip { opacity: 0; transition: opacity .35s; stroke: #ffffffcc; stroke-width: 1.5; filter: drop-shadow(0 0 5px #fff6); }
#board .pen-tip.on { opacity: .95; transition: opacity .1s; }
#board .sel { fill: #ffffff08; stroke: var(--blue); stroke-width: 2.5; stroke-dasharray: 9 8; }
svg.mini .pen-tip { display: none; }

/* subtitles under the board */
.caption {
  flex: none; width: min(92%, 940px); min-height: var(--cap); padding-top: 10px;
  text-align: center; font-size: clamp(14px, 1.3vw, 18px); line-height: 1.45; color: #e6e6e1;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.caption.on { opacity: 1; }
.caption.question::before {
  content: "your turn"; display: inline-block; margin-right: 10px; padding: 1px 8px; border-radius: 4px;
  background: #7df0c41f; color: var(--student); font-size: 11px; font-weight: 700; letter-spacing: .08em; vertical-align: 2px;
}
body.cap-s .caption { font-size: 13px; }
body.cap-l .caption { font-size: clamp(17px, 1.7vw, 22px); }
body.cap-xl { --cap: 84px; }
body.cap-xl .caption { font-size: clamp(20px, 2.1vw, 27px); line-height: 1.35; }
body.no-captions .caption { visibility: hidden; }
body.no-captions { --cap: 12px; }

/* study mode: which slide you're on */
.study { flex: none; display: flex; align-items: center; justify-content: center; gap: 10px; height: 36px; color: var(--muted); font-size: 13px; }
.study #slideNum { min-width: 92px; text-align: center; color: var(--text); }
body.studying { --study: 36px; }

/* ---------- dock ---------- */
.dock { flex: none; display: flex; align-items: center; gap: 14px; width: min(100%, 920px); margin: 0 auto; padding: 8px 22px 18px; min-height: var(--dock); }
.ask { flex: 1; min-width: 0; display: flex; align-items: center; border-bottom: 1px solid #3a3a41; transition: border-color .2s; }
.ask:focus-within { border-color: #d8d8d2; }
.ask input { flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 10px 2px; font-size: 16px; }
.ask input::placeholder { color: #66666c; }
.send { width: 32px; height: 32px; }
.send svg { width: 18px; height: 18px; }
.mic.live { color: var(--red); box-shadow: inset 0 0 0 1.5px var(--red); animation: live 2s ease-in-out infinite; }
.mic.hearing { color: #fff; background: var(--red); box-shadow: 0 0 0 6px #ff464630; animation: none; }
@keyframes live { 50% { box-shadow: inset 0 0 0 1.5px var(--red), 0 0 0 5px #ff46461a; } }
.tools { display: flex; align-items: center; gap: 4px; }
#pause .i-play { display: none; }
#pause.paused .i-play { display: block; }
#pause.paused .i-pause { display: none; }

/* ---------- notes on the board (errors, limits) ---------- */
.banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92%, 460px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.banner h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.banner p { margin: 6px 0; color: var(--muted); }
.banner code { background: #000; padding: 2px 6px; border-radius: 4px; color: var(--green); }
.banner .row { display: flex; gap: 18px; margin-top: 14px; justify-content: flex-end; }
.banner .primary { color: var(--text); font-weight: 600; }
.banner .ghost { color: var(--muted); }

/* ---------- sign in ---------- */
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--ink); overflow-y: auto; }
.auth-card { width: min(420px, 100%); min-width: 0; display: flex; flex-direction: column; align-items: center; }
.auth-logo { height: 92px; max-width: 100%; display: flex; justify-content: center; }
.auth-tag { height: 26px; margin: 14px 0 34px; max-width: 100%; display: flex; justify-content: center; }
.auth-tag .hw { max-width: 100%; }
.auth-form { width: 100%; display: flex; flex-direction: column; gap: 18px; }
.auth-form label, .field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.auth-form input, .field input { background: none; border: 0; border-bottom: 1px solid var(--line-2); outline: none; padding: 9px 2px; font-size: 16px; color: var(--text); }
.auth-form input:focus, .field input:focus { border-color: #d8d8d2; }
.auth-err, .up-err { min-height: 18px; color: #ff8a8a; font-size: 13px; }
.auth-form .btn { padding: 11px; font-size: 14px; }
.auth-card .link { margin-top: 18px; }

/* ---------- sheets (settings, plans, courses) ---------- */
.modal { position: fixed; inset: 0; background: #000b; display: grid; place-items: center; padding: 20px; z-index: 20; }
.sheet { width: min(560px, 100%); max-height: calc(var(--vh) - 40px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px 22px; }
.sheet.wide { width: min(980px, 100%); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-title { height: 38px; min-width: 0; }
.sheet-title .hw, .auth-logo .hw { max-width: 100%; }
.sheet section { padding: 12px 0; border-top: 1px solid #1d1d21; }
.sheet section:first-child { border-top: 0; }
.sheet h4 { margin: 0 0 8px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 40px; }
.row > span { color: var(--text); }
.row small { color: var(--muted); }
.row input[type=range] { flex: 1; max-width: 200px; accent-color: var(--red); }
.row b { font-weight: 500; color: var(--muted); min-width: 40px; text-align: right; }
.row select { background: #0c0c0e; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 8px; max-width: 230px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 6px 0 0; }
.hint a { color: var(--muted); text-underline-offset: 3px; }
.hint a:hover { color: var(--text); }
.hint .link { font-size: inherit; }
.del-box { margin-top: 10px; }
.del-box input { flex: 1; min-width: 0; background: none; border: 0; border-bottom: 1px solid var(--line-2); outline: none; padding: 8px 2px; font-size: 16px; }
.del-box input:focus { border-color: #d8d8d2; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 22px; background: #2a2a30; transition: background .15s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #9a9aa0; transition: transform .15s, background .15s; }
.switch input:checked + i { background: #3a1416; }
.switch input:checked + i::after { transform: translateX(16px); background: var(--red); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { padding: 5px 12px; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--text); color: var(--ink); font-weight: 600; }
.cap-preview { margin-top: 8px; padding: 10px; border-radius: 8px; background: var(--ink); text-align: center; color: #e6e6e1; font-size: 15px; }
.cap-preview.cap-s { font-size: 13px; } .cap-preview.cap-l { font-size: 19px; } .cap-preview.cap-xl { font-size: 24px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* plans */
.meter { margin: 10px 0; }
.meter-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.meter-top b { color: var(--text); font-weight: 500; }
.bar { height: 4px; background: #222226; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--text); border-radius: 4px; transition: width .4s; }
.bar.hot i { background: var(--red); }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.plan { border: 1px solid var(--line-2); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; }
.plan.cur { border-color: #6a6a72; }
.plan-name { height: 34px; }
.plan-price { color: var(--muted); margin: 4px 0 6px; }
.plan ul { margin: 0 0 14px; padding-left: 18px; color: #cfcfca; font-size: 13px; line-height: 1.7; flex: 1; }
.plan-cur { font-size: 12px; color: var(--muted); text-align: center; padding: 8px; }

/* ranks */
.ladder { list-style: none; margin: 12px 0 0; padding: 0; }
.ladder li { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 7px; color: var(--faint); }
.ladder li.done { color: var(--muted); }
.ladder li.cur { color: var(--text); background: #ffffff0a; box-shadow: inset 2px 0 0 var(--red); }
.ladder b { font-weight: 400; }

/* toasts (xp, rank ups) */
.toast { position: fixed; left: 50%; bottom: 112px; transform: translate(-50%, 12px); background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 16px; font-size: 13px; color: var(--text); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.xp b { color: var(--green); }
.toast.rankup { border-color: var(--red); font-size: 15px; padding: 10px 20px; }
.toast.rankup b { color: var(--red); }

/* ---------- upload + course overview ---------- */
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 16px; padding: 30px 16px; border: 1.5px dashed var(--line-2); border-radius: 12px; cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.drop b { font-weight: 500; }
.drop span { color: var(--muted); font-size: 13px; }
.drop:hover, .drop.over { border-color: #8a8a90; background: #ffffff05; }
.files { list-style: none; margin: 12px 0 0; padding: 0; }
.files li { display: flex; align-items: center; gap: 10px; padding: 6px 2px; border-bottom: 1px solid #1d1d21; font-size: 13px; }
.files li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files li em { font-style: normal; color: var(--muted); font-size: 12px; }
.prog { margin: 4px 0 14px; }
.prog-top { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.prog-top b { font-weight: 500; }
.prog-top span { color: var(--muted); }
.prog .bar { height: 6px; }
.prog .bar i { background: var(--red); }
.prog.done .bar i { background: var(--green); }
.lec { border-top: 1px solid #1d1d21; padding: 14px 0; }
.lec-head { display: flex; align-items: center; gap: 12px; }
.lec-head b { font-weight: 500; flex: 1; min-width: 0; }
.lec-head em { font-style: normal; font-size: 12px; color: var(--muted); }
.lec-sum { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 6px 0 8px; }
.concepts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.concepts span { font-size: 12px; color: #cfcfca; border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 8px; }
.concepts span.exam { border-color: #5a2a2a; color: #ffb3b3; }
.concepts span.exam::after { content: " ★"; color: var(--red); }
.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.fig { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--ink); aspect-ratio: 16 / 9; }
.fig:hover { border-color: #5a5a62; }
.fig svg.mini { width: 100%; height: 100%; display: block; }
.fig span { position: absolute; left: 6px; bottom: 4px; font-size: 10px; color: var(--muted); z-index: 1; }
.compare { display: grid; grid-template-columns: 1fr 1.2fr; gap: 12px; align-items: start; margin-bottom: 14px; }
.compare img { width: 100%; border-radius: 8px; display: block; }
.compare svg.mini { width: 100%; display: block; background: var(--ink); border: 1px solid var(--line); border-radius: 8px; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .side { position: fixed; z-index: 15; top: 0; bottom: 0; left: 0; box-shadow: 0 0 40px #000; }
  .app:not(.side-shown) .side { margin-left: calc(-1 * var(--sidew)); box-shadow: none; }
  .app.side-shown .scrim { display: block; position: fixed; inset: 0; z-index: 14; background: #0009; } /* tap outside the drawer to close it */
  .side-open { display: inline-grid; }
  .plans, .compare { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  :root { --top: 46px; --dock: 108px; --cap: 64px; }
  .top { padding: 0 12px 0 6px; gap: 6px; }
  .top-right { gap: 12px; }
  .status, #speed { display: none; }
  .dock { flex-wrap: wrap; padding: 6px 14px 14px; gap: 6px; }
  .mic { order: 0; }
  .ask { order: 1; flex-basis: calc(100% - 52px); }
  .tools { order: 2; width: 100%; justify-content: center; }
  .modal { padding: 10px; }
  .sheet { max-height: calc(var(--vh) - 20px); padding: 14px 16px 18px; }
}
/* A phone held upright: the 16:9 board is only as wide as the screen, so say how to get a bigger one. */
@media (max-width: 600px) and (orientation: portrait) {
  .main { position: relative; }
  .main::after { content: "turn your phone sideways for a bigger board"; position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--faint); pointer-events: none; }
}
/* A phone on its side: every pixel of height goes to the board. Thin bars, a one-row dock,
   two-line captions, and the slide arrows move up into the top bar (nothing covers the ink). */
@media (max-height: 500px) {
  :root { --top: 38px; --dock: 50px; --cap: 36px; }
  body.studying { --study: 0px; }
  body.cap-l { --cap: 42px; }
  body.cap-xl { --cap: 50px; }
  body.no-captions { --cap: 8px; }
  .top { gap: 8px; }
  body.studying .context { visibility: hidden; }
  .study { position: fixed; top: 0; left: 50%; transform: translateX(-50%); height: var(--top); gap: 6px; z-index: 5; }
  .study #slideNum { min-width: 80px; }
  #slidePeek { font-size: 0; }
  #slidePeek::after { content: "original"; font-size: 13px; }
  .caption { padding-top: 3px; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  body.cap-s .caption { font-size: 12px; }
  body.cap-l .caption { font-size: 15px; }
  body.cap-xl .caption { font-size: 18px; line-height: 1.3; }
  .dock { flex-wrap: nowrap; padding: 2px 14px 6px; gap: 8px; }
  .ask { flex-basis: auto; }
  .ask input { padding: 6px 2px; }
  .tools { width: auto; }
  .ic { width: 34px; height: 34px; }
  .side { overflow-y: auto; padding-top: 8px; }
  .course-list { flex: none; overflow: visible; }
  .side-top { padding-bottom: 6px; }
  .side-label { margin-top: 10px; }
  .toast { bottom: 64px; }
}
