/* Lessons: the lesson map (/lessons, .lm-...), the lesson page (/lessons/{slug}, .lp-...) and the locked card
   (Subscriptions/LockedCard.razor, .locked-...). Tokens only (base.css). Motion: transform and opacity only. */

/* ======================= Lesson map ======================= */

.lm-hero {
    display: grid;
    gap: 14px;
    margin-bottom: 24px;
}
.lm-hero-copy { min-width: 0; }
.lm-title { font-size: var(--fs-2xl); margin: 10px 0 8px; }
.lm-sub { max-width: 46ch; color: var(--text-muted); }
.lm-subject { margin: 0 0 4px; color: var(--text-muted); font-weight: 500; }
.lm-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.lm-stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 6px 16px 6px 14px;
    border: 2px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-1);
    line-height: 1.2;
}
.lm-stat .num { font-size: 1.6rem; }
.lm-stat .muted { font-size: var(--fs-sm); }
.lm-stat-star { color: var(--amber); filter: drop-shadow(0 2px 0 var(--accent-edge)); }
.lm-stat-check { color: var(--link); }
.lm-hero-guide { display: flex; align-items: center; gap: 14px; }
.lm-bubble { font-size: 1rem; }

.lm-grade { margin: 8px 0 14px; color: var(--text-muted); font-size: var(--fs-md); }
.lm-grade-subject { font-family: var(--font-text); font-size: var(--fs-sm); font-weight: 400; }
.lm-worlds { display: grid; gap: 24px; margin-bottom: 8px; }

/* One unit = one world: a dark console header and a map under it. Even units take the amber colour. */
.lm-world {
    --w: var(--primary);
    --w-edge: var(--primary-edge);
    --w-soft: var(--primary-soft);
    min-width: 0;
    overflow: hidden;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(var(--bg-dots) 1.2px, transparent 1.4px) 0 0 / 18px 18px,
        linear-gradient(var(--w-soft), transparent 220px),
        var(--surface);
    box-shadow: var(--shadow-1);
    animation: lm-rise .5s var(--ease-out) both;
}
.lm-world-amber { --w: var(--accent); --w-edge: var(--accent-edge); --w-soft: var(--accent-soft); }
.lm-world-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 4px solid var(--w);
    background:
        radial-gradient(16rem 8rem at 100% 0%, color-mix(in srgb, var(--w) 30%, transparent), transparent 70%),
        var(--console);
    color: var(--on-console);
}
.lm-world-num {
    flex: none;
    display: grid;
    place-items: center;
    align-content: center;
    min-width: 64px;
    height: 68px;
    border-radius: 18px;
    background: var(--w);
    color: var(--navy);
    box-shadow: 0 5px 0 var(--w-edge);
    font-family: var(--font-title);
    line-height: 1;
    transform: rotate(-4deg);
}
.lm-world-num small { font-size: .72rem; }
/* The unit in words («السابعة»): the badge grows with a long word. */
.lm-world-num b { padding: 0 6px; font-size: 1.05rem; }
.lm-world-info { flex: 1; min-width: 0; }
.lm-world-title { margin: 0 0 4px; color: var(--on-console); font-size: var(--fs-lg); }
/* The band is dark in both themes: the link keeps the title's white (the page's link colour is dark in light). */
.lm-world-title a { color: inherit; text-decoration-color: var(--w); }
.lm-world-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    margin: 0 0 8px;
    color: var(--on-console-muted);
    font-size: var(--fs-sm);
}
.lm-world-meta:last-child { margin-bottom: 0; }
.lm-world-meta b { color: var(--on-console); font-size: 1.05rem; }
.lm-meta-stars { display: inline-flex; align-items: center; gap: 4px; }
.lm-meta-stars .icon { color: var(--amber); }
.lm-world-head .progress-bar { height: 10px; background: color-mix(in srgb, var(--on-console) 14%, transparent); }
.lm-world-head .progress-fill { background: var(--w); }

