/* Rue des Lilas — "Un café avec Yanis" (conversation practice). Uses the app's own colour tokens. */
.rdlv {
  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: rdlv-in .25s ease-out;
}
@keyframes rdlv-in { from { opacity: 0; transform: translateY(8px); } }
.rdlv *, .rdlv *::before, .rdlv *::after { box-sizing: border-box; }
.rdlv button { font: inherit; color: inherit; cursor: pointer; }
.rdlv [hidden] { display: none !important; }

/* Hide the street underneath while chatting */
.rdlv-open #app { visibility: hidden; }

/* Top bar */
.rdlv-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);
}
.rdlv-back {
  border: 0; background: none; padding: 6px 8px; margin-left: -8px; border-radius: 10px;
  font-weight: 700; color: var(--accent, #6b4f8a);
}
.rdlv-back:hover { background: var(--surface-2, #efe8f5); }
.rdlv-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.rdlv-title strong { font-family: "Fraunces", var(--serif, Georgia, serif); font-size: 1.15rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rdlv-badge {
  flex: none; border: 0; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 800; letter-spacing: .02em;
  background: var(--accent, #6b4f8a); color: var(--surface, #fff);
}
.rdlv-tools { display: flex; gap: 6px; }
.rdlv-tool {
  border: 1px solid var(--line, #e2d9e8); background: var(--surface, #fff); border-radius: 999px;
  min-width: 38px; height: 36px; padding: 0 10px; font-size: .85rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.rdlv-tool[aria-pressed="true"] { background: var(--surface-2, #efe8f5); border-color: var(--accent, #6b4f8a); color: var(--accent, #6b4f8a); }
.rdlv-tool:hover { border-color: var(--accent, #6b4f8a); }

/* Body: scene + chat */
.rdlv-body { min-height: 0; display: grid; grid-template-columns: minmax(300px, 38%) 1fr; }
.rdlv-stage { position: relative; overflow: hidden; border-right: 1px solid var(--line, #e2d9e8); }
.rdlv-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.rdlv-yanis { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(88%, 380px); height: auto; filter: drop-shadow(0 8px 18px #28143c33); }
.rdlv-nameplate {
  position: absolute; left: 16px; top: 14px; z-index: 2;
  background: color-mix(in srgb, var(--surface, #fff) 88%, transparent); backdrop-filter: blur(4px);
  border-radius: 12px; padding: 6px 12px; box-shadow: var(--shadow); font-size: .85rem; line-height: 1.25;
}
.rdlv-nameplate b { font-family: "Fraunces", var(--serif, Georgia, serif); font-size: 1rem; }
.rdlv-nameplate span { display: block; color: var(--muted, #6d6474); }

.rdlv-main { min-width: 0; }
.rdlv-chat { min-height: 0; display: grid; grid-template-rows: 1fr auto auto; }
.rdlv-log { overflow-y: auto; padding: 20px clamp(16px, 4vw, 40px) 12px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.rdlv-msg { max-width: min(560px, 88%); animation: rdlv-pop .22s ease-out; }
@keyframes rdlv-pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.rdlv-msg.y { align-self: flex-start; }
.rdlv-msg.me { align-self: flex-end; }
.rdlv-bubble { padding: 10px 14px; border-radius: 18px; line-height: 1.45; font-size: 1.02rem; }
.rdlv-msg.y .rdlv-bubble { background: var(--surface, #fff); border: 1px solid var(--line, #e2d9e8); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.rdlv-msg.me .rdlv-bubble { background: var(--accent, #6b4f8a); color: var(--surface, #fff); border-bottom-right-radius: 6px; }
.rdlv-en { display: block; margin-top: 4px; font-size: .86rem; color: var(--muted, #6d6474); font-style: italic; }
.rdlv-actions { display: flex; gap: 2px; margin: 3px 0 0 6px; opacity: .75; }
.rdlv-actions button { border: 0; background: none; border-radius: 8px; padding: 2px 6px; font-size: .78rem; font-weight: 700; color: var(--muted, #6d6474); }
.rdlv-actions button:hover { background: var(--surface-2, #efe8f5); color: var(--accent, #6b4f8a); }
.rdlv-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.rdlv-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted, #6d6474); animation: rdlv-dot 1s infinite ease-in-out; }
.rdlv-typing i:nth-child(2) { animation-delay: .15s; } .rdlv-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes rdlv-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.rdlv-sys { align-self: center; font-size: .82rem; color: var(--muted, #6d6474); text-align: center; max-width: 520px; }

/* Hints */
.rdlv-hints { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px clamp(16px, 4vw, 40px) 0; }
.rdlv-hints .lbl { font-size: .8rem; font-weight: 800; color: var(--muted, #6d6474); margin-right: 2px; }
.rdlv-chip {
  border: 1px dashed var(--accent-2, #b47ab8); background: var(--surface-2, #efe8f5); color: var(--text, #2a2430);
  border-radius: 999px; padding: 5px 11px; font-size: .88rem;
}
.rdlv-chip:hover { border-style: solid; }

/* Composer */
.rdlv-compose {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: end;
  padding: 10px clamp(16px, 4vw, 40px); padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.rdlv-input {
  width: 100%; min-height: 46px; max-height: 140px; resize: none; padding: 11px 14px; border-radius: 16px;
  border: 1.5px solid var(--line, #e2d9e8); background: var(--surface, #fff); color: var(--text, #2a2430); font: inherit; font-size: 1rem; line-height: 1.4;
}
.rdlv-input:focus { outline: none; border-color: var(--accent, #6b4f8a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #6b4f8a) 18%, transparent); }
.rdlv-round { width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 1.15rem; }
.rdlv-mic { background: var(--surface-2, #efe8f5); color: var(--accent, #6b4f8a); }
.rdlv-mic.on { background: var(--bad, #c2453d); color: #fff; animation: rdlv-pulse 1.2s infinite; }
@keyframes rdlv-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad, #c2453d) 55%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.rdlv-send { background: var(--accent, #6b4f8a); color: var(--surface, #fff); }
.rdlv-send:disabled, .rdlv-mic:disabled { opacity: .45; cursor: default; }
.rdlv-under { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 0 clamp(16px, 4vw, 40px) 10px; }
.rdlv-key { border: 1px solid var(--line, #e2d9e8); background: var(--surface, #fff); border-radius: 8px; min-width: 30px; height: 30px; padding: 0 6px; font-size: .92rem; }
.rdlv-key:hover { border-color: var(--accent, #6b4f8a); }
.rdlv-under .spacer { flex: 1; }
.rdlv-link { border: 0; background: none; color: var(--accent, #6b4f8a); font-weight: 700; font-size: .85rem; padding: 4px 6px; border-radius: 8px; }
.rdlv-link:hover { background: var(--surface-2, #efe8f5); }

/* Setup + summary panels */
.rdlv-panel { overflow-y: auto; padding: 24px clamp(16px, 4vw, 40px) 32px; }
.rdlv-panel h2 { font-family: "Fraunces", var(--serif, Georgia, serif); font-weight: 600; margin: 0 0 6px; font-size: 1.6rem; }
.rdlv-panel p { margin: 0 0 14px; color: var(--muted, #6d6474); line-height: 1.5; }
.rdlv-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0 20px; }
.rdlv-level {
  text-align: left; border: 1.5px solid var(--line, #e2d9e8); background: var(--surface, #fff); border-radius: var(--radius, 14px);
  padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 4px; transition: transform .12s, border-color .12s;
}
.rdlv-level:hover, .rdlv-level:focus-visible { transform: translateY(-2px); border-color: var(--accent, #6b4f8a); outline: none; }
.rdlv-level .cefr { font-weight: 800; font-size: 1.35rem; color: var(--accent, #6b4f8a); }
.rdlv-level .cefr small { font-size: .85rem; font-weight: 700; color: var(--text, #2a2430); margin-left: 6px; }
.rdlv-level .d { font-size: .88rem; color: var(--muted, #6d6474); line-height: 1.4; }
.rdlv-level.last { border-color: var(--accent-2, #b47ab8); }
.rdlv-opts { display: grid; gap: 12px; padding: 14px 16px; border-radius: var(--radius, 14px); background: var(--surface-2, #efe8f5); }
.rdlv-opt { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .92rem; }
.rdlv-opt > span { min-width: 170px; font-weight: 700; }
.rdlv-seg { display: inline-flex; border: 1px solid var(--line, #e2d9e8); border-radius: 999px; overflow: hidden; background: var(--surface, #fff); }
.rdlv-seg button { border: 0; background: none; padding: 6px 12px; font-size: .88rem; }
.rdlv-seg button[aria-pressed="true"] { background: var(--accent, #6b4f8a); color: var(--surface, #fff); }
.rdlv-note { font-size: .82rem; color: var(--muted, #6d6474); }
.rdlv-sum { display: grid; gap: 16px; max-width: 720px; }
.rdlv-card { background: var(--surface, #fff); border: 1px solid var(--line, #e2d9e8); border-radius: var(--radius, 14px); padding: 16px; box-shadow: var(--shadow); }
.rdlv-card h3 { margin: 0 0 10px; font-size: 1rem; }
.rdlv-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.rdlv-stats div { display: grid; }
.rdlv-stats b { font-size: 1.6rem; color: var(--accent, #6b4f8a); font-family: "Fraunces", var(--serif, Georgia, serif); }
.rdlv-stats span { font-size: .82rem; color: var(--muted, #6d6474); }
.rdlv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rdlv-list li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; line-height: 1.4; font-size: .95rem; }
.rdlv-list .ok { color: var(--good, #2f8a5b); font-weight: 800; }
.rdlv-list .todo { color: var(--muted, #6d6474); }
.rdlv-list em { display: block; color: var(--muted, #6d6474); font-size: .85rem; }
.rdlv-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.rdlv-btn { border: 1.5px solid var(--accent, #6b4f8a); background: var(--surface, #fff); color: var(--accent, #6b4f8a); border-radius: 999px; padding: 9px 16px; font-weight: 800; }
.rdlv-btn.primary { background: var(--accent, #6b4f8a); color: var(--surface, #fff); }

/* Yanis avatar animation */
.rdlv-yanis .yv-head { animation: yv-bob 4s ease-in-out infinite; transform-origin: 120px 190px; }
@keyframes yv-bob { 50% { transform: translateY(2px) rotate(-.6deg); } }
.rdlv-yanis .yv-eyes { animation: yv-blink 5s infinite; transform-origin: 120px 108px; transform-box: view-box; }
@keyframes yv-blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
.rdlv-yanis .yv-pupils, .rdlv-yanis .yv-brows, .rdlv-yanis .yv-mouth > * { transition: transform .25s ease, opacity .15s; }
.rdlv-yanis .yv-m-open, .rdlv-yanis .yv-m-o, .rdlv-yanis .yv-m-laugh, .rdlv-yanis .yv-m-flat { opacity: 0; }
.rdlv-yanis.talk .yv-m-smile, .rdlv-yanis.talk .yv-m-laugh, .rdlv-yanis.talk .yv-m-o, .rdlv-yanis.talk .yv-m-flat { opacity: 0 !important; }
.rdlv-yanis.talk .yv-m-open { opacity: 1; animation: yv-talk .26s ease-in-out infinite alternate; transform-origin: 120px 146px; transform-box: view-box; }
@keyframes yv-talk { from { transform: scaleY(.25) scaleX(.9); } to { transform: scaleY(1) scaleX(1); } }
.rdlv-yanis.m-surprised .yv-brows { transform: translateY(-6px); }
.rdlv-yanis.m-surprised .yv-m-smile { opacity: 0; } .rdlv-yanis.m-surprised .yv-m-o { opacity: 1; }
.rdlv-yanis.m-laugh .yv-m-smile { opacity: 0; } .rdlv-yanis.m-laugh .yv-m-laugh { opacity: 1; }
.rdlv-yanis.m-laugh .yv-eyes { animation: none; transform: scaleY(.35); }
.rdlv-yanis.m-think .yv-pupils { transform: translate(4px, -3px); }
.rdlv-yanis.m-think .yv-brow-l { transform: translateY(-5px); }
.rdlv-yanis.m-think .yv-m-smile { opacity: 0; } .rdlv-yanis.m-think .yv-m-flat { opacity: 1; }
.rdlv-yanis.m-sad .yv-brow-l { transform: rotate(-12deg); transform-origin: 104px 88px; transform-box: view-box; }
.rdlv-yanis.m-sad .yv-brow-r { transform: rotate(12deg); transform-origin: 136px 88px; transform-box: view-box; }
.rdlv-yanis.m-sad .yv-m-smile { opacity: 0; } .rdlv-yanis.m-sad .yv-m-flat { opacity: 1; }
.rdlv-yanis.listening .yv-head { animation: none; transform: rotate(-3deg) translateY(2px); }
.rdlv-yanis .yv-note { opacity: 0; }
.rdlv-yanis.listening .yv-note { opacity: 1; animation: yv-note 1.6s ease-in-out infinite; }
@keyframes yv-note { 50% { transform: translateY(-4px); } }
.rdlv-scene .lamp { opacity: 0; }
.rdlv.night .rdlv-scene .lamp { opacity: 1; }

/* Phones and narrow windows */
@media (max-width: 820px) {
  .rdlv-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: 190px minmax(0, 1fr); }
  .rdlv-top { gap: 6px; padding-left: 12px; padding-right: 12px; }
  .rdlv-back span { display: none; }
  .rdlv-title strong { font-size: 1rem; }
  .rdlv-tool { min-width: 34px; height: 34px; padding: 0 8px; }
  .rdlv-compose, .rdlv-hints, .rdlv-under { padding-left: 12px; padding-right: 12px; }
  .rdlv-log { padding-left: 12px; padding-right: 12px; }
  .rdlv-key { min-width: 28px; height: 28px; }
  .rdlv-stage { border-right: 0; border-bottom: 1px solid var(--line, #e2d9e8); }
  .rdlv-yanis { width: 200px; left: auto; right: 6px; transform: none; bottom: -6px; }
  .rdlv-nameplate { top: auto; bottom: 12px; left: 10px; font-size: .78rem; max-width: calc(100% - 210px); }
  .rdlv-body.setup { grid-template-rows: 150px 1fr; }
  .rdlv-body.setup .rdlv-yanis { width: 160px; }
  .rdlv-body.setup .rdlv-nameplate { max-width: calc(100% - 175px); }
  .rdlv-tool .lbl { display: none; }
  .rdlv-opt > span { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .rdlv, .rdlv-msg, .rdlv-yanis .yv-head, .rdlv-yanis .yv-eyes { animation: none !important; }
}

/* Mode switch (adults / kids) and Théo, the kids-mode character */
.rdlv-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 18px; max-width: 520px; }
.rdlv-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; cursor: pointer;
}
.rdlv-mode button small { font-weight: 600; font-size: .78rem; color: var(--muted, #6d6474); }
.rdlv-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); }
.rdlv.kid .rdlv-level .cefr { color: #d24a24; }
.rdlv.kid .rdlv-level:hover, .rdlv.kid .rdlv-level:focus-visible { border-color: #e4572e; }
.rdlv-theo { width: min(74%, 320px); }
.rdlv-theo .yv-ball { animation: yv-ball 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes yv-ball { 50% { transform: translateY(-5px) rotate(18deg); } }
@media (max-width: 760px) {
  .rdlv-theo { width: 170px; }
  .rdlv-body.setup .rdlv-theo { width: 140px; }
}
@media (prefers-reduced-motion: reduce) { .rdlv-theo .yv-ball { animation: none !important; } }
