/* The live lesson on the sign-in and sign-up screens (frontend/live_lesson.js). Hidden on phones (styles.css). */
/* Frosted glass: a see-through card with two soft lights inside it (the subject's colour and amber) that drift slowly */
.ll {
  --ll-glass: linear-gradient(150deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.24));
  --ll-tile: rgba(255, 255, 255, 0.58);        /* bubbles, the answer box and the home rows */
  --ll-edge: rgba(255, 255, 255, 0.42);        /* a faint light edge: the card melts into the page instead of standing on it */
  --ll-hair: rgba(21, 32, 59, 0.06);
  --ll-lift: 0 3px 10px rgba(21, 32, 59, 0.035);
  --ll-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 24px 64px rgba(21, 32, 59, 0.07);
  --ll-glare: rgba(255, 255, 255, 0.32);
  --ll-orb: 0.42;
  --ll-spring: cubic-bezier(0.2, 1.25, 0.35, 1);
  position: relative; isolation: isolate; width: 100%; max-width: 440px; user-select: none; -webkit-user-select: none;
}
.ll-orb { position: absolute; z-index: 0; aspect-ratio: 1; border-radius: 50%; filter: blur(44px); opacity: var(--ll-orb); pointer-events: none;
  transition: background-color 1.4s ease; }
.ll-orb-a { width: 72%; top: -20%; inset-inline-end: -20%; background-color: var(--ll-glow, var(--accent)); animation: ll-drift-a 16s ease-in-out infinite alternate; }
.ll-orb-b { width: 62%; bottom: -22%; inset-inline-start: -18%; background-color: var(--mark); opacity: calc(var(--ll-orb) * 0.85);
  animation: ll-drift-b 19s ease-in-out infinite alternate; }
.ll svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ll-card {
  position: relative; height: clamp(350px, 52vh, 470px); border-radius: 22px; overflow: hidden; isolation: isolate;
  background: var(--ll-glass); border: 1px solid var(--ll-edge); box-shadow: var(--ll-shadow);
  -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
}
.ll-card::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;   /* a soft glare across the top corner */
  background: linear-gradient(118deg, var(--ll-glare) 0%, transparent 34%); }
.ll-scr { position: absolute; inset: 0; z-index: 2; }
.ll-lesson { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }

/* the lesson's title */
.ll-head { display: flex; align-items: center; gap: 0.7rem; padding: 0.85rem 1rem 0.7rem; }
.ll-ico { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  color: var(--sc, var(--accent)); background: color-mix(in srgb, var(--sc, var(--accent)) 14%, var(--ll-tile)); border: 1px solid var(--ll-edge); }
.ll-ico svg { width: 20px; height: 20px; }
.ll-ttl { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.ll-ttl b { font-size: 1rem; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ll-ttl small { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ll-prog { height: 4px; margin: 0 1rem; border-radius: 4px; background: var(--ll-hair); overflow: hidden; }
.ll-prog i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent);
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.4s; }
.ll-prog.ll-full i { background: var(--mark); }

/* the chat: the newest message on the bottom, the older ones fading out at the top */
.ll-chat { display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; padding: 0.5rem 1rem 0.7rem;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 2.6rem); mask-image: linear-gradient(to bottom, transparent 0, #000 2.6rem); }
.ll-stack { display: flex; flex-direction: column; gap: 8px; }
.ll-b { position: relative; margin: 0; max-width: 86%; padding: 0.55rem 0.85rem; border-radius: 15px; font-size: 0.93rem; line-height: 1.45;
  unicode-bidi: plaintext; overflow-wrap: anywhere; }
.ll-b b { font-weight: 700; }
.ll-m { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ll-b.ll-t { align-self: flex-start; background: var(--ll-tile); color: var(--ink); border: 1px solid var(--ll-edge); box-shadow: var(--ll-lift);
  border-inline-start: 2px solid color-mix(in srgb, var(--sc, var(--accent)) 70%, transparent); border-start-start-radius: 5px; }
.ll-b.ll-hint { background: color-mix(in srgb, var(--mark-soft) 80%, transparent); border-inline-start-color: color-mix(in srgb, var(--mark) 75%, transparent); border-inline-start-style: var(--mark-edge); }
.ll-b.ll-good { background: color-mix(in srgb, var(--accent-soft) 80%, transparent); border-inline-start-color: color-mix(in srgb, var(--accent) 70%, transparent); }
.ll-chip { font-size: 0.74rem; font-weight: 700; color: var(--mark-ink); margin-inline-end: 0.4rem; }
.ll-b.ll-s { align-self: flex-end; color: var(--on-accent); font-weight: 600; border-end-end-radius: 5px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent) 70%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 4px 12px color-mix(in srgb, var(--accent) 16%, transparent); }
.ll-b.ll-dots { display: flex; gap: 4px; padding: 0.78rem 0.9rem; }
.ll-b.ll-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: ll-dot 1s ease-in-out infinite; }
.ll-b.ll-dots i:nth-child(2) { animation-delay: 0.15s; }
.ll-b.ll-dots i:nth-child(3) { animation-delay: 0.3s; }
.ll-tx { animation: ll-fade 0.3s ease both; }
.ll-b.ll-pop { animation: ll-pop 0.45s var(--ll-spring) both; }
.ll-b.ll-s.ll-pop { animation-name: ll-shoot; animation-duration: 0.5s; }
.ll[dir="rtl"] .ll-b.ll-t, .ll[dir="ltr"] .ll-b.ll-s { transform-origin: 100% 100%; }
.ll[dir="ltr"] .ll-b.ll-t, .ll[dir="rtl"] .ll-b.ll-s { transform-origin: 0 100%; }
/* a star on a right answer */
.ll-star { position: absolute; bottom: -7px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); box-shadow: 0 2px 6px rgba(21, 32, 59, 0.1); color: var(--mark); animation: ll-starpop 0.55s var(--ll-spring) both; }
.ll[dir="rtl"] .ll-star { right: -9px; }
.ll[dir="ltr"] .ll-star { left: -9px; }
.ll-star svg { width: 14px; height: 14px; fill: currentColor; stroke-width: 1.2; }