/* The map: stops placed on a winding road. --row and --dot-y match RowPx and DotYPx in LessonList.razor. */
.lm-map {
    --row: 156px;
    --dot: 68px;
    --dot-y: 64px;
    position: relative;
    height: calc(var(--n) * var(--row));
    max-width: 560px;
    margin: 14px auto 6px;
    padding: 0 12px;
}
.lm-road { position: absolute; inset: 0 12px; width: calc(100% - 24px); height: 100%; overflow: visible; }
.lm-road path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.lm-road-edge { stroke: var(--border-strong); stroke-width: 24px; opacity: .55; }
.lm-road-base { stroke: var(--surface-3); stroke-width: 17px; }
.lm-road-line { stroke: var(--border-strong); stroke-width: 3px; stroke-dasharray: 1 11; }
.lm-road-trail { stroke: var(--w); stroke-width: 9px; animation: lm-fade .9s var(--ease-out) .5s both; }

.lm-nodes { position: relative; height: 100%; margin: 0; padding: 0; list-style: none; }
.lm-node {
    position: absolute;
    top: calc(var(--i) * var(--row));
    left: var(--x);
    width: 150px;
    height: var(--row);
    margin-left: -75px;
    animation: lm-pop .55s var(--ease-spring) calc(.2s + var(--i) * .09s) both;
}
.lm-stop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text);
    text-align: center;
    text-decoration: none;
    border-radius: 18px;
}
a.lm-stop:focus-visible { box-shadow: none; }
a.lm-stop:focus-visible .lm-dot { box-shadow: var(--focus-ring); }
.lm-top { display: flex; align-items: center; justify-content: center; height: 24px; }
.lm-dot {
    position: relative;
    display: grid;
    place-items: center;
    width: var(--dot);
    height: var(--dot);
    border: 3px solid var(--border-strong);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 5px 0 var(--edge);
    font-family: var(--font-title);
    font-size: 1.15rem;
    line-height: 1;
    transition: transform .18s var(--ease-spring);
}
a.lm-stop:hover .lm-dot { transform: translateY(-3px) scale(1.06); }
a.lm-stop:active .lm-dot { transform: translateY(4px) scale(.97); transition-duration: .05s; }
.lm-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    padding: 2px 10px;
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 0 0 1.5px var(--border);
    font-size: .86rem;
    font-weight: 500;
    line-height: 1.4;
}
/* «الدرس الأول» over the title: the unit is the heading of the world above. */
.lm-label-num { color: var(--text-muted); font-size: .74rem; font-weight: 700; line-height: 1.3; }
.lm-label-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
a.lm-stop:hover .lm-label { box-shadow: 0 0 0 2px var(--w); }

.lm-stars { gap: 2px; align-items: flex-end; color: var(--border-strong); }
.lm-stars .icon { width: 22px; height: 22px; }
.lm-stars .icon:nth-child(2) { width: 26px; height: 26px; margin-bottom: 4px; }
.lm-chip-lock { background: var(--surface-3); color: var(--text-muted); }
.lm-chip-retry { background: var(--danger-soft); border-color: var(--danger-edge); color: var(--danger); }
.lm-chip-free { background: var(--success-soft); border-color: var(--success-edge); color: var(--success); }

/* States */
.lm-node.is-watched .lm-dot { border-color: var(--primary); background: var(--primary-soft); color: var(--link); box-shadow: 0 5px 0 var(--primary-edge); }
.lm-node.is-quiz .lm-dot {
    border-color: var(--accent-edge);
    background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--amber) 55%, var(--on-console)), var(--amber) 60%);
    color: var(--navy);
    box-shadow: 0 5px 0 var(--accent-edge), var(--glow-accent);
}
.lm-node.is-locked .lm-dot { border-style: dashed; background: var(--surface-3); color: var(--text-muted); }
.lm-node.is-locked .lm-label, .lm-node.is-soon .lm-label { color: var(--text-muted); }
.lm-node.is-soon .lm-dot { --dot: 44px; margin-top: 12px; border-style: dashed; background: var(--surface-2); color: var(--text-muted); box-shadow: none; font-size: .9rem; }
.lm-node.is-soon .lm-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.lm-node.is-soon .lm-top .chip { opacity: .8; }
/* A quiz with 0 stars: try again; it does not count as done. */
.lm-node.is-retry .lm-dot { border-color: var(--danger-edge); background: var(--danger-soft); color: var(--danger); box-shadow: 0 5px 0 var(--danger-edge); }
.lm-node.is-current .lm-dot {
    --dot: 76px;
    margin-top: -4px;
    margin-bottom: -4px;
    border-color: var(--primary-edge);
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 5px 0 var(--primary-edge), var(--glow);
    font-size: 1.3rem;
}
.lm-node.is-current .lm-dot::after {
    content: "";
    position: absolute;
    inset: -10px;
    border: 3px solid var(--primary);
    border-radius: 50%;
    opacity: 0;
    animation: ring 1.8s var(--ease-out) infinite;
}
.lm-node.is-current .lm-label { font-weight: 700; box-shadow: 0 0 0 2px var(--primary); }
.lm-here { animation: lm-bob 1.6s ease-in-out infinite; }

