/* Peergene course app.
   Look: a study notebook you swipe like a feed. Ballpoint-blue ink on cool paper,
   highlighter yellow for what matters. Card colour tells you the kind of card:
   paper = learn, yellow = quick check, ink = remember. */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/bricolage-grotesque-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-next-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-next-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #F5F7FC;
  --sheet: #FFFFFF;
  --ink: #1F2A5A;
  --ink-soft: #535D88;
  --rule: #D6DCEC;
  --dot: rgba(31, 42, 90, 0.12);
  --hl: #FFE14D;
  --on-hl: #1F2A5A;
  --mark-bg: #FFE14D;
  --mark-ink: #1F2A5A;
  --quiz: #FFEC85;
  --quiz-ink: #1F2A5A;
  --quiz-opt: #FFFFFF;
  --quiz-mark-bg: rgba(255, 255, 255, 0.75);
  --key: #1F2A5A;
  --key-ink: #F5F7FC;
  --key-label: #FFE14D;
  --key-mark-bg: #FFE14D;
  --key-mark-ink: #1F2A5A;
  --right: #74E3AA;
  --wrong: #FF9DBC;
  --on-answer: #14203F;
  --bar: #1F2A5A;
  --warn: #C98A00;
  --focus: #2F6BFF;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text: "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141A35;
    --sheet: #1C2347;
    --ink: #E8ECFB;
    --ink-soft: #A7AFD6;
    --rule: #2E3768;
    --dot: rgba(232, 236, 251, 0.07);
    --mark-bg: rgba(255, 225, 77, 0.22);
    --mark-ink: #FFF0A3;
    --quiz: #242E63;
    --quiz-ink: #F3F5FF;
    --quiz-opt: #1A2149;
    --quiz-mark-bg: rgba(255, 225, 77, 0.22);
    --key: #FFE14D;
    --key-ink: #1F2A5A;
    --key-label: #1F2A5A;
    --key-mark-bg: rgba(31, 42, 90, 0.14);
    --key-mark-ink: #1F2A5A;
    --bar: #FFE14D;
    --warn: #FFC94D;
    --focus: #FFE14D;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
html.in-lesson, html.in-lesson body { height: 100%; overflow: hidden; overscroll-behavior: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { display: block; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Highlighter marks: **like this** in a course file */
strong { font-weight: 750; }
.txt strong, .q strong, .key-text strong, .sheet h3 strong, .slide h2 strong {
  padding: 0.02em 0.16em;
  margin: 0 -0.04em;
  border-radius: 0.3em 0.12em 0.34em 0.1em;
  background: var(--mark-bg);
  color: var(--mark-ink);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.k-quiz .txt strong, .k-quiz .q strong { background: var(--quiz-mark-bg); color: inherit; }
.key-text strong { background: var(--key-mark-bg); color: var(--key-mark-ink); }

/* ---------- Screens: home and course ---------- */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(14px + env(safe-area-inset-top)) 20px calc(48px + env(safe-area-inset-bottom));
  background-color: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1.15px, transparent 1.5px);
  background-size: 22px 22px;
}
.wrap { max-width: 560px; margin: 0 auto; }
.muted { color: var(--ink-soft); }

.topbar { display: flex; align-items: center; gap: 10px; min-height: 52px; margin-bottom: 14px; }
.brand {
  margin: 0 auto 0 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.035em;
  text-decoration: none;
}
.pill { font-size: 13px; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: var(--rule); }
.btn-small {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 2px solid currentColor;
  background: transparent;
  font-weight: 750;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
}

.tip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 12px 12px 16px;
  border-radius: 16px;
  background: var(--sheet);
  border: 1.5px solid var(--rule);
  font-size: 15.5px;
  line-height: 1.4;
}
.tip p { margin: 0; flex: 1; }

/* The lesson to do next: a highlighter-yellow note */
.hero {
  display: block;
  margin: 4px 0 14px;
  padding: 22px 20px 20px;
  border-radius: 26px 26px 26px 8px;
  background: var(--hl);
  color: var(--on-hl);
  text-decoration: none;
}
.hero-icon { display: block; font-size: 40px; line-height: 1; margin-bottom: 16px; }
.hero-title {
  display: block;
  font-family: var(--display);
  font-weight: 760;
  font-size: clamp(30px, 8.6vw, 40px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.hero-meta { display: block; margin-top: 10px; font-size: 16px; line-height: 1.35; opacity: 0.82; }
.hero-go {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  min-height: 54px;
  padding: 0 18px;
  border-radius: 15px;
  background: var(--on-hl);
  color: var(--hl);
  font-weight: 800;
  font-size: 17.5px;
}
.hero-mins { font-weight: 600; font-size: 15px; opacity: 0.85; }
.hero.is-quiet .hero-title { font-size: 26px; }
.hero:active { transform: scale(0.99); }

.streak { margin: 0 0 24px; padding-left: 2px; font-size: 16px; color: var(--ink-soft); }

.section-title {
  margin: 10px 0 4px;
  font-family: var(--display);
  font-weight: 720;
  font-size: 23px;
  letter-spacing: -0.02em;
}

.course-list, .lessons { list-style: none; margin: 0; padding: 0; }
.course-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 15px;
  align-items: start;
  padding: 18px 0 20px;
  border-top: 1.5px solid var(--rule);
  text-decoration: none;
  color: inherit;
}
.course-list li:last-child .course-item { border-bottom: 1.5px solid var(--rule); }
.course-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: var(--sheet);
  border: 1.5px solid var(--rule);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}
