:root {
  --bg: #0b0710;
  --bg-2: #140c18;
  --card: rgba(255, 255, 255, 0.035);
  --card-hover: rgba(255, 255, 255, 0.06);
  --gold: #d4a24c;
  --gold-soft: rgba(212, 162, 76, 0.35);
  --gold-faint: rgba(212, 162, 76, 0.14);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --faint: rgba(255, 255, 255, 0.38);
  --danger: #e07a7a;
  --ok: #7fc99a;
  --radius: 14px;
  --rail: 84px;
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 12% -8%, rgba(122, 28, 72, 0.30), transparent 62%),
    radial-gradient(900px 600px at 105% 12%, rgba(78, 32, 110, 0.24), transparent 60%),
    radial-gradient(900px 700px at 50% 115%, rgba(96, 22, 52, 0.20), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
a { color: var(--gold); }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: .01em; }
[hidden] { display: none !important; }

.ico {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Navigation */
.nav {
  position: fixed; z-index: 30;
  display: flex;
  background: rgba(14, 8, 18, 0.86);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 10.5px; line-height: 1.15; text-align: center;
  border-radius: 12px; transition: color .2s, background .2s;
}
.nav-btn:hover, .nav-btn:focus-visible { color: var(--text); background: var(--card-hover); outline: none; }
.nav-btn.active { color: var(--gold); }
.nav-btn[aria-disabled="true"], .nav-btn[aria-disabled="true"]:hover { opacity: .35; color: var(--muted); background: transparent; cursor: default; }
body.is-login .nav { display: none; }

/* viewport-fit=cover lets the installed iOS app draw under the status bar and notch: pad for the safe areas. */
@media (min-width: 768px) {
  .nav {
    top: 0; left: 0; bottom: 0; width: calc(var(--rail) + var(--safe-l));
    flex-direction: column; justify-content: center; gap: 10px;
    padding: calc(16px + var(--safe-t)) 8px calc(16px + var(--safe-b)) calc(8px + var(--safe-l));
    border-right: 1px solid var(--gold-faint);
  }
  .nav-btn { width: 100%; padding: 10px 2px; }
  .view { padding: calc(40px + var(--safe-t)) calc(48px + var(--safe-r)) calc(64px + var(--safe-b)) calc(var(--rail) + var(--safe-l) + 48px); }
  body.is-login .view { padding-left: calc(48px + var(--safe-l)); }
}
@media (max-width: 767px) {
  .nav {
    left: 0; right: 0; bottom: 0;
    height: calc(var(--tabbar) + var(--safe-b));
    padding: 0 calc(4px + var(--safe-r)) var(--safe-b) calc(4px + var(--safe-l));
    border-top: 1px solid var(--gold-faint);
    justify-content: space-around;
  }
  .nav-btn { flex: 1; min-width: 0; height: var(--tabbar); padding: 6px 2px; font-size: 10px; }
  /* Six tabs on a 320 px phone: a label never spills into its neighbour. */
  .nav-btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-btn[data-action="install"] span { font-size: 0; }
  .nav-btn[data-action="install"] span::after { content: "Install"; font-size: 10px; }
  .view { padding: calc(22px + var(--safe-t)) calc(16px + var(--safe-r)) calc(var(--tabbar) + var(--safe-b) + 28px) calc(16px + var(--safe-l)); }
  body.is-login .view { padding-bottom: calc(28px + var(--safe-b)); }
}

.view { max-width: 1280px; min-height: 100vh; outline: none; }
@media (min-width: 768px) { .view { margin: 0 auto; max-width: calc(1280px + var(--rail)); } }
.page { animation: fadeIn .35s var(--ease) both; }
.page.no-anim { animation: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Typography */
.app-name { color: var(--gold); font-size: 13px; letter-spacing: .22em; text-transform: uppercase; font-weight: 600; }
.page-title { color: var(--gold); font-size: clamp(22px, 3.2vw, 30px); line-height: 1.2; margin: 6px 0 22px; }
.section-title { color: var(--gold); font-size: 18px; margin: 30px 0 14px; }
.muted { color: var(--muted); }
.crumb {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 4px;
  color: var(--muted); font-size: 13px; text-decoration: none;
}
.crumb:hover { color: var(--gold); }
.crumb .ico { width: 16px; height: 16px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border-radius: 999px;
  border: 1px solid transparent; background: transparent; cursor: pointer;
  font-weight: 600; font-size: 15px; text-decoration: none; color: var(--text);
  transition: transform .15s var(--ease), background .2s, border-color .2s, color .2s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: default; }
.btn .ico { width: 19px; height: 19px; }
.btn-gold { background: linear-gradient(180deg, #e2b562, #c28f3a); color: #1a0f08; }
.btn-gold:hover { background: linear-gradient(180deg, #ebc275, #cf9b45); }
.btn-outline { border-color: var(--gold-soft); color: var(--gold); }
.btn-outline:hover { border-color: var(--gold); background: var(--gold-faint); }
.btn-ghost { background: var(--card); border-color: rgba(255,255,255,.08); }
.btn-ghost:hover { background: var(--card-hover); }
.btn-block { width: 100%; margin-top: 12px; }
.btn-done { border-color: rgba(127, 201, 154, .5); color: var(--ok); background: rgba(127, 201, 154, .08); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--card-hover); }

/* Login */
.login {
  min-height: calc(100vh - 80px);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 100%; max-width: 420px; padding: 36px 28px 30px; text-align: center;
  border: 1px solid var(--gold-soft); border-radius: 22px;
  background: linear-gradient(180deg, rgba(40, 16, 34, .55), rgba(16, 9, 20, .7));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.login-logo { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 22px; }
.login-card .app-name { font-size: 17px; letter-spacing: .16em; }
.login-card p { color: var(--muted); margin: 14px 0 22px; }
.input {
  width: 100%; height: 50px; padding: 0 16px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .14); background: rgba(0, 0, 0, .35);
  color: var(--text); font-size: 16px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-faint); }
.form-error { color: var(--danger); font-size: 14px; margin: 12px 0 0; text-align: left; }
.login-card .login-welcome { margin: 12px 0 18px; }
.login-label { display: block; color: var(--text); font-weight: 600; font-size: 16px; line-height: 1.4; }
.login-card .login-sub { font-size: 13.5px; margin: 6px 0 16px; }
.form-error-hint { display: block; margin-top: 8px; color: var(--text); opacity: .85; }
.login-help {
  margin-top: 22px; padding: 16px 16px 14px; border-radius: 16px;
  border: 1px solid var(--gold-soft); background: var(--gold-faint);
  transition: border-color .3s, box-shadow .3s;
}
.login-help.is-alert { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-faint); }
.login-card .login-help-title { color: var(--gold); font-weight: 600; font-size: 16px; margin: 0; }
.login-card .login-help-text { color: var(--text); font-size: 14px; margin: 4px 0 0; }
.login-help .btn { white-space: normal; text-align: center; padding: 10px 14px; gap: 7px; font-size: 14.5px; }
.login-help-mail { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 400px) {
  .login-card { padding: 30px 18px 24px; }
  .login-help { padding: 14px 12px 12px; }
}

/* Cards and grids */
.grid { display: grid; gap: 18px; }
.grid-products { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid-modules { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
@media (max-width: 767px) {
  .grid { gap: 12px; }
  .grid-products { grid-template-columns: repeat(2, 1fr); }
  .grid-modules { grid-template-columns: repeat(2, 1fr); }
}

.card {
  position: relative; display: flex; flex-direction: column; justify-content: flex-start;
  width: 100%; padding: 0; text-align: left; font: inherit;
  border: 1px solid var(--gold-soft); border-radius: var(--radius);
  background: var(--card); overflow: hidden; cursor: pointer; color: var(--text); text-decoration: none;
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
.card:hover, .card:focus-visible {
  transform: translateY(-3px); border-color: var(--gold); outline: none;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45), 0 0 0 1px var(--gold-faint);
}
.cover {
  position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden;
  background: linear-gradient(135deg, #2a1024, #150b1b 60%, #0f0913);
}
.cover-tall { aspect-ratio: 9 / 16; }
.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease), opacity .4s; }
.card:hover .cover img { transform: scale(1.03); }
.cover-fallback {
  position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 14px;
  color: var(--gold); font-weight: 600; font-size: 15px; line-height: 1.25;
}
.card-body { padding: 10px 12px 12px; }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Long words wrap (hyphenated where the browser knows the word, lang="en") instead of being cut off. */
.card-title, .page-title, .lesson-title { overflow-wrap: break-word; overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto; }
.card-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.card.locked .cover img, .card.locked .cover-fallback { opacity: .38; filter: grayscale(.5); }
.card.locked .card-title { color: var(--muted); }
.lock-badge {
  position: absolute; top: 10px; right: 10px; display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(11, 7, 16, .78); border: 1px solid var(--gold-soft); color: var(--gold);
}
.lock-badge .ico { width: 17px; height: 17px; }
.done-badge {
  position: absolute; top: 10px; right: 10px; display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: #1a0f08;
}
.done-badge .ico { width: 16px; height: 16px; stroke-width: 2.4; }
/* Product group (the explicit practice courses): age badge on the card, notice above the courses inside */
.age-badge {
  position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 999px;
  background: rgba(11, 7, 16, .82); border: 1px solid var(--gold); color: var(--gold);
  font-size: 12px; font-weight: 700; letter-spacing: .04em; line-height: 1.3; white-space: nowrap;
}
.group-intro {
  display: flex; gap: 12px; align-items: flex-start; max-width: 900px; margin: -8px 0 22px; padding: 14px 16px;
  border: 1px solid var(--gold-soft); border-radius: var(--radius); background: var(--gold-faint);
}
.group-intro p { margin: 0; line-height: 1.5; }
.age-chip {
  flex: none; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--gold); color: var(--gold);
  font-size: 12px; font-weight: 700; line-height: 1.6; white-space: nowrap;
}

.progress { height: 3px; margin-top: 8px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--gold); border-radius: 3px; transition: width .4s var(--ease); }

/* Continue card */
.continue {
  display: flex; align-items: center; gap: 14px; width: 100%; margin: 0 0 8px; padding: 14px 16px;
  border: 1px solid var(--gold-soft); border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(212, 162, 76, .10), rgba(255, 255, 255, .02));
  color: var(--text); text-align: left; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.continue:hover { border-color: var(--gold); }
.continue, .lesson-row { text-decoration: none; }
.cover { flex: none; }
.continue-play {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; background: var(--gold); color: #1a0f08;
}
.continue-play .ico { fill: currentColor; stroke: none; }
.continue-label { font-size: 12px; color: var(--gold); text-transform: uppercase; letter-spacing: .12em; }
.continue-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue-text { min-width: 0; }

/* Lesson list */
.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 900px; }
.lesson-row {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px;
  border: 1px solid rgba(212, 162, 76, .22); border-radius: 12px; background: var(--card);
  color: var(--text); text-align: left; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.lesson-row:hover, .lesson-row:focus-visible { border-color: var(--gold); background: var(--card-hover); outline: none; }
.lesson-num {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--gold-soft); color: var(--gold); font-size: 13px; font-weight: 600;
}
.lesson-type { flex: none; color: var(--faint); }
.lesson-type .ico { width: 18px; height: 18px; }
.lesson-main { flex: 1; min-width: 0; }
.lesson-title { font-weight: 500; line-height: 1.35; }
.lesson-sub { font-size: 12px; color: var(--muted); }
.lesson-dur { flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lesson-check {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .18); color: transparent;
}
.lesson-check .ico { width: 15px; height: 15px; stroke-width: 2.4; }
.lesson-row.done .lesson-check { background: var(--gold); border-color: var(--gold); color: #1a0f08; }
.lesson-row.done .lesson-num { background: var(--gold-faint); }
.lesson-row.current { border-color: var(--gold); }

/* Lesson page */
.lesson-page { max-width: 1040px; }
.player {
  position: relative; width: 100%; aspect-ratio: 16 / 9; margin: 0 auto;
  border-radius: var(--radius); overflow: hidden; background: #000;
  border: 1px solid var(--gold-faint); box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.player.vertical { aspect-ratio: 9 / 16; width: min(100%, calc(80vh * 9 / 16)); max-height: 80vh; }
@supports not (aspect-ratio: 1 / 1) {
  .player { height: 0; padding-top: 56.25%; }
  .player.vertical { width: min(100%, 45vh); height: 80vh; padding-top: 0; }
}
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-frame { position: relative; width: 100%; height: 75vh; min-height: 420px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--gold-faint); background: #111; }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
@media (max-width: 767px) { .player-frame { height: 65vh; min-height: 320px; } }
/* PDF lesson on a phone or tablet: no iframe, a card with a large button that opens the device's PDF viewer. */
.pdf-card {
  display: flex; flex-direction: column; align-items: center; max-width: 560px; margin: 0 auto; padding: 28px 22px 22px;
  text-align: center; border: 1px solid var(--gold-soft); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(212, 162, 76, .10), rgba(255, 255, 255, .02));
}
.pdf-card-icon {
  display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%;
  background: var(--gold-faint); border: 1px solid var(--gold-soft); color: var(--gold);
}
.pdf-card-icon .ico { width: 32px; height: 32px; stroke-width: 1.5; }
.pdf-card-text { margin: 14px 0 4px; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.pdf-card .pdf-card-btn { min-height: 56px; font-size: 17px; }
.pdf-card-btn .ico { width: 22px; height: 22px; }
.lesson-head { margin: 20px 0 6px; }
.lesson-head .page-title { margin: 4px 0 0; }
.lesson-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0; }
.lesson-actions .spacer { flex: 1; }
@media (max-width: 767px) {
  .lesson-actions .btn { flex: 1 1 40%; padding: 10px 12px; font-size: 14px; }
  .lesson-actions .btn-toggle { flex-basis: 100%; order: -1; }
  .lesson-actions .spacer { display: none; }
}
.text-content {
  max-width: 760px; padding: 22px 24px; border: 1px solid var(--gold-faint); border-radius: var(--radius);
  background: var(--card); line-height: 1.7; overflow-wrap: anywhere;
}
.text-content h1, .text-content h2, .text-content h3 { color: var(--gold); margin: 1em 0 .4em; }
.text-content img { height: auto; border-radius: 10px; }
.text-content iframe { max-width: 100%; }
.text-content > :first-child { margin-top: 0; }

/* Search */
.search-box { position: relative; max-width: 640px; margin-bottom: 20px; }
.search-box .ico { position: absolute; left: 14px; top: 14px; color: var(--faint); }
.search-box .input { padding-left: 46px; }

/* Certificate tab: form and preview side by side on wide screens, stacked on a phone. */
.cert-page { max-width: 1100px; }
.cert-intro { color: var(--muted); max-width: 680px; margin: -10px 0 22px; }
.cert-intro strong { color: var(--text); font-weight: 600; }
.cert-layout { display: grid; gap: 22px; align-items: start; }
@media (min-width: 1024px) { .cert-layout { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 28px; } }
.cert-form { padding: 18px 18px 16px; border: 1px solid var(--gold-soft); border-radius: var(--radius); background: var(--card); }
.cert-label { display: block; font-weight: 600; font-size: 16px; }
.cert-hint { margin: 2px 0 12px; color: var(--muted); font-size: 13.5px; }
.cert-form .form-error { margin: 10px 0 0; }
.cert-form .form-error:empty { margin: 0; }
.cert-form .btn-block { margin-top: 14px; }
.cert-preview {
  position: relative; margin: 0; aspect-ratio: 297 / 210; overflow: hidden;
  border: 1px solid var(--gold-soft); border-radius: 10px; background: rgba(251, 246, 236, .04);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}
@supports not (aspect-ratio: 1 / 1) { .cert-preview { height: 0; padding-top: 70.7%; } }
.cert-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .2s; }
.cert-preview.is-empty { border-style: dashed; box-shadow: none; }
.cert-preview.is-stale img { opacity: .4; }
.cert-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 16px; text-align: center; color: var(--muted); font-size: 14px;
}
.cert-empty .ico { width: 34px; height: 34px; color: var(--gold); stroke-width: 1.4; }
.cert-status { margin: 12px 0 0; color: var(--ok); font-size: 14px; font-weight: 600; }
.cert-status:empty { margin: 0; }
.cert-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.cert-actions .btn { flex: 1 1 210px; }
.cert-note { margin: 10px 0 0; color: var(--muted); font-size: 13.5px; }
/* Scrolled into view after "Create certificate": clear of the bottom tab bar. */
@media (max-width: 767px) { .cert-result { scroll-margin-bottom: calc(var(--tabbar) + var(--safe-b) + 16px); } }