/* The character stands next to the current stop, on the side with room. */
.lm-guide { position: absolute; top: calc(var(--dot-y) - 36px); pointer-events: none; }
.lm-node.on-right .lm-guide { left: -26px; }
.lm-node.on-left .lm-guide { left: 120px; }

@keyframes lm-pop { from { opacity: 0; transform: translateY(14px) scale(.7); } }
@keyframes lm-rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes lm-fade { from { opacity: 0; } }
@keyframes lm-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

@media (min-width: 45em) {
    .lm-hero { grid-template-columns: 1fr auto; align-items: end; }
    .lm-bubble { max-width: 260px; }
}
@media (min-width: 56.25em) {
    .lm-worlds { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* ======================= Lesson page ======================= */

.lp-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin-bottom: 6px; color: var(--text-muted); font-size: var(--fs-sm); }
.lp-crumbs a { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 500; }

/* Mission header: a dark game panel in both themes. */
.lp-mission {
    position: relative;
    overflow: hidden;
    padding: 18px;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(26rem 14rem at 100% 0%, color-mix(in srgb, var(--turquoise) 30%, transparent), transparent 65%),
        radial-gradient(20rem 12rem at 0% 100%, color-mix(in srgb, var(--amber) 18%, transparent), transparent 65%),
        linear-gradient(160deg, var(--console-2), var(--console));
    color: var(--on-console);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--turquoise) 40%, transparent), var(--shadow-2);
    animation: lm-rise .45s var(--ease-out) both;
}
.lp-mission-mascot { float: left; width: 84px; height: 88px; margin: 0 0 4px 8px; }
.lp-mission-tag { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 2px; color: var(--amber); font-family: var(--font-title); font-size: 1.05rem; }
.lp-mission-tag b { font-size: 1.2rem; }
/* A long tag («تانية ثانوي بكالوريا، الوحدة الأولى، الدرس التاني») wraps beside the mascot on a phone, never under it. */
.lp-mission-tag .chip { max-width: 100%; white-space: normal; text-align: start; }
/* The colour comes from where it sits: white on the mission band, the page's text in the grade and unit cards. */
.lp-title { margin: 0 0 12px; font-size: var(--fs-xl); }
.lp-mission-score { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 12px; }
.lp-stars { color: color-mix(in srgb, var(--on-console) 22%, transparent); }
.lp-stars .icon { width: 30px; height: 30px; }
.lp-score-text { color: var(--on-console-muted); font-size: var(--fs-sm); }
.lp-score-text b { color: var(--on-console); font-size: 1.25rem; }
.lp-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.lp-steps li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--on-console) 9%, transparent);
    color: var(--on-console-muted);
    font-size: var(--fs-sm);
}
.lp-steps li.is-done { background: color-mix(in srgb, var(--turquoise) 24%, transparent); color: var(--on-console); }
.lp-steps li.is-done .icon { color: var(--turquoise); }
/* «اتفرج على الشرح» and «اختبر نفسك» jump to the video and the quiz. The link fills the chip and looks the same; it is
   44 px tall for the finger, past the chip's 36 px. */
.lp-step-go {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    margin: -4px -12px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    color: inherit;
    text-decoration: none;
}
.lp-step-go:focus-visible { outline: none; box-shadow: var(--focus-ring); }
html:has(.lp-step-go) { scroll-behavior: smooth; }

