/* ============================================================
   Quell — Investor Deck · Theme & Design-System (v2)
   Editable source. `build.py` inlines this into dist/ (self-contained).

   Design goals (from Furti feedback):
   - Guaranteed readability: text never sits on a surface lighter than it.
   - Lean slides: one idea + 1–2 lines; detail lives in speaker notes.
   - Real device shown (line-art from official packaging), not a wrong AI render.
   - Touch/phone operable without a keyboard (big on-screen controls, swipe).
   ============================================================ */

:root{
  --bg:#080B12; --bg2:#0B0E16; --panel:#11151F; --panel2:#161B27;
  --ink:#F4F7FB; --ink2:#D4DAE4; --muted:#9AA7B8; --faint:#5C6879;
  --line:rgba(255,255,255,.10); --line2:rgba(255,255,255,.06);
  --violet:#7C5CFF; --violet2:#A78BFA; --violetdim:rgba(124,92,255,.16);
  --blue:#3B82F6; --cyan:#38BDF8;
  --green:#34D399; --amber:#F5B042; --red:#F04E4E;
  --silver:#C7CDD6;
  --scrim:6,8,13;                /* rgb triplet for all readability scrims */
  --sans:'Inter','Segoe UI',system-ui,-apple-system,Helvetica,Arial,sans-serif;
  --disp:'Sora','Inter','Segoe UI',system-ui,sans-serif;
}

/* ---------- base ---------- */
.reveal{ font-family:var(--sans); font-size:30px; color:var(--ink); font-weight:400; letter-spacing:.1px; }
.reveal .slides{ text-align:left; }
/* lock horizontal size to the real window: never let content overflow expand
   the layout viewport (which would make Reveal fit-scale too small and clip the
   right edge on phones). */
html,body{ background:var(--bg); overflow-x:hidden; max-width:100vw; }
html{ -webkit-text-size-adjust:100%; }
.reveal .slides section{ height:100%; }

