/* Listening & Reading "See how it works" demo (static/lr-demo.js). Phone first; two columns from 720px. */
.lrd {
  --lrd-bg: #ffffff; --lrd-surface: #f6f7fb; --lrd-text: #0f1222; --lrd-muted: #6b7090; --lrd-border: rgba(15, 18, 34, .09);
  --lrd-accent: #4f46e5; --lrd-accent2: #00b8f0; --lrd-red: #dc2626; --lrd-redbg: #fef2f2; --lrd-green: #059669; --lrd-greenbg: #ecfdf5;
  --lrd-amber: #d97706; --lrd-amberbg: #fffbeb; --lrd-hl: #fde68a; --lrd-shadow: rgba(32, 36, 90, .16);
  display: grid; gap: 12px; align-content: start; color: var(--lrd-text); font-family: Inter, system-ui, sans-serif; text-align: left;
}
html[data-theme="dark"] .lrd {
  --lrd-bg: #151b45; --lrd-surface: #11163a; --lrd-text: #eef0ff; --lrd-muted: #a3a9cf; --lrd-border: rgba(129, 140, 248, .22);
  --lrd-accent: #818cf8; --lrd-accent2: #22d3ee; --lrd-red: #f87171; --lrd-redbg: rgba(248, 113, 113, .12); --lrd-green: #34d399;
  --lrd-greenbg: rgba(52, 211, 153, .12); --lrd-amber: #fbbf24; --lrd-amberbg: rgba(251, 191, 36, .12); --lrd-hl: rgba(253, 224, 71, .35);
  --lrd-shadow: rgba(0, 0, 0, .5);
}
.lrd * { box-sizing: border-box; }
.lrd button { font: inherit; cursor: pointer; }

/* ---------- top: Listening | Reading + play / replay ---------- */
.lrd-head { display: flex; align-items: center; gap: 10px; }
.lrd-tabs { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: var(--lrd-surface); border: 1px solid var(--lrd-border); }
.lrd-tabs button { min-height: 38px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--lrd-muted); font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .15s, color .15s; }
.lrd-tabs button.on { background: var(--lrd-bg); color: var(--lrd-text); box-shadow: 0 4px 12px -6px var(--lrd-shadow); }
.lrd-btns { display: flex; gap: 6px; }
.lrd-icon { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--lrd-border); border-radius: 50%; background: var(--lrd-bg); color: var(--lrd-text); }
.lrd-icon svg { width: 16px; height: 16px; }

/* ---------- the exam "device" ---------- */
.lrd-device { border: 1px solid var(--lrd-border); border-radius: 22px; background: var(--lrd-bg); box-shadow: 0 24px 48px -30px var(--lrd-shadow); overflow: hidden; }
.lrd-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: linear-gradient(135deg, #1e1b4b, #312e81); color: #fff; font-size: 13px; }
.lrd-bar b { font-weight: 700; }
.lrd-timer { padding: 3px 9px; border-radius: 8px; background: rgba(255, 255, 255, .14); font-variant-numeric: tabular-nums; font-weight: 700; }
.lrd-screen { display: grid; gap: 12px; padding: 12px; }
.lrd-work { display: grid; gap: 10px; align-content: start; }

.lrd-audio { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--lrd-surface); }
.lrd-playdot { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--lrd-accent); position: relative; }
.lrd-playdot::after { content: ''; position: absolute; left: 10px; top: 8px; border: 5px solid transparent; border-left: 8px solid #fff; }
.lrd-audio.on .lrd-playdot { box-shadow: 0 0 0 0 var(--lrd-accent); animation: lrd-pulse 1.4s infinite; }
.lrd-wave { flex: 1; min-width: 0; height: 22px; display: flex; align-items: center; gap: 3px; overflow: hidden; }
.lrd-wave i { flex: 1; min-width: 2px; height: 30%; border-radius: 2px; background: var(--lrd-muted); opacity: .45; }
.lrd-audio.on .lrd-wave i { background: var(--lrd-accent); opacity: .85; animation: lrd-wave .9s ease-in-out infinite alternate; }
.lrd-wave i:nth-child(3n) { animation-delay: -.3s !important; } .lrd-wave i:nth-child(3n+1) { animation-delay: -.6s !important; } .lrd-wave i:nth-child(4n) { animation-duration: .7s !important; }
.lrd-audio em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--lrd-muted); font-variant-numeric: tabular-nums; }