.lp-section { position: relative; margin-top: 24px; scroll-margin-top: 16px; }
/* The part a chip jumped to lights up once with an amber ring that fades (base.css drops it for reduced motion). */
.lp-section:target::after {
    content: "";
    position: absolute;
    inset: -8px;
    border: 3px solid var(--amber);
    border-radius: calc(var(--radius-lg) + 8px);
    pointer-events: none;
    animation: lp-spot 1.8s var(--ease-out) .35s both;
}
@keyframes lp-spot {
    0% { opacity: 0; transform: scale(1.04); }
    25% { opacity: 1; transform: scale(1); }
    60% { opacity: 1; }
    100% { opacity: 0; }
}
.lp-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lp-heading .icon { color: var(--link); }

/* The video as a game screen */
.lp-screen {
    --s: var(--turquoise);
    padding: 10px;
    border-radius: var(--radius-lg);
    background: linear-gradient(var(--console-2), var(--console));
    color: var(--on-console);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--s) 45%, transparent), 0 0 30px -8px color-mix(in srgb, var(--s) 50%, transparent), 0 6px 0 var(--edge);
}
.lp-screen-amber { --s: var(--amber); }
.lp-screen-bar { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 6px 8px; }
.lp-screen-dots { display: inline-flex; gap: 5px; }
.lp-screen-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); }
.lp-screen-dots i:first-child { background: var(--turquoise); }
.lp-screen-dots i:last-child { background: color-mix(in srgb, var(--on-console) 30%, transparent); }
.lp-screen-title { flex: 1; margin: 0; color: var(--on-console); font-size: var(--fs-md); }
.lp-screen .player { margin: 0; }
.lp-screen .player-bar { padding: 0 4px 2px; color: var(--on-console); }
.lp-screen .player-select { border-color: color-mix(in srgb, var(--on-console) 22%, transparent); background: var(--console-2); color: var(--on-console); }
.lp-stars .icon:not(.is-on) path { stroke: var(--on-console-muted); }
.lp-screen .locked, .lp-screen .video-card { margin: 0; }
.lp-slot {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 12px;
    aspect-ratio: 16 / 9;
    padding: 16px;
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--s) 22%, transparent), transparent 65%),
        repeating-linear-gradient(0deg, color-mix(in srgb, var(--on-console) 4%, transparent) 0 2px, transparent 2px 5px),
        var(--console);
    text-align: center;
}
.lp-slot p { max-width: 34ch; margin: 0; color: var(--on-console); }
.lp-slot .actions { justify-content: center; }
.lp-slot .btn-on-dark, .lp-screen .player-fullscreen {
    --btn-bg: var(--console-2);
    --btn-fg: var(--on-console);
    --btn-border: color-mix(in srgb, var(--on-console) 30%, transparent);
    --btn-edge: var(--console-edge);
}
.lp-slot-play {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 5px 0 var(--primary-edge), var(--glow);
    animation: lp-throb 2s ease-in-out infinite;
}
/* A free video for a visitor: its YouTube copy in the frame. */
.lp-youtube { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); background: var(--console); }
/* The next-step box under a free explanation: the plans in one row, the buttons, then the small part of accounts (its buttons stack on a phone). */
.lp-next { margin-top: 16px; display: grid; gap: 10px; }
.lp-next-title { margin: 0; font-size: var(--fs-md); }
.lp-next-line { margin: 0; }
.lp-next-line.muted { font-size: var(--fs-sm); }
.lp-next-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.lp-next-plans li { display: grid; gap: 2px; padding: 8px; border: 1px solid var(--border-strong); border-radius: 14px; text-align: center; font-size: var(--fs-sm); }
.lp-next-plans .num { font-size: var(--fs-md); font-weight: 700; }
.lp-next-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.lp-join { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border-strong); font-size: var(--fs-sm); }
.lp-join-row, .lp-join-actions { display: grid; gap: 12px; }
.lp-join-text { margin: 0; }
.lp-join-note { margin: 12px 0 0; font-size: var(--fs-sm); }
@media (min-width: 45em) {
    .lp-join-row { grid-template-columns: 1fr auto; align-items: center; }
    .lp-join-actions { grid-auto-flow: column; }
}

