/* =====================================================================
   lesson-extras.css  (pairs with js/lesson-extras.js)
   1) the "skip amounts" popup next to the rewind / forward buttons
   2) the end-of-lesson screen: XP ring, level-up, confetti
   ===================================================================== */

/* ---------- 1) skip amounts popup ---------- */
.lx-skip-wrap { position: relative; display: inline-flex; align-items: center; }
#lx-skip-cfg svg { width: 18px; height: 18px; }
#lx-skip-cfg.on { color: #a5b4fc; }

#lx-skip-pop.lx-pop {
    position: absolute; bottom: calc(100% + 12px); left: 0; z-index: 60;
    width: min(300px, calc(100vw - 24px)); box-sizing: border-box; padding: 14px;
    display: flex; flex-direction: column; gap: 14px;
    background: rgba(10, 14, 28, .97); color: #e2e8f0; text-align: left;
    border: 1px solid rgba(255, 255, 255, .14); border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
    animation: lxPop .2s ease both;
}
#lx-skip-pop.lx-pop[hidden] { display: none !important; }
#lx-skip-pop .lx-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#lx-skip-pop .lx-pop-head span { font: 800 12px/1 system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #94a3b8; }
#lx-skip-pop .lx-x { width: 28px; height: 28px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, .08); color: #cbd5e1; font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
#lx-skip-pop .lx-x:hover { background: rgba(255, 255, 255, .18); color: #fff; }
#lx-skip-pop .lx-row { display: flex; flex-direction: column; gap: 8px; }
#lx-skip-pop .lx-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
#lx-skip-pop .lx-row-top span { font: 700 13px/1 system-ui, sans-serif; color: #e2e8f0; }
#lx-skip-pop .lx-row-top output { font: 800 22px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: #fff; font-variant-numeric: tabular-nums; }
#lx-skip-pop .lx-row-ctl { display: flex; align-items: center; gap: 8px; }
#lx-skip-pop .lx-step { flex: none; width: 34px; height: 34px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, .1); color: #fff; font: 700 18px/1 system-ui, sans-serif; cursor: pointer; display: grid; place-items: center; }
#lx-skip-pop .lx-step:hover { background: rgba(255, 255, 255, .2); }
#lx-skip-pop .lx-step:disabled { opacity: .35; cursor: default; }
#lx-skip-pop .lx-range { flex: 1; min-width: 0; height: 32px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
#lx-skip-pop .lx-range::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, #818cf8, #a78bfa var(--p, 0%), rgba(255, 255, 255, .22) var(--p, 0%)); }
#lx-skip-pop .lx-range::-moz-range-track { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .22); }
#lx-skip-pop .lx-range::-moz-range-progress { height: 6px; border-radius: 999px; background: linear-gradient(to right, #818cf8, #a78bfa); }
#lx-skip-pop .lx-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 999px; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
#lx-skip-pop .lx-range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 999px; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
#lx-skip-pop .lx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
#lx-skip-pop .lx-chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: #cbd5e1; font: 700 12px/1 ui-monospace, monospace; cursor: pointer; }
#lx-skip-pop .lx-chip:hover { background: rgba(255, 255, 255, .16); color: #fff; }
#lx-skip-pop .lx-chip.on { background: #4f46e5; border-color: #6366f1; color: #fff; }
#lx-skip-pop .lx-pop-note { margin: 0; font: 500 11px/1.4 system-ui, sans-serif; color: #7d8aa0; }
@media (max-width: 640px) {
    #lx-skip-pop .lx-step { width: 40px; height: 40px; }
    #lx-skip-pop .lx-chip { height: 34px; padding: 0 14px; }
}
@keyframes lxPop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- 2) end-of-lesson screen ---------- */
#lx-done { position: fixed; inset: 0; z-index: 100000; display: none; align-items: center; justify-content: center; padding: 12px; box-sizing: border-box;
    background: radial-gradient(ellipse at 50% 38%, rgba(79, 70, 229, .32), rgba(3, 6, 18, .93) 70%); }
#lx-done.on { display: flex; animation: lxFade .35s ease both; }
html.perf-full #lx-done.on {   }
#lx-done .lx-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
#lx-done .lx-card { position: relative; z-index: 1; width: min(380px, 100%); max-height: 100%; overflow: auto; box-sizing: border-box;
    padding: 22px 20px 20px; border-radius: 28px; text-align: center; color: #fff;
    background: linear-gradient(180deg, rgba(30, 33, 70, .92), rgba(10, 13, 30, .94));
    border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(129, 140, 248, .15) inset;
    animation: lxCard .6s cubic-bezier(.2, 1.2, .3, 1) both; -webkit-overflow-scrolling: touch; }