.course-name {
  display: block;
  font-family: var(--display);
  font-weight: 720;
  font-size: 21.5px;
  line-height: 1.12;
  letter-spacing: -0.015em;
}
.course-about { display: block; margin-top: 5px; font-size: 15.5px; line-height: 1.4; color: var(--ink-soft); }
.course-item:hover .course-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.course-item.is-broken .course-icon { color: var(--warn); border-color: var(--warn); }

.meter { display: block; height: 6px; margin-top: 13px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--bar); }
.meter.large { height: 8px; margin-top: 4px; }
.course-count { display: block; margin: 7px 0 0; font-size: 14.5px; color: var(--ink-soft); }

.notice {
  margin: 18px 0 24px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--sheet);
  border: 2px solid var(--warn);
  font-size: 15.5px;
  line-height: 1.45;
}
.notice p { margin: 0 0 6px; }
.notice ul { margin: 6px 0; padding-left: 1.1em; }
.notice li { margin-bottom: 6px; }
.notice-title { font-weight: 800; }
.notice-foot { color: var(--ink-soft); }

/* Course page */
.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  margin: 0 0 8px -8px;
  padding: 0 10px 0 2px;
  font-weight: 750;
  text-decoration: none;
}
.back svg { width: 26px; height: 26px; }
.course-head { margin: 6px 0 30px; }
.course-icon.large { width: 74px; height: 74px; margin-bottom: 18px; border-radius: 22px; font-size: 40px; }
.course-head h1 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-weight: 780;
  font-size: clamp(36px, 10vw, 48px);
  line-height: 1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.about { margin: 0 0 20px; font-size: 18px; line-height: 1.45; color: var(--ink-soft); }
.course-head .course-count { margin-bottom: 20px; }
.all-done { font-weight: 750; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 12px 22px;
  border-radius: 16px;
  border: 2px solid currentColor;
  background: transparent;
  color: inherit;
  font-weight: 800;
  font-size: 17px;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.wide { display: flex; width: 100%; }
.btn:active { transform: scale(0.985); }

.module { margin-bottom: 28px; }
.module h2 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 720;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.lesson-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 13px;
  align-items: center;
  min-height: 64px;
  padding: 12px 0;
  border-top: 1.5px solid var(--rule);
  text-decoration: none;
}
.lessons li:last-child .lesson-row { border-bottom: 1.5px solid var(--rule); }
.num {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid currentColor;
  font-weight: 800;
  font-size: 15px;
}
.num svg { width: 19px; height: 19px; }
.is-done .num { background: var(--right); border-color: var(--right); color: var(--on-answer); }
.lesson-title { font-size: 18px; font-weight: 650; line-height: 1.3; }
.is-next .lesson-name {
  padding: 0.02em 0.16em;
  margin: 0 -0.16em;
  border-radius: 0.3em 0.12em 0.34em 0.1em;
  background: var(--mark-bg);
  color: var(--mark-ink);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.mins { font-size: 14.5px; color: var(--ink-soft); white-space: nowrap; }

/* ---------- Lesson player: one card per screen, swipe up for the next ---------- */
.player {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--paper);
  color: var(--ink);
}
.player-top {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 680px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px 6px;
  pointer-events: none;
  transition: color 0.2s;
}
.player-top > * { pointer-events: auto; }
.player[data-kind="quiz"] .player-top { color: var(--quiz-ink); }
.player[data-kind="key"] .player-top { color: var(--key-ink); }
.icon-btn {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.icon-btn svg { width: 24px; height: 24px; }
.bar {
  flex: 1;
  height: 8px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(127, 127, 127, 0.25);
  background: color-mix(in srgb, currentColor 16%, transparent);
}
.bar > span { display: block; width: 0; height: 100%; border-radius: 6px; background: currentColor; transition: width 0.3s ease; }
.pos { min-width: 3em; text-align: right; font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; }

.feed {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }
.feed:focus { outline: none; }
.slide {
  position: relative;
  display: flex;
  height: 100%;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.slide-inner {
  width: 100%;
  max-width: 620px;
  max-height: 100%;
  margin: auto;
  overflow-y: auto;
  padding: calc(74px + env(safe-area-inset-top)) 24px calc(108px + env(safe-area-inset-bottom));
}
.k-card, .k-done {
  background-color: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1.15px, transparent 1.5px);
  background-size: 22px 22px;
}
.k-quiz { background: var(--quiz); color: var(--quiz-ink); }
.k-key { background: var(--key); color: var(--key-ink); }

.emoji { margin: 0 0 20px; font-size: 62px; line-height: 1; }
.slide h2 {
  margin: 0 0 20px;
  font-family: var(--display);
  font-weight: 760;
  font-size: clamp(31px, 8.6vw, 42px);
  line-height: 1.03;
  letter-spacing: -0.032em;
  text-wrap: balance;
}
.txt p, .txt ul { margin: 0 0 14px; font-size: 19.5px; line-height: 1.5; max-width: 32em; }
.txt ul { padding-left: 1.15em; }
.txt li { margin-bottom: 6px; }
.txt a { font-weight: 700; text-decoration-thickness: 2px; text-underline-offset: 3px; }

.more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  margin-top: 6px;
  padding: 0 18px 0 14px;
  border-radius: 999px;
  border: 2px solid currentColor;
  background: transparent;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
}
.more-btn svg { width: 20px; height: 20px; }