.lrd-passage { padding: 10px 12px; border-radius: 14px; background: #fffdf8; border: 1px solid rgba(76, 110, 190, .14); color: #1d2240; font-size: 13px; line-height: 1.55; }
.lrd-passage p { margin: 0; }
.lrd-ptitle { font-weight: 800; margin-bottom: 4px !important; }

.lrd-qs { display: grid; gap: 6px; }
.lrd-q { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0; padding: 7px 10px; border-radius: 12px; border: 1.5px solid var(--lrd-border); font-size: 13px; line-height: 1.45; transition: border-color .3s, background .3s; }
.lrd-q > b { flex: none; width: 20px; height: 20px; display: inline-grid; place-items: center; border-radius: 6px; background: var(--lrd-surface); font-size: 11px; }
.lrd-q > span { flex: 1; min-width: 0; }
.lrd-gap { display: inline-block; min-width: 72px; padding: 0 6px; border-bottom: 2px solid var(--lrd-muted); font-weight: 700; color: var(--lrd-accent); }
.lrd-gap:empty::before { content: '\00a0'; }
.lrd-gap.typing::after { content: ''; display: inline-block; width: 2px; height: 1em; margin-left: 1px; vertical-align: -2px; background: currentColor; animation: lrd-blink .7s steps(1) infinite; }
.lrd-opts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.lrd-opts span { padding: 3px 9px; border-radius: 8px; border: 1px solid var(--lrd-border); font-size: 12px; color: var(--lrd-muted); transition: background .2s, color .2s, border-color .2s; }
.lrd-opts span.picked { background: var(--lrd-accent); border-color: var(--lrd-accent); color: #fff; font-weight: 700; }
.lrd-q.ok { border-color: color-mix(in srgb, var(--lrd-green) 45%, transparent); }
.lrd-q.bad { border-color: var(--lrd-red); background: var(--lrd-redbg); animation: lrd-shake .35s; }
.lrd-q.bad .lrd-gap, .lrd-q.bad .picked { color: var(--lrd-red); border-color: var(--lrd-red); text-decoration: line-through; }
.lrd-q.bad .picked { background: transparent; }
.lrd-q.fixed { border-color: var(--lrd-green); background: var(--lrd-greenbg); }
.lrd-q.fixed .lrd-gap { color: var(--lrd-green); border-color: var(--lrd-green); }
.lrd-q.fixed .picked { background: var(--lrd-green); border-color: var(--lrd-green); }
.lrd-q.ok::after, .lrd-q.fixed::after { content: '✓'; position: absolute; right: 9px; top: 6px; color: var(--lrd-green); font-weight: 800; }
.lrd-key { flex-basis: 100%; padding-left: 28px; font-style: normal; font-size: 12px; font-weight: 800; color: var(--lrd-green); animation: lrd-in .3s ease-out; }
.lrd-key small { margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--lrd-red); color: #fff; font-size: 10.5px; font-weight: 700; }

.lrd-submit { justify-self: end; padding: 8px 16px; border-radius: 12px; background: var(--lrd-accent); color: #fff; font-size: 13px; font-weight: 700; transition: transform .15s, opacity .3s; }
.lrd-submit.press { animation: lrd-press .5s; opacity: .55; }

/* ---------- result side: score + one panel ---------- */
.lrd-result { display: grid; gap: 10px; align-content: start; }
.lrd-score { padding: 10px 14px; border-radius: 16px; background: var(--lrd-surface); opacity: .55; transition: opacity .3s, box-shadow .3s; }
.lrd-score.on { opacity: 1; background: linear-gradient(135deg, #4f46e5, #6366f1 55%, #0ea5e9); color: #fff; box-shadow: 0 16px 30px -18px #4f46e5; }
.lrd-score.bump .lrd-score-nums b { animation: lrd-bump .45s; }
.lrd-score-label { margin: 0 0 2px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .85; }
.lrd-score-nums { display: flex; align-items: flex-end; gap: 10px; }
.lrd-score-nums div { display: grid; }
.lrd-score-nums small { font-size: 10.5px; font-weight: 700; opacity: .8; }
.lrd-score-nums b { font-size: 30px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.lrd-score-nums i { font-style: normal; font-size: 26px; line-height: 1; opacity: .55; }
.lrd-gain { margin-left: auto; align-self: center; padding: 4px 10px; border-radius: 999px; background: #22c55e; color: #fff; font-size: 13px; font-weight: 800; opacity: 0; transform: scale(.6); transition: opacity .3s, transform .4s cubic-bezier(.3, 1.6, .5, 1); }
.lrd-gain.on { opacity: 1; transform: none; }

.lrd-panels { display: grid; }
.lrd-panel { grid-area: 1 / 1; padding: 12px; border-radius: 16px; border: 1px solid var(--lrd-border); background: var(--lrd-bg); font-size: 13px; line-height: 1.5; opacity: 0; transform: translateY(10px); visibility: hidden; transition: opacity .35s, transform .35s, visibility 0s .35s; }
.lrd-panel.on { opacity: 1; transform: none; visibility: visible; transition: opacity .35s, transform .35s; }
.lrd-panel p { margin: 0; }
.lrd-wait { display: grid; place-items: center; border-style: dashed; color: var(--lrd-muted); text-align: center; }
.lrd-h { margin-bottom: 8px !important; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--lrd-muted); }
.lrd-type { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; padding: 8px 10px; border-radius: 12px; background: var(--lrd-surface); }
.lrd-type + .lrd-type { margin-top: 6px; }
.lrd-type span { font-weight: 700; }
.lrd-type em { font-style: normal; font-weight: 700; color: var(--lrd-red); }
.lrd-type small { flex-basis: 100%; font-size: 12px; font-weight: 700; color: var(--lrd-amber); }
.lrd-type.is-weak { background: var(--lrd-amberbg); box-shadow: inset 3px 0 0 var(--lrd-amber); }
.lrd-quote { font-size: 13px; }
.lrd-hl { border-radius: 4px; background-image: linear-gradient(var(--lrd-hl), var(--lrd-hl)); background-repeat: no-repeat; background-size: 0 100%; transition: background-size .9s ease-out; }
.lrd-hl.on { background-size: 100% 100%; }
.lrd-passage .lrd-hl.on { box-shadow: 0 0 0 2px var(--lrd-hl); }
.lrd-replay { display: inline-flex; gap: 6px; margin-top: 8px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--lrd-border); font-size: 12px; font-weight: 700; color: var(--lrd-accent); }
.lrd-replay.on { background: var(--lrd-accent); border-color: var(--lrd-accent); color: #fff; animation: lrd-pulse 1.4s infinite; }
.lrd-ai { background: linear-gradient(135deg, rgba(99, 102, 241, .08), rgba(14, 165, 233, .08)); border-color: rgba(99, 102, 241, .3); }
.lrd-spark { color: var(--lrd-accent); }
.lrd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lrd-chips span { padding: 4px 10px; border-radius: 10px; background: var(--lrd-surface); border: 1px solid var(--lrd-border); font-size: 12.5px; font-weight: 700; }
.lrd-panel.on .lrd-chips span { animation: lrd-in .4s both; }
.lrd-chips span:nth-child(2) { animation-delay: .1s !important; } .lrd-chips span:nth-child(3) { animation-delay: .2s !important; }
.lrd-chips span:nth-child(4) { animation-delay: .3s !important; } .lrd-chips span:nth-child(5) { animation-delay: .4s !important; } .lrd-chips span:nth-child(6) { animation-delay: .5s !important; }
.lrd-note { display: block; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--lrd-amber); }

/* ---------- step chips + progress ---------- */
.lrd-steps { position: relative; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.lrd-steps::-webkit-scrollbar { display: none; }
.lrd-step { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 11px 0 5px; border: 1px solid var(--lrd-border); border-radius: 999px; background: var(--lrd-bg); color: var(--lrd-muted); font-size: 12.5px; font-weight: 700; transition: background .2s, color .2s; }
.lrd-step i { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--lrd-surface); font-style: normal; font-size: 11px; }
.lrd-step.done { color: var(--lrd-text); }
.lrd-step.done i { background: var(--lrd-green); color: #fff; }
.lrd-step.on { background: var(--lrd-accent); border-color: var(--lrd-accent); color: #fff; }
.lrd-step.on i { background: rgba(255, 255, 255, .25); color: #fff; }
.lrd-prog { height: 4px; border-radius: 999px; background: var(--lrd-surface); overflow: hidden; }
.lrd-prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--lrd-accent), var(--lrd-accent2)); transform-origin: left; transform: scaleX(0); }

/* Phone: tighter, and a fixed result height so the page below does not jump while panels change. */
.lrd-panels { min-height: 150px; }
@media (max-width: 719px) {
  .lrd-screen { gap: 10px; padding: 10px; }
  .lrd-work { gap: 8px; }
  .lrd-audio { padding: 6px 10px; }
  .lrd-q { padding: 6px 9px; font-size: 12.5px; }
  .lrd-opts { margin-top: 4px; gap: 4px; }
  .lrd-opts span { padding: 2px 7px; font-size: 11.5px; }
  .lrd-submit { padding: 6px 14px; font-size: 12.5px; }
  .lrd-score { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; }
  .lrd-score-label { margin: 0; max-width: 90px; }
  .lrd-score-nums b { font-size: 26px; }
  .lrd-gain { margin-left: 4px; }
}
@media (min-width: 720px) {
  .lrd-screen { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; padding: 16px; min-height: 340px; }
  .lrd-steps { flex-wrap: wrap; justify-content: center; overflow: visible; }
  .lrd-head { max-width: 460px; width: 100%; justify-self: center; }
}

@keyframes lrd-pulse { 0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, .5); } 100% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); } }
@keyframes lrd-wave { from { height: 20%; } to { height: 100%; } }
@keyframes lrd-blink { 50% { opacity: 0; } }
@keyframes lrd-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes lrd-press { 40% { transform: scale(.92); } }
@keyframes lrd-bump { 50% { transform: scale(1.12); } }
@keyframes lrd-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .lrd *, .lrd *::before, .lrd *::after { animation: none !important; transition: none !important; }
}