/* The quiz: the big mission CTA */
.lp-quest {
    position: relative;
    border-color: var(--accent);
    background: linear-gradient(160deg, var(--accent-soft), var(--surface) 65%);
    box-shadow: var(--glow-accent), 0 5px 0 var(--accent-edge);
}
.lp-quest-icon {
    position: absolute;
    top: 16px;
    left: 16px;
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: var(--accent);
    color: var(--navy);
    box-shadow: 0 5px 0 var(--accent-edge);
    animation: lp-zap 2.8s ease-in-out infinite;
}
.lp-quest-copy { min-width: 0; }
.lp-quest-copy p { margin: 0 0 8px; }
.lp-quest-title { margin: 6px 0 4px; font-size: var(--fs-xl); }
.lp-quest-reward { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: var(--fs-sm); }
.lp-xp { flex: none; }
.lp-xp {
    padding: 0 10px;
    border-radius: var(--radius-pill);
    background: var(--amber);
    color: var(--navy);
    box-shadow: 0 3px 0 var(--accent-edge);
    font-family: var(--font-title);
}
.lp-quest-btn { margin-top: 14px; }
.lp-quest-soon { display: flex; align-items: center; gap: 14px; border-color: var(--border); background: var(--surface); box-shadow: var(--shadow-1); }
.lp-quest-soon p { margin: 0; }

/* Terms: a deck of cards; swipe sideways, tap to flip (a checkbox, so it works without JavaScript). */
.lp-terms-hint { display: flex; align-items: center; gap: 6px; margin: -4px 0 12px; font-size: var(--fs-sm); }
.lp-deck {
    display: flex;
    gap: 12px;
    margin: 0 -16px;
    padding: 4px 16px 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 16px;
    scrollbar-width: thin;
    list-style: none;
}
.lp-card { flex: 0 0 85%; display: flex; scroll-snap-align: center; animation: lm-rise .45s var(--ease-out) calc(min(var(--i), 4) * .06s) both; }
.lp-flip { position: relative; flex: 1; display: flex; perspective: 1200px; cursor: pointer; }
.lp-flip-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; }
.lp-flip-inner {
    flex: 1;
    display: grid;
    border-radius: var(--radius-lg);
    transform-style: preserve-3d;
    transition: transform .55s var(--ease-spring);
}
.lp-flip-toggle:checked + .lp-flip-inner { transform: rotateY(180deg); }
.lp-flip-toggle:focus-visible + .lp-flip-inner { box-shadow: var(--focus-ring); }
.lp-flip:active .lp-flip-inner { scale: .98; }
.lp-face {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 220px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-1);
    backface-visibility: hidden;
}
.lp-front {
    align-items: center;
    justify-content: center;
    text-align: center;
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
    background:
        radial-gradient(var(--bg-dots) 1.2px, transparent 1.4px) 0 0 / 16px 16px,
        radial-gradient(120% 80% at 50% 0%, var(--primary-soft), var(--surface) 70%);
}
.lp-card:nth-child(even) .lp-front { border-color: color-mix(in srgb, var(--accent) 70%, var(--border)); background: radial-gradient(var(--bg-dots) 1.2px, transparent 1.4px) 0 0 / 16px 16px, radial-gradient(120% 80% at 50% 0%, var(--accent-soft), var(--surface) 70%); }
.lp-back { transform: rotateY(180deg); border-color: var(--primary); box-shadow: var(--glow), 0 4px 0 var(--primary-edge); line-height: 1.6; }
.lp-card-top { position: absolute; top: 12px; inset-inline: 12px; display: flex; justify-content: space-between; align-items: center; }
.lp-term-num {
    display: grid;
    place-items: center;
    min-width: 44px;
    height: 30px;
    padding: 0 8px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--link);
    font-size: .95rem;
}
.lp-card-name { font-family: var(--font-title); font-size: var(--fs-xl); line-height: 1.3; overflow-wrap: anywhere; }
.lp-term-en { overflow-wrap: anywhere; color: var(--link); font-size: var(--fs-md); font-weight: 500; }
.lp-card-turn {
    margin-top: 6px;
    padding: 2px 12px;
    border-radius: var(--radius-pill);
    background: var(--console);
    color: var(--on-console);
    font-family: var(--font-title);
    font-size: var(--fs-sm);
}
.lp-page {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border: 1.5px solid color-mix(in srgb, var(--accent) 70%, transparent);
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: var(--fs-xs);
    font-weight: 700;
    white-space: nowrap;
}
.lp-back > span, .lp-front .lp-term-simple { display: block; width: 100%; padding: 8px 12px; border-radius: 12px; text-align: start; }
.lp-front { padding-top: 52px; }
.lp-term-label { display: block; font-family: var(--font-title); font-size: var(--fs-sm); color: var(--text-muted); }
.lp-term-book { border-inline-start: 4px solid var(--border-strong); background: var(--surface-2); }
.lp-term-simple { background: var(--primary-soft); }
.lp-term-simple .lp-term-label { color: var(--link); }
.lp-term-example { background: var(--accent-soft); }
.lp-term-example .lp-term-label { color: var(--accent-text); }
@media (min-width: 45em) { .lp-card { flex-basis: calc((100% - 12px) / 2); } }
@media (min-width: 62.5em) { .lp-card { flex-basis: calc((100% - 24px) / 3); } }

