/* =========================================================
   Student & teacher portal — same editorial system, app layout
   Loaded after site.css.
   ========================================================= */
html { font-size: 16px; }
body.portal { background: var(--canvas); }
.p-muted { color: var(--ink-muted); }
.p-alert { color: #a3333d; }

/* ---------- Shell ---------- */
.p-shell { min-height: 100svh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 960px) { .p-shell { grid-template-columns: 17rem minmax(0, 1fr); } }
.p-side {
  background: var(--surface-dark); color: var(--on-dark);
  display: flex; flex-direction: column; gap: 1.5rem; padding: 1.25rem 1.25rem 1rem;
}
@media (min-width: 960px) { .p-side { position: sticky; top: 0; height: 100svh; padding: 2rem 1.75rem; gap: 2.5rem; } }
.p-side .logo__word { font-size: 1.05rem; }
.p-side__role { margin-top: 0.6rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.2em; color: var(--on-dark-faint); }
.p-nav { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; margin-inline: -0.25rem; }
.p-nav::-webkit-scrollbar { display: none; }
@media (min-width: 960px) { .p-nav { flex-direction: column; overflow: visible; flex: 1; } }
.p-nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; white-space: nowrap;
  padding: 0.6rem 0.75rem; font-size: 0.9rem; color: var(--on-dark-muted); border-radius: 2px;
  transition: color 0.25s, background-color 0.25s;
}
.p-nav a:hover { color: var(--on-dark); }
.p-nav a[aria-current="page"] { color: var(--on-dark); background: rgba(255, 255, 255, 0.07); }
.p-nav a[aria-current="page"] span { font-family: var(--serif); font-style: italic; }
.p-badge { font-style: normal; font-size: 0.7rem; min-width: 1.4rem; text-align: center; padding: 0.1rem 0.35rem; border: 1px dashed var(--line-on-dark); color: var(--on-dark); }
.p-badge:empty { display: none; }
.p-side__bottom { display: none; border-top: 1px dashed var(--line-on-dark); padding-top: 1.25rem; }
@media (min-width: 960px) { .p-side__bottom { display: block; } }
.p-user strong { display: block; font-weight: 500; font-size: 0.9rem; }
.p-user span { display: block; font-size: 0.78rem; color: var(--on-dark-muted); overflow-wrap: anywhere; }
.p-side__row { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.p-link { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--on-dark-muted); transition: color 0.25s; }
.p-link:hover { color: var(--on-dark); }
.p-mobilebar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
@media (min-width: 960px) { .p-mobilebar { display: none; } }

.p-main { padding: 2rem 1.25rem 5rem; min-width: 0; outline: none; }
@media (min-width: 960px) { .p-main { padding: 3.5rem 3.5rem 6rem; } }
.p-main > * { max-width: 72rem; }

/* ---------- Page parts ---------- */
.p-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1.5rem; margin-bottom: 2.5rem; }
.p-head .eyebrow { margin-bottom: 1rem; }
.p-head h1 { font-size: 2.4rem; line-height: 1.08; max-width: 22ch; }
@media (min-width: 960px) { .p-head h1 { font-size: 3rem; } }
.p-back { display: inline-flex; gap: 0.5rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-muted); margin-bottom: 1.5rem; }
.p-back:hover { color: var(--ink); }
.p-section { margin-top: 3.5rem; }
.p-section > h2 { font-size: 1.6rem; margin-bottom: 1.25rem; }
.p-grid2 { display: grid; gap: 2.5rem; }
@media (min-width: 1100px) { .p-grid2 { grid-template-columns: 1fr 1fr; gap: 3rem; } }

.p-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 2rem; }
@media (min-width: 960px) { .p-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.p-tile { border-top: 1px dashed var(--line); padding-top: 1.1rem; }
.p-tile dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-faint); }
.p-tile dd { font-family: var(--serif); font-size: 2.6rem; line-height: 1.1; margin-top: 0.4rem; }
.p-tile dd small { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-muted); margin-left: 0.25rem; }

