:root {
  --terracotta: #D95D39; --cedar: #1B4332; --azure: #0077B6; --sand: #F8F4E3; --slate: #1E293B;
  --card: #ffffff; --line: #e4dcc3; --muted: #5b6a7e; --ok: #1f8a4c; --bad: #c0392b;
  --blue: #0077B6; --amber: #e0a526; --emerald: #1f9d6b; --rose: #d6487a;
  --radius: 14px;
  /* darker shades: text on white, and the solid drop under pressable buttons */
  --ink: #0F172A; --terracotta-dark: #a8432a; --amber-dark: #b07d10; --press: #cbbf9c; --track: #efe8cf;
  /* answer feedback in the bottom bar: right, close, wrong (the bar's green and red are the app's own --ok / --bad) */
  --right: var(--ok); --right-bg: #ECFDF5; --right-text: #047857; --close: #F59E0B; --close-bg: #FFFBEB; --close-text: #92400E; --wrong-text: var(--bad);
  /* pale fills for picked answers and done states */
  --ok-bg: #e6f6ec; --bad-bg: #fdeaea; --ok-tint: #f1faf4;
  /* the question panel: warm, not grey; and the badge behind the bottom bar's icons */
  --panel: #f7f0df; --panel-line: #ebe0c4; --badge: #ecd9a7;
  /* the bottom bar's neutral state ("Your turn", "Listen…"): the question panel's warm fill */
  --info-bg: var(--panel);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* App shell: the window never scrolls. Header and nav are fixed rows; #view is the only scroll container. */
body { font-family: Inter, system-ui, sans-serif; background: var(--sand); color: var(--slate); line-height: 1.45; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
h1, h2, h3, h4 { margin: .4em 0; font-family: Cairo, Inter, sans-serif; color: var(--cedar); }
a { color: var(--azure); text-decoration: none; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.ar, .big-ar { font-family: Cairo, 'Noto Sans Arabic', sans-serif; direction: rtl; }
.ar { font-size: 1.15em; }

#hdr { flex: none; position: relative; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: var(--cedar); color: #fff; }
.logo-ar { font-family: Cairo, sans-serif; font-size: 1.3rem; color: #ffd9c9; }
.stats { display: flex; gap: 10px; font-size: .85rem; flex-wrap: wrap; justify-content: flex-end; }
.stat { background: rgba(255,255,255,.12); padding: 3px 9px; border-radius: 999px; }

#view { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 16px max(16px, calc((100% - 820px) / 2)) 90px; }
.badge { position: absolute; top: 0; right: 0; background: var(--terracotta); color: #fff; border-radius: 999px; font-style: normal; font-size: .62rem; padding: 1px 5px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: 0 1px 2px rgba(30,41,59,.05); }
a.card.link { display: block; color: inherit; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--slate); border-radius: 10px; padding: 10px 14px; cursor: pointer; min-height: 44px; }
.btn:hover { border-color: var(--azure); }
.btn.primary { background: var(--terracotta); border-color: var(--terracotta); color: #fff; font-weight: 600; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { min-height: 32px; padding: 4px 10px; }
.btn.opt { display: block; width: 100%; text-align: left; margin: 6px 0; }
.btn.right, .btn.opt.right { background: var(--ok-bg); border-color: var(--ok); }
.btn.wrong, .btn.opt.wrong { background: var(--bad-bg); border-color: var(--bad); }
.btn:disabled { opacity: .7; cursor: default; }
.chip { font: inherit; font-size: .8rem; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; border: 0; background: #fff; padding: 8px 12px; cursor: pointer; }
.seg button.on { background: var(--cedar); color: #fff; }
.inp { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin: 6px 0; }
.field { display: block; margin: 8px 0; } .field span { display: block; font-size: .85rem; color: var(--muted); }
.check { display: block; margin: 6px 0; }
.bar { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; margin: 6px 0; }
.bar .fill { height: 100%; background: linear-gradient(90deg, var(--terracotta), var(--azure)); }
.fb { padding: 10px 12px; border-radius: 10px; margin: 10px 0; }
.fb.ok { background: var(--ok-bg); color: #14532d; } .fb.bad { background: var(--bad-bg); color: #7f1d1d; }
.rule { font-size: .88rem; color: var(--cedar); background: #eef5ef; border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
.culture { background: #fff3e6; border-radius: 10px; padding: 4px 12px; margin: 10px 0; }
.prompt { font-size: 1.3rem; font-weight: 600; margin: 8px 0 12px; }
.crumb { font-size: .9rem; }

.audio { border: 0; background: var(--azure); color: #fff; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; flex: none; display: inline-grid; place-items: center; padding: 0; }
.audio svg { width: 22px; height: 22px; }
.audio.small { width: 30px; height: 30px; }
.audio.small svg { width: 17px; height: 17px; }
.audio.playing { background: var(--terracotta); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }

/* text blocks */
.tx { display: flex; flex-direction: column; gap: 2px; }
.tx .chat { font-weight: 600; font-size: 1.05rem; }
.tx.big .chat { font-size: 1.6rem; } .tx.big .ar { font-size: 1.7rem; }
.tx .ar { color: var(--slate); }
.w { cursor: pointer; border-bottom: 1px dotted var(--muted); }
.w:hover { background: #fff0cc; }
.phrases { display: grid; gap: 10px; }
.phrase { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid #f0ead6; }
.en { color: var(--muted); font-size: .92rem; }

/* sheet (x-ray) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: min(560px, 100%); border-radius: 18px 18px 0 0; padding: 16px; max-height: 80vh; overflow: auto; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.x { border: 0; background: none; font-size: 1.2rem; cursor: pointer; }
.xr-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f1ecd8; }
.xr-k { flex: 0 0 150px; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* map */
.hero { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tier { margin-top: 22px; color: var(--terracotta); font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; }
.unit { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin: 10px 0; overflow: hidden; }
.station { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--azure); color: #fff; display: grid; place-items: center; font-weight: 700; border: 4px solid #cfe9f7; }
.station.complete { background: var(--ok); border-color: #c9efd8; }
.sub { display: flex; gap: 10px; padding: 9px 14px; color: var(--slate); border-bottom: 1px solid #f7f2e0; align-items: center; min-height: 44px; }
.sub:hover { background: #fffaf0; }
.sub.pending { color: #94a3b8; }

/* chat story */
.wa { background: #e7dfc9; border-radius: var(--radius); padding: 10px; }
.wa-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.wa-thread { display: flex; flex-direction: column; gap: 8px; max-height: 58vh; overflow: auto; padding: 4px; }
.bubble { max-width: 86%; padding: 8px 12px; border-radius: 12px; background: #fff; position: relative; }
.bubble.me { align-self: flex-end; background: #d9f2c6; }
.bubble.them { align-self: flex-start; }
.who { font-size: .72rem; font-weight: 700; color: var(--terracotta); }
.bub-foot { text-align: right; margin-top: 2px; }
.wa-ctl { margin-top: 10px; }
.check-q { margin: 6px 0; }

.shorty-lines .sh-line { padding: 8px 10px; border-radius: 10px; margin: 6px 0; cursor: pointer; border-left: 4px solid transparent; }
.sh-line.active { background: #fff0cc; border-left-color: var(--terracotta); }

/* tiles */
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.tile { font: inherit; border: 2px solid; border-radius: 10px; padding: 8px 14px; background: #fff; cursor: pointer; font-weight: 600; min-height: 44px; }
.legend .tile { font-size: .75rem; min-height: 0; padding: 3px 8px; cursor: default; }
.k-p { color: var(--blue); border-color: var(--blue); background: #e6f3fb; }
.k-s { color: #8a5e00; border-color: var(--amber); background: #fff6dc; }
.k-x { color: #0d6b47; border-color: var(--emerald); background: #e2f6ee; }
.k-c { color: #a02456; border-color: var(--rose); background: #fde9f1; }
.k-w { color: var(--slate); border-color: #cbd5e1; background: #f1f5f9; }
.tb-answer, .tb-tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-radius: 12px; margin: 10px 0; min-height: 64px; align-items: center; }
.tb-answer { border: 2px dashed var(--line); background: #fffdf5; }
.segs { display: inline-flex; gap: 2px; }
.seg-t { padding: 2px 8px; border-radius: 8px; border: 2px solid; font-weight: 700; font-size: 1.1rem; }

/* anticipation */
.radial { width: 150px; height: 150px; transform: rotate(-90deg); }
.radial .rbg { fill: none; stroke: var(--track); stroke-width: 9; }
.radial .rfg { fill: none; stroke: var(--terracotta); stroke-width: 9; stroke-linecap: round; }
.radial .rtxt { transform: rotate(90deg); transform-origin: 50px 50px; font-size: 22px; font-weight: 700; fill: var(--cedar); font-family: Cairo, sans-serif; }
.chain { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; }
.hands { float: right; font-size: .85rem; color: var(--muted); }

/* labs */
.slider-row { display: grid; grid-template-columns: 70px 1fr 150px; gap: 10px; align-items: center; margin: 10px 0; }
.slider-row input[type=range] { width: 100%; accent-color: var(--terracotta); min-height: 32px; }
.lab-out { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.lab-form { font-size: 1.4rem; }
.lab-pron { color: var(--muted); font-size: 1rem; }
.lab-label { font-size: .85rem; color: var(--cedar); font-weight: 600; }
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.letter { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; cursor: pointer; }
.big-ar { font-size: 2.6rem; line-height: 1.2; color: var(--cedar); }
.lt-chat { font-weight: 700; color: var(--terracotta); } .lt-ex { font-size: .85rem; margin-top: 6px; }
.marks { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.mark { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; display: flex; flex-direction: column; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0; }
.pair-w { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; min-width: 0; }
.pair-focus { font-weight: 700; color: var(--terracotta); }

/* review grades */

/* phases */
.phases { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.phase { font: inherit; font-size: .72rem; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.phase b { font-size: 1rem; } .phase.on { background: var(--cedar); color: #fff; } .phase.past { background: var(--ok-bg); }

/* roots */
.verb-list { display: grid; gap: 6px; max-height: 340px; overflow: auto; }
.verb { display: grid; grid-template-columns: 90px 1fr 1fr auto; gap: 8px; align-items: center; text-align: left; font: inherit; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.verb.on { border-color: var(--terracotta); background: #fff6f2; }
.forms { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.formcell { background: var(--sand); border-radius: 10px; padding: 8px; cursor: pointer; display: flex; flex-direction: column; }
.scroll-x { overflow-x: auto; }
.matrix { border-collapse: collapse; width: 100%; font-size: .9rem; }
.matrix th, .matrix td { border: 1px solid var(--track); padding: 4px 6px; text-align: left; white-space: nowrap; cursor: pointer; }
.matrix .seg-t { font-size: .85rem; padding: 0 4px; border-width: 1px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: var(--slate); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .25s; z-index: 80; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .slider-row { grid-template-columns: 1fr; }
  .verb { grid-template-columns: 70px 1fr; } .verb .chip { display: none; }
  .pair { grid-template-columns: 1fr 1fr; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { .audio.playing { animation: none; } }

/* ── gamification ── */
.stats { color: inherit; align-items: center; }
/* header: streak + today's goal (one pill) */
.stat.streak { display: inline-flex; gap: 5px; align-items: center; padding: 2px 10px 2px 3px; border: 0; color: #fff; font: inherit; cursor: pointer; line-height: 1; }
.stat.streak .flame { font-style: normal; font-size: .82rem; line-height: 1; }
.stat.streak.cold .flame { filter: grayscale(1); opacity: .55; }
.stat.streak .streak-n { font-size: .95rem; font-weight: 700; }
.stat.streak .goal-n { font-size: .75rem; opacity: .8; margin-left: 2px; }
.stat.streak.hit .ring .rfg { stroke: #ffc94d; }
.stat.streak.hit { box-shadow: inset 0 0 0 1px rgba(255,201,77,.6); }
.stat.streak:hover, .stat.streak:focus-visible { background: rgba(255,255,255,.22); }
/* XP lands in the pill: a small +N flies up to it, the pill bumps and the ring fills; a burst when the goal is hit */
.stat.streak.bump { animation: pillBump .45s ease-out; }
.stat.streak.goal-pop { animation: pillBump .45s ease-out, goalPop 1.2s ease-out; }
@keyframes pillBump { 40% { transform: scale(1.18); } }
@keyframes goalPop { 0% { box-shadow: 0 0 0 0 rgba(255,201,77,.9); } 100% { box-shadow: 0 0 0 16px rgba(255,201,77,0); } }
.xp-fly { position: fixed; z-index: 91; pointer-events: none; font-weight: 700; font-size: .9rem; color: #7a4b00; background: #ffd27a; border-radius: 999px; padding: 2px 8px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
@media (prefers-reduced-motion: reduce) { .stat.streak.bump, .stat.streak.goal-pop { animation: none; } .xp-fly { display: none; } }
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .rbg { fill: none; stroke: rgba(120,120,120,.22); stroke-width: 4; }
.ring .rfg { fill: none; stroke: var(--terracotta); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .6s; }
.stat .ring .rbg { stroke: rgba(255,255,255,.25); } .stat .ring .rfg { stroke: #ffd27a; }
.ring span { position: relative; font-size: .8rem; }
.hero { align-items: center; justify-content: flex-start; gap: 16px; }
.week { display: flex; justify-content: space-between; margin: 14px 0 6px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .7rem; color: var(--muted); }
.wd i { width: 32px; height: 32px; border-radius: 50%; background: var(--track); display: grid; place-items: center; font-style: normal; font-size: 1rem; }
.wd.on i { background: #ffe3cf; } .wd.today i { box-shadow: 0 0 0 2px var(--terracotta); }
.quests { display: grid; gap: 6px; margin-top: 8px; }
.quest { display: flex; gap: 8px; align-items: center; font-size: .92rem; } .quest span:nth-child(2) { flex: 1; } .quest small { color: var(--muted); }
.quest.done span:nth-child(2) { text-decoration: line-through; color: var(--muted); }
.stars { font-size: 3rem; letter-spacing: 6px; color: #d9d2bb; } .stars .on { color: #f1b020; animation: pop .5s both; } .stars span:nth-child(2) { animation-delay: .15s; } .stars span:nth-child(3) { animation-delay: .3s; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.35); } 100% { transform: scale(1); } }
.xp-float { position: fixed; left: 50%; top: 38%; transform: translateX(-50%); z-index: 90; font-weight: 700; font-size: 1.4rem; color: var(--terracotta); text-shadow: 0 1px 0 #fff, 0 0 12px #fff; pointer-events: none; animation: floatup 1.3s ease-out forwards; }
.xp-float.big { font-size: 1.9rem; color: var(--cedar); } .xp-float.combo { top: 30%; color: var(--azure); }
@keyframes floatup { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -90px); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; animation: fall 2.2s linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }
.celebrate { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 92; display: grid; place-items: center; padding: 20px; }
.cel-card { background: #fff; border-radius: 20px; padding: 24px; text-align: center; max-width: 340px; animation: pop .45s both; }
.cel-emoji { font-size: 4rem; }
.rank { display: flex; gap: 14px; align-items: center; } .rank > div:last-child { flex: 1; }
.stat-row { display: flex; justify-content: space-around; text-align: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.big-stat b { display: block; font-size: 1.5rem; color: var(--terracotta); } .big-stat span { font-size: .78rem; color: var(--muted); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.badge-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; display: flex; flex-direction: column; gap: 2px; opacity: .55; }
.badge-card.got { opacity: 1; background: #fff8e6; border-color: var(--amber); }
.badge-card small { color: var(--muted); } .b-ic { font-size: 2rem; }

/* ── Audio Lab ── */
.al-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.al-row { border-top: 1px solid var(--line); padding: 10px 0; }
.al-row.playing { background: #fff6e6; }
.al-main { display: flex; align-items: center; gap: 10px; }
.al-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.al-rate { display: flex; gap: 6px; align-items: center; margin-top: 6px; padding-left: 46px; }
.al-note { flex: 1; min-width: 0; padding: 6px 8px; font-size: .85rem; }
.chip.on { background: #e3f4ea; border-color: var(--ok); }
.chip.on.bad { background: #fbe5e2; border-color: var(--bad); }
pre.code { background: #f3efe0; padding: 10px; border-radius: 8px; overflow-x: auto; }

/* ══════════ V2: nav ══════════ */

/* ══════════ The Road ══════════ */
.road-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.rh-main { flex: 1; min-width: 0; }
.rh-top { display: flex; gap: 12px; flex-wrap: wrap; font-weight: 600; }
.rh-rank { color: var(--cedar); }
.btn.big-cta { width: 100%; font-size: 1.05rem; padding: 14px 16px; border-radius: 16px; box-shadow: 0 4px 0 var(--terracotta-dark); }
.btn.big-cta:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--terracotta-dark); }
.btn.big-cta[disabled] { opacity: .45; box-shadow: none; }
.road { display: flex; flex-direction: column; align-items: center; padding: 8px 0 120px; }
.station-banner { align-self: stretch; display: flex; gap: 12px; align-items: center; margin: 22px 0 14px; padding: 12px 14px; border-radius: 16px; color: #fff; background: var(--azure); scroll-margin-top: 70px; }
.station-banner.tier-2 { background: var(--terracotta); }
.station-banner.tier-3 { background: var(--cedar); }
.station-banner .muted { color: rgba(255,255,255,.8); }
.station-banner .bar { background: rgba(255,255,255,.25); }
.station-banner .bar .fill { background: #fff; }
.sb-n { flex: none; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; }
.sb-main { flex: 1; min-width: 0; }
.sb-place { font: 700 1.05rem Cairo, Inter, sans-serif; }
.sb-place .ar { font-size: .95rem; opacity: .85; }
.sb-title { font-size: .85rem; opacity: .95; }
.rnode { position: relative; display: flex; flex-direction: column; align-items: center; margin: 6px 0 18px; }
.rn-btn { width: 66px; height: 62px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.6rem; background: #e6dfc8; color: #8a8f98; box-shadow: 0 6px 0 var(--press); transition: transform .1s; }
.rn-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--press); }
.rnode.big .rn-btn { width: 80px; height: 74px; font-size: 2rem; }
.rnode.done .rn-btn { background: #f1c84b; color: #6b4e00; box-shadow: 0 6px 0 #c99a17; font-weight: 700; }
.rnode.open .rn-btn { background: #fff; color: var(--slate); box-shadow: 0 6px 0 var(--press); }
.rnode.current .rn-btn { background: var(--terracotta); color: #fff; box-shadow: 0 6px 0 var(--terracotta-dark), 0 0 0 8px rgba(217,93,57,.18); animation: nodeglow 1.6s ease-in-out infinite; }
.rnode.t-boss.current .rn-btn, .rnode.t-boss.open .rn-btn { background: #7b3f61; color: #fff; box-shadow: 0 6px 0 #4f2740; }
.rnode.t-shorty.current .rn-btn, .rnode.t-shorty.open .rn-btn { background: var(--azure); color: #fff; box-shadow: 0 6px 0 #005484; }
@keyframes nodeglow { 50% { box-shadow: 0 6px 0 var(--terracotta-dark), 0 0 0 14px rgba(217,93,57,.08); } }
.rn-label { font-size: .7rem; color: var(--muted); margin-top: 8px; max-width: 120px; text-align: center; }
.rnode.current .rn-label { color: var(--terracotta); font-weight: 700; }
.start-tag { position: absolute; top: -30px; background: #fff; border: 2px solid var(--terracotta); color: var(--terracotta); font-weight: 700; font-size: .72rem; letter-spacing: .08em; padding: 3px 10px; border-radius: 10px; animation: bob 1.2s ease-in-out infinite; z-index: 1; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.road-pending { margin: 10px 0 0; }
/* the warm-up notice: one quiet line like a kicker (no box), with a Skip link */
.warmup-tag { margin: 6px 0 2px; }
.wt-label { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.wt-ico { width: 16px; height: 16px; color: var(--amber-dark); }
.wt-skip { border: 0; background: none; padding: 6px 4px; min-height: 32px; font: inherit; font-size: .88rem; font-weight: 600; color: var(--azure); cursor: pointer; }
.wt-skip:hover { text-decoration: underline; }

/* ══════════ The Gym ══════════ */
.gym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.gym-tile { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; color: inherit; box-shadow: 0 3px 0 var(--line); }
.gym-tile.hot { border-color: var(--terracotta); box-shadow: 0 3px 0 #f0b8a6; }
.gym-tile.locked { opacity: .6; cursor: default; }
.gt-ic { font-size: 1.9rem; width: 48px; height: 48px; display: grid; place-items: center; background: var(--sand); border-radius: 12px; flex: none; }

/* ══════════ My Diwan ══════════ */
.diwan-hero { display: flex; gap: 14px; align-items: center; }
.diwan-cat { width: 120px; flex: none; }
.diwan-cat .cat { width: 100%; height: auto; }
.wallet { margin-top: 8px; font-size: 1.05rem; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.shop-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.shop-item.on { border-color: var(--ok); background: var(--ok-tint); }
.shop-item.locked { opacity: .6; }
.si-ic { font-size: 1.8rem; }
.si-lock { color: var(--muted); }
.postcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.postcard { border: 2px dashed #d8cfb6; border-radius: 12px; padding: 12px; background: #fffdf6; }
.postcard.got { border-style: solid; border-color: var(--amber); background: linear-gradient(135deg, #fffaf0, #fdf1d8); }
.ladder { display: flex; flex-direction: column; gap: 6px; }
.rung { display: flex; gap: 12px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; }
.rung.past { opacity: .6; }
.rung.cur { background: #fff1ea; border: 1px solid var(--terracotta); }
.rg-xp { width: 70px; flex: none; padding-top: 2px; }
.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.cast-card { display: flex; gap: 10px; align-items: flex-start; }
.prof-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0; }
.prof-row .inp { max-width: 60%; }

/* ══════════ Characters ══════════ */
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; }
.avatar.sm { width: 34px; height: 34px; }
.avatar.lg { width: 60px; height: 60px; }
.avatar .face { width: 100%; height: 100%; display: block; }
.avatar.cat-av { background: #fdf0c8; overflow: hidden; } .avatar.cat-av .cat { width: 100%; height: 100%; display: block; }
.face .m-open { opacity: 0; transform-box: fill-box; transform-origin: center; }
.talking .face .m-open { animation: talk .22s ease-in-out infinite alternate; }
.talking .face .m-closed { opacity: 0; }
.talking { filter: drop-shadow(0 0 6px rgba(0,119,182,.55)); }
@keyframes talk { from { opacity: 1; transform: scaleY(.25); } to { opacity: 1; transform: scaleY(1); } }
.bub-row { display: flex; gap: 8px; align-items: flex-end; margin: 6px 0; }
.bub-row.me { flex-direction: row-reverse; }
.bub-row .bubble { margin: 0; }
.sh-line { display: flex; gap: 10px; align-items: flex-start; }
.sh-body { flex: 1; min-width: 0; }

/* ══════════ Za3tar the cat ══════════ */
.mascot { position: fixed; right: 10px; bottom: 78px; z-index: 30; width: 74px; height: 74px; padding: 0; border: 0; background: none; cursor: pointer; filter: drop-shadow(0 3px 4px rgba(30,41,59,.25)); }
.mascot .cat { width: 100%; height: 100%; overflow: visible; }
.cat .tail { transform-origin: 68px 74px; animation: tail 2.4s ease-in-out infinite; }
@keyframes tail { 50% { transform: rotate(-12deg); } }
.cat .cat-eyes { transform-origin: 50px 40px; animation: blink 4.5s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.cat .cat-x { display: none; }
.cat .cup { display: none; }
.cat .cup[data-gold] { display: inline; }
.cat .ear { transition: transform .2s; }
.mascot.listen .ear-l { transform: translate(-1px, -3px) rotate(-6deg); transform-origin: 37px 24px; }
.mascot.listen .ear-r { transform: translate(1px, -3px) rotate(6deg); transform-origin: 63px 24px; }
.mascot.think .cup { display: inline; }
.mascot.think .head { transform: rotate(-6deg); transform-origin: 50px 60px; transition: transform .3s; }
.mascot.think .steam { animation: steam 1.2s ease-in-out infinite; }
@keyframes steam { 50% { opacity: .3; transform: translateY(-2px); } }
.mascot.happy .cat { animation: hop .45s ease-out 2; }
.mascot.party .cat { animation: dabkeh .5s ease-in-out infinite; }
@keyframes hop { 40% { transform: translateY(-14px); } }
@keyframes dabkeh { 25% { transform: translateY(-10px) rotate(-8deg); } 50% { transform: translateY(0); } 75% { transform: translateY(-10px) rotate(8deg); } }
.mascot.sad .cat { transform: rotate(-80deg) translate(-10px, 14px); transition: transform .35s; }
.mascot.sad .cat-eyes { display: none; }
.mascot.sad .cat-x { display: inline; }
.mascot-bubble { position: fixed; right: 88px; bottom: 150px; z-index: 31; max-width: 220px; background: #fff; border: 2px solid var(--cedar); border-radius: 14px 14px 2px 14px; padding: 8px 12px; font-size: .9rem; box-shadow: 0 4px 10px rgba(30,41,59,.15); opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .2s, transform .2s; }
.mascot-bubble.show { opacity: 1; transform: none; }
.mascot-bubble small { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .cat .tail, .cat .cat-eyes, .mascot.party .cat, .mascot.happy .cat, .rnode.current .rn-btn, .start-tag { animation: none !important; } }

/* ══════════ Combo meter & fire ══════════ */
#combo-meter { position: fixed; top: 62px; left: 50%; transform: translateX(-50%) scale(.85); z-index: 25; display: inline-flex; align-items: center; gap: 6px; background: var(--cedar); color: #fff; font-family: Cairo, Inter, sans-serif; font-weight: 700; font-size: 1rem; padding: 5px 14px 5px 10px; border-radius: 999px; box-shadow: 0 2px 8px rgba(30,41,59,.18); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#combo-meter.show { opacity: 1; transform: translateX(-50%) scale(1); }
#combo-meter.x3, #combo-meter.x5 { background: var(--terracotta); }
#combo-meter .cm-ico { width: 18px; height: 18px; color: var(--amber); } #combo-meter.x3 .cm-ico, #combo-meter.x5 .cm-ico { color: #ffe08a; }
@keyframes pulse { 50% { transform: translateX(-50%) scale(1.08); } }
#view.on-fire .card { box-shadow: 0 0 0 2px var(--amber), 0 0 18px rgba(217,93,57,.45); transition: box-shadow .3s; }
.xp-float.combo.x3, .xp-float.combo.x5 { color: var(--terracotta); }
.xp-float { display: inline-flex; align-items: center; gap: 6px; font-family: Cairo, Inter, sans-serif; white-space: nowrap; }
.xp-float .xf-ico { width: 1em; height: 1em; color: var(--amber); }
.tile.snap { animation: snap .18s ease-out; }
@keyframes snap { from { transform: scale(1.25); } to { transform: scale(1); } }

/* ══════════ Onboarding ══════════ */
.onboard { position: fixed; inset: 0; z-index: 60; background: rgba(27,67,50,.92); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.ob-panel { background: var(--sand); border-radius: 22px; max-width: 460px; width: 100%; padding: 22px 18px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.ob-panel h4 { margin: 14px 0 6px; }
.ob-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.ob-dots i { width: 8px; height: 8px; border-radius: 50%; background: #d8cfb6; }
.ob-dots i.on { background: var(--terracotta); width: 22px; border-radius: 4px; }
.ob-dots i.past { background: var(--cedar); }
.ob-cat { width: 130px; margin: 0 auto; }
.ob-cat .cat { width: 100%; height: auto; }
.ob-cat.wave .cat { animation: hop .6s ease-out 2; }
.ob-cat.tap-cat { position: relative; cursor: pointer; }
.ob-cat.tap-cat::after { content: '🔊'; position: absolute; right: 4px; top: 18px; font-size: 1rem; background: #fff; border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.ob-cat.happy .cat { animation: dabkeh .6s ease-in-out 3; }
.ob-choices { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
/* age groups: always one row of equal buttons; the text scales a little on the smallest phones */
.ob-ages { display: grid; grid-template-columns: minmax(0, 1.45fr) repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 auto 16px; max-width: 400px; }
.ob-ages .chip { padding: 8px 2px; font-size: clamp(.74rem, 3.5vw, .88rem); white-space: nowrap; text-align: center; }
.chip.big { font-size: .95rem; padding: 9px 14px; }
.ob-sounds { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.ob-count { font-weight: 700; color: var(--cedar); margin: 10px 0 0; }
.ob-sound { display: flex; gap: 12px; align-items: center; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; cursor: pointer; font: inherit; }
.ob-sound.heard { border-color: var(--ok); background: var(--ok-tint); }
.obs-d { flex: none; width: 46px; height: 46px; border-radius: 12px; background: var(--terracotta); color: #fff; font: 800 1.6rem Inter, sans-serif; display: grid; place-items: center; }
.ob-sound.heard .obs-d { background: var(--ok); }
.ob-demo { background: #fff; border-radius: 14px; padding: 16px; margin: 12px 0; }
.ob-ranks { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.ob-rank { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; }
.ob-rank.on { border-color: var(--terracotta); background: #fff1ea; }
.ob-rank small { color: var(--muted); }
@media (max-width: 420px) { .diwan-hero { flex-direction: column; text-align: center; } }
/* lessons: leave room under the content for Za3tar */

/* ══════════ Gold checkpoints on the Road (Shorty / Boss) ══════════ */
.rnode.t-shorty.current .rn-btn, .rnode.t-shorty.open .rn-btn, .rnode.t-boss.current .rn-btn, .rnode.t-boss.open .rn-btn { background: linear-gradient(160deg, #f7d774, var(--amber)); color: #5a3d00; box-shadow: 0 6px 0 var(--amber-dark); }
.rnode.t-shorty.current .rn-btn, .rnode.t-boss.current .rn-btn { box-shadow: 0 6px 0 var(--amber-dark), 0 0 0 10px rgba(224,165,38,.25); }
.rnode.t-shorty .rn-label, .rnode.t-boss .rn-label { color: #9a6b00; font-weight: 700; }

/* ══════════ 5-Beat Episode ══════════ */
.beat-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 6px 0 12px; }
.beat { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .62rem; color: var(--muted); text-align: center; }
.beat b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #e6dfc8; color: #8a8f98; font-size: .75rem; }
.beat.past b { background: var(--ok); color: #fff; font-size: .85rem; font-weight: 700; }
.beat.on b { background: var(--terracotta); color: #fff; box-shadow: 0 0 0 4px rgba(217,93,57,.2); }
.beat.on span { color: var(--terracotta); font-weight: 700; }
.literal { display: flex; flex-wrap: wrap; gap: 3px; margin: 4px 0 2px; }
.lit { font: 500 .68rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; background: #f3efe0; color: #6b6150; border-radius: 6px; padding: 1px 5px; }
.bubble.me .lit { background: rgba(255,255,255,.6); }
.za-notes { display: flex; gap: 12px; align-items: center; }
.za-cat { width: 70px; flex: none; }
.za-cat .cat, .ring-tip-cat .cat { width: 100%; height: auto; }
.za-note { display: flex; gap: 10px; align-items: flex-start; border-top: 1px solid var(--line); padding: 10px 0; }
.za-num { flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--terracotta); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .85rem; }
.za-note p { margin: 2px 0; }
.sub-prog { font-size: .8rem; font-weight: 700; color: var(--terracotta); letter-spacing: .03em; margin: 4px 0; }

/* Character Ring */
/* the TO / ABOUT (or past / present...) switch: a soft track, the chosen tab a raised white pill */
.ring-modes { display: flex; gap: 4px; margin: 4px 0 12px; padding: 4px; background: var(--track); border-radius: 999px; }
.ring-modes button { flex: 1 1 0; min-width: 0; min-height: 44px; font: inherit; font-size: .95rem; font-weight: 600; color: var(--muted); background: none; border: 0; border-radius: 999px; padding: 8px 12px; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.ring-modes button:hover { color: var(--cedar); }
.ring-modes button.on { background: var(--card); color: var(--cedar); box-shadow: 0 1px 3px rgba(30,41,59,.14); }
.ring-modes button:focus-visible { outline: 2px solid var(--cedar); outline-offset: 2px; }
.flip-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 48px; align-items: center; margin: 8px 0; perspective: 600px; }
.flip-tiles .tile { font-size: 1.15rem; padding: 8px 12px; cursor: default; }
.tile.fused { margin-left: -4px; /* touches the tile before it (the row's gap is 4px), no overlap */ border-top-left-radius: 2px; border-bottom-left-radius: 2px; }
.tile-flip-anim { animation: morphFlip .45s cubic-bezier(.2,.8,.3,1.2), morphGlow 1s ease-out; transform-origin: center; backface-visibility: hidden; }
@keyframes morphFlip { from { transform: rotateX(90deg); } to { transform: rotateX(0deg); } }
@keyframes morphGlow { 0% { box-shadow: 0 0 0 0 rgba(224,165,38,.9); } 100% { box-shadow: 0 0 0 12px rgba(224,165,38,0); } }
.ring-said { text-align: center; min-height: 60px; }
.ring-person { position: absolute; width: 84px; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; cursor: pointer; padding: 0; font: inherit; }
.ring-person .ring-av { width: 56px; height: 56px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(30,41,59,.2); background: #fff; transition: transform .15s; }
.ring-person.seen .ring-av { border-color: transparent; }
.ring-av.thing { display: flex; align-items: center; justify-content: center; font-size: 30px; line-height: 1; background: #fffaf0; } /* a thing in a pattern circle: its emoji */
.ring-person.on .ring-av { border-color: transparent; } /* the selected card has its own outline; the faces stay plain */
.ring-person .rp-label { font-size: .64rem; line-height: 1.15; background: rgba(255,255,255,.9); border-radius: 6px; padding: 1px 4px; text-align: center; }
.ring-av .face { width: 100%; height: 100%; display: block; border-radius: 50%; }
.ring-av.stack, .ring-bar .ring-person .ring-av.stack { width: auto; height: auto; border: 0; border-radius: 0; background: none; box-shadow: none; display: inline-flex; flex: none; }
.ring-av.stack .face { width: 36px; height: 36px; border-radius: 50%; }
.ring-av.stack .face + .face { margin-left: -14px; }
.ring-person.on .ring-av.stack { transform: none; }
/* the side column (wide screens): a little smaller so "A group" fits beside them */
@media (min-width: 521px) { .ring-bar .ring-person .ring-av.stack { height: 36px; align-items: center; } .ring-bar .ring-av.stack .face { width: 26px; height: 26px; } .ring-bar .ring-av.stack .face + .face { margin-left: -12px; } } /* same height as a single face, so every card is the same height */
.ring-tip { display: flex; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; margin: 8px 0; }
.ring-tip-cat { width: 44px; flex: none; }

/* Beat 5 */
.chain-steps { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.chain-step { display: flex; gap: 10px; align-items: center; text-align: left; font: inherit; font-size: 1.05rem; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer; }
.chain-step.next { border-color: var(--terracotta); box-shadow: 0 0 0 4px rgba(217,93,57,.15); }
.chain-step.heard { border-color: var(--ok); background: var(--ok-tint); }
.chain-step.later { opacity: .45; }
.cs-n { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--sand); display: grid; place-items: center; font-size: .75rem; font-weight: 700; }
.reflex-clock { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
.radial-wrap { width: 84px; flex: none; }
.radial-wrap .radial { width: 100%; height: auto; }
.radial-wrap.out .rfg { stroke: var(--bad); }

/* ══════════ Chat screens: the dialogue frame fills the view, its thread scrolls, controls stay visible ══════════ */
#view.chat-mode { overflow: hidden; display: flex; flex-direction: column; padding-bottom: 8px; }
#view.chat-mode > * { flex: none; }
#view.chat-mode .chat-fill { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#view.chat-mode .chat-fill > * { flex: none; }
#view.chat-mode .chat-fill > .chat-fill, #view.chat-mode .chat-fill > .chat-frame { flex: 1 1 auto; min-height: 0; }
#view.chat-mode .chat-frame { display: flex; flex-direction: column; min-height: 0; margin: 0; }
#view.chat-mode .chat-frame .wa-thread { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; }
#view.chat-mode .chat-frame .wa-ctl { flex: none; padding-right: 80px; } /* keep the buttons clear of Za3tar */
#view.chat-mode h2 { font-size: 1.1rem; margin: .2em 0; }
#view.chat-mode .crumb { font-size: .8rem; }

/* ══════════ Workout & mic ══════════ */
.big-listen { font-size: 1.2rem; padding: 18px 22px; margin: 10px 0; }
.big-inp { font-size: 1.15rem; padding: 12px; width: 100%; }
.rule { margin-top: 6px; font-size: .9rem; color: var(--slate); background: #fff8e8; border-radius: 8px; padding: 6px 8px; }
.chain-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chain-row .chain-step { flex: 1; min-width: 0; }
.btn.mic.on { background: var(--bad); color: #fff; animation: pulse-mic 1s ease-in-out infinite; }
@keyframes pulse-mic { 50% { box-shadow: 0 0 0 8px rgba(192,57,43,.2); } }
.mic-words { font-family: Cairo, 'Noto Sans Arabic', sans-serif; font-size: 1.05rem; }
.mic-words .hit { color: var(--ok); font-weight: 700; }
.mic-words .miss { color: var(--muted); }
.radial-wrap.listening .rfg { stroke: var(--azure); }

/* mic: one fixed-height result line, so nothing around it moves */


/* ══════════ V3.8: header (no bottom tab bar) ══════════ */
#hdr { gap: 8px; padding: 8px 12px; }
.brand { display: flex; flex-direction: column; color: #fff; line-height: 1.1; min-width: 0; }
.brand-title { font: 800 1.05rem Cairo, Inter, sans-serif; white-space: nowrap; }
.brand-title .logo-ar { font-size: .95rem; color: #ffd9c9; }
.hdr-right { display: flex; align-items: center; gap: 9px; flex: none; }
.hdr-btn { position: relative; display: inline-flex; align-items: center; gap: 2px; color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); padding: 5px 9px; border-radius: 999px; font-size: .8rem; font-weight: 700; cursor: pointer; white-space: nowrap; transition: box-shadow .15s, background .15s; }
.hdr-btn:hover, .hdr-btn:focus-visible { background: rgba(255,255,255,.24); box-shadow: 0 0 0 3px rgba(255,217,201,.35); }
.hdr-btn.rank { background: #fff3c9; color: var(--cedar); border-color: #ffe08a; }
button.hdr-btn { font-family: inherit; line-height: inherit; }
.hdr-btn.save-btn { gap: 6px; background: #fff; color: var(--cedar); border-color: #fff; padding: 5px 12px 5px 10px; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.hdr-btn.save-btn:hover, .hdr-btn.save-btn:focus-visible { background: #fff; box-shadow: 0 0 0 3px rgba(255,217,201,.45), 0 1px 2px rgba(0,0,0,.18); }
.save-ico { display: inline-flex; }
.hdr-btn .badge { top: -6px; right: -6px; }
#practice-btn:has(.badge) { margin-right: 5px; }
.stat .goal-n { margin-left: 3px; }
@media (max-width: 480px) { .hb-label, .stat .goal-n, .brand-rest { display: none; }
  .brand-title .logo-ar { margin-left: 6px; } }
.back-link { display: inline-block; margin: 2px 0 6px; font-weight: 700; }
.khatt-head h2 { margin-bottom: 0; }
.khatt-head .kh-dash { font-size: .8em; color: var(--muted); font-weight: 600; }
.mascot { bottom: 16px; }
.mascot-bubble { bottom: 96px; }

/* ══════════ Exercise frame: kicker / hero / body / action dock ══════════ */
.card.exercise { padding: 0; overflow: visible; }
.card.exercise > .test-bar, .card.exercise > .ex-kicker, .card.exercise > .ex-hero, .card.exercise > .ex-body { margin-left: 16px; margin-right: 16px; }
.ex-kicker { padding-top: 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 6px; }
/* the question: a warm rounded panel, the line in Cairo (docs/DESIGN.md) */
.ex-hero { margin-top: 6px; margin-bottom: 14px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); font-family: Cairo, Inter, sans-serif; font-size: 1.3rem; font-weight: 700; color: var(--slate); line-height: 1.4; }
.ex-hero .hero-en, .ex-hero .reflex-chat, .ex-hero .ctx-pill { font-family: Inter, system-ui, sans-serif; }
.ex-hero .hero-ctx { font-size: .9rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.ex-hero .hero-en { font-size: .9rem; font-weight: 500; color: var(--muted); margin-top: 4px; }
.ex-hero .big-listen { font-size: 1.1rem; margin: 0; }
.ex-hero.plain { background: none; border: 0; padding: 0; margin-top: 2px; font-size: 1rem; font-weight: 400; line-height: 1.45; color: var(--muted); }
.ex-body { padding-bottom: 14px; }
.ex-body .opts { margin-top: 0; }
.opts.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.exercise-action-dock { position: sticky; bottom: 0; z-index: 6; min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; background: #fff; border-top: 0; border-radius: 0 0 16px 16px; transition: background-color .2s ease, border-color .2s ease; }
.exercise-action-dock.is-correct { background: var(--right-bg); }
.exercise-action-dock.is-wrong { background: var(--bad-bg); }
.dock-msg { flex: 1; min-width: 0; font-size: .9rem; color: var(--muted); }
.is-correct .dock-msg b { color: var(--right-text); } .is-wrong .dock-msg b { color: var(--wrong-text); }
.dock-why { font-size: .82rem; color: var(--slate); margin-top: 2px; max-height: 3.9em; overflow: auto; }
.dock-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.dock-btn { min-width: 132px; }
.legend-wrap { position: relative; }
.legend-q { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; padding: 0; line-height: 16px; }
.legend-pop { position: absolute; top: 22px; left: 0; z-index: 8; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; box-shadow: 0 6px 16px rgba(30,41,59,.15); width: 240px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.legend-pop .legend { flex-wrap: wrap; }

/* test-mode jumpers */
.test-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 10px; padding: 6px 8px; border: 1px dashed #a78bfa; background: #f5f3ff; border-radius: 10px; font-size: .75rem; font-weight: 700; color: #6d28d9; }
.test-bar button { border: 1px solid #c4b5fd; background: #fff; border-radius: 6px; padding: 2px 7px; font: inherit; cursor: pointer; color: #5b21b6; }
.test-bar button.on { background: #7c3aed; color: #fff; }
/* the shared step bar (YL.ui.beatBar): done steps (✓) and test-mode steps are buttons */
button.beat { cursor: pointer; border: 0; background: none; font-family: inherit; font-size: .62rem; padding: 0; color: var(--muted); }
button.beat:hover b, button.beat:focus-visible b { box-shadow: 0 0 0 4px rgba(27,67,50,.22); }
button.beat.past:hover span { color: var(--cedar); } /* the ring on the circle says it can be tapped; no link underline */
.beat-bar.few { max-width: 320px; margin-left: auto; margin-right: auto; }

/* ══════════ Grammar tips vs Word X-Ray ══════════ */
.grammar-tip-pill { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; margin: 0 2px; border: 0; cursor: pointer; background: var(--close); color: #fff; font: inherit; font-weight: 700; font-size: 12px; padding: 3px 9px 3px 6px; border-radius: 999px; line-height: 1.4; }
.grammar-tip-pill:hover { background: #e08e0a; }
.chat .w { text-decoration: none; border-radius: 6px; padding: 0 2px; transition: background .15s; cursor: pointer; }
.chat .w:hover, .chat .w:focus { background: rgba(0,119,182,.12); }
.spotlight { flex: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; margin: 6px 0; padding: 8px; border: 2px solid var(--close); border-radius: 12px; background: var(--close-bg); max-height: 140px; overflow-y: auto; }
.spot-text { flex-basis: 100%; font-size: .85rem; color: #451a03; }
.spot-text p { margin: 2px 0; }
.pulse { animation: tipPulse .8s ease-out; }
@keyframes tipPulse { from { box-shadow: 0 0 0 0 rgba(245,158,11,.6); } to { box-shadow: 0 0 0 12px rgba(245,158,11,0); } }
.sheet.xray .sheet-head { align-items: center; }
.xray-badge { background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 3px 8px; border-radius: 6px; }
.xray-word { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
.xw-chat { font-size: 1.4rem; font-weight: 700; }
.xw-ar { font-size: 1.3rem; }

/* ══════════ Pattern Stage / Call & Response ══════════ */
.living-sentence { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 10px; margin: 8px 0; text-align: center; }
.tile.still { opacity: .95; }
.ring-diff { min-height: 1.6em; font-size: .85rem; color: var(--slate); margin-top: 6px; }
.ring-diff .d-from { color: var(--bad); } .ring-diff .d-to { color: var(--ok); }
.rg { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 2px solid; }
.ring-person.on .ring-av { border-color: transparent; }
.cr-line { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cr-tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cr-arrow { font-size: 1.3rem; color: var(--terracotta); margin: 2px 0; }
/* fixed dock height: the button keeps exactly the same coordinates whatever the feedback says */
.exercise-action-dock { height: 96px; min-height: 96px; box-sizing: border-box; }
.exercise-action-dock .dock-msg { max-height: 68px; overflow-y: auto; }
.exercise-action-dock .dock-why { max-height: none; overflow: visible; } /* Arabic in Cairo runs taller than the line: it made the message scroll */
/* exercise screens: the bottom belongs to the action dock, so Za3tar moves to the top right (still reacting) */

/* ══════════ V3.9 polish ══════════ */
/* the dock sits at the end of its card (after the content), not floating mid-screen */
.exercise-action-dock { position: static; }
.exercise-action-dock.is-great { background: var(--right-bg); }
.exercise-action-dock.is-close { background: var(--close-bg); }
.exercise-action-dock.is-again { background: var(--bad-bg); }
.exercise-action-dock.is-info { background: var(--info-bg); }
.is-great .dock-msg b { color: var(--right-text); } .is-close .dock-msg b { color: var(--close-text); } .is-again .dock-msg b { color: var(--wrong-text); } .is-info .dock-msg b { color: var(--cedar); }
.dock-msg.flash { animation: dockIn .28s ease-out; }
@keyframes dockIn { from { opacity: 0; } to { opacity: 1; } } /* a fade only: sliding in briefly overflowed the message box (a scrollbar on Windows) */
.dock-why .heard { font-family: Cairo, 'Noto Sans Arabic', sans-serif; }
@media (prefers-reduced-motion: reduce) { .dock-msg.flash { animation: none; } }
/* two CTAs side by side always get a gap */
.wa-ctl, .toolbar, .dock-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn + .btn { margin-left: 0; }
/* header */
.brand-title .logo-ar { margin-left: 8px; }
/* cloze as a mini dialogue */
.ex-hero.hero-chat { background: #e7dfc9; padding: 10px; border-radius: 14px; font-size: 1rem; }
.ex-hero.hero-chat .hero-line { font-size: 1.2rem; font-weight: 600; color: var(--slate); }
.ex-hero.hero-chat .bub-row { margin: 4px 0; }
.ex-hero .hero-ctx { font-weight: 700; }
/* tips beside the bubble */
.tip-col { display: flex; flex-direction: column; gap: 4px; align-self: center; flex: none; }
.tip-col .grammar-tip-pill { font-size: 12px; }
.za-num { font-size: .85rem; }
/* Pattern Stage: vertical person bar + Living Sentence beside it */
.stage-grid { display: grid; grid-template-columns: 136px 1fr; gap: 10px; align-items: start; margin-top: 8px; }
.ring-bar { display: flex; flex-direction: column; gap: 6px; }
.rb-group { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 4px; }
.ring-bar .ring-person { position: static; width: auto; flex-direction: row; gap: 6px; align-items: center; text-align: left; padding: 4px 6px 4px 4px; border-radius: 12px; background: #fff; border: 2px solid var(--line); }
.ring-bar .ring-person .ring-av { width: 36px; height: 36px; flex: none; border-width: 2px; box-shadow: none; }
.ring-bar .ring-av.thing { font-size: 20px; }
.ring-bar .ring-person .rp-label { font-size: .7rem; background: none; padding: 0; text-align: left; line-height: 1.15; }
.rp-label b { display: block; font-weight: 600; white-space: nowrap; }
.rp-label small { display: block; font-size: .92em; opacity: .7; }
.ring-bar .ring-person.seen { background: #f6fbf8; }
.ring-bar .ring-person.on { border-color: var(--terracotta); background: #fff1ea; box-shadow: 0 0 0 3px rgba(217,93,57,.18); }
.stage-main { position: sticky; top: 0; min-width: 0; }
.stage-main .living-sentence { margin-top: 0; }
.stage-main .ring-said .tx.big { font-size: 1.15rem; }
@media (max-width: 360px) { .stage-grid { grid-template-columns: 96px 1fr; } }

/* any two buttons in a row get a gap; flex containers already use gap */
.btn + .btn { margin-left: 8px; }
.toolbar > .btn + .btn, .wa-ctl > .btn + .btn, .dock-actions > .btn + .btn, .dock-side > .btn + .btn, .opts > .btn + .btn, .finish-actions > .btn + .btn { margin-left: 0; }
.finish-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }

/* Pattern Stage: horizontal person strip on phones, vertical bar from 600px up */
@media (max-width: 599px) {
  .stage-grid { grid-template-columns: 1fr; }
  /* phones: the people share the row (no sideways scrolling); a 5th or 6th person wraps to a second row */
  .ring-bar { gap: 10px; padding-bottom: 4px; }
  .rb-people { flex-direction: row; flex-wrap: wrap; }
  .ring-bar .ring-person { flex: 1 1 0; min-width: 64px; max-width: 120px; flex-direction: column; gap: 2px; padding: 6px 4px; text-align: center; }
  .ring-bar .ring-person .rp-label { text-align: center; }
  .stage-main { position: static; }
}
.stage-card .ex-hero { font-size: 18px; }
.warmup-tag { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Shared dock under chat threads (stories, episode scenes): same bar as the exercise cards */
.dock-side { display: flex; gap: 8px; align-items: center; }
.dock-side:empty { display: none; }
.wa-ctl.docked { display: block; margin-top: 8px; }
#view.chat-mode .chat-frame .wa-ctl.docked { padding-right: 0; }
.wa-ctl.docked .exercise-action-dock { border-radius: 12px; background: transparent; padding-left: 0; padding-right: 0; } /* the story bar: the buttons on the chat background, no white box */
.wa-ask:empty { display: none; }
.wa-ask .opts { margin: 6px 0 8px; }
.ex-q { margin: 4px 0 10px; font-weight: 600; }
.ant-stage { min-height: 60px; }
.ant-stage .inp { width: 100%; margin-top: 8px; }
.exercise .hands { float: none; display: flex; justify-content: flex-end; gap: 4px; margin: -4px 0 6px; font-size: .8rem; color: var(--muted); }
@media (max-width: 480px) {
  .exercise-action-dock { padding: 12px; gap: 10px; }
  .exercise-action-dock .dock-msg:empty { display: none; }
  .exercise-action-dock .dock-actions { margin-left: auto; }
}

/* Za3tar: same size and place on every screen (bottom right). The content always keeps room below it, so the
   cat never sits on top of a button: #view has 90px of bottom padding, chat screens reserve the same on phones. */
.mascot { right: 12px; bottom: 12px; width: 74px; height: 74px; }
.mascot-bubble { right: 92px; bottom: 70px; }
@media (min-width: 760px) { .mascot { right: 32px; bottom: 16px; } .mascot-bubble { right: 114px; bottom: 74px; } }
#view.chat-mode { padding-bottom: 8px; }
/* phones and tablets: the story needs the room, so the floating cat steps aside (it would sit on "Next line");
   wide screens keep it in the side margin */
@media (max-width: 1039px) { body:has(#view.chat-mode) .mascot { display: none; } }
@media (min-width: 1040px) { #view.chat-mode { padding-bottom: 16px; } }
/* story mode: a slim control bar (no empty message row) and a compact step bar */
#view.chat-mode .wa-ctl.docked .exercise-action-dock { height: auto; min-height: 0; padding: 8px 10px; gap: 8px; }
#view.chat-mode .wa-ctl.docked .exercise-action-dock .dock-msg:empty { display: none; }
#view.chat-mode .wa-ctl.docked .exercise-action-dock .dock-actions { margin-left: auto; }
#view.chat-mode .beat-bar { margin: 2px 0 6px; }
#view.chat-mode .beat-bar .beat span { display: none; }
#view.chat-mode .beat-bar .beat.on span { display: block; }
/* phones in story mode: one slim bar on top (the crumb); the steps hide (no step can be jumped to mid-story),
   the scene title takes one line and the script switch shrinks, so the conversation gets the screen */
@media (max-width: 1039px) {
  #view.chat-mode > h2, #view.chat-mode .beat-bar { display: none; }
  #view.chat-mode .wa-head { gap: 6px; margin-bottom: 4px; }
  #view.chat-mode .wa-head > b { flex: 1 1 100%; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
  #view.chat-mode .wa-head .seg button { padding: 3px 9px; font-size: .78rem; }
  #view.chat-mode .wa-head .chip, #view.chat-mode .wa-head > button { padding: 2px 8px; font-size: .78rem; }
}
/* grammar tips: an overlay over the bottom of the chat, opened from a line's 💡 (takes no room when closed) */
.chat-frame .spotlight { position: relative; height: 0; margin: 0; padding: 0; border: 0; background: none; overflow: visible; max-height: none; }
.chat-frame .spot-text { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 8; max-height: 45vh; overflow-y: auto;
  background: var(--close-bg); border: 2px solid var(--close); border-radius: 12px; padding: 10px 12px; box-shadow: 0 -6px 24px rgba(0,0,0,.18); cursor: pointer; }
.spot-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; color: #78350F; }
.spot-x { color: var(--close-text); font-weight: 700; }
.grammar-tip-pill.on { background: var(--close-text); color: #fff; }

#view.chat-mode .toolbar { margin: 2px 0 4px; }
#view.chat-mode .toolbar .seg button { padding: 4px 10px; font-size: .85rem; }

/* Speaking prompts as a chat: their line, then your (empty or English) bubble */
.reflex-chat { display: flex; flex-direction: column; gap: 8px; }
.reflex-lead { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.reflex-setup:empty { display: none; }
.reflex-setup { font-size: .85rem; color: var(--muted); font-weight: 600; }
.reflex-chat .bub-row { margin: 0; }
.bubble.mine { border: 2px dashed #9fd0ec; background: #f5fbff; min-width: 140px; }
.bubble.mine.filled { border-style: solid; border-color: var(--right); background: var(--right-bg); }
.bubble.mine .mine-text { font-size: 1.15rem; font-weight: 700; }
.bubble.mine .mine-en { color: var(--ink); }
.ex-hero .reflex-chat .bubble { font-size: 1rem; }
.reflex-opts { margin-top: 6px; }
.link-btn { background: none; border: 0; padding: 0; min-height: 0; font: inherit; font-weight: 700; color: #0369a1; text-decoration: underline; cursor: pointer; }
.chain-step.heard .cs-n { background: var(--ok); color: #fff; } /* a solid green circle, like the done badges on the map */
/* feedback with an explanation (or the mic's word row) grows to fit: never a scroll box inside the dock */
.exercise-action-dock:has(.dock-why, .mic-words) { height: auto; }
.exercise-action-dock:has(.dock-why, .mic-words) .dock-msg { max-height: none; overflow: visible; }
/* phones: a dock with two buttons or an explanation stacks (message full width on top, buttons right-aligned underneath) */
@media (max-width: 480px) {
  .exercise-action-dock:has(.dock-side:not(:empty)), .exercise-action-dock:has(.dock-why, .mic-words) { flex-wrap: wrap; height: auto; min-height: 96px; row-gap: 10px; }
  .exercise-action-dock:has(.dock-side:not(:empty)) .dock-msg, .exercise-action-dock:has(.dock-why, .mic-words) .dock-msg { flex: 1 1 100%; max-height: none; overflow: visible; }
  .dock-why { font-size: .88rem; line-height: 1.35; margin-top: 4px; }
}
/* keyboard: the focused answer is obvious */
.btn.opt:focus-visible { outline: 3px solid var(--terracotta); outline-offset: 2px; }

/* Typing helper: chat digits one tap away */
.arabizi-input .inp { width: 100%; }
.digit-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.digit-chip { font: inherit; font-size: .8rem; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px; min-height: 30px; cursor: pointer; color: var(--muted); }
.digit-chip b { color: var(--slate); }
.digit-chip:active { transform: scale(.95); }
/* Context pills: who is talking / to whom */
/* who it's for: the faces on the same line as the English, which carries (m.) / (f.) / (pl.) */
.en-ctx { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; vertical-align: middle; }
/* inside an answer button: a block of its own, so no space is kept below the line for descenders */
.btn .en-ctx { display: flex; }
.living-sentence .en-ctx, .ring-said .en-ctx { justify-content: center; }
.ctx-pill { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .01em; padding: 3px 9px; border-radius: 999px; background: #e0f2fe; color: #075985; white-space: nowrap; vertical-align: middle; }
.ex-hero .ctx-pill { font-size: .78rem; }
.cw-faces { display: inline-flex; flex: none; vertical-align: middle; }
.cw-faces svg { width: 24px; height: 24px; border-radius: 50%; background: var(--card); }
.ex-hero .hero-line .cw-faces svg, .reflex-lead .cw-faces svg { width: 30px; height: 30px; }
.cw-faces svg + svg { margin-left: -9px; }
.en .cw-faces svg { width: 20px; height: 20px; }
.en .en-ctx { gap: 4px 6px; }
.exercise-action-dock .mic-words { display: flex; flex-wrap: wrap; gap: 2px 8px; font-family: inherit; font-size: .95rem; margin-top: 2px; }
.mic-words .miss { color: var(--wrong-text); text-decoration: underline wavy rgba(185,28,28,.4); }
/* Show choices: a fallback, not the main thing: small, quiet, centred below the timer (no border, no fill) */
.show-choices { display: flex; align-items: center; gap: 5px; margin: 6px auto 0; padding: 6px 12px; min-height: 32px; border: 0; border-radius: 999px; background: none; font: inherit; font-size: .82rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.show-choices:hover { background: var(--track); color: var(--slate); }
.show-choices .ico { color: var(--close); }
.show-choices .ico { color: var(--close); }
.reflex-opts[hidden], .show-choices[hidden] { display: none; }
.quests-box { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.quests-box summary { cursor: pointer; font-weight: 700; font-size: .9rem; list-style: none; }
.quests-box summary::-webkit-details-marker { display: none; }
.quests-box summary::after { content: ' ▾'; color: var(--muted); }
.quests-box:not([open]) summary::after { content: ' ▸'; }

/* Side trips (YL.DETOURS) */
.detours { display: grid; gap: 8px; }
.detour-card { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 2px dashed var(--amber); border-radius: 12px; background: var(--close-bg); color: inherit; text-decoration: none; }
.detour-card b { color: var(--slate); }
.detour-card.locked { opacity: .65; border-color: var(--line); background: #f8fafc; }
.dc-ic { font-size: 1.4rem; }
.road-detour { margin: 8px 0 14px; }
.rd-tag { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; color: var(--close-text); margin-bottom: 4px; text-transform: uppercase; }

/* sign-in (js/account.js): Google's own button style, white with the logo */
.btn.google, .btn.google.primary { display: inline-flex; align-items: center; gap: 8px; background: #fff; color: #1f1f1f; border-color: #747775; font-weight: 600; }
.btn.google span { display: inline-flex; }
.save-progress { display: flex; gap: 14px; align-items: center; }
.save-progress h3 { margin: 0 0 4px; }
/* onboarding: sound, browser, microphone */
.ob-checks { display: grid; gap: 10px; text-align: left; margin: 12px 0; }
.ob-check { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; }
.ob-check .obc-ic { font-size: 1.6rem; flex: none; }
.ob-check .obc-body { flex: 1; }
.ob-check .obc-body p { margin: 2px 0 0; }
.ob-check .obc-state { flex: none; }
.ob-check.ok { border-color: var(--ok); }
.ob-check.warn { border-color: var(--bad); }
.ob-signin { margin-top: 10px; text-align: center; }
.sign-gate .ob-cat { width: 110px; margin: 0 auto; }
.sign-gate .center-row { justify-content: center; }
.goal-choices { display: flex; flex-wrap: wrap; gap: 8px; }
/* a scene's setting, like a chat app's grey system note at the top of the thread */
.wa-setting { align-self: center; max-width: 92%; margin: 4px auto 10px; padding: 6px 12px; border-radius: 10px; background: rgba(30,41,59,.06); color: var(--muted); font-size: .85rem; font-style: italic; text-align: center; }
.pairs-intro { margin: 0 0 8px; }
.scene-img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; margin: 0 0 8px; background: var(--line); }
.scene-intro { overflow: hidden; }
.scene-intro .scene-img { margin: 0 0 12px; border-radius: 0; }
.scene-intro h3 { margin: 0 16px 6px; }
.scene-intro .scene-setting { margin: 0 16px 12px; color: var(--muted); }
.scene-intro .exercise-action-dock { box-shadow: none; height: auto; min-height: 0; padding-top: 4px; }
.test-badge { background: var(--amber); color: var(--slate); }
.rn-label .rn-kind { display: block; font-size: .62rem; opacity: .75; font-weight: 400; }
.rnode.current { margin-top: 30px; }

/* Pattern Stage groups: a labelled row each (you're speaking / talking to / talking about), its own colour;
   a ✓ on each person tried; nobody chosen at the start */
.ring-bar { gap: 10px; }
.rb-row { display: flex; flex-direction: column; gap: 5px; padding: 6px; border-radius: 12px; }
.rb-row.grp-speak { background: #eef7f1; } .rb-row.grp-to { background: #eaf3fa; } .rb-row.grp-about { background: #fbf3e2; }
.rb-row .rb-group { margin: 0 0 0 2px; font-size: 11px; letter-spacing: .03em; }
.rb-row.grp-speak .rb-group { color: #1f6f4a; } .rb-row.grp-to .rb-group { color: #0b5a8a; } .rb-row.grp-about .rb-group { color: #8a5a00; }
.rb-people { display: flex; flex-direction: column; gap: 6px; }
.ring-bar .ring-person { position: relative; }
.ring-bar .ring-person.seen::after { content: '✓'; position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.ring-empty { color: var(--muted); font-size: 1rem; padding: 18px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ring-empty .tap-ico { width: 30px; height: 30px; color: var(--terracotta); }
/* before the first tap: only the instruction, centred in the box */
.living-sentence.is-empty { display: flex; align-items: center; justify-content: center; min-height: 160px; }
.living-sentence.is-empty .flip-tiles, .living-sentence.is-empty .ring-diff { display: none; }
@media (max-width: 599px) { .rb-people { flex-direction: row; flex-wrap: wrap; } .rb-row { padding: 6px 6px 8px; } }
/* road: the icon says the kind of stop; a badge says done / locked */
.rn-btn { position: relative; }
.rnode.locked .rn-ic { filter: grayscale(1); opacity: .55; }
.rn-badge { position: absolute; right: -4px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 2px solid #fff; }
.rn-badge.done { background: var(--ok); color: #fff; }
.rn-badge.locked { background: #fff; font-size: 11px; }

/* About · Privacy small print */
.legal-links { text-align: center; margin: 24px 0 8px; }
.legal-links a { color: inherit; }
.ob-wrap { max-width: 460px; width: 100%; }
.ob-story { text-align: center; color: rgba(255,255,255,.85); font-size: 14px; margin: 14px 0 0; }
.ob-story a { color: #f3c98b; font-weight: 600; }

/* Report a problem (js/ui/report.js): a link at the foot of the X-Ray, a small flag in the dock, a compact sheet */
.report-link { display: block; margin: 14px auto 0; background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.report-link:hover, .report-link:focus-visible { color: var(--slate); }
.dock-flag { background: none; border: 0; color: var(--muted); font-size: 1rem; padding: 6px 8px; cursor: pointer; border-radius: 8px; opacity: .7; }
.dock-flag:hover, .dock-flag:focus-visible { opacity: 1; background: rgba(0,0,0,.05); }
.sheet.report { display: grid; gap: 12px; }
.report-about { font-size: .9rem; color: var(--muted); background: var(--sand); border-radius: 10px; padding: 8px 10px; overflow-wrap: anywhere; }
.report-kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.report-kinds .chip { font-size: .88rem; }
.report-kinds .chip.on { background: var(--cedar); color: #fff; border-color: var(--cedar); }
.report-note { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
.report-actions { justify-content: flex-end; }
.report-about { display: flex; gap: 8px; align-items: center; }
.report-heard { font-size: .8rem; color: var(--muted); margin-top: -6px; }
/* Script Lab: letter shapes */
.shapes { display: grid; gap: 4px; margin: 6px 0; }
.sh-row { display: grid; grid-template-columns: 0 repeat(4, 1fr); align-items: center; text-align: center; }
.sh-row .big-ar { font-size: 1.6rem; }
.sh-head span { font-size: .8rem; }
.sh-note { font-size: .9rem; }

/* a reading moment: a sign or menu in Arabic script, each line a choice */
.read-sign { display: grid; gap: 8px; }
.read-sign .read-line { font-size: 1.6rem; line-height: 1.6; text-align: center; }
.read-sign .read-line .read-price { margin-inline-start: 0.8em; opacity: 0.85; }

/* Paid plans (js/ui/plans.js) */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 14px 0; text-align: left; }
.plan-opt { font: inherit; color: var(--ink, #1d2420); display: grid; gap: 4px; align-content: start; text-align: left; padding: 14px; border-radius: 14px; border: 1.5px solid #dfe4df; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.plan-opt:hover, .plan-opt:focus-visible { border-color: var(--cedar); box-shadow: 0 0 0 3px rgba(27,67,50,.15); }
.plan-opt.best, .plan-opt.on { border-color: var(--cedar); background: #f3f8f4; }
.plan-opt:disabled { opacity: .6; cursor: progress; }
.po-name { font-weight: 700; }
.po-price { font-size: 1.5rem; font-weight: 700; color: var(--cedar); }
.po-price s { font-size: 1rem; font-weight: 600; color: #8a948e; }
.po-price small { font-size: .85rem; font-weight: 600; color: #5d6a62; }
.po-note { font-size: .85rem; color: #5d6a62; }
.plan-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 4px; }
.pl-link { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--cedar); font-weight: 600; font-size: .9rem; text-decoration: none; transition: border-color .15s, background .15s; }
.pl-link:hover, .pl-link:focus-visible { border-color: var(--cedar); background: #f3f8f4; }
.danger-zone { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.danger-zone summary { cursor: pointer; color: var(--muted); font-size: .85rem; width: max-content; max-width: 100%; }
.danger-zone summary:hover { color: var(--slate); }
.dz-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; margin-top: 10px; }
.dz-row p { margin: 0; flex: 1 1 220px; }
.plan-welcome { font-weight: 700; color: var(--cedar); }
.plan-tag { margin-left: 8px; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #fff3c9; color: var(--cedar); border: 1px solid #ffe08a; text-decoration: none; vertical-align: middle; white-space: nowrap; }
.family-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.family-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.family-link, .code-input { font: inherit; flex: 1 1 220px; min-width: 0; padding: 8px 10px; border: 1px solid #cfd6d1; border-radius: 8px; }
.code-input { text-transform: uppercase; letter-spacing: .04em; }
.gift-form { display: grid; gap: 12px; margin: 6px 0 14px; }
.field { display: grid; gap: 4px; }
.field > span { font-weight: 700; font-size: .9rem; }
.field input, .field textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfd6d1; border-radius: 8px; width: 100%; box-sizing: border-box; }
.gift-season { display: flex; align-items: center; gap: 8px; margin: 12px 0; padding: 12px 14px; border-radius: var(--radius); background: #fff8e6; border: 1px solid #ffe08a; }
.gift-season a { flex: 1; display: flex; align-items: center; gap: 12px; color: var(--slate); text-decoration: none; }
.gift-season a b { color: var(--cedar); }
.gs-ic { font-size: 1.6rem; }
.gs-x { font: inherit; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.gs-x:hover, .gs-x:focus-visible { background: rgba(0,0,0,.05); }
.gs-sub { display: block; margin-top: 2px; }
.pw-emoji { font-size: 2rem; line-height: 1; margin-bottom: 4px; }

/* the bottom bar's message: an icon badge beside the text (docs/DESIGN.md) */
.dock-msg:has(> .dock-ico) { display: flex; align-items: center; gap: 12px; }
.dock-text { min-width: 0; }
.dock-msg b { font-weight: 600; font-size: 1rem; letter-spacing: -.005em; }
.dock-ico { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; line-height: 1; background: var(--badge); color: var(--cedar); }
.dock-ico svg { width: 20px; height: 20px; }
.is-correct .dock-ico.ico-check, .is-great .dock-ico.ico-check { background: none; color: var(--right); }
.is-close .dock-ico.ico-check { background: none; color: var(--close); }
.is-wrong .dock-ico.ico-cross, .is-again .dock-ico.ico-cross { background: none; color: var(--bad); }
.dock-ico.ico-mic { color: var(--cedar); }
/* drawn mic / stop on a button, sized to the text */
.btn-ico { display: inline-flex; width: 1.15em; height: 1.15em; margin-right: .4em; vertical-align: -.2em; }
.btn-ico svg { width: 100%; height: 100%; }
.btn-ico.after { margin: 0 0 0 .35em; width: 1em; height: 1em; vertical-align: -.12em; }
.btn-ico.solo { margin: 0; }

/* the gap in a fill-in line: a drawn blank, not underscores */
.gap { display: inline-block; width: 3.2em; height: 1.05em; margin: 0 .15em; vertical-align: -.15em; border-bottom: 3px solid var(--terracotta); background: var(--card); border-radius: 6px 6px 0 0; }
/* Lebanese lines keep the app's reading font, even inside the question panel */
.ex-hero .hero-line.lb-line, .ex-hero .bubble .hero-line { font-family: Inter, system-ui, sans-serif; }
/* the listening question: the warm panel itself is the button; the speaker and "Tap to listen" on one line, flat */
.ex-hero:has(> .listen-hero) { background: none; border: 0; padding: 0; }
.listen-hero { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px 16px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); cursor: pointer; font: inherit; color: var(--slate); transition: background-color .15s; }
.listen-hero:hover { background: #f2e8d1; }
.listen-hero:focus-visible { outline: 3px solid var(--cedar); outline-offset: 2px; }
.lh-circle { display: inline-flex; color: var(--azure); }
.lh-circle svg { width: 26px; height: 26px; }
.lh-label { font-family: Inter, system-ui, sans-serif; font-size: 1.1rem; font-weight: 600; color: var(--slate); }

.chip .chip-ico { display: inline-flex; width: 1.1em; height: 1.1em; margin-right: .35em; vertical-align: -.15em; color: var(--azure); }
.chip .chip-ico svg { width: 100%; height: 100%; }

/* the drawn icons (bulb...) sized to the text they sit in */
.ico { display: inline-flex; width: 1.1em; height: 1.1em; flex: none; vertical-align: -.18em; }
.ico svg { width: 100%; height: 100%; }
.spot-head .ico { color: var(--close); margin-right: 4px; }
.dock-msg .in-time-ico { color: var(--amber); margin-right: 4px; } /* "In time!": the combo meter's bolt, gold for a reward */
.h-ico { color: var(--close); margin-right: 6px; }
.culture .culture-ico { color: var(--close); margin-right: 6px; }
.culture:has(> .culture-ico) { display: flex; align-items: flex-start; gap: 8px; }
.culture > .culture-ico { margin: .2em 0 0; }
.culture > span > p:first-child { margin-top: 0; } .culture > span > p:last-child { margin-bottom: 0; }

/* Phosphor's circled tick and cross are their own circle: drawn full size, no badge behind */
.dock-ico.ico-check, .dock-ico.ico-cross { width: 40px; height: 40px; } .dock-ico.ico-check svg, .dock-ico.ico-cross svg { width: 40px; height: 40px; } /* the svg fits its badge: nothing spills (it made the message scroll) */
.again-ico { margin-right: 5px; color: var(--muted); }

/* Vowel spelling guide inside Stop 1.2 (Sound Lab) */
.vg-intro p { margin: 0 0 10px; font-size: .95rem; }
.vg-intro p:last-child { margin-bottom: 14px; }
.vg-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.vg-table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 8px 8px 0; border-bottom: 2px solid var(--panel-line); }
.vg-table td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--panel-line); vertical-align: top; }
.vg-table tbody tr:last-child td { border-bottom: 0; }
.vg-sp { white-space: nowrap; color: var(--terracotta); font-size: 1rem; padding-right: 12px; }
.vg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.vg-ar { white-space: nowrap; font-size: .84rem; padding-right: 0; }
.vg-ar .ar { font-size: 1.05em; }
.vg-note { margin-top: 14px; }
.vg-note p { margin: 0; }
@media (max-width: 600px) {
  .vg-table thead { display: none; }
  .vg-table, .vg-table tbody { display: block; }
  .vg-table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--panel-line); }
  .vg-table tbody tr:last-child { border-bottom: 0; }
  .vg-table td { display: block; padding: 0; border: 0; }
  .vg-sp { grid-column: 1; grid-row: 1; }
  .vg-ar { grid-column: 2; grid-row: 1; text-align: right; align-self: center; }
  .vg-snd { grid-column: 1 / -1; grid-row: 2; }
  .vg-ex { grid-column: 1 / -1; grid-row: 3; }
}