/* «مساعد المذاكرة» (Features/Helper): a student's card right under the explanation video. */
.lp-helper { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 16px; padding: 16px 18px; }
.lp-helper-avatar { flex: none; display: block; }
.lp-helper-text { flex: 1 1 12rem; min-width: 0; }
.lp-helper-title { margin: 0; font-size: var(--fs-md); }
.lp-helper-text p { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }
.lp-helper .btn { flex: 1 1 100%; }
@media (min-width: 35em) { .lp-helper .btn { flex: none; } }

/* A locked video: a compact strip on the dark screen (the quiz card has the full subscribe card). */
.lp-locked {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 14px;
    border: 2px dashed color-mix(in srgb, var(--amber) 55%, transparent);
    border-radius: var(--radius);
    background: linear-gradient(160deg, color-mix(in srgb, var(--amber) 14%, var(--console-2)), var(--console));
    color: var(--on-console);
}
.lp-locked-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--amber);
    color: var(--navy);
    box-shadow: 0 4px 0 var(--accent-edge);
    animation: locked-wiggle 3s ease-in-out infinite;
}
.lp-locked-text { flex: 1 1 140px; display: grid; margin: 0; line-height: 1.4; }
.lp-locked-text span { color: var(--on-console-muted); font-size: var(--fs-sm); }

@keyframes lp-throb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes lp-zap { 0%, 100% { transform: rotate(-6deg); } 10% { transform: rotate(6deg) scale(1.08); } 20% { transform: rotate(-6deg); } }
@keyframes lp-open { from { opacity: 0; transform: translateY(-6px); } }

@media (min-width: 45em) {
    .lp-mission { display: flex; align-items: flex-end; gap: 20px; padding: 24px 28px; }
    .lp-mission-copy { flex: 1; min-width: 0; }
    .lp-mission-mascot { float: none; order: 2; width: 140px; height: 147px; margin: 0; }
    .lp-title { font-size: var(--fs-2xl); }
    .lp-quest { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; padding: 20px 24px; }
    .lp-quest-soon { display: flex; }
    .lp-quest-icon { position: static; width: 72px; height: 72px; }
    .lp-quest-btn { width: auto; margin: 0; }
}

/* ======================= Locked card (also on the quiz pages) ======================= */

.locked {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 18px;
    border-color: var(--accent);
    background: linear-gradient(160deg, var(--accent-soft), var(--surface) 70%);
    box-shadow: var(--glow-accent), 0 5px 0 var(--accent-edge);
    color: var(--text);
}
.locked-art { position: relative; flex: none; }
.locked-badge {
    position: absolute;
    bottom: -2px;
    left: -6px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--accent);
    color: var(--navy);
    box-shadow: 0 3px 0 var(--accent-edge);
    animation: locked-wiggle 3s ease-in-out infinite;
}
.locked-body { flex: 1 1 220px; min-width: 0; }
.locked-body p { margin: 0 0 12px; }
.locked-title { margin: 0 0 4px; font-family: var(--font-title); font-size: var(--fs-lg); line-height: 1.35; }
@keyframes locked-wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-14deg); } 90% { transform: rotate(12deg); } 95% { transform: rotate(-6deg); } }