/* background field for non-image slides */
.reveal-viewport{
  background:
    radial-gradient(1200px 680px at 78% -8%, rgba(124,92,255,.18), transparent 60%),
    radial-gradient(1000px 620px at 8% 108%, rgba(59,130,246,.12), transparent 62%),
    linear-gradient(180deg,#080B12 0%,#070911 100%);
}

/* ============================================================
   READABILITY SYSTEM (deterministic — text never sits on light)
   Three stacked guarantees on every image-background slide:
   (1) the image itself is darkened,
   (2) a flat global scrim removes residual brightness,
   (3) a text-plate gradient makes the exact text zone near-opaque dark.
   ============================================================ */

/* (1) darken the actual background image (reveal wraps it in .slide-background-content) */
.reveal .backgrounds .slide-background[style*="background-image"] .slide-background-content{
  filter:brightness(.46) saturate(1.04) contrast(1.02);
}
/* (2) flat global scrim on top of every image slide */
.reveal .backgrounds .slide-background[style*="background-image"]::after{
  content:''; position:absolute; inset:0; background:rgba(var(--scrim),.36);
}

/* (3) text-plate: the content overlay carries its own dark gradient,
       anchored to where the text actually sits. */
.overlay-tl{                 /* text pinned bottom-left → strong bottom/left band */
  background:
    linear-gradient(0deg,
      rgba(var(--scrim),.96) 0%,
      rgba(var(--scrim),.93) 30%,
      rgba(var(--scrim),.80) 50%,
      rgba(var(--scrim),.50) 66%,
      rgba(var(--scrim),.16) 82%,
      rgba(var(--scrim),0)  100%),
    linear-gradient(90deg,
      rgba(var(--scrim),.55) 0%,
      rgba(var(--scrim),.20) 45%,
      rgba(var(--scrim),0)  70%);
}
.overlay-c{                  /* centred text → radial dark plate */
  background:radial-gradient(ellipse 86% 82% at 50% 52%,
    rgba(var(--scrim),.90) 0%,
    rgba(var(--scrim),.74) 48%,
    rgba(var(--scrim),.40) 80%,
    rgba(var(--scrim),.14) 100%);
}

/* ---------- typography ---------- */
.reveal h1,.reveal h2,.reveal h3{ font-family:var(--disp); color:var(--ink); font-weight:700; line-height:1.05; letter-spacing:-.5px; margin:0 0 .2em; text-transform:none; }
.reveal h1{ font-size:2.3em; font-weight:800; }
.reveal h2{ font-size:1.62em; }
.reveal h3{ font-size:1.12em; }
.reveal p{ line-height:1.42; margin:.35em 0; }
.reveal strong{ color:#fff; font-weight:700; }
.reveal em{ color:var(--violet2); font-style:normal; }
.reveal .slides section img{ border:none; box-shadow:none; background:none; margin:0; }

/* subtle text shadow on anything sitting over an image → extra safety margin */
.overlay-tl h1,.overlay-tl h2,.overlay-tl h3,.overlay-tl p,.overlay-tl .kicker,.overlay-tl li,
.overlay-c h1,.overlay-c h2,.overlay-c p,.overlay-c .quoteblock,.overlay-c .kicker{
  text-shadow:0 2px 20px rgba(0,0,0,.6);
}

.kicker{ font-family:var(--disp); font-weight:700; letter-spacing:.28em; text-transform:uppercase;
  font-size:.5em; color:var(--violet2); margin-bottom:.9em; display:flex; align-items:center; gap:.7em; }
.kicker::before{ content:''; width:34px; height:2px; background:linear-gradient(90deg,var(--violet),transparent); display:inline-block; }
.lead{ color:var(--ink2); font-size:.92em; max-width:20em; }
.muted{ color:var(--muted); }
.tiny{ font-size:.5em; color:var(--faint); letter-spacing:.02em; }
.accent{ color:var(--violet2); }

/* ---------- layout helpers ---------- */
.wrap{ position:absolute; inset:0; padding:58px 80px; display:flex; flex-direction:column; justify-content:center; }
.wrap.center{ align-items:center; text-align:center; justify-content:center; }
.grid2{ display:grid; grid-template-columns:1fr 1fr; gap:48px; align-items:center; height:100%; }
.grid2.tt{ align-items:start; align-content:center; }
.stack>*+*{ margin-top:.5em; }
.right{ text-align:right; }

/* content over image — inner block width-limited & bottom-anchored */
.overlay-tl{ position:absolute; inset:0; padding:64px 84px 58px; display:flex; flex-direction:column; justify-content:flex-end; }
.overlay-tl>h1,.overlay-tl>h2,.overlay-tl>h3,.overlay-tl>p,.overlay-tl>.kicker,.overlay-tl>.bul{ max-width:32em; }
.overlay-c{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; text-align:center; flex-direction:column; padding:0 10%; }

/* ---------- bullets ---------- */
.bul{ list-style:none; margin:.2em 0 0; padding:0; }
.bul li{ position:relative; padding:.26em 0 .26em 1.4em; color:var(--ink2); font-size:.86em; line-height:1.34; }
.bul li::before{ content:''; position:absolute; left:0; top:.7em; width:9px; height:9px; border-radius:2px;
  background:var(--violet); box-shadow:0 0 12px rgba(124,92,255,.7); transform:rotate(45deg); }
.bul.check li::before{ content:'✓'; background:none; box-shadow:none; color:var(--green); font-weight:800; transform:none; top:.2em; font-size:.9em; }
.bul.next li::before{ content:'▸'; background:none; box-shadow:none; color:var(--violet2); transform:none; top:.22em; }

/* ---------- pills / badges ---------- */
.pill{ display:inline-flex; align-items:center; gap:.5em; font-size:.52em; font-weight:600; letter-spacing:.04em;
  padding:.5em .95em; border-radius:999px; border:1px solid var(--line); background:var(--panel);
  color:var(--ink2); }
.pill .dot{ width:8px; height:8px; border-radius:50%; background:var(--violet); }
.pill.v{ border-color:rgba(124,92,255,.4); background:var(--violetdim); color:var(--violet2); }
.pillrow{ display:flex; flex-wrap:wrap; gap:.55em; }

/* ---------- cards ---------- */
.card{ background:linear-gradient(180deg,var(--panel) 0%,rgba(17,21,31,.7) 100%); border:1px solid var(--line);
  border-radius:16px; padding:20px 22px; }
.card h3{ margin:.1em 0 .25em; font-size:1em; }
.card p{ font-size:.72em; color:var(--muted); line-height:1.35; margin:0; }
.card .ico{ font-size:1.35em; }
.cards{ display:grid; gap:18px; }
.cards.c2{ grid-template-columns:1fr 1fr; } .cards.c3{ grid-template-columns:repeat(3,1fr); } .cards.c4{ grid-template-columns:repeat(4,1fr); }

/* cards over an image get a solid dark fill (not translucent) for contrast */
.overlay-tl .card{ background:rgba(11,14,22,.86); border-color:rgba(255,255,255,.14); backdrop-filter:blur(3px); }

/* ---------- stat tiles ---------- */
.stats{ display:grid; gap:20px; }
.stats.s2{ grid-template-columns:1fr 1fr; } .stats.s3{ grid-template-columns:repeat(3,1fr); } .stats.s4{ grid-template-columns:repeat(4,1fr); }
.stat{ background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:22px 20px; }
.stat .n{ font-family:var(--disp); font-weight:800; font-size:1.8em; line-height:1; color:#fff;
  background:linear-gradient(180deg,#fff,#C9BCFF); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.stat .n.sm{ font-size:1.3em; }
.stat .l{ font-size:.58em; color:var(--muted); margin-top:.55em; line-height:1.3; }

/* ---------- phone frame ---------- */
.phone{ width:258px; border-radius:34px; padding:11px; background:linear-gradient(160deg,#20242E,#0C0F16);
  border:1px solid rgba(255,255,255,.14); box-shadow:0 40px 80px -30px rgba(0,0,0,.8), 0 0 0 1px rgba(0,0,0,.5) inset;
  position:relative; }
.phone::before{ content:''; position:absolute; top:20px; left:50%; transform:translateX(-50%); width:70px; height:6px; border-radius:6px; background:rgba(255,255,255,.14); z-index:3; }
.phone img{ width:100%; border-radius:24px; display:block; }
.phones{ display:flex; gap:26px; align-items:center; justify-content:center; }
.phone.sm{ width:210px; } .phone.lg{ width:286px; }

/* framed image */
.frame{ border:1px solid var(--line); border-radius:16px; overflow:hidden; background:var(--panel); box-shadow:0 30px 70px -34px rgba(0,0,0,.8); }
.frame img{ width:100%; display:block; }
.frame.pad{ padding:16px; background:#0E1220; }

/* ============================================================
   DEVICE STAGE — real device line-art (from packaging) presented
   premium on the dark theme, with concentric masking ripples.
   ============================================================ */
.devstage{ position:relative; display:flex; align-items:center; justify-content:center; width:100%; height:100%; min-height:360px; }
.devstage .rings{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:none; }
.devstage .rings span{ position:absolute; border-radius:50%; border:2px solid rgba(124,92,255,.42);
  width:120px; height:120px; animation:ripple 3.4s ease-out infinite; }
.devstage .rings span:nth-child(2){ animation-delay:1.13s; }
.devstage .rings span:nth-child(3){ animation-delay:2.26s; }
@keyframes ripple{ 0%{ transform:scale(1); opacity:.75; } 80%{ opacity:.12; } 100%{ transform:scale(4.6); opacity:0; } }
.devstage .device{ position:relative; width:min(74%,440px); filter:drop-shadow(0 26px 46px rgba(124,92,255,.42)); z-index:2; }
.devstage .glowpad{ position:absolute; width:56%; aspect-ratio:1; border-radius:50%;
  background:radial-gradient(circle, rgba(124,92,255,.30), transparent 68%); filter:blur(14px); z-index:1; }
.devcap{ position:absolute; left:0; right:0; bottom:8px; text-align:center; }

/* ---------- architecture / diagram ---------- */
.arch{ display:grid; grid-template-columns:repeat(3,1fr); gap:26px; align-items:stretch; }
.node{ background:linear-gradient(180deg,var(--panel2),rgba(17,21,31,.6)); border:1px solid var(--line); border-radius:18px; padding:22px 22px; position:relative; }
.node .t{ font-family:var(--disp); font-weight:700; font-size:.92em; color:#fff; display:flex; align-items:center; gap:.5em; }
.node .s{ font-size:.5em; color:var(--violet2); letter-spacing:.12em; text-transform:uppercase; margin-top:.2em; }
.node ul{ list-style:none; padding:0; margin:.7em 0 0; }
.node li{ font-size:.62em; color:var(--muted); padding:.2em 0; padding-left:1em; position:relative; }
.node li::before{ content:''; position:absolute; left:0; top:.62em; width:5px; height:5px; border-radius:50%; background:var(--violet); }
.linklabel{ display:flex; justify-content:center; gap:22px; margin-top:22px; flex-wrap:wrap; }
.linklabel span{ font-size:.52em; color:var(--ink2); border:1px dashed var(--line); border-radius:999px; padding:.4em 1em; background:rgba(124,92,255,.06); }

/* pipeline */
.pipe{ display:flex; align-items:stretch; gap:0; }
.pipe .step{ flex:1; background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:16px 14px; text-align:center; position:relative; }
.pipe .step .k{ font-family:var(--disp); font-weight:700; color:#fff; font-size:.8em; }
.pipe .step .d{ font-size:.54em; color:var(--muted); margin-top:.35em; line-height:1.3; }
.pipe .arrow{ display:flex; align-items:center; color:var(--violet2); font-size:1.1em; padding:0 12px; }

/* two-column compare */
.cols{ display:grid; grid-template-columns:1fr 1fr; gap:26px; }
.col{ border:1px solid var(--line); border-radius:18px; padding:24px 26px; }
.col.old{ background:linear-gradient(180deg,rgba(240,78,78,.06),transparent); }
.col.new{ background:linear-gradient(180deg,rgba(124,92,255,.10),transparent); border-color:rgba(124,92,255,.35); }
.col h3{ font-size:1em; } .col .tag{ font-size:.5em; letter-spacing:.16em; text-transform:uppercase; }
.col.old .tag{ color:var(--red); } .col.new .tag{ color:var(--violet2); }

/* roadmap */
.road{ display:grid; grid-template-columns:repeat(3,1fr); gap:24px; }
.road .h{ display:flex; align-items:center; gap:.6em; font-family:var(--disp); font-weight:700; color:#fff; font-size:.86em; margin-bottom:.4em; }
.road .h .n{ width:30px; height:30px; border-radius:50%; display:grid; place-items:center; font-size:.7em; background:var(--violetdim); border:1px solid rgba(124,92,255,.4); color:var(--violet2); }

/* security table */
.sec{ display:grid; grid-template-columns:1fr 1fr; gap:14px 26px; }
.secrow{ display:flex; gap:.7em; align-items:flex-start; font-size:.72em; }
.secrow .layer{ color:#fff; font-weight:600; min-width:8.2em; }
.secrow .mech{ color:var(--muted); }
.secrow::before{ content:'🔒'; font-size:.9em; }

/* logo / wordmark */
.brandmark{ display:flex; align-items:center; gap:22px; }
.qmark{ width:104px; height:104px; border-radius:24px; }
.wordmark{ font-family:var(--disp); font-weight:800; letter-spacing:-1.5px; font-size:2.9em; line-height:.9; color:#fff; }
.tag{ font-size:.9em; color:var(--ink2); }

/* animated equalizer / waves */
.eq{ display:flex; align-items:center; gap:5px; height:56px; }
.eq span{ width:5px; border-radius:4px; background:linear-gradient(180deg,var(--violet2),var(--violet)); box-shadow:0 0 14px rgba(124,92,255,.55);
  animation:eq 1.25s ease-in-out infinite; }
@keyframes eq{ 0%,100%{ height:14px; opacity:.7;} 50%{ height:52px; opacity:1;} }

/* speech-gap waveform (science slide) */
.gapwave{ display:flex; align-items:center; gap:4px; height:80px; }
.gapwave span{ width:5px; border-radius:3px; background:var(--silver); opacity:.85; }

/* footer brand */
.foot{ position:absolute; left:80px; bottom:26px; display:flex; align-items:center; gap:12px; font-size:.5em; color:var(--faint); letter-spacing:.06em; z-index:4; }
.foot img{ width:22px; height:22px; border-radius:6px; }
/* footer over an image needs its own contrast */
.overlay-tl .foot,.overlay-c .foot{ color:var(--ink2); }
.reveal .slides section .pagehint{ position:absolute; left:50%; transform:translateX(-50%); bottom:24px; font-size:.46em; color:var(--faint); letter-spacing:.14em; text-transform:uppercase; z-index:4; }

/* ---------- reveal chrome ---------- */
.reveal .progress{ color:var(--violet); height:4px; }
/* slide counter hidden — the progress bar + overview grid convey position, and it
   would otherwise collide with the on-screen control dock (bottom-right). */
.reveal .slide-number{ display:none; }
.reveal .backgrounds{ background:var(--bg); }
/* hide Reveal's tiny built-in arrows — we ship our own big touch dock */
.reveal .controls{ display:none !important; }

/* fragment: soft rise */
.reveal .fragment.rise{ opacity:0; transform:translateY(14px); transition:all .4s ease; }
.reveal .fragment.rise.visible{ opacity:1; transform:none; }

/* misc */
.big{ font-size:1.15em; } .w60{ max-width:60%; } .w70{ max-width:70%; } .w80{ max-width:80%; }
.divider-line{ width:60px; height:3px; background:linear-gradient(90deg,var(--violet),transparent); margin:.6em 0 1em; border-radius:3px; }
.quoteblock{ font-family:var(--disp); font-weight:600; font-size:1.5em; line-height:1.3; color:#fff; max-width:16em; }
.quoteblock .accent{ color:var(--violet2); }

/* ============================================================
   ON-SCREEN TOUCH CONTROLS (keyboard-free operation)
   Fixed to the viewport (NOT inside Reveal's scaled .slides) so the
   buttons keep a real ≥44px touch target at any zoom/scale.
   ============================================================ */
.uidock{ position:fixed; z-index:60; right:16px; bottom:14px; display:flex; align-items:center; gap:10px;
  padding:8px; border-radius:999px; background:rgba(12,15,23,.72); border:1px solid rgba(255,255,255,.12);
  backdrop-filter:blur(9px); box-shadow:0 10px 30px -12px rgba(0,0,0,.7); }
.uibtn{ width:48px; height:48px; border-radius:50%; border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.05); color:var(--ink); display:grid; place-items:center; cursor:pointer;
  -webkit-tap-highlight-color:transparent; transition:background .15s, transform .1s, border-color .15s; padding:0; }
.uibtn:hover{ background:rgba(124,92,255,.20); border-color:rgba(124,92,255,.5); }
.uibtn:active{ transform:scale(.92); }
.uibtn svg{ width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.uibtn.nav{ width:54px; height:54px; }
.uibtn.play.on{ background:rgba(124,92,255,.28); border-color:var(--violet); color:#fff; }
.uibtn .ic-pause{ display:none; }
.uibtn.play.on .ic-play{ display:none; }
.uibtn.play.on .ic-pause{ display:block; }
.uihint{ position:fixed; z-index:60; left:16px; bottom:20px; font-size:12px; letter-spacing:.12em; text-transform:uppercase;
  color:var(--faint); font-family:var(--disp); pointer-events:none; opacity:.8; }

/* edge tap-zones for one-handed nav (below the dock, above slides) */
.tapzone{ position:fixed; top:0; bottom:0; width:11%; z-index:40; cursor:pointer; -webkit-tap-highlight-color:transparent; }
.tapzone.l{ left:0; } .tapzone.r{ right:0; }
body.overview-on .tapzone{ display:none; }        /* don't hijack taps in the slide grid */

/* ============================================================
   RESPONSIVE — phone portrait (§1b). body.portrait toggled from deck.js.
   The slide canvas is switched to a tall aspect in JS; here we reflow
   multi-column layouts to a single stacked column and relax paddings.
   ============================================================ */
/* extra bottom room so content never hides under the centered control dock */
body.portrait .wrap{ padding:40px 38px 132px; }
body.portrait .overlay-tl{ padding:44px 42px 132px; }
body.portrait .reveal{ font-size:34px; }
body.portrait .grid2,
body.portrait .grid2.tt{ grid-template-columns:1fr; gap:24px; align-content:center; align-items:start; height:auto; }
body.portrait .cols,
body.portrait .arch,
body.portrait .cards.c3,
body.portrait .cards.c4,
body.portrait .stats.s3,
body.portrait .stats.s4,
body.portrait .road,
body.portrait .sec{ grid-template-columns:1fr; }
body.portrait .cards.c4{ grid-template-columns:1fr 1fr; }
body.portrait .stats.s4{ grid-template-columns:1fr 1fr; }
body.portrait .pipe{ flex-direction:column; }
body.portrait .pipe .arrow{ transform:rotate(90deg); padding:6px 0; justify-content:center; }
body.portrait .phones{ flex-wrap:wrap; }
body.portrait .phone.lg{ width:210px; } body.portrait .phone{ width:180px; } body.portrait .phone.sm{ width:150px; }
body.portrait .foot{ left:40px; bottom:16px; }
body.portrait .reveal .slides section .pagehint{ display:none; }
body.portrait .devstage{ min-height:300px; }
/* keep the dock clear of content on tall screens */
body.portrait .uidock{ right:50%; transform:translateX(50%); bottom:18px; }
body.portrait .tapzone{ width:9%; bottom:96px; }   /* leave the centered dock tappable */

/* very small heights (landscape phone) — tighten vertical rhythm */
@media (max-height:430px){
  .wrap{ padding:34px 60px; }
  .uidock{ bottom:8px; right:10px; padding:6px; gap:7px; }
  .uibtn{ width:40px; height:40px; } .uibtn.nav{ width:44px; height:44px; }
}

/* ============================================================
   LANGUAGE SELECT — startup splash + in-dock live switcher (js/i18n.js)
   Flags are inline SVG (emoji flags don't render on Windows).
   ============================================================ */
.qflag{ display:block; width:100%; height:100%; }
.qflag-wrap{ display:block; line-height:0; border-radius:4px; overflow:hidden;
  box-shadow:0 1px 4px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,255,255,.16); }

/* startup splash overlay */
.qlang-splash{ position:fixed; inset:0; z-index:120; display:flex; align-items:center; justify-content:center;
  background:radial-gradient(1100px 640px at 50% -12%, rgba(124,92,255,.22), transparent 60%), rgba(6,8,13,.95);
  backdrop-filter:blur(12px); opacity:0; visibility:hidden; transition:opacity .4s ease, visibility .4s ease; }
.qlang-splash.on{ opacity:1; visibility:visible; }
.qlang-card{ text-align:center; padding:34px 44px; max-width:min(92vw,600px);
  max-height:94vh; overflow-y:auto;
  transform:translateY(12px); transition:transform .45s cubic-bezier(.2,.8,.2,1); }
.qlang-splash.on .qlang-card{ transform:none; }
.qlang-brand{ display:flex; align-items:center; justify-content:center; gap:16px; margin-bottom:24px; }
.qlang-word{ font-family:var(--disp); font-weight:800; letter-spacing:-1.5px; font-size:54px; line-height:1; color:#fff; }
.qlang-eq{ display:flex; align-items:flex-end; gap:4px; height:40px; }
.qlang-eq i{ display:block; width:5px; height:14px; border-radius:4px;
  background:linear-gradient(180deg,var(--violet2),var(--violet)); box-shadow:0 0 14px rgba(124,92,255,.55);
  animation:eq 1.25s ease-in-out infinite; }
.qlang-choose{ font-family:var(--disp); font-weight:700; font-size:27px; color:#fff; letter-spacing:-.3px; }
.qlang-sub{ font-size:13px; color:var(--muted); margin-top:9px; letter-spacing:.02em; }
.qlang-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:32px; }
.qlang-opt{ display:flex; align-items:center; gap:14px; padding:15px 18px; cursor:pointer; text-align:left;
  border-radius:14px; border:1px solid var(--line); background:linear-gradient(180deg,var(--panel),rgba(17,21,31,.6));
  color:var(--ink); -webkit-tap-highlight-color:transparent; transition:border-color .15s, background .15s, transform .1s; }
.qlang-opt:hover{ border-color:rgba(124,92,255,.5); background:rgba(124,92,255,.14); }
.qlang-opt:active{ transform:scale(.98); }
.qlang-opt.active{ border-color:var(--violet); box-shadow:inset 0 0 0 1px var(--violet); }
.qlang-grid .qflag-wrap{ width:48px; height:32px; flex:0 0 auto; }
.qlang-name{ font-family:var(--disp); font-weight:600; font-size:19px; }

/* small live switcher, integrated into the control dock */
.uibtn.qlang-btn{ padding:0; }
.uibtn.qlang-btn .qflag-wrap{ width:26px; height:18px; }
.qlang-btn.qlang-float{ position:fixed; z-index:60; top:14px; right:16px; width:46px; height:32px; border-radius:9px;
  background:rgba(12,15,23,.72); border:1px solid rgba(255,255,255,.14); display:grid; place-items:center;
  backdrop-filter:blur(9px); }

/* switcher popover (opens above the dock, positioned in JS) */
.qlang-pop{ position:fixed; z-index:70; display:none; flex-direction:column; gap:6px; padding:8px;
  border-radius:14px; background:rgba(12,15,23,.94); border:1px solid rgba(255,255,255,.14);
  backdrop-filter:blur(12px); box-shadow:0 22px 55px -20px rgba(0,0,0,.85); min-width:172px; }
.qlang-pop.on{ display:flex; }
.qlang-pop .qlang-opt{ padding:9px 12px; border-radius:10px; }
.qlang-pop .qflag-wrap{ width:30px; height:20px; flex:0 0 auto; }
.qlang-pop .qlang-name{ font-size:15px; }

/* narration mute button (in the control dock) */
.uibtn.qnarr-btn{ color:var(--muted); }
.uibtn.qnarr-btn .qnarr-ico{ display:grid; place-items:center; }
.uibtn.qnarr-btn.on{ color:#fff; background:rgba(124,92,255,.20); border-color:rgba(124,92,255,.5); }

/* narration speed selector (dock button + preset popover) */
.uibtn.qspeed-btn{ width:auto; min-width:48px; padding:0 12px; border-radius:24px;
  font-family:var(--disp); font-weight:700; font-size:14px; letter-spacing:.02em; color:var(--ink2); }
.uibtn.qspeed-btn:hover{ color:#fff; }
.qspeed-pop{ position:fixed; z-index:70; display:none; flex-direction:column; gap:4px; padding:8px;
  border-radius:14px; background:rgba(12,15,23,.94); border:1px solid rgba(255,255,255,.14);
  backdrop-filter:blur(12px); box-shadow:0 22px 55px -20px rgba(0,0,0,.85); min-width:98px; }
.qspeed-pop.on{ display:flex; }
.qspeed-opt{ font-family:var(--disp); font-weight:600; font-size:14px; text-align:center; cursor:pointer;
  padding:8px 12px; border-radius:10px; border:1px solid transparent; background:transparent; color:var(--ink2);
  -webkit-tap-highlight-color:transparent; transition:background .15s, color .15s, border-color .15s; }
.qspeed-opt:hover{ background:rgba(124,92,255,.14); color:#fff; }
.qspeed-opt.active{ color:#fff; border-color:var(--violet); box-shadow:inset 0 0 0 1px var(--violet); }

/* startup splash — narration on/off pre-selection */
.qlang-speech{ margin-top:20px; display:inline-flex; align-items:center; gap:10px; cursor:pointer;
  padding:10px 18px; border-radius:999px; border:1px solid var(--line); background:var(--panel);
  color:var(--ink2); font-family:var(--disp); font-weight:600; font-size:15px;
  -webkit-tap-highlight-color:transparent; transition:border-color .15s, background .15s, color .15s; }
.qlang-speech:hover{ border-color:rgba(124,92,255,.45); }
.qlang-speech .qsp-ico{ font-size:18px; line-height:1; }
.qlang-speech .qsp-state{ font-size:11px; letter-spacing:.12em; padding:2px 8px; border-radius:999px;
  background:rgba(255,255,255,.08); color:var(--muted); }
.qlang-speech.on{ border-color:rgba(124,92,255,.5); background:rgba(124,92,255,.14); color:#fff; }
.qlang-speech.on .qsp-state{ background:rgba(124,92,255,.35); color:#fff; }

/* startup splash — start buttons (Autoplay / Manual) */
.qlang-modes{ display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:24px; }
.qlang-mode{ display:flex; align-items:center; gap:13px; text-align:left; cursor:pointer; padding:14px 18px;
  border-radius:14px; border:1px solid var(--line); background:var(--panel); color:var(--ink);
  -webkit-tap-highlight-color:transparent; transition:border-color .15s, background .15s, transform .1s; }
.qlang-mode:hover{ border-color:rgba(124,92,255,.5); background:rgba(124,92,255,.14); }
.qlang-mode:active{ transform:scale(.98); }
.qlang-mode.auto{ border-color:rgba(124,92,255,.5); background:linear-gradient(180deg,rgba(124,92,255,.20),rgba(124,92,255,.06)); }
.qlang-mode .qm-ico{ flex:0 0 auto; width:36px; height:36px; border-radius:10px; display:grid; place-items:center;
  background:rgba(255,255,255,.06); color:var(--ink); }
.qlang-mode.auto .qm-ico{ background:var(--violet); color:#fff; }
.qlang-mode .qm-ico svg{ width:18px; height:18px; }
.qlang-mode .qm-text{ display:flex; flex-direction:column; min-width:0; }
.qlang-mode .qm-title{ font-family:var(--disp); font-weight:700; font-size:16px; line-height:1.1; }
.qlang-mode .qm-desc{ font-size:11.5px; color:var(--muted); margin-top:3px; line-height:1.25; }

/* startup splash — controls legend */
.qlang-legend{ margin:22px auto 2px; max-width:38em; font-size:12px; line-height:1.55; color:var(--muted); }
.qlang-legend .ql-legtitle{ font-family:var(--disp); font-weight:700; font-size:10.5px; letter-spacing:.2em;
  text-transform:uppercase; color:var(--faint); margin-bottom:7px; }
.qlang-legend .ql-keys{ color:var(--ink2); }
.qlang-legend .ql-touch{ margin-top:5px; }

/* portrait tweaks */
body.portrait .qlang-word{ font-size:44px; }
body.portrait .qlang-grid{ grid-template-columns:1fr; }
body.portrait .qlang-modes{ grid-template-columns:1fr; }