.p-list { border-bottom: 1px dashed var(--line); }
.p-list > li, .p-list > a { display: flex; justify-content: space-between; align-items: baseline; gap: 1.25rem; border-top: 1px dashed var(--line); padding-block: 1rem; }
.p-list > a:hover .p-list__title { text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.p-list__title { font-weight: 500; }
.p-list__meta { font-size: 0.85rem; color: var(--ink-muted); margin-top: 0.2rem; }
.p-list__side { font-size: 0.85rem; color: var(--ink-muted); white-space: nowrap; text-align: right; }
.p-empty { color: var(--ink-muted); padding: 1rem 0; border-top: 1px dashed var(--line); }

.p-table-wrap { overflow-x: auto; }
.p-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.p-table th { text-align: left; font-weight: 400; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-faint); padding: 0 1rem 0.75rem 0; white-space: nowrap; }
.p-table td { border-top: 1px dashed var(--line); padding: 0.95rem 1rem 0.95rem 0; vertical-align: top; }
.p-table tr:last-child td { border-bottom: 1px dashed var(--line); }
.p-table a { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 0.2em; }
.p-table a:hover { text-decoration-color: var(--ink); }
.p-num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.p-chip { display: inline-block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; padding: 0.25rem 0.55rem; border: 1px dashed var(--line-strong); white-space: nowrap; }
.p-chip--submitted { background: var(--surface-grey); border-style: solid; border-color: transparent; }
.p-chip--graded { background: var(--ink); color: #fff; border-color: var(--ink); border-style: solid; }
.p-chip--late { color: #a3333d; border-color: rgba(163, 51, 61, 0.5); }

/* Course cards */
.p-cards { display: grid; gap: 2rem; }
@media (min-width: 760px) { .p-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.p-card { border-top: 1px dashed var(--line); padding-top: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }
.p-card h3 { font-size: 1.6rem; }
.p-card__meta { font-size: 0.85rem; color: var(--ink-muted); }
.p-progress { height: 2px; background: var(--line); margin-top: 0.5rem; }
.p-progress i { display: block; height: 100%; background: var(--ink); }
.p-card .cta { align-self: flex-start; margin-top: 0.75rem; }
.p-card.is-locked { opacity: 0.6; }

/* Buttons & forms */
.btn { padding: 0.75rem 1.4rem; font-size: 0.78rem; }
.btn-text { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-muted); border-bottom: 1px dashed var(--line-strong); padding-bottom: 0.1rem; transition: color 0.25s; }
.btn-text:hover { color: var(--ink); }
.btn-text--danger:hover { color: #a3333d; }
.p-form { display: grid; gap: 1.25rem; max-width: 44rem; }
.p-form--inline { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); max-width: none; align-items: end; }
.p-field { display: flex; flex-direction: column; gap: 0.4rem; }
.p-field > span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-muted); }
.p-field input, .p-field textarea, .p-field select {
  width: 100%; border: 0; border-bottom: 1px solid var(--line-strong); background: transparent;
  padding: 0.55rem 0; font-size: 1rem; border-radius: 0; transition: border-color 0.25s;
}
.p-field select { cursor: pointer; }
.p-field textarea { resize: vertical; min-height: 8rem; line-height: 1.55; border: 1px solid var(--line-strong); padding: 0.75rem; }
.p-field input:focus, .p-field textarea:focus, .p-field select:focus { outline: none; border-color: var(--ink); }
.p-field small { font-size: 0.8rem; color: var(--ink-muted); line-height: 1.45; }
.p-actions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.p-box { border: 1px dashed var(--line); padding: 1.5rem; }
.p-box + .p-box { margin-top: 1.5rem; }
details.p-box > summary { cursor: pointer; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; list-style: none; display: flex; justify-content: space-between; }
details.p-box > summary::-webkit-details-marker { display: none; }
details.p-box > summary::after { content: "+"; font-size: 1.1rem; line-height: 1; transition: transform 0.4s var(--ease-spring); }
details.p-box[open] > summary::after { transform: rotate(45deg); }
details.p-box[open] > summary { margin-bottom: 1.5rem; }

/* Lesson viewer */
.p-lesson { position: relative; max-width: 46rem; padding: 2rem 0 1rem; }
.p-lesson h2 { font-size: 2.2rem; margin-bottom: 1.5rem; }
.p-lesson__body { font-size: 1.1rem; line-height: 1.7; }
.p-lesson__body p + p, .p-lesson__body p + ul, .p-lesson__body ul + p, .p-lesson__body h3 { margin-top: 1.1rem; }
.p-lesson__body h3 { font-size: 1.4rem; margin-top: 2rem; }
.p-lesson__body ul { list-style: none; padding-left: 0; margin-top: 0.6rem; }
.p-lesson__body li { padding-left: 1.4rem; position: relative; }
.p-lesson__body li::before { content: "—"; position: absolute; left: 0; color: var(--ink-faint); }
.p-lesson__body strong { font-weight: 500; }
.p-note { font-size: 0.8rem; color: var(--ink-muted); border-top: 1px dashed var(--line); padding-top: 1rem; margin-top: 2.5rem; max-width: 46rem; }
.p-pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; max-width: 46rem; }
.p-video { position: relative; aspect-ratio: 16 / 9; margin: 0 0 2rem; background: var(--surface-dark); }
.p-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.p-protected { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.p-protected img { pointer-events: none; -webkit-user-drag: none; }
.p-watermark { position: absolute; inset: 0; pointer-events: none; z-index: 2; background-repeat: repeat; }
.p-veil {
  position: absolute; inset: -1rem; z-index: 3; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-muted);
}
.p-protected.is-veiled .p-veil { opacity: 1; visibility: visible; }
.p-print-note { display: none; }
@media print {
  .p-protected, .p-side, .p-pager { display: none !important; }
  .p-print-note { display: block; font: 16px/1.5 sans-serif; padding: 2rem; }
}