/* the answer box, and the button that replaces it when the lesson is done */
.ll-foot { position: relative; padding: 0.55rem 0.85rem 0.85rem; }
.ll-input { display: flex; align-items: center; gap: 0.5rem; height: 2.7rem; padding-inline: 1rem 0.3rem; border-radius: 999px;
  background: var(--ll-tile); border: 1px solid var(--ll-edge); box-shadow: var(--ll-lift); transition: opacity 0.3s, transform 0.35s; }
.ll-typed, .ll-ph { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; font-size: 0.93rem; }
.ll-typed { display: none; color: var(--ink); unicode-bidi: plaintext; }
.ll-ph { color: var(--muted); }
.ll-input.ll-on .ll-typed { display: block; }
.ll-input.ll-on .ll-ph { display: none; }
.ll-input.ll-on .ll-typed::after { content: ""; display: inline-block; width: 2px; height: 1.05em; margin-inline-start: 1px; vertical-align: -0.17em;
  background: var(--accent); animation: ll-blink 1s steps(1) infinite; }
.ll-send { flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center; margin-inline-start: auto;
  background: var(--ll-hair); color: var(--muted); transition: background-color 0.2s, color 0.2s, transform 0.15s; }
.ll-input.ll-on .ll-send { background: var(--accent); color: var(--on-accent); }
.ll-send.ll-press { transform: scale(0.84); }
.ll-finish { position: absolute; inset: 0.55rem 0.85rem 0.85rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; overflow: hidden;
  border-radius: 999px; color: var(--on-accent); font-weight: 700; font-size: 0.97rem;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent) 70%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 8px 20px color-mix(in srgb, var(--accent) 18%, transparent);
  opacity: 0; transform: translateY(16px) scale(0.96); pointer-events: none;
  transition: opacity 0.3s, transform 0.5s var(--ll-spring), filter 0.15s; }
.ll-finish svg:last-child { opacity: 0.75; }
.ll-foot.ll-end .ll-input { opacity: 0; transform: translateY(12px); }
.ll-foot.ll-end .ll-finish { opacity: 1; transform: none; }
.ll-foot.ll-end .ll-finish::after { content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%); animation: ll-shine 1.1s 0.35s ease both; }
.ll-foot.ll-end .ll-finish.ll-pressed { transform: scale(0.95); filter: brightness(0.9); }

/* the home screen */
.ll-home { visibility: hidden; display: flex; flex-direction: column; padding: 0.85rem 1rem 1rem; }
.ll-hbar { display: flex; align-items: center; gap: 0.45rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--ll-hair); color: var(--ink); font-size: 0.92rem; }
.ll-hbar svg { color: var(--accent); }
.ll-av { margin-inline-start: auto; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--ll-edge);
  background: linear-gradient(135deg, var(--accent-soft), var(--mark-soft)); }
.ll-hello { margin: 1rem 0 0; font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.ll-mine { margin: 0.25rem 0 0.6rem; font-size: 0.8rem; color: var(--muted); }
.ll-rows { display: grid; gap: 0.55rem; }
.ll-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.75rem; border-radius: 15px; background: var(--ll-tile);
  border: 1px solid var(--ll-edge); box-shadow: var(--ll-lift); transition: border-color 0.3s, opacity 0.3s; }