/* A world with no published lesson: one short "coming soon" card. */
.lm-soon { display: grid; justify-items: center; gap: 10px; padding: 18px 16px 20px; text-align: center; }
.lm-soon-stops { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0; padding: 0; list-style: none; }
.lm-soon-stops li {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 3px dashed var(--border-strong);
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: .9rem;
}
.lm-soon-text { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }

/* The quizzes an admin made, on the lesson page and the unit page (Features/Catalog/CustomQuizList, .lp-xq-...). */
.lp-xq { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 40em) { .lp-xq { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lp-xq-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 14px 16px; color: inherit; text-decoration: none; }
.lp-xq-card:hover { border-color: var(--primary); }
.lp-xq-body { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.lp-xq-title { font-size: var(--fs-md); }
.lp-xq-go, .lp-xq-lock { flex: none; color: var(--link); }
.lp-xq-stars .icon { width: 20px; height: 20px; }

/* The unit quizzes under a world's title on the lesson map. */
.lm-world-quizzes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 10px 16px 0; font-weight: 600; }
.lm-world-quizzes .icon { color: var(--link); }
.lm-world-quizzes .chip { min-height: 32px; text-decoration: none; }

/* Stops (Features/Catalog/StopRules): a week stop is a smaller amber node, a unit summary the navy «الزعيم» at the end of
   its unit, and a stop of one lesson (or a week in another unit) a chip under its lesson. */
.lm-node.is-stop .lm-dot { --dot: 48px; margin-top: 8px; border-color: var(--accent-edge); background: var(--accent); color: var(--on-accent); box-shadow: 0 5px 0 var(--accent-edge); }
.lm-node.is-boss .lm-dot { --dot: 72px; border-color: var(--amber); background: var(--navy); color: var(--amber); box-shadow: 0 5px 0 var(--accent-edge), var(--glow-accent); }
.lm-node.is-stop.is-watched .lm-dot, .lm-node.is-boss.is-watched .lm-dot { border-color: var(--primary); }
.lm-node.has-chips .lm-label-title { -webkit-line-clamp: 1; }
.lm-xchips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 4px; }
.lm-xchip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-height: 24px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: .74rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.lm-xchip.is-done { background: var(--primary-soft); color: var(--link); }
.lm-xchip.is-elsewhere { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent-edge); color: var(--accent-text); }
/* The chip looks small, but its touch area is 44px high (ui/README.md). */
.lm-xchip { position: relative; }
.lm-xchip::after { content: ""; position: absolute; inset: -10px 0; }

/* Stops on the lesson page: the lessons a stop covers, and the stop cards of a lesson. */
.lp-covers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 8px; color: var(--text-muted); font-size: .9rem; }
.lp-covers .chip { min-height: 32px; max-width: 100%; white-space: normal; text-decoration: none; }
.lp-stops { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.lp-stop-card { display: flex; align-items: center; gap: 12px; min-height: 64px; color: var(--text); text-decoration: none; box-shadow: inset 0 0 0 2px var(--accent); }
.lp-stop-card small { display: block; }
.gr-faq dt { margin-top: 16px; }
.gr-faq dt:first-child { margin-top: 0; }
.gr-faq dd { margin: 4px 0 0; }
.lp-stop-icon { display: grid; flex: none; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--accent); color: var(--on-accent); }

/* The tabs of the map of sec1 and eb2: their book and the QUREO course. */
.lm-tabs { display: flex; gap: 8px; margin: 0 0 12px; }
.lm-tabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 1.5px var(--border); color: var(--text); font-weight: 700; text-decoration: none; }
.lm-tabs a[aria-current="page"] { background: var(--primary); box-shadow: none; color: var(--on-primary); }