/* ---------- where the demo sits ---------- */
.lrd-section { margin-top: clamp(28px, 5vw, 56px); text-align: center; }
.lrd-section h2 { margin: 0 0 6px; font-size: clamp(22px, 3.4vw, 32px); line-height: 1.15; letter-spacing: -.02em; font-weight: 800; color: var(--ah-text, #0f1222); }
.lrd-section > p { margin: 0 auto 16px; max-width: 560px; font-size: 14.5px; line-height: 1.55; color: var(--ah-muted, #6b7090); }
.lrd-section .lrd { max-width: 920px; margin: 0 auto; }
.lrd-card { padding: 16px; border-radius: 24px; border: 1px solid #f3f4f6; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.lrd-card .aura-section-title { margin-bottom: 12px; }
html[data-theme="dark"] .lrd-card { background: transparent; }

/* ---------- landing: Writing demo + Listening & Reading demo ----------
   Computer: stacked, switch hidden. Phone: side by side in a swipe track, the next card peeking in from the right. */
.ah-demo-switch { display: none; }
@media (max-width: 767px) {
  .ah-demos { margin-top: clamp(28px, 5vw, 48px); }
  .ah-demo-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; max-width: 360px; margin: 0 auto 14px; padding: 4px; border-radius: 999px; background: var(--ah-surface); border: 1px solid var(--ah-border); }
  .ah-demo-switch button { min-height: 38px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--ah-muted); font: 700 13px/1.2 Inter, system-ui, sans-serif; cursor: pointer; transition: background .2s, color .2s; }
  .ah-demo-switch button.on { background: var(--ah-card); color: var(--ah-text); box-shadow: 0 4px 12px -6px var(--ah-shadow); }
  .ah-demo-track { position: relative; display: flex; align-items: flex-start; gap: 12px; margin: 0 -16px; padding: 0 16px 6px; overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory; scroll-padding: 0 16px; overscroll-behavior-x: contain; scrollbar-width: none; transition: height .35s ease; }
  .ah-demo-track::-webkit-scrollbar { display: none; }
  .ah-demo-track > * { flex: 0 0 90%; min-width: 0; margin-top: 0; scroll-snap-align: start; scroll-snap-stop: always; }
  .ah-demo-track > :last-child { scroll-snap-align: end; }
  .ah-demo-track .lrd-section { margin-top: 0; }
  .ah-demo-track .lrd-section > h2, .ah-demo-track .lrd-section > p { display: none; }  /* the switch already names it */
  .ah-demo-track .ah-stage canvas { touch-action: pan-x pan-y; }  /* let a sideways swipe on the Writing demo move the track */
}
@media (max-width: 767px) and (prefers-reduced-motion: reduce) { .ah-demo-track { transition: none; scroll-behavior: auto; } }