/* States */
.state { max-width: 520px; margin: 48px auto; padding: 30px 24px; text-align: center; border: 1px dashed var(--gold-soft); border-radius: var(--radius); color: var(--muted); }
.state h3 { color: var(--text); margin-bottom: 8px; font-size: 17px; }
.state .btn { margin-top: 16px; }

.skel { position: relative; overflow: hidden; background: rgba(255, 255, 255, .05); border-radius: 10px; }
.skel::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-title { height: 28px; width: 46%; max-width: 360px; margin: 6px 0 24px; }
.skel-card { aspect-ratio: 1 / 1; border-radius: var(--radius); }
.skel-card.tall { aspect-ratio: 9 / 16; }
.skel-row { height: 56px; border-radius: 12px; }
.skel-player { aspect-ratio: 16 / 9; border-radius: var(--radius); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 3, 8, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .2s both; }
.modal-card {
  position: relative; width: 100%; max-width: 400px; padding: 26px 22px 22px;
  border: 1px solid var(--gold-soft); border-radius: 20px;
  background: linear-gradient(180deg, #1d0f1d, #120a16);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  animation: pop .25s var(--ease) both;
}
.modal-card p { margin: 10px 0; }
.modal-title { color: var(--gold); font-size: 20px; padding-right: 36px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
#help-mail-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The help modal grows with the feedback form: it scrolls inside instead of leaving the screen. */
.modal-card { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Feedback (help modal) */
.feedback { margin: 16px 0 0; padding: 16px; border: 1px solid var(--gold-faint); border-radius: var(--radius); background: var(--card); }
.feedback-title { color: var(--gold); font-size: 16px; }
.modal-card .feedback-sub { margin: 4px 0 10px; font-size: 13.5px; }
.modal-card .feedback-sub + .feedback-sub { margin-top: -6px; }
.stars { display: flex; gap: 4px; margin: 0 0 12px -6px; }
.star {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--faint); cursor: pointer;
  transition: color .15s, transform .15s var(--ease), background .2s;
}
.star .ico { width: 28px; height: 28px; stroke-width: 1.5; }
.star:hover, .star:focus-visible { color: var(--gold); background: var(--gold-faint); outline: none; }
.star:active { transform: scale(.92); }
.star.on { color: var(--gold); }
.star.on .ico { fill: currentColor; }
.textarea { display: block; height: auto; min-height: 104px; padding: 12px 16px; line-height: 1.45; font-family: inherit; resize: vertical; }
.feedback .form-error { margin: 10px 0 0; }
.modal-card .feedback-ok { margin: 10px 0 0; color: var(--ok); font-size: 14px; font-weight: 600; }
/* The notices are always-present live regions: empty, they take no space. */
.feedback .form-error:empty, .modal-card .feedback-ok:empty { margin: 0; }
.help-support { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--gold-faint); }
.help-support p { color: var(--muted); font-size: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (max-width: 767px) {
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { max-width: none; border-radius: 20px 20px 0 0; padding-bottom: calc(22px + var(--safe-b)); }
}

/* Toasts */
.toasts {
  position: fixed; z-index: 80; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + var(--safe-b)); width: calc(100% - 32px); max-width: 420px;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
@media (max-width: 767px) { .toasts { bottom: calc(var(--tabbar) + var(--safe-b) + 12px); } }
.toast {
  padding: 12px 16px; border-radius: 12px; font-size: 14px;
  background: rgba(30, 18, 32, .96); border: 1px solid var(--gold-soft); color: var(--text);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
  animation: toastIn .25s var(--ease) both;
}
.toast.error { border-color: rgba(224, 122, 122, .6); }
.toast.hide { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.summary { color: var(--muted); font-size: 14px; margin: -12px 0 18px; }
.search-box + div .summary { margin: 0 0 12px; }
.eyebrow { color: var(--gold); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.media-links { margin-top: 12px; }
.lesson-page .crumb { margin-bottom: 14px; }
.lesson-page .section-title { margin-top: 36px; }

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