/* Undertone overlay v3: real glass, same language as the console.
   Dusk (default, body.dusk) = dark glass, gold accent. Dawn = light glass, lake-blue accent.
   States on .ut-ov[data-state]: off | idle | them | you | drafting | ready
   --op is the glass alpha (Settings > Overlay opacity), --fs the answer size. */
.ut-ov{position:relative;z-index:1;--fs:15px;--op:.9;width:var(--ut-w,100%);
  font-family:"Segoe UI Variable Text","Segoe UI",sans-serif;font-size:14px;-webkit-font-smoothing:antialiased;
  /* dawn */
  --glass-rgb:247,249,251;--glass-top:255,255,255;--edge:rgba(255,255,255,.95);--outline:rgba(11,23,34,.16);
  --txt:#0b1722;--body:rgba(11,23,34,.86);--sub:rgba(11,23,34,.56);--said:rgba(11,23,34,.3);--rule:rgba(11,23,34,.10);
  --accent:#1d4f73;--you:#9a6a26;--hover:rgba(11,23,34,.06);
  --hub-them:29,79,115;--hub-you:168,117,46;--hub-idle:90,110,128;
  color:var(--txt)}
body.dusk .ut-ov{--glass-rgb:16,21,30;--glass-top:40,46,58;--edge:rgba(255,255,255,.14);--outline:rgba(0,0,0,.35);
  --txt:#f4f2ec;--body:rgba(241,243,245,.88);--sub:rgba(241,243,245,.56);--said:rgba(241,243,245,.32);--rule:rgba(255,255,255,.09);
  --accent:#dcbb86;--you:#e2c18a;--hover:rgba(255,255,255,.07);
  --hub-them:169,199,218;--hub-you:226,193,138;--hub-idle:200,210,220}
.ut-bar,.ut-sheet{
  background:linear-gradient(180deg,rgba(var(--glass-top),calc(var(--op) * .97)),rgba(var(--glass-rgb),var(--op)) 46%);
  border:1px solid var(--edge);box-shadow:0 0 0 1px var(--outline),inset 0 1px 0 rgba(255,255,255,.12);border-radius:14px}