.ll-row .ll-ico { width: 34px; height: 34px; }
.ll-row.ll-later { opacity: 0.68; }
.ll-st { flex: none; display: grid; place-items: center; color: var(--muted); }
.ll[dir="rtl"] .ll-chev { transform: scaleX(-1); }
.ll-ok { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-strong); color: transparent; }
.ll-ok svg { width: 15px; height: 15px; stroke-width: 2.6; }
.ll-row.ll-done .ll-ok { background: var(--accent); border-color: var(--accent); color: var(--on-accent); animation: ll-check 0.5s var(--ll-spring) both; }
.ll-go { display: inline-block; padding: 0.32rem 0.85rem; border-radius: 999px; color: var(--on-accent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent) 70%);
  font-size: 0.83rem; font-weight: 700; transition: transform 0.15s, filter 0.15s; }
.ll-go.ll-pressed { transform: scale(0.9); filter: brightness(0.9); }
.ll-row.ll-next.ll-glow { border-color: color-mix(in srgb, var(--accent) 55%, transparent); animation: ll-glow 1.3s ease-in-out infinite; }

/* the finger that taps */
.ll-finger { position: absolute; left: 0; top: 0; width: 40px; height: 40px; margin: -20px 0 0 -20px; z-index: 5; opacity: 0; pointer-events: none; }
.ll-finger::before, .ll-finger::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.ll-finger::before { background: color-mix(in srgb, var(--ink) 22%, transparent); border: 2px solid color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 6px 18px rgba(21, 32, 59, 0.22); transition: transform 0.15s ease; }
.ll-finger.ll-down::before { transform: scale(0.78); }
.ll-finger::after { border: 2px solid var(--ink); opacity: 0; }
.ll-finger.ll-ripple::after { animation: ll-ripple 0.5s ease-out; }

/* dark: smoked glass, and the subject colours a little lighter so they read on it */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .ll {
    --ll-glass: linear-gradient(150deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.025)); --ll-tile: rgba(255, 255, 255, 0.07);
    --ll-edge: rgba(255, 255, 255, 0.07); --ll-hair: rgba(255, 255, 255, 0.06); --ll-lift: 0 3px 10px rgba(0, 0, 0, 0.12);
    --ll-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 24px 64px rgba(0, 0, 0, 0.3); --ll-glare: rgba(255, 255, 255, 0.05); --ll-orb: 0.34; }
  :root:not([data-mode="light"]) .ll-ico { color: color-mix(in srgb, var(--sc, var(--accent)) 55%, #fff); background: color-mix(in srgb, var(--sc, var(--accent)) 24%, transparent); }
  :root:not([data-mode="light"]) .ll-b.ll-q { border-inline-start-color: color-mix(in srgb, var(--sc, var(--accent)) 55%, #fff); }
}
@media screen {
  :root[data-mode="dark"] .ll {
    --ll-glass: linear-gradient(150deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.025)); --ll-tile: rgba(255, 255, 255, 0.07);
    --ll-edge: rgba(255, 255, 255, 0.07); --ll-hair: rgba(255, 255, 255, 0.06); --ll-lift: 0 3px 10px rgba(0, 0, 0, 0.12);
    --ll-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 24px 64px rgba(0, 0, 0, 0.3); --ll-glare: rgba(255, 255, 255, 0.05); --ll-orb: 0.34; }
  :root[data-mode="dark"] .ll-ico { color: color-mix(in srgb, var(--sc, var(--accent)) 55%, #fff); background: color-mix(in srgb, var(--sc, var(--accent)) 24%, transparent); }
  :root[data-mode="dark"] .ll-b.ll-q { border-inline-start-color: color-mix(in srgb, var(--sc, var(--accent)) 55%, #fff); }
}
/* no see-through where the browser can't blur: a solid card instead */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .ll-card { background: var(--surface); }
}

@keyframes ll-drift-a { from { transform: translate(0, 0) scale(1); } to { transform: translate(-14%, 18%) scale(1.12); } }
@keyframes ll-drift-b { from { transform: translate(0, 0) scale(1.05); } to { transform: translate(16%, -14%) scale(0.95); } }
@keyframes ll-pop { from { opacity: 0; transform: translateY(10px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes ll-shoot { from { opacity: 0; transform: translateY(30px) scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes ll-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ll-dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes ll-blink { 50% { opacity: 0; } }
@keyframes ll-starpop { 0% { opacity: 0; transform: scale(0.2) rotate(-40deg); } 100% { opacity: 1; transform: none; } }
@keyframes ll-check { 0% { transform: scale(0.4); } 100% { transform: none; } }
@keyframes ll-shine { from { transform: translateX(-120%); } to { transform: translateX(120%); } }
@keyframes ll-ripple { from { opacity: 0.4; transform: scale(0.8); } to { opacity: 0; transform: scale(2.1); } }
@keyframes ll-glow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 28%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 12%, transparent); } }

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