/* Submission (teacher grading) */
.p-sub { border-top: 1px dashed var(--line); padding-block: 1.5rem; display: grid; gap: 1rem; }
@media (min-width: 960px) { .p-sub { grid-template-columns: 14rem minmax(0, 1fr) 18rem; gap: 2rem; } }
.p-sub__who strong { display: block; font-weight: 500; }
.p-sub__who span { font-size: 0.85rem; color: var(--ink-muted); }
.p-sub__body { white-space: pre-wrap; line-height: 1.6; background: var(--surface-grey); padding: 1rem 1.1rem; font-size: 0.95rem; }
.p-sub form { display: grid; gap: 0.85rem; align-content: start; }

/* Toast */
.p-toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 100; transform: translate(-50%, 1rem);
  background: var(--ink); color: #fff; padding: 0.8rem 1.2rem; font-size: 0.88rem; max-width: calc(100vw - 2rem);
  opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.4s var(--ease-out);
}
.p-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Sign-in page ---------- */
.p-login { min-height: 100svh; display: grid; }
@media (min-width: 960px) { .p-login { grid-template-columns: 1fr 1fr; } }
.p-login__art { position: relative; background: var(--surface-dark); color: #fff; padding: 1.5rem; display: flex; flex-direction: column; justify-content: space-between; min-height: 16rem; overflow: hidden; }
@media (min-width: 960px) { .p-login__art { padding: 2.5rem 3rem; } }
.p-login__art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); opacity: 0.45; }
.p-login__art > *:not(img) { position: relative; }
.p-login__quote { font-family: var(--serif); font-size: 2rem; line-height: 1.15; max-width: 16ch; }
@media (min-width: 960px) { .p-login__quote { font-size: 3rem; } }
.p-login__form { padding: 2.5rem 1.5rem 4rem; display: flex; flex-direction: column; justify-content: center; gap: 2rem; max-width: 34rem; width: 100%; margin-inline: auto; }
.p-login__form h1 { font-size: 2.6rem; }
.p-login__lead { color: var(--ink-muted); line-height: 1.6; margin-top: 0.75rem; }
.p-login__top { display: flex; justify-content: flex-end; padding: 1.25rem 1.5rem 0; }
.p-demo-accounts { display: grid; gap: 0; border-bottom: 1px dashed var(--line); }
.p-demo-accounts button { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; width: 100%; text-align: left; border-top: 1px dashed var(--line); padding: 1rem 0; transition: padding 0.4s var(--ease-spring); }
.p-demo-accounts button:hover { padding-left: 0.5rem; }
.p-demo-accounts strong { font-weight: 500; }
.p-demo-accounts span { font-size: 0.8rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.14em; }
.p-msg { font-size: 0.9rem; color: var(--ink-muted); min-height: 1.4em; }
.p-msg.is-error { color: #a3333d; }
.p-side__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.p-mobilebar .lang { color: var(--on-dark); }
.p-h2 { font-size: 1.6rem; margin-bottom: 1.25rem; }
/* Phones: let the dark bar shrink to the screen and wrap its top row. */
.p-side { min-width: 0; }
.p-side__top { flex-wrap: wrap; }
.p-nav { max-width: 100%; min-width: 0; }

/* ---------- Website editor ---------- */
.ed-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; border-bottom: 1px dashed var(--line); padding-bottom: 0.9rem; margin-bottom: 1.5rem; }
.ed-tabs a { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-muted); padding: 0.25rem 0; }
.ed-tabs a:hover { color: var(--ink); }
.ed-tabs a[aria-current="page"] { color: var(--ink); border-bottom: 1px solid var(--ink); }
.ed-hint { max-width: 70ch; line-height: 1.6; margin-bottom: 2rem; }
.ed-group { border: 0; padding: 0; margin: 0 0 3rem; min-width: 0; }
.ed-group > legend { font-family: var(--serif); font-size: 1.5rem; padding: 0; margin-bottom: 0.5rem; }
.ed-item { border-top: 1px dashed var(--line); padding: 1.1rem 0 1.25rem; }
.ed-item.is-saved { box-shadow: inset 2px 0 0 var(--ink); padding-left: 0.9rem; }
.ed-item__head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.6rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-muted); }
.ed-key { color: var(--ink-faint); text-transform: none; letter-spacing: 0; }
.ed-key .btn-text { font-size: 0.7rem; }
.ed-cols { display: grid; gap: 1rem 1.5rem; }
@media (min-width: 900px) { .ed-cols { grid-template-columns: 1fr 1fr; } .ed-cols--single { grid-template-columns: 1fr; max-width: 34rem; } }
.ed-cols .p-field textarea { min-height: 0; padding: 0.6rem 0.7rem; font-size: 0.95rem; }
.ed-cols .p-field > span { font-size: 0.66rem; }
.ed-image { display: grid; gap: 1.25rem; }
@media (min-width: 900px) { .ed-image { grid-template-columns: 9rem minmax(0, 1fr); align-items: start; } }
.ed-thumb { width: 9rem; aspect-ratio: 3 / 4; object-fit: cover; background: var(--surface-grey); filter: grayscale(1); }
.ed-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: 1.5rem;
  background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(6px); border-top: 1px dashed var(--line); padding: 1rem 0;
}
.ed-count { margin-right: auto; font-size: 0.85rem; color: var(--ink-muted); }