/* bar */
.ut-bar{position:relative;height:52px;display:flex;align-items:center;gap:10px;padding:0 10px 0 6px;overflow:hidden;isolation:isolate;-webkit-app-region:drag}
.ut-mark{width:40px;height:40px;flex:none}
.ut-line{flex:1;min-width:0;display:flex;justify-content:flex-end;overflow:hidden;white-space:nowrap;
  -webkit-mask-image:linear-gradient(90deg,transparent,#000 14%,#000);mask-image:linear-gradient(90deg,transparent,#000 14%,#000)}
.ut-words{font-size:13px;font-weight:350;color:var(--body)}
.ut-words.me{color:var(--you)}
.ut-words:empty:before{content:attr(data-idle);color:var(--sub)}
.ut-w{display:inline-block;margin-right:.28em;opacity:0;filter:blur(4px);transform:translateY(3px);animation:ut-in .36s cubic-bezier(.2,.8,.2,1) forwards}
@keyframes ut-in{to{opacity:1;filter:blur(0);transform:none}}
.ut-state{flex:none;font-size:11.5px;font-weight:400;letter-spacing:.02em;color:var(--sub);transition:color .5s}
.ut-ov[data-state=you] .ut-state,.ut-ov[data-state=ready] .ut-state,.ut-ov[data-state=drafting] .ut-state{color:var(--accent)}
/* controls: quiet until you reach for them */
.ut-ctls{display:flex;gap:2px;max-width:0;opacity:0;overflow:hidden;transition:max-width .3s cubic-bezier(.2,.8,.2,1),opacity .25s}
.ut-bar:hover .ut-ctls,.ut-bar:focus-within .ut-ctls{max-width:110px;opacity:1}
.ut-ctl{-webkit-app-region:no-drag;width:30px;height:30px;border-radius:8px;border:0;background:transparent;color:var(--sub);display:grid;place-items:center;cursor:pointer;flex:none}
.ut-ctl svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
.ut-ctl:hover{background:var(--hover);color:var(--txt)}
.ut-ctl.on{color:var(--accent)}
.ut-ctl:focus-visible{outline:1.5px solid var(--accent);outline-offset:1px}
.ut-wave{position:absolute;left:14px;right:14px;bottom:4px;width:calc(100% - 28px);height:12px;opacity:.85;z-index:-1;pointer-events:none}
/* writing: a slow light passes along the bar */
.ut-bar:after{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(100deg,transparent 35%,rgba(var(--hub-you),.16) 50%,transparent 65%);transform:translateX(-110%);opacity:0}
.ut-ov[data-state=drafting] .ut-bar:after{opacity:1;animation:ut-sweep 1.15s cubic-bezier(.4,0,.2,1) infinite}
@keyframes ut-sweep{to{transform:translateX(110%)}}
/* Readability on real glass: the answer card is denser than the bar, and every line of
   text carries a soft halo in the glass colour, so busy or high-contrast content behind
   the overlay cannot bleed into the letters. --op still controls how see-through it is. */
.ut-sheet{background:linear-gradient(180deg,rgba(var(--glass-top),min(1,calc(var(--op) + .07))),rgba(var(--glass-rgb),min(1,calc(var(--op) + .08))) 40%)}
.ut-words,.ut-state,.ut-q,.ut-beat,.ut-next,.ut-fact,.ut-meta{text-shadow:0 0 1px rgba(var(--glass-rgb),.95),0 0 6px rgba(var(--glass-rgb),.9),0 0 12px rgba(var(--glass-rgb),.6)}
/* the answer */
.ut-sheet{display:none;margin-top:8px;padding:14px 18px 11px;max-height:calc(100vh - 80px);overflow-y:auto}
.ut-sheet::-webkit-scrollbar{width:0}
.ut-ov.open .ut-sheet{display:block;animation:ut-unfold .55s cubic-bezier(.2,.8,.2,1)}
@keyframes ut-unfold{from{clip-path:inset(0 0 100% 0 round 14px);transform:translateY(-6px)}to{clip-path:inset(0 0 0 0 round 14px);transform:none}}
.ut-q{font-size:12px;color:var(--sub);margin-bottom:8px;line-height:1.4}
.ut-beat{margin-bottom:6px;font-size:calc(var(--fs) - 1px);font-weight:350;line-height:1.5;color:var(--body);transition:color .7s}
.ut-beat:first-child{font:500 calc(var(--fs) + 1px)/1.35 "Segoe UI Variable Display","Segoe UI",sans-serif;color:var(--txt);margin-bottom:7px}
.ut-beat.said,.ut-beat:first-child.said{color:var(--said)}
.ut-beat .gap{display:inline-block;margin:0 .32em 0 .04em;opacity:.35}.ut-beat .gap:before{content:"\00b7"}
.ut-ans.drafting .ut-beat{opacity:.7}
.ut-next{font-size:12px;color:var(--sub);margin-top:6px}
.ut-next:empty{display:none}
.ut-fact{margin-top:10px;padding-top:9px;border-top:1px solid var(--rule);font-size:12.5px;line-height:1.5;color:var(--body);white-space:pre-wrap}
.ut-fact b{display:block;font-weight:500;font-size:11px;letter-spacing:.03em;color:var(--accent);margin-bottom:3px}
.ut-meta{display:flex;justify-content:space-between;gap:12px;margin-top:10px;padding-top:8px;border-top:1px solid var(--rule);font-size:11.5px;font-weight:350;color:var(--sub)}
.ut-meta:has(span:empty + span:empty){display:none}
.ut-meta b{color:var(--accent);font-weight:500}
.ut-err{color:#d9534f}body.dusk .ut-err{color:#ffb4a8}
body.ghost .ut-ov{opacity:.6}
@media (prefers-reduced-motion:reduce){.ut-w{animation:none;opacity:1;filter:none;transform:none}.ut-ov *{transition:none!important}.ut-bar:after{display:none}.ut-ov.open .ut-sheet{animation:none}}
