/* =========================================================
   Diction Masters — the shared page design system.
   Loaded on every page by base.html, straight after base.css.

   It holds the site chrome (header, footer, messages) and the pieces
   every learner page is built from, in the look first made for the
   dashboard and EchoSpell: a dark hero with breadcrumbs and a
   progress ring, then a warm workspace of cards that lift in 3D.

   Everything is prefixed `ui-`. The older app stylesheets (app.css,
   book.css, library.css, assessments.css, clash.css) still load where
   their pages need them; the "App extras" section at the bottom
   refines their components inside a `.ui` page without renaming
   anything a script relies on.
   ========================================================= */

:root {
  --ui-ground: #f2f5fc;
  --ui-card: #ffffff;
  --ui-good: #3D63E6;
  --ui-bad: #1846E0;
  --ui-wait: #e9ae00;
  --ui-shadow:
    0 1px 1px rgba(11, 26, 74, 0.04),
    0 4px 10px rgba(11, 26, 74, 0.06),
    0 18px 36px -14px rgba(11, 26, 74, 0.2);
  --ui-shadow-lift:
    0 2px 2px rgba(11, 26, 74, 0.05),
    0 14px 26px rgba(11, 26, 74, 0.1),
    0 34px 56px -18px rgba(11, 26, 74, 0.34);
}

@property --ui-p { syntax: "<number>"; inherits: false; initial-value: 0; }
@keyframes ui-rise { from { opacity: 0; translate: 0 14px; } }
@keyframes ui-ring { from { --ui-p: 0; } }
@keyframes ui-bar { from { transform: scaleX(0); } }
@keyframes ui-wave { to { transform: scale(1.08); } }
@keyframes ui-pulse { 50% { box-shadow: inset 0 -4px 8px rgba(24, 70, 224, 0.25), 0 0 0 8px rgba(255, 199, 44, 0.22); } }

/* =========================================================
   Site chrome
   ========================================================= */