#lx-done .lx-check { width: 52px; height: 52px; margin: 0 auto 8px; }
#lx-done .lx-check svg { width: 100%; height: 100%; }
#lx-done .lx-check-c { fill: rgba(45, 212, 191, .14); stroke: #2dd4bf; stroke-width: 2.5; stroke-dasharray: 160; stroke-dashoffset: 160; animation: lxDraw .7s .15s ease forwards; }
#lx-done .lx-check-p { fill: none; stroke: #2dd4bf; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: lxDraw .45s .6s ease forwards; }
#lx-done .lx-title { margin: 0; font: 800 22px/1.2 system-ui, sans-serif; color: #fff; letter-spacing: .01em; }
#lx-done .lx-sub { margin: 4px 0 0; font: 600 12px/1.4 system-ui, sans-serif; color: #94a3b8; overflow-wrap: anywhere; }
#lx-done .lx-ringbox { --rs: min(190px, 30vh); position: relative; width: var(--rs); height: var(--rs); margin: 16px auto 10px; }
#lx-done .lx-ring { width: 100%; height: 100%; display: block; overflow: visible; }
#lx-done .lx-track { fill: none; stroke: rgba(255, 255, 255, .1); stroke-width: 14; }
#lx-done .lx-arc { fill: none; stroke: url(#lxg); stroke-width: 14; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 100;
    transition: stroke-dashoffset var(--lx-dur, 1.2s) cubic-bezier(.22, .8, .2, 1); filter: drop-shadow(0 0 7px rgba(129, 140, 248, .75)); }
#lx-done .lx-arc.zero { stroke-opacity: 0; }
#lx-done .lx-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; pointer-events: none; }
#lx-done .lx-lv-label { font: 800 10px/1 system-ui, sans-serif; letter-spacing: .18em; color: #a5b4fc; }
#lx-done .lx-lv { font: 900 calc(var(--rs) * .3)/1 system-ui, sans-serif; color: #fff; }
#lx-done .lx-xpline { font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; color: #cbd5e1; font-variant-numeric: tabular-nums; }
#lx-done .lx-xpline b { color: #fbbf24; font-weight: 800; }
#lx-done .lx-xpline i { font-style: normal; color: #94a3b8; }
#lx-done .lx-chip-xp { position: absolute; left: 50%; top: 100%; z-index: 3; padding: 7px 14px; border-radius: 999px; white-space: nowrap; opacity: 0; pointer-events: none;
    font: 900 18px/1 system-ui, sans-serif; color: #1a1205; background: linear-gradient(135deg, #fde68a, #f59e0b); box-shadow: 0 6px 22px rgba(245, 158, 11, .6); transform: translate(-50%, 10px); }
#lx-done .lx-chip-xp span { font-size: 11px; font-weight: 800; letter-spacing: .06em; }
#lx-done .lx-chip-xp.fly { animation: lxFly 1.05s cubic-bezier(.5, 0, .2, 1) forwards; }
#lx-done .lx-ringbox.pulse { animation: lxPulse .6s ease; }
#lx-done .lx-ringbox.flash::after { content: ""; position: absolute; inset: -6px; border-radius: 999px; border: 3px solid rgba(251, 191, 36, .9); animation: lxRipple .9s ease-out forwards; }
#lx-done .lx-lvname { min-height: 18px; font: 800 14px/1.3 system-ui, sans-serif; color: #e0e7ff; }
#lx-done .lx-levelup { height: 0; overflow: visible; opacity: 0; font: 900 24px/1 system-ui, sans-serif; letter-spacing: .08em; color: #fbbf24; text-shadow: 0 0 18px rgba(251, 191, 36, .7); }
#lx-done .lx-levelup.show { animation: lxBanner 1.6s ease forwards; }
#lx-done .lx-stats { display: flex; gap: 10px; margin: 14px 0 16px; }
#lx-done .lx-stats > div { flex: 1; padding: 10px 6px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); display: flex; flex-direction: column; gap: 4px; }
#lx-done .lx-stats b { font: 800 18px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: #2dd4bf; font-variant-numeric: tabular-nums; }
#lx-done .lx-stats span { font: 600 10px/1.2 system-ui, sans-serif; color: #94a3b8; }
#lx-done .lx-btn { width: 100%; height: 46px; border: 0; border-radius: 999px; cursor: pointer; font: 800 15px/1 system-ui, sans-serif; color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 10px 28px rgba(99, 102, 241, .45); }
#lx-done .lx-btn:active { transform: scale(.98); }
#lx-done .lx-btn.ready { animation: lxNudge 1.6s ease-in-out infinite; }

@keyframes lxFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lxCard { from { opacity: 0; transform: translateY(26px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes lxDraw { to { stroke-dashoffset: 0; } }
@keyframes lxFly {
    0%   { opacity: 0; transform: translate(-50%, 10px) scale(.6); }
    25%  { opacity: 1; transform: translate(-50%, -8px) scale(1.15); }
    75%  { opacity: 1; transform: translate(-50%, calc(var(--rs) * -.5 - 8px)) scale(.8); }
    100% { opacity: 0; transform: translate(-50%, calc(var(--rs) * -.5 - 8px)) scale(.3); }
}
@keyframes lxPulse { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes lxRipple { from { opacity: 1; transform: scale(.96); } to { opacity: 0; transform: scale(1.25); } }
@keyframes lxBanner {
    0%   { opacity: 0; transform: translateY(8px) scale(.6); }
    20%  { opacity: 1; transform: translateY(-6px) scale(1.15); }
    80%  { opacity: 1; transform: translateY(-6px) scale(1); }
    100% { opacity: 0; transform: translateY(-14px) scale(1); }
}
@keyframes lxNudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }

@media (max-height: 560px) {
    #lx-done .lx-check { display: none; }
    #lx-done .lx-ringbox { --rs: 130px; margin: 10px auto 6px; }
    #lx-done .lx-stats { margin: 8px 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
    #lx-done *, #lx-skip-pop { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}