/* Rue des Lilas — "Écoute" (listening stories + questions). Uses the app's own colour tokens. */
.rdle {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; grid-template-rows: auto 1fr;
  background: var(--bg, #f7f3ee); color: var(--text, #2a2430);
  font-family: var(--font, system-ui, sans-serif);
  animation: rdle-in .25s ease-out;
}
@keyframes rdle-in { from { opacity: 0; transform: translateY(8px); } }
.rdle *, .rdle *::before, .rdle *::after { box-sizing: border-box; }
.rdle button { font: inherit; color: inherit; cursor: pointer; }
.rdle [hidden] { display: none !important; }
.rdle-open #app { visibility: hidden; }

/* Top bar */
.rdle-top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface, #fff); border-bottom: 1px solid var(--line, #e2d9e8);
}
.rdle-back { border: 0; background: none; padding: 6px 8px; margin-left: -8px; border-radius: 10px; font-weight: 700; color: var(--accent, #6b4f8a); }
.rdle-back:hover { background: var(--surface-2, #efe8f5); }
.rdle-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.rdle-title strong { font-family: "Fraunces", var(--serif, Georgia, serif); font-size: 1.15rem; font-weight: 600; }
.rdle-sub { font-size: .78rem; font-weight: 800; color: var(--accent, #6b4f8a); }
.rdle-tool {
  border: 1px solid var(--line, #e2d9e8); background: var(--surface, #fff); border-radius: 999px;
  min-width: 42px; height: 36px; padding: 0 10px; font-size: .85rem; font-weight: 700;
}
.rdle-tool[aria-pressed="true"] { background: var(--surface-2, #efe8f5); border-color: var(--accent, #6b4f8a); color: var(--accent, #6b4f8a); }

.rdle-main { overflow-y: auto; min-height: 0; }
.rdle-wrap { max-width: 860px; margin: 0 auto; padding: 22px clamp(16px, 4vw, 40px) 40px; }
.rdle h1 { font-family: "Fraunces", var(--serif, Georgia, serif); font-weight: 600; font-size: clamp(1.45rem, 3.5vw, 1.9rem); margin: 0 0 6px; }
.rdle-lead { color: var(--muted, #6d6474); line-height: 1.5; margin: 0 0 14px; }
.rdle-warn { background: #fff4d6; border: 1px solid #f0d68a; border-radius: 12px; padding: 10px 12px; font-size: .9rem; }
.rdle-count { font-size: .85rem; color: var(--muted, #6d6474); margin: 6px 0 12px; }

/* English translations: hidden unless EN is on */
.rdle-en { display: none; font-size: .86em; color: var(--muted, #6d6474); font-style: italic; margin-top: 2px; }
.rdle.show-en .rdle-en { display: block; }

/* Filters */
.rdle-filters { display: grid; gap: 8px; margin: 10px 0 4px; }
.rdle-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rdle-chipf { border: 1px solid var(--line, #e2d9e8); background: var(--surface, #fff); border-radius: 999px; padding: 6px 12px; font-size: .88rem; font-weight: 700; }
.rdle-chipf[aria-pressed="true"] { background: var(--accent, #6b4f8a); border-color: var(--accent, #6b4f8a); color: var(--surface, #fff); }

/* Story cards */
.rdle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.rdle-card {
  text-align: left; display: grid; gap: 4px; align-content: start;
  border: 1.5px solid var(--line, #e2d9e8); background: var(--surface, #fff); border-radius: var(--radius, 14px);
  padding: 14px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s;
}
.rdle-card:hover, .rdle-card:focus-visible { transform: translateY(-2px); border-color: var(--accent, #6b4f8a); outline: none; }
.rdle-card strong { font-size: 1.05rem; line-height: 1.3; }
.rdle-card-top, .rdle-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rdle-card-foot { margin-top: 6px; font-size: .8rem; color: var(--muted, #6d6474); }
.rdle-card-en { font-size: .82rem; color: var(--muted, #6d6474); margin: 0; }
.rdle-cat { font-size: .8rem; font-weight: 700; color: var(--muted, #6d6474); }
.rdle-lv { display: inline-block; font-size: .72rem; font-weight: 800; padding: 1px 8px; border-radius: 999px; color: #fff; font-style: normal; }
.lv-A1 { background: #3f9a6b; } .lv-A2 { background: #d48a1f; } .lv-B1 { background: #c2453d; }
.rdle-score { font-weight: 800; white-space: nowrap; color: #c08a00; }
.rdle-score.new { color: var(--accent, #6b4f8a); }
.rdle-score.top { color: #3f9a6b; }

/* Story head + words */
.rdle-head h1 { margin-top: 4px; }
.rdle-words { margin: 14px 0; background: var(--surface, #fff); border: 1px solid var(--line, #e2d9e8); border-radius: 12px; padding: 10px 14px; }
.rdle-words summary { cursor: pointer; font-weight: 700; font-size: .92rem; }
.rdle-words ul { list-style: none; margin: 10px 0 2px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rdle-words li { background: var(--surface-2, #efe8f5); border-radius: 999px; padding: 4px 11px; font-size: .88rem; }
.rdle-words li span { color: var(--muted, #6d6474); margin-left: 4px; }

/* Player */
.rdle-player {
  display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center;
  background: var(--surface, #fff); border: 1px solid var(--line, #e2d9e8); border-radius: 18px; padding: 16px; box-shadow: var(--shadow);
}
.rdle-play {
  width: 72px; height: 72px; border-radius: 50%; border: 0; font-size: 1.6rem; display: grid; place-items: center;
  background: var(--accent, #6b4f8a); color: var(--surface, #fff); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent, #6b4f8a) 35%, transparent);
}
.rdle-play.on { animation: rdle-pulse 1.4s infinite; }
.rdle-play:disabled { opacity: .4; cursor: default; }
@keyframes rdle-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent, #6b4f8a) 45%, transparent); } 100% { box-shadow: 0 0 0 16px transparent; } }
.rdle-pctl { display: grid; gap: 10px; min-width: 0; }
.rdle-dots { display: flex; flex-wrap: wrap; gap: 6px; }
.rdle-dot { width: 22px; height: 10px; border-radius: 999px; border: 0; background: var(--line, #e2d9e8); padding: 0; }
.rdle-dot.done { background: color-mix(in srgb, var(--accent, #6b4f8a) 40%, var(--line, #e2d9e8)); }
.rdle-dot.cur { background: var(--accent, #6b4f8a); width: 34px; }
.rdle-pbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.rdle-pbtns button { border: 1px solid var(--line, #e2d9e8); background: var(--surface, #fff); border-radius: 999px; padding: 6px 12px; font-size: .85rem; font-weight: 700; }
.rdle-pbtns button[aria-pressed="true"] { background: var(--surface-2, #efe8f5); border-color: var(--accent, #6b4f8a); color: var(--accent, #6b4f8a); }
.rdle-pbtns button:disabled { opacity: .4; cursor: default; }
.rdle-hint { font-size: .82rem; color: var(--muted, #6d6474); margin: 8px 4px 0; }

/* Transcript */
.rdle-text { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 6px; }
.rdle-text li { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; padding: 8px 10px; border-radius: 12px; line-height: 1.5; font-size: 1.04rem; transition: background .2s; }
.rdle-text li.cur { background: color-mix(in srgb, var(--accent, #6b4f8a) 12%, var(--surface, #fff)); }
.rdle-say { border: 0; background: none; padding: 2px 4px; border-radius: 8px; font-size: .9rem; opacity: .7; }
.rdle-say:hover { opacity: 1; background: var(--surface-2, #efe8f5); }

.rdle-go { margin: 22px 0 0; display: flex; justify-content: center; }
.rdle-btn { border: 1.5px solid var(--line, #e2d9e8); background: var(--surface, #fff); border-radius: 999px; padding: 10px 18px; font-weight: 800; font-size: .95rem; }
.rdle-btn:hover { border-color: var(--accent, #6b4f8a); }
.rdle-btn.primary { background: var(--accent, #6b4f8a); border-color: var(--accent, #6b4f8a); color: var(--surface, #fff); }
.rdle-btn.pulse { animation: rdle-pulse 1.4s infinite; }
.rdle-link { border: 0; background: none; color: var(--accent, #6b4f8a); font-weight: 700; font-size: .9rem; padding: 6px 8px; border-radius: 8px; }
.rdle-link:hover { background: var(--surface-2, #efe8f5); }

/* Questions */
.rdle-qhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.rdle-qprog { display: flex; gap: 6px; }
.rdle-qprog i { width: 28px; height: 8px; border-radius: 999px; background: var(--line, #e2d9e8); }
.rdle-qprog i.cur { background: var(--accent, #6b4f8a); }
.rdle-qprog i.ok { background: #3f9a6b; } .rdle-qprog i.ko { background: #c2453d; }
.rdle-q { font-family: "Fraunces", var(--serif, Georgia, serif); font-weight: 600; font-size: clamp(1.25rem, 3vw, 1.55rem); margin: 16px 0 14px; line-height: 1.3; }
.rdle-q small { display: block; font-family: var(--font, system-ui, sans-serif); font-size: .78rem; font-weight: 800; color: var(--muted, #6d6474); letter-spacing: .03em; margin-bottom: 4px; }
.rdle-opts { display: grid; gap: 10px; }
.rdle-opt {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; text-align: left;
  border: 1.5px solid var(--line, #e2d9e8); background: var(--surface, #fff); border-radius: 14px; padding: 12px 14px; font-size: 1.02rem; box-shadow: var(--shadow);
}
.rdle-opt b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2, #efe8f5); color: var(--accent, #6b4f8a); font-size: .85rem; }
.rdle-opt:hover:not(:disabled) { border-color: var(--accent, #6b4f8a); }
.rdle-opt:disabled { cursor: default; }
.rdle-opt.right { border-color: #3f9a6b; background: #e9f6ef; }
.rdle-opt.right b { background: #3f9a6b; color: #fff; }
.rdle-opt.wrong { border-color: #c2453d; background: #fbecea; }
.rdle-opt.wrong b { background: #c2453d; color: #fff; }
.rdle-fb { margin-top: 14px; border-radius: 14px; padding: 12px 14px; border: 1px solid var(--line, #e2d9e8); background: var(--surface, #fff); }
.rdle-fb.ok { border-color: #9fd3b6; } .rdle-fb.ko { border-color: #eab0aa; }
.rdle-verdict { margin: 0 0 6px; font-weight: 800; font-size: 1.05rem; }
.rdle-fb.ok .rdle-verdict { color: #2e7d55; } .rdle-fb.ko .rdle-verdict { color: #b23a32; }
.rdle-proof { margin: 0 0 8px; line-height: 1.5; }
.rdle-fbbtns { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.rdle-qtools { margin-top: 14px; }

/* Result */
.rdle-result { text-align: center; background: var(--surface, #fff); border: 1px solid var(--line, #e2d9e8); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.rdle-big { font-size: 2.2rem; color: #e0a800; letter-spacing: .1em; }
.rdle-result h2 { font-size: 2rem; margin: 2px 0 4px; }
.rdle-result p { margin: 4px 0; }
.rdle-review { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.rdle-review li { display: grid; grid-template-columns: auto 1fr; gap: 10px; background: var(--surface, #fff); border: 1px solid var(--line, #e2d9e8); border-radius: 12px; padding: 10px 12px; line-height: 1.45; }
.rdle-review .mk { font-weight: 800; }
.rdle-review li.ok .mk { color: #3f9a6b; } .rdle-review li.ko .mk { color: #c2453d; }
.rdle-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

@media (max-width: 640px) {
  .rdle-back span { display: none; }
  .rdle-player { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .rdle-pctl { justify-items: center; }
  .rdle-dots, .rdle-pbtns { justify-content: center; }
  .rdle-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .rdle, .rdle-play.on, .rdle-btn.pulse { animation: none !important; } }

/* Adults / kids switch + kids mode */
.rdle-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 18px; max-width: 520px; }
.rdle-mode button {
  border: 1.5px solid var(--line, #e2d9e8); background: var(--surface, #fff); border-radius: var(--radius, 14px);
  padding: 10px 12px; font-weight: 800; font-size: .95rem; text-align: left; display: grid; gap: 2px;
}
.rdle-mode button small { font-weight: 600; font-size: .78rem; color: var(--muted, #6d6474); }
.rdle-mode button[aria-pressed="true"] { border-color: var(--accent, #6b4f8a); background: var(--surface-2, #efe8f5); box-shadow: inset 0 0 0 1px var(--accent, #6b4f8a); }
.rdle.kid { --rdle-kid: #e4572e; }
.rdle.kid .rdle-mode button[data-mode="kid"][aria-pressed="true"] { border-color: var(--rdle-kid); box-shadow: inset 0 0 0 1px var(--rdle-kid); background: #fff1ea; }
.rdle.kid .rdle-card { border-radius: 20px; }
.rdle.kid .rdle-card strong { font-size: 1.12rem; }
.rdle.kid .rdle-play { background: var(--rdle-kid); width: 84px; height: 84px; font-size: 1.9rem; box-shadow: 0 6px 18px #e4572e55; }
.rdle.kid .rdle-dot.cur { background: var(--rdle-kid); }
.rdle.kid .rdle-text li { font-size: 1.12rem; }
.rdle.kid .rdle-opt { font-size: 1.12rem; padding: 14px 16px; border-radius: 18px; }
.rdle.kid .rdle-btn.primary { background: var(--rdle-kid); border-color: var(--rdle-kid); }
.rdle.kid .rdle-qprog i.cur { background: var(--rdle-kid); }