/* The new format of a lesson (LessonPartRules.IsLive): three ways into it on the lesson page, in this order. */
.lp-ways { display: grid; gap: 10px; margin: 16px 0 0; }
.lp-way { display: flex; align-items: center; gap: 12px; min-height: 72px; color: var(--text); text-decoration: none; box-shadow: inset 0 0 0 2px var(--border); }
.lp-way:hover { box-shadow: inset 0 0 0 2px var(--primary); }
.lp-way-icon { display: grid; flex: none; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--primary); color: var(--on-primary); }
.lp-way-fast .lp-way-icon { background: var(--accent); color: var(--on-accent); }
.lp-way-revision .lp-way-icon { background: var(--navy); color: var(--on-console); }
.lp-way-copy { min-width: 0; }
.lp-way-copy b { font-family: var(--font-title); font-size: var(--fs-md); }
.lp-way-time { display: block; color: var(--accent-text); font-size: var(--fs-sm); font-weight: 700; }
.lp-way-line { display: block; color: var(--text-muted); font-size: var(--fs-sm); }
@media (min-width: 56.25em) {
    .lp-ways { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lp-way { align-items: flex-start; }
}

/* /lessons/{slug}/fast and /revision: the head, the parts list and the trap links. */
.fp-head { margin: 4px 0 16px; }
.fp-head .lp-title { margin-bottom: 2px; }
.fp-sub { margin: 0; color: var(--text-muted); font-weight: 500; }
tbm-fast { display: block; }
.fp-parts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.fp-part {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: inset 0 0 0 2px var(--border);
    color: var(--text);
    text-decoration: none;
}
.fp-part.is-current { box-shadow: inset 0 0 0 3px var(--primary); background: var(--primary-soft); }
.fp-part-num { display: grid; flex: none; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-3); font-family: var(--font-title); font-weight: 700; }
.fp-part.is-done .fp-part-num { background: var(--success); color: var(--on-primary); }
.fp-part-copy { flex: 1; min-width: 0; }
.fp-part-title { display: block; font-weight: 500; overflow-wrap: anywhere; }
.fp-part-meta { display: flex; flex-wrap: wrap; gap: 0 10px; color: var(--text-muted); }
.fp-part-go { flex: none; }
.rp-traps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.rp-trap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    min-height: 52px;
    padding: 8px 14px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: inset 0 0 0 2px var(--accent);
    color: var(--text);
    text-decoration: none;
}
.rp-trap-num { color: var(--accent-text); }
.rp-trap .icon { margin-inline-start: auto; color: var(--link); }
.rp-quiz { margin: 24px 0 0; }

/* The end card of a part (js/fast.js): the questions one at a time, then the next part. Over the video, so it scrolls
   when a question is taller than a phone's small player. The player's own «شغّل تاني» waits for the questions. */
.player-end:has(.fp-end) { align-content: safe center; overflow-y: auto; }
.player-end:has([data-fast-questions]:not([hidden])) .player-end-actions { display: none; }
.fp-end { display: grid; justify-items: center; gap: 8px; width: min(100%, 36rem); }
.fp-questions { display: grid; justify-items: center; gap: 6px; width: 100%; }
.fp-q { display: grid; gap: 8px; width: 100%; margin: 0; padding: 0; border: 0; }
.fp-q-stem { padding: 0; font-weight: 700; line-height: 1.4; }
.fp-q-count { margin-inline-end: 4px; color: var(--amber); }
.fp-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 6px; }
.fp-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--console-2);
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--on-console) 25%, transparent);
    text-align: start;
    cursor: pointer;
}
.fp-option:has(input:checked) { box-shadow: inset 0 0 0 2px var(--turquoise); }
.fp-option input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--turquoise); }
.fp-q-result { margin: 0; font-weight: 700; }
.fp-q-result.is-right { color: var(--turquoise); }
.fp-q-result.is-wrong { color: var(--amber); }
.fp-q-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.player-end .fp-skip { --btn-fg: var(--on-console-muted); }
.fp-next { display: grid; justify-items: center; gap: 6px; max-width: 100%; }
.fp-next-link { max-width: 100%; }
.fp-next-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-count { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--on-console-muted); font-size: var(--fs-sm); }
.fp-count span:empty, .fp-count span:empty + .btn { display: none; }
/* A phone's small player (about 200 px high): no title, two columns of options and smaller words; the card scrolls. */
@media (max-width: 30em) {
    .player:not(.is-full) .player-end:has(.fp-end) { padding: 8px; }
    .player:not(.is-full) .player-end:has(.fp-end) .player-end-title { display: none; }
    .player:not(.is-full) .fp-q-stem { font-size: var(--fs-sm); }
    .player:not(.is-full) .fp-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .player:not(.is-full) .fp-option { font-size: var(--fs-sm); line-height: 1.3; }
}