.media { margin: 0 0 20px; border-radius: 18px; overflow: hidden; background: var(--rule); }
.media img { display: block; width: 100%; height: auto; max-height: 42vh; object-fit: cover; }
.media.video { aspect-ratio: 16 / 9; }
.media.video iframe { display: block; width: 100%; height: 100%; border: 0; }

.label { margin: 0 0 12px; font-size: 16px; font-weight: 800; }
.k-key .label { color: var(--key-label); }
.k-quiz .q { font-size: clamp(27px, 7.4vw, 36px); }
.k-quiz .txt p { font-size: 18.5px; }

.options { display: grid; gap: 11px; margin: 24px 0 6px; }
.opt {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 14px 16px 14px 18px;
  border-radius: 17px;
  border: 2px solid currentColor;
  background: var(--quiz-opt);
  color: var(--quiz-ink);
  font-weight: 650;
  font-size: 18px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}
/* The highlighter swipe when you answer */
.opt::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.opt.is-right::before { background: var(--right); transform: scaleX(1); }
.opt.is-wrong::before { background: var(--wrong); transform: scaleX(1); }
.opt.is-right, .opt.is-wrong { color: var(--on-answer); border-color: var(--on-answer); }
.opt.is-dim { opacity: 0.5; }
.opt:disabled { cursor: default; }
.opt:not(:disabled):active { transform: scale(0.985); }
.opt-text { flex: 1; }
.opt-mark { flex: none; width: 24px; height: 24px; }
.opt-mark svg { width: 24px; height: 24px; }

.feedback { margin-top: 16px; }
.is-answered .feedback { animation: appear 0.35s ease both; }
.verdict { margin: 0 0 6px; font-family: var(--display); font-weight: 780; font-size: 26px; letter-spacing: -0.02em; }
.feedback .txt p { font-size: 18px; }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }

.key-text p {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 740;
  font-size: clamp(32px, 9vw, 46px);
  line-height: 1.07;
  letter-spacing: -0.032em;
  text-wrap: balance;
}
.key-text ul { font-size: 22px; padding-left: 1.1em; }

.done-mark {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  border-radius: 50%;
  background: var(--right);
  color: var(--on-answer);
}
.done-mark svg { width: 40px; height: 40px; }
.is-finished .done-mark { animation: pop 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
@keyframes pop { from { transform: scale(0.5); opacity: 0; } to { transform: none; opacity: 1; } }
.k-done h2 { margin-bottom: 6px; }
.done-lesson { margin: 0 0 18px; font-size: 19px; font-weight: 700; }
.done-stats p { margin: 0 0 6px; font-size: 18px; color: var(--ink-soft); }
.done-actions { display: grid; gap: 11px; margin-top: 28px; }

.next {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  width: 58px;
  height: 58px;
  margin-left: -29px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.next svg { width: 28px; height: 28px; }
.next:active { transform: scale(0.94); }
.player[data-kind="quiz"] .next { background: var(--quiz-ink); color: var(--quiz); }
.player[data-kind="key"] .next { background: var(--key-ink); color: var(--key); }

.hint {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: calc(92px + env(safe-area-inset-bottom));
  margin: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  pointer-events: none;
  animation: nudge 1.4s ease-in-out 0.6s 3;
}
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

/* "Tell me more" panel */
.sheet { position: fixed; inset: 0; z-index: 10; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(12, 17, 40, 0.5); opacity: 0; transition: opacity 0.22s; }
.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 640px;
  max-height: 80vh;
  max-height: 80dvh;
  margin: 0 auto;
  overflow-y: auto;
  padding: 6px 22px calc(30px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: var(--sheet);
  color: var(--ink);
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.is-open .sheet-backdrop { opacity: 1; }
.sheet.is-open .sheet-panel { transform: none; }
.sheet-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 -8px 6px 0;
  padding-top: 12px;
  background: var(--sheet);
}
.sheet-head h3 {
  flex: 1;
  margin: 0;
  font-family: var(--display);
  font-weight: 760;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.sheet-body p { font-size: 18.5px; }

@media (min-width: 760px) {
  .slide-inner { padding-left: 40px; padding-right: 40px; }
  .brand { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