.site-header {
  background: rgba(242, 245, 252, 0.86);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid rgba(11, 26, 74, 0.08);
  box-shadow: 0 6px 24px -18px rgba(11, 26, 74, 0.4);
}
.site-header__inner { min-height: 72px; height: auto; gap: 22px; flex-wrap: wrap; }
.brand__mark {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 13px;
  color: #FFD86B;
  background: linear-gradient(145deg, #23355a, #0b1a4a);
  box-shadow: 0 8px 16px rgba(11, 26, 74, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transform: perspective(300px) rotateY(-10deg);
  transition: transform 0.35s ease;
}
.brand:hover .brand__mark { transform: perspective(300px) rotateY(10deg); }
.brand__mark svg { width: 28px; height: 28px; }
.brand__name { font-size: 1.2rem; }

.main-nav { gap: 6px; }
.main-nav a {
  padding: 8px 14px;
  border-radius: 30px;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}
.main-nav a:hover { background: rgba(11, 26, 74, 0.06); color: var(--ink); }
.main-nav a[aria-current="page"] { background: var(--ink); color: #ffffff; }

.header-actions { gap: 12px; }
.header-actions .link-quiet {
  padding: 8px 14px;
  border: 0;
  border-radius: 30px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(11, 26, 74, 0.06);
  opacity: 1;
  transition: background 0.2s ease;
}
.header-actions .link-quiet:hover { background: rgba(11, 26, 74, 0.12); }
.header-actions .link-quiet[aria-current="page"] { color: #0b1a4a; background: linear-gradient(135deg, #FFD86B, #ffc72c); }
/* ---------- the account menu (My dashboard, Learning tools, Log out) ---------- */

.account-menu { position: relative; }
.account-menu > summary { list-style: none; }
.account-menu > summary::-webkit-details-marker,
.account-menu > summary::marker { display: none; content: ""; }

.account-menu__button {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 12px 4px 4px;
  border: 1px solid rgba(11, 26, 74, 0.12);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(11, 26, 74, 0.08);
  color: var(--ink);
  font-weight: 600; font-size: 0.9rem;
  cursor: pointer; user-select: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.account-menu__button:hover,
.account-menu[open] .account-menu__button { border-color: rgba(233, 174, 0, 0.55); box-shadow: 0 6px 16px rgba(11, 26, 74, 0.12); }
.account-menu__button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.account-menu__avatar {
  flex: 0 0 auto;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-serif); font-weight: 700; font-size: 0.95rem;
  color: #0b1a4a; background: linear-gradient(135deg, #FFC72C, #ffc72c);
  box-shadow: inset 0 -2px 0 rgba(11, 26, 74, 0.12);
}
.account-menu__avatar--big { width: 42px; height: 42px; font-size: 1.2rem; }
.account-menu__name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu__chevron { color: var(--ink-40); transition: transform 0.2s ease; }
.account-menu[open] .account-menu__chevron { transform: rotate(180deg); }

.account-menu__panel {
  position: absolute; right: 0; top: calc(100% + 12px); z-index: 30;
  width: 290px; padding: 8px;
  border-radius: 18px; background: #ffffff;
  border: 1px solid rgba(11, 26, 74, 0.08);
  box-shadow: 0 24px 48px rgba(11, 26, 74, 0.18), 0 2px 6px rgba(11, 26, 74, 0.06);
  transform-origin: top right;
  animation: account-menu-in 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
}
/* the little pointer up to the button */
.account-menu__panel::before {
  content: ""; position: absolute; top: -7px; right: 24px;
  width: 12px; height: 12px; transform: rotate(45deg);
  background: #ffffff;
  border-left: 1px solid rgba(11, 26, 74, 0.08); border-top: 1px solid rgba(11, 26, 74, 0.08);
}
@keyframes account-menu-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }

.account-menu__who {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 6px; padding: 12px 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(11, 26, 74, 0.04), rgba(233, 174, 0, 0.08));
}
.account-menu__identity { min-width: 0; }
.account-menu__identity strong { display: block; color: var(--ink); font-size: 0.97rem; line-height: 1.2; }
.account-menu__identity small { display: block; margin-top: 2px; color: var(--ink-70); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.account-menu__list { display: grid; gap: 2px; }
.account-menu__item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 12px;
  font: inherit; text-align: left;
  color: var(--ink); background: none; text-decoration: none; cursor: pointer;
  transition: background 0.15s ease;
}
.account-menu__item:hover, .account-menu__item:focus-visible { background: rgba(11, 26, 74, 0.05); outline: none; }
.account-menu__item[aria-current="page"] { background: rgba(233, 174, 0, 0.12); }
.account-menu__icon {
  flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--ink); background: rgba(11, 26, 74, 0.06);
  transition: background 0.15s ease, color 0.15s ease;
}
.account-menu__item:hover .account-menu__icon,
.account-menu__item[aria-current="page"] .account-menu__icon { color: #3D63E6; background: rgba(233, 174, 0, 0.18); }
.account-menu__text { display: flex; flex-direction: column; min-width: 0; }
.account-menu__text > span { font-size: 0.93rem; font-weight: 600; }
.account-menu__text small { margin-top: 1px; font-size: 0.78rem; color: var(--ink-40); }

.account-menu__logout { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid rgba(11, 26, 74, 0.08); }
.account-menu__item--out { color: var(--maroon); }
.account-menu__item--out .account-menu__icon { color: var(--maroon); background: rgba(24, 70, 224, 0.08); }
.account-menu__item--out:hover { background: rgba(24, 70, 224, 0.06); }
.account-menu__item--out:hover .account-menu__icon { color: #fff; background: var(--maroon); }

@media (prefers-reduced-motion: reduce) {
  .account-menu__panel { animation: none; }
  .account-menu__chevron { transition: none; }
}

.header-actions .btn--gold {
  border-radius: 30px;
  border-color: rgba(11, 26, 74, 0.25);
}
.phonemic-icon-btn {
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(11, 26, 74, 0.1), inset 0 -2px 0 rgba(11, 26, 74, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.phonemic-icon-btn:hover { transform: translateY(-2px) rotate(-3deg); box-shadow: 0 10px 18px rgba(11, 26, 74, 0.16); }

/* Messages float as toasts under the header, then fade away on their
   own — no script, so a page that is read later still shows them first. */
.messages {
  position: fixed;
  top: 86px; right: 0; left: 0;
  z-index: 40;
  pointer-events: none;
  animation: ui-toast-out 0.6s ease 9s forwards;
}
.messages .wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; list-style: none; margin: 0 auto; padding-top: 0; padding-bottom: 0; }
.messages .message { pointer-events: auto; max-width: min(520px, 100%); box-shadow: var(--ui-shadow-lift); }
@keyframes ui-toast-out { to { opacity: 0; visibility: hidden; translate: 0 -10px; } }
.message {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border: 0;
  border-left: 5px solid currentColor;
  border-radius: 14px;
  background: var(--ui-card);
  box-shadow: var(--ui-shadow);
  font-weight: 500;
  animation: ui-rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.message::before { font-size: 1.1rem; }
.message--success { color: #3D63E6; background: #F2F5FC; }
.message--success::before { content: "✓"; }
.message--error { color: #1846E0; background: #FFE9A8; }
.message--error::before { content: "!"; font-weight: 800; }
.message--info, .message--warning { color: #3D63E6; background: #fff5d6; }
.message--info::before, .message--warning::before { content: "i"; font-weight: 800; font-family: var(--font-serif); }

.site-footer {
  position: relative;
  overflow: hidden;
  padding: 64px 0 28px;
  background:
    radial-gradient(ellipse 45% 80% at 95% 0%, rgba(255, 199, 44, 0.14), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(160deg, #101b33, #0b1a4a 60%, #0B1A4A);
}
.site-footer__brand { display: flex; flex-direction: column; gap: 6px; }
.site-footer__brand .brand__name { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; }
.site-footer__logo { height: 36px; width: auto; max-width: 200px; object-fit: contain; }
.site-footer__mark {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 11px;
  font-family: var(--font-serif); font-style: italic; font-size: 1rem;
  color: #0b1a4a;
  background: linear-gradient(135deg, #FFD86B, #ffc72c);
}
.site-footer__links { gap: 6px; }
.site-footer__links a { padding: 8px 14px; border-radius: 30px; transition: background 0.2s ease; }
.site-footer__staff {
  border: 1px solid rgba(255, 199, 44, 0.45);
  color: #FFD86B !important;
  background: rgba(255, 199, 44, 0.12);
}
.site-footer__staff:hover { background: rgba(255, 199, 44, 0.24); }
.site-footer__links a:hover { background: rgba(255, 255, 255, 0.08); }
.site-footer__copyright { position: relative; }

/* =========================================================
   Page pieces
   ========================================================= */

.ui {
  background: var(--ui-ground);
  padding-bottom: 88px;
  min-height: 60vh;
}

/* ---------- hero ---------- */

.ui-hero {
  --tint: #ffc72c;
  --hero-a: #0f31ae;
  --hero-b: #1846e0;
  --hero-c: #0b1a4a;
  position: relative;
  overflow: hidden;
  color: #eef2f8;
  padding: 34px 0 96px;
  background:
    radial-gradient(ellipse 55% 80% at 88% 10%, color-mix(in srgb, var(--tint) 30%, transparent), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(135deg, var(--hero-a) 0%, var(--hero-b) 55%, var(--hero-c) 100%);
}
.ui-hero--green  { --hero-a: #0f31ae; --hero-b: #1846e0; }
.ui-hero--blue   { --hero-a: #0f31ae; --hero-b: #1846e0; }
.ui-hero--gold   { --hero-a: #0f31ae; --hero-b: #1846e0; }
.ui-hero--maroon { --hero-a: #0f31ae; --hero-b: #1846e0; }
.ui-hero--plum   { --hero-a: #0f31ae; --hero-b: #0F31AE; }
.ui-hero--teal   { --hero-a: #0f31ae; --hero-b: #1846e0; }
.ui-hero::after {                          /* soft rings */
  content: "";
  position: absolute;
  right: -90px; bottom: -150px;
  width: 420px; height: 420px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 40px rgba(255, 255, 255, 0.025), 0 0 0 80px rgba(255, 255, 255, 0.02), 0 0 0 120px rgba(255, 255, 255, 0.015);
  animation: ui-wave 7s ease-in-out infinite alternate;
  pointer-events: none;
}

.ui-crumbs {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 0 0 22px; padding: 0; list-style: none;
  font-size: 0.82rem;
}
.ui-crumbs li { display: inline-flex; align-items: center; gap: 6px; color: rgba(238, 242, 248, 0.6); }
.ui-crumbs li + li::before { content: "›"; color: rgba(238, 242, 248, 0.35); }
.ui-crumbs a { color: rgba(238, 242, 248, 0.85); text-decoration: none; padding: 3px 8px; border-radius: 20px; background: rgba(255, 255, 255, 0.07); transition: background 0.2s ease; }
.ui-crumbs a:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

.ui-hero__inner { position: relative; z-index: 1; display: flex; align-items: center; gap: 28px; }
.ui-hero__main { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 20px; animation: ui-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.ui-hero__icon {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 76px; height: 76px;
  border-radius: 22px;
  font-size: 2.2rem;
  font-family: var(--font-serif);
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--tint) 50%, rgba(255, 255, 255, 0.2)), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 16px 30px rgba(11, 26, 74, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transform: perspective(500px) rotateX(8deg) rotateY(-10deg);
}
.ui-hero__icon svg { width: 34px; height: 34px; }
.ui-hero__eyebrow { margin: 0 0 6px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: #ffc72c; }
.ui-hero__title { color: #fff; font-size: clamp(1.9rem, 4.2vw, 3rem); font-weight: 600; letter-spacing: -0.01em; }
.ui-hero__lede { margin: 10px 0 0; max-width: 640px; color: rgba(238, 242, 248, 0.8); font-size: 1.02rem; }
.ui-hero__lede a { color: #FFD86B; }
.ui-hero__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.ui-hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }
.ui-hero__side { flex: 0 0 auto; animation: ui-rise 0.6s 0.1s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.ui-hero__tabs { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

.ui-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 30px;
  font-size: 0.8rem; font-weight: 600;
  color: #eef2f8;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-decoration: none;
}
.ui-chip--gold { background: rgba(255, 199, 44, 0.2); border-color: rgba(255, 199, 44, 0.45); color: #FFE9A8; }
.ui-chip--done { background: rgba(110, 141, 238, 0.25); border-color: rgba(110, 141, 238, 0.55); color: #E7EFFF; }

/* Tabs on the hero (lesson sections, days) */
.ui-tab {
  display: inline-grid; place-items: center;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.86rem; font-weight: 700;
  text-decoration: none;
  color: rgba(238, 242, 248, 0.85);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background 0.2s ease, transform 0.2s ease;
}
a.ui-tab:hover { background: rgba(255, 255, 255, 0.18); transform: translateY(-2px); }
.ui-tab--active { color: #0b1a4a; background: linear-gradient(135deg, #FFD86B, #ffc72c); border-color: transparent; box-shadow: 0 8px 18px rgba(233, 174, 0, 0.35); }

/* Progress ring */
.ui-ring {
  --ui-p: var(--p, 0);
  --size: 132px;
  position: relative;
  display: grid; place-items: center;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--hero-b, #1846e0) 80%, #0B1A4A) 80%, transparent 81.5%),
    conic-gradient(#ffc72c calc(var(--ui-p) * 1%), rgba(255, 255, 255, 0.12) 0);
  box-shadow: 0 18px 40px rgba(11, 26, 74, 0.35), 0 0 30px rgba(255, 199, 44, 0.18);
  animation: ui-ring 1.3s cubic-bezier(0.2, 0.7, 0.2, 1) 0.25s both;
  text-align: center;
}
.ui-ring strong { display: block; font-family: var(--font-serif); font-size: 2rem; line-height: 1; color: #fff; }
.ui-ring span { display: block; margin-top: 4px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(238, 242, 248, 0.7); }
.ui-ring--light {
  --size: 58px;
  flex: 0 0 auto;
  background:
    radial-gradient(closest-side, var(--ui-card) 76%, transparent 78%),
    conic-gradient(var(--ring, #1846e0) calc(var(--ui-p) * 1%), rgba(11, 26, 74, 0.09) 0);
  box-shadow: none;
}
.ui-ring--light strong { font-family: var(--font-sans); font-size: 0.8rem; font-weight: 700; color: var(--ink); }

/* ---------- body ---------- */

.ui-body { position: relative; z-index: 2; margin-top: -58px; }
.ui-body--narrow { max-width: 840px; }

.ui-panel {
  padding: 24px;
  border-radius: 22px;
  background: var(--ui-card);
  box-shadow: var(--ui-shadow);
  animation: ui-rise 0.6s 0.08s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.ui-panel__label { margin: 0 0 12px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-deep); }
.ui-panel__title { font-size: 1.25rem; margin-bottom: 6px; }
.ui-panel__lede { margin: 0 0 14px; color: var(--ink-70); font-size: 0.93rem; }
.ui-stack > * + * { margin-top: 26px; }

.ui-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ui-section__title { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; }
.ui-section__num {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 10px;
  font-family: var(--font-sans); font-size: 0.85rem; font-weight: 700;
  color: #fff; background: #1846e0;
  box-shadow: 0 6px 12px rgba(24, 70, 224, 0.35);
}
.ui-section__aside { margin: 0; font-size: 0.86rem; color: var(--ink-40); }

.ui-empty {
  display: flex; align-items: center; gap: 14px;
  padding: 22px;
  border-radius: 18px;
  border: 1.5px dashed rgba(11, 26, 74, 0.15);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-70);
}
.ui-empty::before { content: "🌱"; font-size: 1.8rem; }
.ui-empty p { margin: 0; }

.ui-lift {
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s ease, border-color 0.25s ease;
}
.ui-lift:hover, .ui-lift:focus-visible {
  transform: perspective(900px) rotateX(3deg) translateY(-6px);
  box-shadow: var(--ui-shadow-lift);
}
.ui-lift:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---------- buttons ---------- */

.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border: 0;
  border-radius: 12px;
  font: inherit; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.ui-btn:hover { transform: translateY(-2px); }
.ui-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.ui-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.ui-btn--gold { color: #0b1a4a; background: linear-gradient(135deg, #FFD86B, #ffc72c); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 10px 24px rgba(233, 174, 0, 0.35); }
.ui-btn--green { color: #fff; background: linear-gradient(135deg, #6E8DEE, #3D63E6); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 24px rgba(61, 99, 230, 0.35); }
.ui-btn--maroon { color: #fff; background: linear-gradient(135deg, #6E8DEE, #1846E0); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 10px 24px rgba(24, 70, 224, 0.3); }
.ui-btn--ghost { color: var(--ink); background: transparent; border: 1.5px solid var(--rule); }
.ui-btn--ghost:hover { border-color: var(--ink-40); }
.ui-btn--glass { color: #fff; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.25); }
.ui-btn--glass:hover { background: rgba(255, 255, 255, 0.2); }
.ui-btn--small { padding: 8px 14px; font-size: 0.86rem; border-radius: 10px; }
.ui-btn--large { padding: 15px 28px; font-size: 1.05rem; }
.ui-btn--full { width: 100%; }
.ui-link { font-size: 0.9rem; font-weight: 600; color: var(--maroon); text-decoration: none; }
.ui-link:hover { text-decoration: underline; }
.ui-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 20px; font-size: 0.75rem; color: #0b1a4a; background: #FFD86B; }

/* ---------- status, bars, tags ---------- */

.ui-status {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-40); background: rgba(11, 26, 74, 0.06);
  white-space: nowrap;
}
.ui-status--current { color: #3D63E6; background: rgba(255, 199, 44, 0.2); }
.ui-status--done { color: #3D63E6; background: rgba(61, 99, 230, 0.14); }
.ui-status--fail { color: #1846E0; background: rgba(24, 70, 224, 0.1); }

.ui-bar { display: block; height: 8px; border-radius: 6px; background: rgba(11, 26, 74, 0.08); overflow: hidden; }
.ui-bar__fill {
  display: block; height: 100%;
  width: calc(var(--p) * 1%);
  border-radius: 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--tone, #1846e0) 65%, white), var(--tone, #1846e0));
  transform-origin: left;
  animation: ui-bar 1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s both;
}
.ui-bar-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.76rem; color: var(--ink-40); }

.ui-tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; color: var(--ink-70); background: rgba(11, 26, 74, 0.06); }
.ui-tag--video { color: #1846E0; background: rgba(24, 70, 224, 0.09); }
.ui-tag--audio { color: #1846e0; background: rgba(24, 70, 224, 0.1); }

/* ---------- card grids ---------- */

.ui-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 18px; }
.ui-grid--small { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 14px; }

.ui-card {
  --tone: #1846e0;
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  min-height: 200px;
  padding: 22px;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid transparent;
  background: var(--ui-card);
  box-shadow: var(--ui-shadow);
  text-decoration: none;
  color: inherit;
  animation: ui-rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 0.05s);
}
.ui-card::before {                         /* colour wash */
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 90px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tone) 18%, transparent), transparent 75%);
  pointer-events: none;
}
.ui-card--current { border-color: rgba(233, 174, 0, 0.7); box-shadow: 0 0 0 3px rgba(255, 199, 44, 0.18), var(--ui-shadow); }
.ui-card--soon { opacity: 0.6; }
.ui-card__top { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ui-card__icon {
  display: grid; place-items: center;
  width: 56px; height: 56px;
  border-radius: 16px;
  font-size: 1.7rem;
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--tone) 70%, white), var(--tone));
  box-shadow: 0 12px 22px color-mix(in srgb, var(--tone) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transform: translateZ(34px);
  transition: transform 0.35s ease;
}
.ui-card__icon svg { width: 26px; height: 26px; }
.ui-card:hover .ui-card__icon { transform: translateZ(48px) rotate(-6deg) scale(1.05); }
.ui-card__name { position: relative; font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600; color: var(--ink); }
.ui-card__sub { font-size: 0.85rem; font-weight: 600; color: var(--gold-deep); }
.ui-card__desc { font-size: 0.9rem; color: var(--ink-70); line-height: 1.5; }
.ui-card__foot { display: block; margin-top: auto; padding-top: 14px; }
.ui-card__meta { display: flex; justify-content: space-between; gap: 10px; font-size: 0.8rem; color: var(--ink-40); margin-bottom: 8px; }
.ui-card__cta { margin-top: auto; padding-top: 12px; font-size: 0.88rem; font-weight: 700; color: var(--maroon); }

/* ---------- rows (lists of results, articles, etc.) ---------- */

.ui-rows { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.ui-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  border-radius: 18px;
  background: var(--ui-card);
  box-shadow: var(--ui-shadow);
  text-decoration: none;
  color: inherit;
  animation: ui-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 0.04s);
}
.ui-row__icon {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 46px; height: 46px;
  border-radius: 14px;
  font-size: 1.3rem;
  background: linear-gradient(145deg, #fff5d6, #ffe9a8);
  box-shadow: inset 0 -3px 6px rgba(233, 174, 0, 0.15);
}
.ui-row__main { flex: 1; min-width: 0; }
.ui-row__kicker { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-deep); }
.ui-row__title { display: block; font-weight: 700; color: var(--ink); }
.ui-row__title--serif { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600; }
.ui-row__meta { display: block; margin-top: 2px; font-size: 0.84rem; color: var(--ink-40); }
.ui-row__go { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #ffffff; background: var(--ink); transition: transform 0.25s ease; }
.ui-row:hover .ui-row__go { transform: translateX(4px); }

/* ---------- path of steps (terms) and tiles (weeks, chapters) ---------- */

.ui-path { position: relative; display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }
.ui-path::before { content: ""; position: absolute; left: 43px; top: 30px; bottom: 30px; width: 3px; border-radius: 3px; background: linear-gradient(180deg, rgba(24, 70, 224, 0.35), rgba(11, 26, 74, 0.08)); }
.ui-step {
  --tone: #1846e0;
  position: relative;
  display: flex; align-items: center; gap: 18px;
  padding: 18px 22px;
  border-radius: 20px;
  border: 1px solid transparent;
  background: var(--ui-card);
  box-shadow: var(--ui-shadow);
  text-decoration: none;
  color: inherit;
  animation: ui-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 0.05s);
}
.ui-node {
  position: relative;
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-family: var(--font-serif); font-size: 1.15rem; font-weight: 700;
  color: var(--ink);
  background: radial-gradient(circle at 35% 30%, #fff, #e3e8f4);
  box-shadow: inset 0 -4px 8px rgba(11, 26, 74, 0.12), 0 6px 14px rgba(11, 26, 74, 0.12);
  transform: translateZ(22px);
}
.ui-step--done .ui-node, .ui-tile--done .ui-node { color: #fff; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--tone) 55%, white), var(--tone)); }
.ui-step--active, .ui-tile--active { border-color: rgba(233, 174, 0, 0.7); box-shadow: 0 0 0 3px rgba(255, 199, 44, 0.18), var(--ui-shadow); }
.ui-step--active .ui-node, .ui-tile--active .ui-node { color: #0B1A4A; background: radial-gradient(circle at 35% 30%, #FFE9A8, #ffc72c); animation: ui-pulse 2.2s ease-in-out infinite; }
.ui-step--locked, .ui-tile--locked { background: rgba(255, 255, 255, 0.6); box-shadow: none; border: 1.5px dashed rgba(11, 26, 74, 0.14); }
.ui-step--locked .ui-node, .ui-tile--locked .ui-node { background: #eceef3; box-shadow: none; font-size: 1rem; }
.ui-step__main { flex: 1; min-width: 0; }
.ui-step__title { display: block; font-family: var(--font-serif); font-size: 1.2rem; font-weight: 600; color: var(--ink); }
.ui-step--locked .ui-step__title, .ui-tile--locked .ui-tile__name { color: var(--ink-40); }
.ui-step__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; font-size: 0.84rem; color: var(--ink-40); }
.ui-step__progress { flex: 0 0 180px; }

.ui-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 16px; }
.ui-tile {
  --tone: #1846e0;
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 160px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: var(--ui-card);
  box-shadow: var(--ui-shadow);
  text-decoration: none;
  color: inherit;
  animation: ui-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 0.035s);
}
.ui-tile .ui-node { width: 52px; height: 52px; margin-bottom: 10px; font-size: 1.35rem; }
.ui-tile .ui-status { position: absolute; top: 16px; right: 14px; }
.ui-tile__name { font-weight: 700; color: var(--ink); }
.ui-tile__title { font-size: 0.86rem; color: var(--ink-70); }

.ui-continue { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 18px 22px; }
.ui-continue__text { flex: 1; min-width: 200px; }
.ui-continue__kicker { margin: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-deep); }
.ui-continue__title { margin: 2px 0 0; font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600; color: var(--ink); }
.ui-continue__meta { margin: 2px 0 0; font-size: 0.85rem; color: var(--ink-40); }

.ui-complete {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 20px 24px;
  border-radius: 22px;
  background: linear-gradient(135deg, #ffffff, #fff5d6);
  box-shadow: var(--ui-shadow);
}
.ui-complete--done { background: linear-gradient(135deg, #E7EFFF, #D6E3FF); }
.ui-complete__mark { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; font-size: 1.5rem; color: #fff; background: radial-gradient(circle at 35% 30%, #FFD86B, #e9ae00); box-shadow: 0 10px 20px rgba(233, 174, 0, 0.35); }
.ui-complete--done .ui-complete__mark { background: radial-gradient(circle at 35% 30%, #A9BDF6, #3D63E6); box-shadow: 0 10px 20px rgba(61, 99, 230, 0.35); }
.ui-complete__text { flex: 1; min-width: 200px; }
.ui-complete__text strong { display: block; font-family: var(--font-serif); font-size: 1.15rem; color: var(--ink); }
.ui-complete__text span { font-size: 0.88rem; color: var(--ink-70); }

.ui-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 26px; }
.ui-pager a { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; border-radius: 18px; background: var(--ui-card); box-shadow: var(--ui-shadow); text-decoration: none; color: inherit; }
.ui-pager__next { text-align: right; grid-column: 2; }
.ui-pager small { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-40); }
.ui-pager strong { color: var(--maroon); }

/* ---------- facts, tables, callouts, prose ---------- */

.ui-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 0; }
.ui-facts div { padding: 14px 16px; border-radius: 14px; background: rgba(11, 26, 74, 0.04); }
.ui-facts dt { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-40); }
.ui-facts dd { margin: 4px 0 0; font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; color: var(--ink); }

.ui-table-wrap { overflow-x: auto; }
.ui-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.ui-table th, .ui-table td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--rule); }
.ui-table thead th { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-40); }
.ui-table tbody tr { transition: background 0.2s ease; }
.ui-table tbody tr:hover { background: rgba(255, 199, 44, 0.08); }
.ui-table tbody th { font-weight: 600; color: var(--ink-70); }

.ui-callout { position: relative; padding: 18px 20px 18px 22px; border-radius: 16px; border-left: 5px solid var(--tone, var(--gold)); background: color-mix(in srgb, var(--tone, #e9ae00) 8%, var(--ui-card)); }
.ui-callout + .ui-callout { margin-top: 12px; }
.ui-callout--maroon { --tone: #1846E0; }
.ui-callout--green { --tone: #3D63E6; }
.ui-callout--gold { --tone: #e9ae00; }
.ui-callout__title { margin: 0 0 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tone); }
.ui-callout p:last-child { margin: 0; }

.ui-prose { font-size: 1.08rem; line-height: 1.85; color: var(--ink); }
.ui-prose--pre { white-space: pre-line; }

/* ---------- media and form fields inside a .ui page ---------- */

.ui audio { width: 100%; height: 44px; border-radius: 30px; }
.ui .video-card { border-radius: 18px; overflow: hidden; box-shadow: 0 16px 34px rgba(11, 26, 74, 0.18); border: 0; }
.ui .attachment-list { margin-top: 18px; }
.ui .attachment-row { border-radius: 12px; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.ui .attachment-row:hover { transform: translateY(-2px); box-shadow: var(--ui-shadow); }
.ui .content-card { border: 0; border-radius: 20px; background: var(--ui-card); box-shadow: var(--ui-shadow); padding: 24px; }
.ui .entry-list { display: flex; flex-direction: column; gap: 16px; }
.ui .entry-list .content-card + .content-card { margin-top: 0; }

.ui .field { margin-bottom: 16px; }
.ui .field label { display: block; margin-bottom: 6px; font-size: 0.86rem; font-weight: 600; color: var(--ink-70); }
.ui .field input:not([type=radio]):not([type=checkbox]), .ui .field select, .ui .field textarea, .ui-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--rule);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ui .field input:focus, .ui .field select:focus, .ui .field textarea:focus, .ui-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(233, 174, 0, 0.16); }
.ui .radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ui .radio-option { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1.5px solid var(--rule); border-radius: 12px; background: #fff; cursor: pointer; font-weight: 600; }
.ui .radio-option:has(input:checked) { border-color: var(--gold); background: rgba(255, 199, 44, 0.12); }
.ui .field-errors, .ui .non-field-errors { margin: 6px 0 0; padding: 10px 14px; list-style: none; border-radius: 10px; color: #1846E0; background: #FFE9A8; font-size: 0.86rem; }

/* =========================================================
   App extras
   ========================================================= */

/* ---------- 44 Academy: sound tiles, phonemic chart, lessons ---------- */

.ui-sounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 14px; }
.ui-sound {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 20px 12px 16px;
  border-radius: 20px;
  background: var(--ui-card);
  box-shadow: var(--ui-shadow);
  text-align: center;
  text-decoration: none;
  color: inherit;
  animation: ui-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 0.02s);
}
.ui-sound__symbol {
  display: grid; place-items: center;
  min-width: 70px; height: 70px;
  padding: 0 12px;
  margin-bottom: 8px;
  border-radius: 20px;
  font-family: var(--font-serif); font-size: 2rem; font-weight: 600;
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--tone, #1846e0) 70%, white), var(--tone, #1846e0));
  box-shadow: 0 12px 22px color-mix(in srgb, var(--tone, #1846e0) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transform: translateZ(30px);
  transition: transform 0.35s ease;
}
.ui-sound:hover .ui-sound__symbol { transform: translateZ(44px) rotate(-5deg) scale(1.06); }
.ui-sound--active { box-shadow: 0 0 0 3px rgba(255, 199, 44, 0.6), var(--ui-shadow); }
.ui-sound--active .ui-sound__symbol { color: #0b1a4a; background: linear-gradient(135deg, #FFD86B, #ffc72c); }
.ui-sound__name { font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.ui-sound__words { font-size: 0.78rem; color: var(--ink-40); }

/* A numbered list of lessons (All Tricks): each row opens one. */
.ui-numlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ui-numlist > li { animation: ui-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 0.04s); }
.ui-numlist__item {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 22px 16px 16px;
  border-radius: 18px;
  background: var(--ui-card);
  box-shadow: var(--ui-shadow);
  color: inherit; text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ui-numlist__item:hover { transform: translateY(-2px); box-shadow: var(--ui-shadow-lift); }
.ui-numlist__item:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 199, 44, 0.6), var(--ui-shadow-lift); }
.ui-numlist__num {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 14px;
  font-family: var(--font-serif); font-size: 1.35rem; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #1846E0, #1846E0);
  box-shadow: 0 8px 16px rgba(24, 70, 224, 0.28);
}
.ui-numlist__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ui-numlist__name { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 600; color: var(--ink); }
.ui-numlist__words { font-size: 0.85rem; color: var(--ink-40); }
.ui-numlist__arrow { flex: 0 0 auto; font-size: 1.2rem; color: #e9ae00; transition: transform 0.2s ease; }
.ui-numlist__item:hover .ui-numlist__arrow { transform: translateX(4px); }
/* Taken in order: done, up next, locked. */
.ui-numlist__item--done .ui-numlist__num { background: linear-gradient(135deg, #6E8DEE, #3D63E6); box-shadow: 0 8px 16px rgba(61, 99, 230, 0.28); }
.ui-numlist__item--current { box-shadow: 0 0 0 2px rgba(255, 199, 44, 0.75), var(--ui-shadow); }
.ui-numlist__tag {
  flex: 0 0 auto; padding: 4px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: #1846E0; background: rgba(255, 199, 44, 0.2);
}
.ui-numlist__item--locked { cursor: not-allowed; background: rgba(255, 255, 255, 0.6); box-shadow: none; border: 1px dashed rgba(11, 26, 74, 0.14); }
.ui-numlist__item--locked:hover { transform: none; box-shadow: none; }
.ui-numlist__item--locked .ui-numlist__num { background: #C9D0E2; box-shadow: none; }
.ui-numlist__item--locked .ui-numlist__name { color: var(--ink-40); }
.ui-numlist__lock { flex: 0 0 auto; color: #8A93AE; }
@media (max-width: 560px) {
  .ui-numlist__item { gap: 14px; padding: 14px 16px 14px 12px; }
  .ui-numlist__num { width: 40px; height: 40px; font-size: 1.15rem; border-radius: 12px; }
  .ui-numlist__name { font-size: 1.05rem; }
}
.ui-sound__audio { position: absolute; top: 10px; right: 10px; font-size: 0.8rem; opacity: 0.65; }
.ui-listen { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; padding: 16px 18px; border-radius: 16px; background: rgba(255, 199, 44, 0.1); }
.ui-listen__icon { flex: 0 0 auto; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; font-size: 1.3rem; color: #fff; background: radial-gradient(circle at 35% 30%, #FFD86B, #e9ae00); box-shadow: 0 10px 20px rgba(233, 174, 0, 0.35); }
.ui-listen__body { flex: 1; min-width: 0; }
.ui-listen__text { margin: 6px 0 0; font-size: 0.85rem; color: var(--ink-40); font-style: italic; }
.ui-hero__symbol { font-size: clamp(2.2rem, 5vw, 3.2rem); line-height: 1; white-space: nowrap; }
.ui-hero__icon--big { width: auto; min-width: 120px; height: 120px; padding: 0 20px; border-radius: 30px; }

.ui .entry-card__word { font-family: var(--font-serif); font-size: 1.5rem; }
.ui .pair-card__row { gap: 12px; }
.ui .pair-card__word { flex: 1; padding: 16px; border-radius: 14px; text-align: center; background: rgba(11, 26, 74, 0.04); font-family: var(--font-serif); font-size: 1.5rem; }
.ui .twister-card__text { font-family: var(--font-serif); font-size: 1.25rem; font-style: italic; line-height: 1.6; }
.ui .link-list { display: flex; flex-direction: column; gap: 12px; list-style: none; margin: 0; padding: 0; }
.ui .link-card { display: block; padding: 18px 20px; border: 0; border-radius: 18px; background: var(--ui-card); box-shadow: var(--ui-shadow); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.ui .link-card:hover { transform: translateY(-4px); box-shadow: var(--ui-shadow-lift); }
.ui .qr-note { border-radius: 14px; }

/* ---------- Reference Library ---------- */

.ui-search { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; max-width: 620px; }
.ui-search input {
  flex: 1 1 260px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  font: inherit; font-size: 1.02rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.ui-search input::placeholder { color: rgba(238, 242, 248, 0.6); }
.ui-search input:focus { outline: none; border-color: #ffc72c; background: rgba(255, 255, 255, 0.16); box-shadow: 0 0 0 4px rgba(255, 199, 44, 0.2); }

/* ---------- Assessments ---------- */

.ui .as-kinds { gap: 18px; }
.ui .as-kind, .ui .as-card {
  border: 0;
  border-radius: 22px;
  background: var(--ui-card);
  box-shadow: var(--ui-shadow);
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s ease;
  animation: ui-rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.ui .as-kind:hover, .ui .as-card:hover { transform: perspective(900px) rotateX(3deg) translateY(-6px); box-shadow: var(--ui-shadow-lift); }
.ui .as-kind__icon {
  display: grid; place-items: center;
  width: 58px; height: 58px;
  border-radius: 16px;
  font-size: 1.8rem;
  background: linear-gradient(145deg, #fff5d6, #ffe9a8);
  box-shadow: inset 0 -3px 6px rgba(233, 174, 0, 0.15), 0 10px 20px rgba(11, 26, 74, 0.1);
  transform: translateZ(34px);
}
.ui .as-resume { border: 0; border-radius: 18px; box-shadow: var(--ui-shadow); }
.ui .as-result-row { border: 0; border-radius: 16px; background: var(--ui-card); box-shadow: var(--ui-shadow); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.ui .as-result-row:hover { transform: translateY(-3px); box-shadow: var(--ui-shadow-lift); }
.ui .as-section-title { font-size: 1.35rem; margin: 30px 0 14px; }
.ui .as-brief { border: 0; border-radius: 22px; background: var(--ui-card); box-shadow: var(--ui-shadow); }
.ui .as-score, .ui .as-placement, .ui .as-teacher, .ui .as-mark__item { border: 0; border-radius: 22px; box-shadow: var(--ui-shadow); }
.ui .as-score { background: var(--ui-card); border-left: 6px solid var(--ui-wait); }
.ui .as-score--pass { border-left-color: var(--ui-good); }
.ui .as-score--fail { border-left-color: var(--ui-bad); }
.ui .as-review__item { border-radius: 16px; box-shadow: var(--ui-shadow); }
.ui .as-q { border: 0; border-radius: 20px; background: var(--ui-card); box-shadow: var(--ui-shadow); }
.ui .as-q:focus-within { box-shadow: 0 0 0 3px rgba(24, 70, 224, 0.22), var(--ui-shadow); }
.ui .as-bar { top: 72px; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(10px); box-shadow: 0 10px 24px -16px rgba(11, 26, 74, 0.35); }
.ui .as-errors { border-radius: 16px; }

/* ---------- Diction Clash hub: the arena sits in a dark panel ---------- */

.ui .clash--panel {
  min-height: 0;
  padding: 34px 28px 30px;
  border-radius: 26px;
  box-shadow: 0 30px 60px -24px rgba(11, 20, 39, 0.7);
  animation: ui-rise 0.6s 0.08s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.ui .clash--panel .clash-setup, .ui .clash--panel .clash-boards { max-width: none; }
.ui .clash--panel .clash-panel { min-width: 0; overflow-x: auto; }
.ui .clash--panel .clash-boards { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }

/* ---------- School dashboard ---------- */

.ui-code {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #0b1a4a;
  background: rgba(255, 199, 44, 0.22);
}
.ui-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 22px; align-items: start; }
.ui-cols > div > * + * { margin-top: 22px; }

/* =========================================================
   Responsive and motion
   ========================================================= */

@media (max-width: 860px) {
  .site-header__inner { min-height: 64px; padding-top: 10px; padding-bottom: 10px; row-gap: 10px; gap: 12px; }
  .ui-hero__inner { flex-direction: column; align-items: flex-start; }
  .ui-hero__side { align-self: flex-start; }
  .ui-ring { --size: 104px; }
  .ui-ring strong { font-size: 1.6rem; }
  .ui-ring--light { --size: 58px; }
  .ui-ring--light strong { font-size: 0.8rem; }
  .ui-step { flex-wrap: wrap; }
  .ui-step__progress { flex: 1 1 100%; order: 3; }
  .ui-path::before { display: none; }
  .ui-cols { grid-template-columns: minmax(0, 1fr); }
  .site-header__inner { gap: 12px; }
}
@media (max-width: 560px) {
  /* A phone screen is narrow: give the page a little more room and let
     the header settle onto two neat rows rather than one squashed one. */
  .wrap { padding: 0 18px; }
  /* Top and bottom only: this row is also a .wrap, which gives the side gutters. */
  .site-header__inner { padding-top: 9px; padding-bottom: 9px; row-gap: 8px; }
  .brand { margin-right: auto; }
  .brand__name { font-size: 1.02rem; }
  .header-actions { width: auto; justify-content: flex-end; gap: 8px; margin-left: auto; }
  .header-actions .link-quiet { padding: 7px 11px; font-size: 0.84rem; }
  .account-menu__name { display: none; }
  .account-menu__button { padding: 3px 8px 3px 3px; }
  .account-menu__panel { right: -6px; width: min(290px, calc(100vw - 24px)); }
  .header-actions .btn, .logout-form .btn { padding: 7px 12px; font-size: 0.82rem; }
  .phonemic-icon-btn { padding: 4px 6px; }
  /* Toasts clear the taller header. */
  .messages { top: 116px; }
  .ui-hero { padding: 24px 0 84px; }
  .ui-hero__main { flex-direction: column; gap: 14px; }
  .ui-hero__icon { width: 60px; height: 60px; font-size: 1.7rem; border-radius: 18px; }
  .ui-hero__icon--big { width: 90px; height: 90px; }
  .ui-hero__side { display: none; }
  .ui-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .ui-sounds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-pager { grid-template-columns: minmax(0, 1fr); }
  .ui-pager__next { grid-column: 1; }
  .ui-panel { padding: 18px; }
  .ui-row { padding: 14px; gap: 12px; }
  .ui .clash--panel { padding: 22px 14px; border-radius: 20px; }
  .ui .clash--panel .clash-boards { grid-template-columns: minmax(0, 1fr); }
  .ui .clash--panel .clash-setup__go { gap: 10px; }
  .ui .clash--panel .clash-setup__go .clash-btn--play { padding: 15px 26px; }
  .brand__mark { width: 36px; height: 36px; border-radius: 11px; }
  .brand__mark svg { width: 24px; height: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .ui *, .ui *::before, .ui *::after, .ui-hero::after, .message { animation: none !important; transition: none !important; }
  .messages { animation-duration: 0.01s; }
  .brand__mark, .phonemic-icon-btn { transition: none; }
}

/* =========================================================
   Read along — text that highlights itself as a recording plays
   (static/js/read_along.js). Without the script none of these
   classes are added, so the text simply reads as normal.
   ========================================================= */

.ra-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 14px;
}
.ra-toggle {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 16px 8px 10px;
  border: 1.5px solid rgba(233, 174, 0, 0.5);
  border-radius: 30px;
  font: inherit; font-size: 0.86rem; font-weight: 700;
  color: var(--gold-deep);
  background: rgba(255, 199, 44, 0.14);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.ra-toggle:hover { background: rgba(255, 199, 44, 0.24); }
.ra-toggle:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ra-toggle__dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(255, 199, 44, 0.25);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.ra-toggle[aria-pressed="false"] { color: var(--ink-40); border-color: var(--rule); background: transparent; }
.ra-toggle[aria-pressed="false"] .ra-toggle__dot { background: var(--ink-40); box-shadow: none; }
.is-playing .ra-toggle__dot { animation: ra-pulse 1.6s ease-in-out infinite; }
@keyframes ra-pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 199, 44, 0.18); } }
.ra-hint { font-size: 0.8rem; color: var(--ink-40); }
/* The recording was only just added: the words are still being measured,
   and the highlight follows the voice's pauses until they arrive. */
.ra.is-preparing .ra-hint { color: var(--gold-deep); }
.ra.is-preparing .ra-hint::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px;
  border-radius: 50%; background: var(--gold); animation: ra-wait 1.2s ease-in-out infinite;
}
@keyframes ra-wait { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .ra.is-preparing .ra-hint::before { animation: none; } }
.ra.is-off .ra-hint { display: none; }

/* The words themselves. The text box holds the gliding highlight, so it
   is its own positioning and stacking context: the highlight sits behind
   the words but above the card. */
.ra-text { position: relative; isolation: isolate; }
.ra-text .ra-w {
  border-radius: 6px;
  padding: 1px 2px;
  margin: 0 -1px;
  transition: background 0.18s ease, color 0.18s ease, opacity 0.25s ease;
}
.ra.is-timed:not(.is-off) .ra-text .ra-w { cursor: pointer; }
.ra.is-timed:not(.is-off) .ra-text .ra-w:hover { background: rgba(11, 26, 74, 0.07); }

/* While a recording plays, the sentence being read comes forward and
   the rest of the page settles back. */
.ra.is-playing:not(.is-off) .ra-text { color: var(--ink-40); }
.ra:not(.is-off) .ra-text .ra-w--near { color: var(--ink); }
.ra:not(.is-off) .ra-text .ra-w--on { color: #0b1a4a; }

/* One highlight for the whole text, moved from word to word. */
.ra-marker {
  position: absolute; left: 0; top: 0; z-index: -1;
  pointer-events: none;
  opacity: 0;
  will-change: transform, width;
  transition: opacity 0.2s ease;
}
.ra-marker::before {
  content: "";
  position: absolute; inset: -2px -4px;
  border-radius: 7px;
  background: linear-gradient(135deg, #FFE9A8, #ffc72c);
  box-shadow: 0 2px 0 rgba(233, 174, 0, 0.35), 0 6px 14px rgba(233, 174, 0, 0.3);
}
/* A thin bar that fills as the word is said. */
.ra-marker__fill {
  position: absolute; left: -4px; right: -4px; bottom: -2px;
  height: 3px;
  border-radius: 0 0 7px 7px;
  background: rgba(24, 70, 224, 0.55);
  transform: scaleX(var(--ra-p, 0));
  transform-origin: left center;
}
.ra-marker.is-on { opacity: 1; }

/* A dialogue: every line sits in its own bubble, whose background would
   hide a highlight behind it, so here the highlight lies over the words
   like a highlighter pen — dark text stays dark, the paper turns gold.
   The speaker's bubble comes forward; the others settle back. */
.ra-text--lines .ra-marker { z-index: 2; mix-blend-mode: multiply; }
.ra-text--lines .ra-marker::before { box-shadow: none; }
.ra-text [data-ra-line] { transition: opacity 0.3s ease, box-shadow 0.3s ease; }
.ra.is-playing:not(.is-off) .ra-text [data-ra-line]:not(.is-speaking) { opacity: 0.5; }
.ra:not(.is-off) .ra-text [data-ra-line].is-speaking {
  box-shadow: 0 0 0 2px var(--gold), 0 10px 24px rgba(233, 174, 0, 0.22);
}
.ra.is-off .ra-marker { opacity: 0; }
.ra-marker--glide {
  transition: opacity 0.2s ease,
              transform var(--ra-glide, 0.16s) cubic-bezier(0.25, 0.8, 0.35, 1),
              width var(--ra-glide, 0.16s) cubic-bezier(0.25, 0.8, 0.35, 1),
              height var(--ra-glide, 0.16s) ease;
}

@media (prefers-reduced-motion: reduce) {
  .ra-text .ra-w, .ra-toggle, .ra-toggle__dot, .ra-marker, .ra-marker--glide { transition: none; }
  .ra-marker__fill { display: none; }
  .is-playing .ra-toggle__dot { animation: none; }
}

/* =========================================================
   Sign in and sign up — a dark panel that says where you are, and the
   form beside it. Used by login, registration and joining with a code.
   ========================================================= */

.ui-auth {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 0;
  align-items: stretch;
  max-width: 1080px;
  margin: 46px auto 80px;
  border-radius: 26px;
  overflow: hidden;
  background: var(--ui-card);
  box-shadow: var(--ui-shadow-lift);
  animation: ui-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.ui-auth__aside {
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column;
  gap: 18px;
  padding: 40px 36px;
  color: #eef2f8;
  background:
    radial-gradient(ellipse 60% 60% at 90% 0%, rgba(255, 199, 44, 0.28), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 38px 38px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 38px 38px,
    linear-gradient(150deg, #0f31ae, #0b1a4a 55%, #1846E0);
}
.ui-auth__aside::after {
  content: "";
  position: absolute;
  left: -70px; bottom: -120px;
  width: 300px; height: 300px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 0 34px rgba(255, 255, 255, 0.03), 0 0 0 68px rgba(255, 255, 255, 0.02);
  animation: ui-wave 8s ease-in-out infinite alternate;
  pointer-events: none;
}
.ui-auth__aside > * { position: relative; z-index: 1; }
.ui-auth__mark {
  display: grid; place-items: center;
  width: 54px; height: 54px;
  border-radius: 16px;
  font-family: var(--font-serif); font-style: italic; font-weight: 700; font-size: 1.15rem;
  color: #0b1a4a;
  background: linear-gradient(135deg, #FFD86B, #ffc72c);
  box-shadow: 0 12px 24px rgba(11, 26, 74, 0.35);
}
.ui-auth__eyebrow { margin: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: #ffc72c; }
.ui-auth__title { margin: 6px 0 0; font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 600; color: #fff; }
.ui-auth__lede { margin: 10px 0 0; color: rgba(238, 242, 248, 0.78); font-size: 0.98rem; }
.ui-auth__points { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 0; padding: 0; list-style: none; }
/* On a long form the panel is tall; the writing stays beside the first
   fields instead of drifting to the bottom of the page. */
.ui-auth__aside > :last-child { margin-bottom: auto; }
.ui-auth__points li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem; color: rgba(238, 242, 248, 0.86); }
.ui-auth__points li::before { content: "✓"; color: #FFD86B; font-weight: 800; }
.ui-auth__sounds { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ui-auth__sounds span {
  padding: 4px 11px;
  border-radius: 20px;
  font-family: var(--font-serif); font-size: 0.92rem;
  color: #FFD86B;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ui-auth__panel { padding: 40px 38px; }
.ui .form-card, .ui-auth .form-card { border: 0; background: none; box-shadow: none; padding: 0; max-width: none; }
.ui-auth__heading { font-size: 1.35rem; }
.ui-auth__note { margin: 4px 0 20px; color: var(--ink-70); font-size: 0.92rem; }
.ui-auth__section { margin-bottom: 22px; padding-bottom: 6px; border-bottom: 1px dashed var(--rule); }
.ui-auth__section:last-of-type { border-bottom: 0; }
.ui-auth__section-title {
  margin: 0 0 12px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold-deep);
}
.ui-auth__foot { margin: 18px 0 0; text-align: center; font-size: 0.9rem; color: var(--ink-70); }
.ui-auth__foot a { color: var(--maroon); font-weight: 600; }

@media (max-width: 860px) {
  .ui-auth { grid-template-columns: minmax(0, 1fr); margin: 24px 16px 60px; }
  .ui-auth__aside { padding: 28px 24px; gap: 14px; }
  .ui-auth__points { margin-top: 6px; }
  .ui-auth__panel { padding: 28px 22px; }
}

/* =========================================================
   Quick look — the Phonemic Chart and Quick Words in a panel over the
   page you're on (static/js/quick_tools.js).
   ========================================================= */

.tool-btn--words { justify-content: center; gap: 1px; min-width: 34px; color: var(--ink); }
.tool-btn__words { font-family: var(--font-serif); font-size: 13px; font-weight: 700; line-height: 1; color: var(--maroon); }
.tool-btn__glass { color: var(--gold-deep); }
.tool-btn.is-open,
.tool-btn[aria-current="page"] {
  box-shadow: 0 0 0 2px var(--gold), 0 6px 14px rgba(233, 174, 0, 0.3);
}

.tool-sheet {
  position: fixed;
  top: var(--tool-top, 0px); left: 0; right: 0; bottom: 0;
  z-index: 19;                 /* under the sticky header, over everything else */
  display: flex; flex-direction: column;
  background: var(--parchment);
  box-shadow: 0 -10px 30px -18px rgba(11, 26, 74, 0.45);
}
.tool-sheet[hidden] { display: none; }
.tool-sheet.is-in { animation: tool-sheet-in 0.22s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes tool-sheet-in { from { opacity: 0; transform: translateY(-10px); } }

.tool-sheet__bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 28px;
  border-bottom: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.95);
}
.tool-sheet__title { margin: 0; font-family: var(--font-serif); font-size: 1.1rem; font-weight: 600; color: var(--ink); }
.tool-sheet__note { margin: 0; font-size: 0.84rem; color: var(--ink-40); }
.tool-sheet__close {
  margin-left: auto;
  padding: 8px 16px;
  border: 1.5px solid rgba(11, 26, 74, 0.2);
  border-radius: 30px;
  font: inherit; font-size: 0.88rem; font-weight: 700;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}
.tool-sheet__close:hover { border-color: var(--gold); }
.tool-sheet__close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.tool-sheet__stage { position: relative; flex: 1; min-height: 0; }
.tool-sheet__loading { position: absolute; inset: 40% 0 auto; margin: 0; text-align: center; color: var(--ink-40); }
.tool-sheet__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--parchment); opacity: 0; transition: opacity 0.2s ease; }
.tool-sheet__frame.is-loaded { opacity: 1; }
.tool-sheet__frame[hidden] { display: none; }

/* The page underneath stays exactly where it was. */
html.tool-sheet-open { overflow: hidden; }

/* A tool shown inside the panel: no second header or footer. */
.is-embedded .site-header,
.is-embedded .site-footer { display: none; }
.is-embedded .messages { top: 12px; }

@media (max-width: 560px) {
  .tool-sheet__bar { padding: 8px 18px; }
  .tool-sheet__note { display: none; }
  .header-actions { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .tool-sheet.is-in { animation: none; }
  .tool-sheet__frame { transition: none; }
}

/* ---------- trial and renewal banner (templates/billing/_banner.html) ---------- */

.bl-banner { font-size: 0.9rem; border-bottom: 1px solid rgba(11, 26, 74, 0.08); }
.bl-banner__inner { display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; padding-top: 9px; padding-bottom: 9px; }
.bl-banner p { margin: 0; }
.bl-banner__cta { font-weight: 700; text-decoration: none; white-space: nowrap; color: inherit; border-bottom: 1.5px solid currentColor; }
.bl-banner--trial { color: #0F31AE; background: rgba(61, 99, 230, 0.1); }
.bl-banner--soon { color: #1846E0; background: rgba(255, 199, 44, 0.22); }
.bl-banner--ended { color: #fff; background: linear-gradient(90deg, #1846E0, #1846E0); }
.is-embedded .bl-banner { display: none; }

.ui-auth__trial { margin: -4px 0 16px; padding: 10px 14px; border-radius: 12px; font-size: 0.9rem; color: #0F31AE; background: rgba(61, 99, 230, 0.1); }
.ui-auth__trial a { color: inherit; font-weight: 700; }
.ui-hero__side { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }

/* ---------- registration: free trial or pay now (templates/billing/_start_choice.html) ---------- */

.bl-start { margin: 6px 0 18px; padding: 0; border: 0; min-width: 0; }
.bl-start__legend { margin-bottom: 10px; font-weight: 700; color: var(--ink); }
.bl-start__options { display: grid; gap: 10px; }
.bl-start__option { position: relative; display: block; cursor: pointer; }
.bl-start__option input { position: absolute; opacity: 0; pointer-events: none; }
.bl-start__card {
  display: grid; gap: 3px;
  padding: 14px 16px 14px 46px;
  border: 1.5px solid var(--rule);
  border-radius: 14px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bl-start__card::before {
  content: "";
  position: absolute; left: 16px; top: 17px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--ink-40); background: #fff;
}
.bl-start__option input:checked + .bl-start__card { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 199, 44, 0.25); }
.bl-start__option input:checked + .bl-start__card::before { border-color: var(--gold-deep); background: radial-gradient(circle, var(--gold-deep) 45%, #fff 50%); }
.bl-start__option input:focus-visible + .bl-start__card { outline: 3px solid var(--gold); outline-offset: 2px; }
.bl-start__title { font-weight: 700; color: var(--ink); }
.bl-start__note { font-size: 0.86rem; color: var(--ink-70); }
.bl-start__plan { margin-top: 14px; }
.bl-start__plan[hidden] { display: none; }
.bl-school-found { margin: -6px 0 14px; padding: 8px 12px; border-radius: 10px; font-size: 0.9rem; font-weight: 600; color: #0F31AE; background: rgba(61, 99, 230, 0.1); }
.bl-school-found--missing { color: var(--maroon); background: rgba(24, 70, 224, 0.08); }

/* ---------- scanning a code from the book (static/js/qr_scanner.js) ---------- */

/* ---------- the AI reading tutor's button ---------- */

.tool-btn--tutor { position: relative; color: var(--ink-70); }
.tool-btn--tutor svg:first-child { display: block; }
.tool-btn--tutor:hover { color: var(--maroon); }
.tool-btn__spark {
  position: absolute; top: 3px; right: 3px;
  color: var(--gold-deep);
  animation: tutor-spark 2.6s ease-in-out infinite;
}
@keyframes tutor-spark { 50% { transform: scale(0.72) rotate(20deg); opacity: 0.7; } }
@media (prefers-reduced-motion: reduce) { .tool-btn__spark { animation: none; } }

.tool-btn--scan { color: var(--ink); }
.tool-btn--scan svg { display: block; color: var(--ink-70); }
.tool-btn--scan:hover svg { color: var(--maroon); }

.qs {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(10, 16, 30, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.qs[hidden] { display: none; }
.qs__panel {
  width: min(460px, 100%);
  overflow: hidden;
  border-radius: 20px;
  background: var(--paper-white);
  box-shadow: 0 30px 70px -24px rgba(11, 26, 74, 0.6);
}
.qs__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.qs__title { margin: 0; font-family: var(--font-serif); font-size: 1.1rem; font-weight: 600; color: var(--ink); }
.qs__close {
  width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 10px;
  font-size: 1.5rem; line-height: 1;
  color: var(--ink-70); background: rgba(11, 26, 74, 0.06);
  cursor: pointer;
}
.qs__close:hover { color: var(--ink); background: rgba(11, 26, 74, 0.12); }
.qs__close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.qs__stage { position: relative; aspect-ratio: 4 / 3; background: #0b1220; }
.qs__video { width: 100%; height: 100%; object-fit: cover; display: block; }
.qs__frame {
  position: absolute; inset: 18% 20%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgba(10, 16, 30, 0.35);
}
.qs.is-found .qs__frame { border-color: #A9BDF6; }
.qs__says { margin: 0; padding: 14px 16px; font-size: 0.92rem; color: var(--ink-70); }
html.qs-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .qs { backdrop-filter: none; }
}

/* "Reading starts at 0:33 — skip to it", for a recording that opens with a greeting. */
.ra-skip {
  padding: 6px 14px;
  border: 1.5px solid rgba(233, 174, 0, 0.5);
  border-radius: 30px;
  font: inherit; font-size: 0.82rem; font-weight: 700;
  color: var(--gold-deep);
  background: rgba(255, 199, 44, 0.14);
  cursor: pointer;
}
.ra-skip:hover { background: rgba(255, 199, 44, 0.26); }
.ra-skip:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ra-skip[hidden] { display: none; }

/* ---------- "Start the lesson", after scanning a code (static/js/lesson_start.js) ---------- */

.ls {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 55;
  display: flex; align-items: center; gap: 10px;
  transform: translateX(-50%);
  width: min(440px, calc(100% - 32px));
  padding: 10px;
  border-radius: 22px;
  background: rgba(11, 26, 74, 0.94);
  box-shadow: 0 24px 60px -18px rgba(11, 26, 74, 0.6);
  animation: ls-in 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes ls-in { from { opacity: 0; transform: translate(-50%, 16px); } }
.ls__start {
  flex: 1;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border: 0; border-radius: 16px;
  font: inherit; text-align: left;
  color: #0b1a4a;
  background: linear-gradient(135deg, #FFD86B, #ffc72c);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.ls__start:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.ls__icon {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 52px; height: 52px; border-radius: 50%;
  color: #fff; background: #0b1a4a;
  animation: ls-pulse 1.8s ease-in-out infinite;
}
@keyframes ls-pulse { 50% { box-shadow: 0 0 0 10px rgba(11, 26, 74, 0.18); } }
.ls__text { display: grid; }
.ls__text strong { font-size: 1.1rem; }
.ls__text small { font-size: 0.82rem; opacity: 0.75; }
.ls__later {
  padding: 10px 12px;
  border: 0; border-radius: 12px;
  font: inherit; font-size: 0.86rem; font-weight: 600;
  color: rgba(255, 255, 255, 0.78); background: transparent;
  cursor: pointer;
}
.ls__later:hover { color: #fff; }
@media (prefers-reduced-motion: reduce) {
  .ls, .ls__icon { animation: none; }
}

/* ---------- A trick's Assessment tab (templates/tricks/_assessment.html) ---------- */
.tr-test { display: grid; gap: 18px; max-width: 784px; margin: 0 auto; }
.tr-test__card { padding: 24px 26px; border-radius: 20px; background: var(--ui-card); box-shadow: var(--ui-shadow); }
.tr-test__card--waiting { opacity: 0.8; }
.tr-test__eyebrow { margin: 0 0 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #6E8DEE; }
.tr-test__title { margin: 0 0 12px; font-family: var(--font-serif); font-size: 1.4rem; color: var(--ink); }
.tr-test__facts { margin: 0 0 10px; font-size: 0.9rem; font-weight: 600; color: var(--ink-70); }
.tr-test__note { margin: 0 0 12px; color: var(--ink-70); line-height: 1.55; }
.tr-test__retry { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; font-size: 0.9rem; color: #1846E0; background: rgba(233, 174, 0, 0.12); }
.tr-test__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 6px; }
.tr-test__actions form { margin: 0; }
.tr-test__actions .ui-btn[disabled] { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.tr-test__hint { font-size: 0.86rem; color: var(--ink-40); }
.tr-check { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tr-check__item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(11, 26, 74, 0.03); }
.tr-check__item a { flex: 1; font-weight: 600; color: var(--ink); text-decoration: none; }
.tr-check__item a:hover { text-decoration: underline; text-underline-offset: 3px; }
.tr-check__mark { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 0.8rem; font-weight: 700; color: #fff; border: 2px solid rgba(11, 26, 74, 0.18); }
.tr-check__item--done .tr-check__mark { background: #3D63E6; border-color: #3D63E6; }
.tr-check__state { font-size: 0.8rem; color: var(--ink-40); }
.tr-check__item--done .tr-check__state { color: #3D63E6; }
.tr-acts { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
.tr-act { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: rgba(11, 26, 74, 0.03); border: 1px solid rgba(11, 26, 74, 0.06); }
.tr-act--done { background: rgba(61, 99, 230, 0.07); border-color: rgba(61, 99, 230, 0.22); }
.tr-act__icon { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-size: 1.3rem; background: #fff; box-shadow: 0 4px 10px rgba(11, 26, 74, 0.08); }
.tr-act__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tr-act__title { font-weight: 700; color: var(--ink); }
.tr-act__meta { font-size: 0.8rem; color: var(--ink-40); }
.tr-act__state { font-size: 0.84rem; font-weight: 600; color: var(--ink-70); }
.tr-act--done .tr-act__state { color: #3D63E6; }
.tr-act__go { flex: 0 0 auto; }
.tr-act__go[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
@media (max-width: 560px) {
  .tr-act { flex-wrap: wrap; }
  .tr-act__go { width: 100%; justify-content: center; text-align: center; }
}
.ui-tab__seen { color: #6E8DEE; font-weight: 700; }
.ui-tab--active .ui-tab__seen { color: #0F31AE; }
.ui-tab--test { border-style: dashed; }
@media (max-width: 560px) {
  .tr-test__card { padding: 18px; }
  .tr-check__state { display: none; }
}

/* ---------- A new release is ready (static/js/pwa.js) ---------- */
.app-update {
  position: fixed; left: 50%; bottom: 18px; z-index: 1000; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px);
  padding: 10px 10px 10px 18px; border-radius: 999px;
  color: #ffffff; background: #0b1a4a; box-shadow: 0 14px 34px rgba(11, 26, 74, 0.35);
  animation: ui-rise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.app-update__text { font-size: 0.9rem; font-weight: 600; }
.app-update__go { padding: 8px 16px; border: 0; border-radius: 999px; font: inherit; font-weight: 700; color: #0b1a4a; background: linear-gradient(135deg, #FFD86B, #ffc72c); cursor: pointer; }
.app-update__later { width: 32px; height: 32px; border: 0; border-radius: 50%; font-size: 1.2rem; color: rgba(255, 255, 255, 0.7); background: transparent; cursor: pointer; }
@media (max-width: 560px) { .app-update { border-radius: 18px; bottom: 12px; } .app-update__text { font-size: 0.84rem; } }

/* ---------- 44 Academy's sound tiles, taken in order ---------- */
.ui-sound__badge { position: absolute; top: 8px; left: 8px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; color: #fff; background: #3D63E6; }
.ui-sound__badge--next { padding: 0 8px; color: #1846E0; background: rgba(255, 199, 44, 0.3); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.6rem; }
.ui-sound--current { box-shadow: 0 0 0 2px rgba(255, 199, 44, 0.75), var(--ui-shadow); }
.ui-sound--locked { cursor: not-allowed; box-shadow: none; background: rgba(255, 255, 255, 0.6); border: 1px dashed rgba(11, 26, 74, 0.14); }
.ui-sound--locked .ui-sound__symbol { filter: grayscale(1); opacity: 0.45; }
.ui-sound--locked .ui-sound__name { color: var(--ink-40); }
.ui-sound__lock { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 600; color: #8A93AE; }

/* ---------- "Install app": a round button by the scrollbar (static/js/pwa.js) ---------- */

/* On a phone there is no hover, so the words are always there. */

/* The steps, for browsers without an install button of their own. */
.install-steps { padding: 0; border: 0; border-radius: 24px; max-width: min(420px, calc(100vw - 32px)); background: transparent; }
.install-steps::backdrop { background: rgba(11, 26, 74, 0.55); backdrop-filter: blur(3px); }
.install-steps__card { padding: 30px 26px 24px; border-radius: 24px; text-align: center; color: var(--ink); background: #ffffff; }
.install-steps__icon { width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 10px 22px rgba(11, 26, 74, 0.25); }
.install-steps__title { margin: 14px 0 6px; font-family: var(--font-serif); font-size: 1.45rem; }
.install-steps__lede { margin: 0 0 16px; color: var(--ink-70); font-size: 0.95rem; line-height: 1.5; }
.install-steps__list { margin: 0 0 20px; padding: 14px 16px 14px 34px; border-radius: 16px; text-align: left; line-height: 1.6; background: rgba(11, 26, 74, 0.04); }
.install-steps__list[hidden] { display: none; }
.install-steps__done {
  padding: 12px 26px; border: 0; border-radius: 14px; font: inherit; font-weight: 700;
  color: #0b1a4a; background: linear-gradient(135deg, #FFD86B, #ffc72c); cursor: pointer;
}

/* Small links under the account menu: privacy, delete account. */
.account-menu__small { margin: 8px 0 2px; text-align: center; font-size: 13px; color: var(--muted, #55607E); }
.account-menu__small a { color: inherit; }

/* Lessons on this device (templates/videos/offline.html, static/js/offline_sync.js). */
.os-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 16px 0; }
.os-stats div { background: var(--sky, #E7EFFF); border-radius: 14px; padding: 12px 14px; }
.os-stats dt { font-size: 13px; color: var(--muted, #55607E); }
.os-stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 800; }
.os-check { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-weight: 600; }
.os-check input { width: 20px; height: 20px; flex: none; }
.os-check small { font-weight: 400; color: var(--muted, #55607E); }
.os-progress { width: 100%; height: 10px; margin: 8px 0; accent-color: var(--blue, #1846E0); }
.os-status { min-height: 1.5em; margin: 6px 0 12px; font-weight: 600; }
.os-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.ga-footer-link { font-weight: 700; }

/* Previous / Next at the foot of a lesson section (templates/book/_tab_steps.html) */
.tab-steps { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 8px; padding-top: 20px; border-top: 1px solid #E3E8F4; }
.tab-steps__spacer { flex: 0 1 300px; }
.tab-steps__btn {
  flex: 0 1 300px; min-width: 0; display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-radius: 18px; text-decoration: none; color: #0B1A4A;
  background: #fff; border: 2px solid transparent;
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, rgba(24, 70, 224, .35), rgba(255, 199, 44, .55)) border-box;
  box-shadow: 0 8px 20px rgba(16, 40, 120, 0.08);
  transition: transform .18s, box-shadow .18s;
}
.tab-steps__btn:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(16, 40, 120, 0.14); }
.tab-steps__btn:focus-visible { outline: 3px solid #FFC72C; outline-offset: 3px; }
.tab-steps__btn--next { justify-content: flex-end; text-align: right; background: linear-gradient(135deg, #FFD86B, #FFC72C); box-shadow: 0 10px 24px rgba(233, 174, 0, 0.3); }
.tab-steps__text { display: flex; flex-direction: column; min-width: 0; }
.tab-steps__text small { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .7; }
.tab-steps__text strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-steps__arrow { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; font-weight: 800; background: #E7EFFF; color: #1846E0; }
.tab-steps__btn--next .tab-steps__arrow { background: #0B1A4A; color: #FFC72C; }
.tab-steps__count { flex: 1; text-align: center; font-size: 13px; font-weight: 700; color: #55607E; }
@media (max-width: 560px) {
  .tab-steps { gap: 8px; }
  .tab-steps__btn, .tab-steps__spacer { flex: 1 1 0; }
  .tab-steps__btn { padding: 10px 12px; gap: 8px; }
  .tab-steps__text strong { font-size: 14px; white-space: normal; line-height: 1.2; }
  .tab-steps__arrow { width: 30px; height: 30px; font-size: 15px; }
  .tab-steps__count { display: none; }
}