/* PDF pages drawn as images inside the protected lesson */
.p-pdf { margin-top: 2rem; display: grid; gap: 1rem; }
.p-pdf canvas { display: block; background: #fff; box-shadow: 0 0 0 1px var(--line); }

/* ---------- Lesson videos ---------- */
.p-lesson--video { max-width: 60rem; padding-top: 0; }
.p-lesson--video .p-video { margin: 0; }
.p-video--demo { display: grid; place-items: center; background: var(--surface-dark); color: var(--on-dark-muted); font-size: 0.85rem; text-align: center; padding: 1rem; }
.vid-students { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.vid-chip { position: relative; }
.vid-chip input { position: absolute; opacity: 0; pointer-events: none; }
.vid-chip span { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.85rem; border: 1px dashed var(--line-strong); font-size: 0.85rem; cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.vid-chip span::before { content: ""; width: 0.6rem; height: 0.6rem; border: 1px solid currentColor; }
.vid-chip input:checked + span { background: var(--ink); color: #fff; border-style: solid; border-color: var(--ink); }
.vid-chip input:checked + span::before { background: #fff; }
.vid-chip input:focus-visible + span { outline: 1px dashed var(--ink); outline-offset: 3px; }

/* ================================================================ Exams */
.ex-card { margin-bottom: 2rem; }
.ex-desc { max-width: 60ch; margin-top: 1rem; font-size: 1rem; }
.ex-status { margin-top: 1.25rem; font-size: 0.95rem; }
.ex-parts { margin-top: 1.25rem; border-bottom: 1px dashed var(--line); }
.ex-part { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; border-top: 1px dashed var(--line); padding: 1rem 0; }
.ex-part.is-done { opacity: 0.65; }
.ex-intro { font-size: 0.85rem; margin-top: 0.25rem; max-width: 60ch; }
.ex-part__side { flex: none; }

/* runner */
.ex-bar {
  position: sticky; top: 0; z-index: 6; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(6px); border-bottom: 1px dashed var(--line);
  padding: 0.9rem 0; margin: -0.5rem 0 2rem;
}
.ex-bar__title { font-family: var(--serif); font-size: 1.4rem; line-height: 1.2; }
.ex-bar__clock { text-align: right; }
.ex-bar__clock span { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-muted); }
.ex-bar__clock strong { font-family: var(--serif); font-size: 2rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.ex-bar__clock.is-low strong { color: #a3333d; }
.ex-form { max-width: 52rem; position: relative; }
.ex-section { margin-bottom: 3rem; }
.ex-instr { color: var(--ink-muted); margin-bottom: 1.25rem; max-width: 62ch; }
.ex-text { border-left: 2px solid var(--line); padding: 0.25rem 0 0.25rem 1.25rem; margin: 0 0 2rem; font-size: 1.05rem; }
.ex-q { border: 0; border-top: 1px dashed var(--line); padding: 1.1rem 0; margin: 0; min-width: 0; }
.ex-q legend, .ex-q > p { line-height: 1.7; padding: 0; }
.ex-q__n { display: inline-block; min-width: 1.8rem; font-family: var(--serif); color: var(--ink-muted); }
.ex-opts { display: grid; gap: 0.4rem; margin-top: 0.7rem; padding-left: 1.8rem; }
.ex-opt { display: flex; gap: 0.6rem; align-items: baseline; cursor: pointer; }
.ex-opt input { accent-color: #191917; transform: translateY(0.1rem); }
.ex-opt b { font-weight: 500; margin-right: 0.25rem; }
.ex-gap { border: 0; border-bottom: 1px solid var(--ink); background: var(--surface-grey); padding: 0.15rem 0.5rem; font: inherit; min-width: 9rem; max-width: 100%; }
.ex-gap:focus { outline: 1px dashed var(--ink); outline-offset: 2px; }
.ex-q textarea { width: 100%; margin-top: 0.6rem; border: 1px solid var(--line-strong); padding: 0.7rem; font: inherit; line-height: 1.55; resize: vertical; }
.ex-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; border-top: 1px dashed var(--line); padding-top: 1.5rem; }

/* listening player */
.ex-player { display: flex; align-items: center; gap: 1rem; border: 1px dashed var(--line-strong); padding: 0.9rem 1rem; margin-bottom: 1.5rem; max-width: 34rem; }
.ex-play { width: 2.8rem; height: 2.8rem; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 0.85rem; flex: none; }
.ex-player__track { flex: 1; height: 3px; background: var(--line); }
.ex-player__track i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.25s linear; }
.ex-player__count { font-size: 0.8rem; color: var(--ink-muted); white-space: nowrap; }
.ex-player__gone { font-size: 0.9rem; color: var(--ink-muted); }

/* speaking */
.ex-step { max-width: 52rem; }
.ex-step .eyebrow { margin-bottom: 1rem; }
.ex-step__foot { display: flex; align-items: center; gap: 1.5rem; margin-top: 2rem; }
.ex-overview { border-top: 1px dashed var(--line); padding: 1.25rem 0; }
.ex-overview h3 { font-size: 1.3rem; margin-bottom: 0.75rem; }
.ex-task { font-size: 1.15rem; line-height: 1.6; margin: 1rem 0; }
.ex-plan { margin: 0.75rem 0 0 1.2rem; list-style: disc; line-height: 1.8; }
.ex-meter { height: 8px; background: var(--surface-grey); margin-top: 1.5rem; max-width: 26rem; }
.ex-meter i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.08s linear; }
.ex-ring {
  --p: 1; width: 7.5rem; height: 7.5rem; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--ink) calc(var(--p) * 360deg), var(--line) 0);
}
.ex-ring > div { width: 6.6rem; height: 6.6rem; border-radius: 50%; background: #fff; display: grid; place-content: center; text-align: center; }
.ex-ring strong { font-family: var(--serif); font-size: 1.7rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.ex-ring span { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-muted); }
.ex-rec { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; margin-top: 2rem; border-top: 1px dashed var(--line); padding-top: 1.5rem; }
.ex-rec__dot { width: 0.8rem; height: 0.8rem; border-radius: 50%; background: #c2414b; animation: ex-pulse 1.1s ease-in-out infinite; }
@keyframes ex-pulse { 50% { opacity: 0.25; transform: scale(0.8); } }
.ex-q-slide { text-align: center; padding: 3rem 0 1rem; margin-inline: auto; }
.ex-q-slide__n { font-family: var(--serif); font-size: 2.6rem; animation: ex-in 0.6s var(--ease-out); }
@keyframes ex-in { from { opacity: 0; transform: translateY(1.5rem); } }
.ex-dots { display: flex; justify-content: center; gap: 0.5rem; margin: 1.25rem 0; }
.ex-dots i { width: 0.6rem; height: 0.6rem; border-radius: 50%; border: 1px solid var(--ink); }
.ex-dots i.is-done { background: var(--ink); }
.ex-dots i.is-now { background: var(--ink); animation: ex-pulse 1.1s ease-in-out infinite; }
.ex-q-slide .ex-rec { justify-content: center; }
.ex-thanks { max-width: 40rem; padding: 3rem 0; }
.ex-thanks h1 { font-size: 3rem; margin: 1rem 0; }

/* editor + grading */
.ex-ed-grid { display: grid; gap: 1rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); margin-bottom: 1rem; }
.ex-wide { grid-column: 1 / -1; }
.ex-ed-section { border: 1px dashed var(--line); padding: 1.25rem; margin: 0 0 1.5rem; min-width: 0; }
.ex-ed-section > legend { font-family: var(--serif); font-size: 1.25rem; padding: 0 0.5rem; }
.ex-ed-qs { display: grid; gap: 0.75rem; margin: 1rem 0; }
.ex-ed-q { background: var(--surface-grey); padding: 1rem; }
.ex-ed-q__head { display: flex; gap: 0.75rem; align-items: baseline; margin-bottom: 0.75rem; }
.ex-ed-q__head .btn-text { margin-left: auto; }
.ex-ed-q textarea { min-height: 0 !important; }
.ex-ed-opts { display: grid; gap: 0.4rem; margin-bottom: 0.5rem; }
.ex-ed-opt { display: flex; align-items: center; gap: 0.6rem; }
.ex-ed-opt input[type="radio"] { accent-color: #191917; }
.ex-ed-opt input:not([type]) { flex: 1; border: 0; border-bottom: 1px solid var(--line-strong); background: transparent; padding: 0.35rem 0; font: inherit; }
.ex-audio-row { display: flex; gap: 1rem; align-items: center; }
.ex-audio-row input { flex: 1; }
.ex-upload { cursor: pointer; white-space: nowrap; }
.ex-clips { display: grid; gap: 0.6rem; margin: 1rem 0 1.5rem; }
.ex-clip { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; border-top: 1px dashed var(--line); padding-top: 0.6rem; }
.ex-clip audio { height: 2.2rem; max-width: 100%; }
.ex-pts { width: 4.5rem; border: 1px solid var(--line-strong); padding: 0.3rem 0.4rem; font: inherit; }
.ex-their { white-space: pre-wrap; max-width: 26rem; }

/* "Keep me signed in" */
.p-check { display: flex; gap: 0.75rem; align-items: flex-start; cursor: pointer; }
.p-check input { width: 1.1rem; height: 1.1rem; margin-top: 0.15rem; accent-color: #191917; flex: none; }
.p-check strong { display: block; font-weight: 500; }
.p-check small { display: block; font-size: 0.8rem; color: var(--ink-muted); line-height: 1.45; margin-top: 0.15rem; }
.p-demo-accounts { margin-top: 0.5rem; }

/* Form fields always light, whatever the device's dark mode does. */
.portal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .portal textarea, .portal select {
  background-color: #fff; color: var(--ink);
}
.ex-gap { background-color: var(--surface-grey) !important; }
/* Copy protection must not stop students typing their answers (Safari). */
.p-protected input, .p-protected textarea { -webkit-user-select: text; user-select: text; }

/* Exam guard: covers the exam while the student is away */
.ex-lock { position: fixed; inset: 0; z-index: 200; background: rgba(25, 25, 23, 0.96); color: #fff; display: grid; place-items: center; padding: 1.5rem; }
.ex-lock[hidden] { display: none; }
.ex-lock__box { max-width: 34rem; }
.ex-lock__box .eyebrow { color: var(--on-dark-muted); }
.ex-lock__box h2 { font-size: 2.4rem; margin: 1rem 0; color: #fff; }
.ex-lock__box p { color: var(--on-dark-muted); line-height: 1.6; }
.ex-lock__box .cta { margin-top: 1.75rem; background: #fff; color: var(--ink); }
.ex-rule { font-size: 0.85rem; margin-top: 0.4rem; }

/* Settings */
.set-grid { display: grid; gap: 1.5rem; }
@media (min-width: 1100px) { .set-grid { grid-template-columns: 1fr 1fr; } }
.set-grid .p-box + .p-box { margin-top: 0; }
.set-steps { list-style: decimal; padding-left: 1.2rem; line-height: 1.6; display: grid; gap: 0.5rem; }
.set-buttons { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }

/* First sign-in: name prompt (reuses the lock overlay) */
.name-ask input { width: 100%; margin-top: 1.25rem; border: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.5); background: transparent !important; color: #fff !important; font-size: 1.3rem; padding: 0.5rem 0; }
.name-ask input:focus { outline: none; border-bottom-color: #fff; }

/* ---------- 2026-10-18: practice, schedule, payments ---------- */
.ed-tabs button { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-muted); padding: 0.25rem 0; }
.ed-tabs button:hover { color: var(--ink); }
.ed-tabs button[aria-selected="true"] { color: var(--ink); border-bottom: 1px solid var(--ink); }
.ed-tabs .ed-tab--extra { color: var(--ink); }
.ed-tabs a:not(.ed-tab--extra) + .ed-tab--extra { margin-left: auto; }
.p-notice { border: 1px dashed var(--line-strong); padding: 0.85rem 1rem; margin-bottom: 2rem; font-size: 0.95rem; }
.p-notice a { text-decoration: underline; text-underline-offset: 0.2em; }
.cta.is-quiet { background: transparent; color: var(--ink); border: 1px dashed var(--line-strong); }

/* lesson practice box */
.lp { margin-top: 2.5rem; display: grid; gap: 1.25rem; max-width: 46rem; }
.lp__links { display: grid; gap: 1rem; }
@media (min-width: 640px) { .lp__links { grid-template-columns: 1fr 1fr; } }
.lp__link { display: grid; gap: 0.35rem; border: 1px dashed var(--line-strong); padding: 1.1rem 1.25rem; transition: border-color 0.25s, transform 0.4s var(--ease-spring-soft); }
.lp__link:hover { border-color: var(--ink); transform: translateY(-2px); }
.lp__link strong { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; }
.lp__link span:last-child { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-muted); }
.lp__done { display: inline-flex; align-items: center; gap: 0.75rem; justify-self: start; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.14em; padding: 0.7rem 1.1rem; border: 1px solid var(--ink); }
.lp__done:hover { background: var(--surface-grey); }
.lp__tick { width: 1.1rem; height: 1.1rem; border: 1px solid var(--ink); display: grid; place-items: center; }
.lp__done.is-done { background: var(--ink); color: #fff; }
.lp__done.is-done .lp__tick { border-color: #fff; }
.lp__done.is-done .lp__tick::after { content: ""; width: 0.55rem; height: 0.3rem; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }

/* flashcards */
.fc-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.fc-bar .ed-tabs { margin: 0; border: 0; padding: 0; }
.fc-rev { font-size: 0.9rem; }
.fc { display: grid; justify-items: center; gap: 1.25rem; text-align: center; max-width: 34rem; margin-inline: auto; }
.fc__count { font-size: 0.8rem; letter-spacing: 0.14em; color: var(--ink-muted); }
.fc__card { position: relative; width: 100%; aspect-ratio: 3 / 2; perspective: 1200px; cursor: pointer; }
.fc__face { position: absolute; inset: 0; display: grid; place-content: center; gap: 0.75rem; padding: 1.5rem; border: 1px solid var(--ink); background: #fff; backface-visibility: hidden; transition: transform 0.6s var(--ease-out); }
.fc__face--back { background: var(--surface-dark); color: #fff; transform: rotateY(180deg); }
.fc__card.is-flipped .fc__face { transform: rotateY(-180deg); }
.fc__card.is-flipped .fc__face--back { transform: rotateY(0deg); }
.fc__term { font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 2.6rem); line-height: 1.15; }
.fc__ex { font-size: 0.95rem; color: var(--on-dark-muted); font-style: italic; }
.fc__tap { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-faint); }
.fc__actions { display: flex; align-items: center; gap: 1.5rem; }
.fc__hint { font-size: 0.8rem; }
.fc__big { font-family: var(--serif); font-size: 4rem; }
.fc--end { padding-top: 2rem; }
.fc-test { max-width: 46rem; }
.fc-test__fb { margin-left: 0.75rem; font-size: 0.9rem; }

/* quizzes */
.qz { max-width: 46rem; }
.ex-q.is-right { box-shadow: inset 3px 0 0 #2f7d4f; padding-left: 0.9rem; }
.ex-q.is-wrong { box-shadow: inset 3px 0 0 #b3412e; padding-left: 0.9rem; }
.ex-q.is-right .fc-test__fb { color: #2f7d4f; }
.ex-q.is-wrong .fc-test__fb { color: #b3412e; }
.qz__fb { margin-top: 0.6rem; font-size: 0.92rem; color: var(--ink-muted); padding-left: 1.8rem; }
.qz__score { font-family: var(--serif); font-weight: 400; font-size: 1.8rem; }
.qz-prev { max-width: 46rem; }

/* schedule */
.sc-next { border: 1px solid var(--ink); padding: 1.5rem 1.5rem 1.25rem; max-width: 46rem; }
.sc-next h2 { font-family: var(--serif); font-weight: 400; font-size: 2rem; margin: 0.4rem 0 0.6rem; }
.sc-next.is-live { background: var(--surface-dark); color: #fff; }
.sc-next.is-live .p-muted, .sc-next.is-live .eyebrow { color: var(--on-dark-muted); }
.sc-next.is-live .cta--solid { background: #fff; color: var(--ink); }
.sc-next.is-live .btn-text { color: var(--on-dark-muted); border-color: var(--line-on-dark); }
.sc-next__notes { margin-top: 0.75rem; }
.sc-tz, .sc-hint { font-size: 0.82rem; margin-top: 0.5rem; }
.sc-weekbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; }
.sc-weekbar strong { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; }
.sc-week { display: grid; gap: 0.75rem; }
@media (min-width: 760px) { .sc-week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.5rem; } }
.sc-day { border-top: 1px dashed var(--line); padding-top: 0.6rem; display: grid; gap: 0.5rem; align-content: start; min-height: 4rem; }
.sc-day h3 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 400; color: var(--ink-muted); }
.sc-day.is-today { border-top: 2px solid var(--ink); }
.sc-day.is-today h3 { color: var(--ink); }
.sc-day__empty { color: var(--ink-faint); }
.sc-item { display: grid; gap: 0.15rem; background: var(--surface-grey); padding: 0.55rem 0.65rem; font-size: 0.85rem; border-left: 2px solid var(--ink); transition: background 0.2s; }
.sc-item:hover { background: #e9e9e9; }
.sc-item__time { font-size: 0.75rem; color: var(--ink-muted); }
.sc-item__title { font-weight: 500; }
.sc-item__who { font-size: 0.78rem; color: var(--ink-muted); }
.sc-item.is-cancelled { opacity: 0.55; text-decoration: line-through; border-left-color: var(--ink-faint); }

/* ---------- 2026-10-19: rich lesson text, imported exercises and tests ---------- */
.p-lesson__body h4 { font-size: 1.1rem; font-weight: 500; margin-top: 1.6rem; }
.p-lesson__body ol { padding-left: 1.4rem; margin-top: 0.6rem; }
.p-lesson__body ol li { padding-left: 0.2rem; }
.p-lesson__body ol li::before { content: none; }
.p-lesson__body hr { border: 0; border-top: 1px dashed var(--line); margin: 2rem 0; }
.p-lesson__body blockquote { margin: 1.2rem 0; padding: 1rem 1.25rem; background: var(--surface-grey); border-left: 2px solid var(--ink); font-size: 1rem; }
.p-lesson__body blockquote p + p { margin-top: 0.7rem; }
.p-lesson__body code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; background: var(--surface-grey); padding: 0.05rem 0.3rem; }
.md-table { overflow-x: auto; margin: 1rem 0; }
.md-table table { border-collapse: collapse; font-size: 0.95rem; line-height: 1.45; min-width: 60%; }
.md-table th, .md-table td { text-align: left; vertical-align: top; padding: 0.55rem 1rem 0.55rem 0; border-top: 1px dashed var(--line); }
.md-table th { font-weight: 500; font-size: 0.85rem; border-top: 0; border-bottom: 1px solid var(--line-strong); }
.md-table tr:last-child td { border-bottom: 1px dashed var(--line); }

.qz-sec { margin-top: 1.75rem; }
.qz-sec h3 { font-size: 1.15rem; font-weight: 500; }
.qz-sec--major { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--ink); }
.qz-sec--major h3 { font-family: var(--serif); font-weight: 400; font-size: 1.7rem; }
.qz-sec__text { font-size: 1rem; margin-top: 0.5rem; }
.qz-note { margin-top: 0.6rem; font-size: 0.9rem; color: var(--ink-muted); border: 1px dashed var(--line-strong); padding: 0.6rem 0.8rem; }
.qz-reveal { border: 1px dashed var(--line-strong); padding: 1rem 1.2rem; }
.qz-reveal .p-lesson__body { font-size: 1rem; }
.qz-reveal__answer { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px dashed var(--line); }
.ex-gap--long { display: block; width: 100%; min-width: 0; margin-top: 0.5rem; }
.ex-opts--row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.lp__link--test { background: var(--ink); color: #fff; border-color: var(--ink); }
.lp__link--test span:last-child { color: rgba(255, 255, 255, 0.7); }
.lp__link--test .eyebrow { color: rgba(255, 255, 255, 0.7); }
@media (min-width: 900px) { .lp__links { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); } }

/* ---------- Enquiries ---------- */
.enq { border-top: 1px dashed var(--line); padding: 1.5rem 0; }
.enq.is-new { border-top: 2px solid var(--ink); }
.enq__head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.enq__head h2 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; }
.enq__head a { text-decoration: underline; text-underline-offset: 0.2em; text-decoration-color: var(--line-strong); }
.enq__side { display: flex; align-items: center; gap: 0.75rem; }
.enq__facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.6rem 1.5rem; margin-top: 1rem; }
.enq__facts dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-faint); }
.enq__facts dd { font-size: 0.95rem; margin-top: 0.15rem; }
.enq__msg { margin: 1rem 0; padding: 0.9rem 1.1rem; background: var(--surface-grey); white-space: pre-wrap; line-height: 1.6; max-width: 60rem; }
