:root{color-scheme:light;--bg:#f3eee4;--boot:#f3eee4;--ink:#141414;--bean:#9cc3f0;--hl:#dbe8f8;--track:#e4ddd0;--muted:#8a847a}
html,body{margin:0;height:100%;overflow:hidden;background:
    radial-gradient(ellipse at 50% 44%,#ffffffcc 0%,#ffffff00 45%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='560' height='84'><text x='0' y='22' font-family='Menlo,monospace' font-size='14' fill='%23141414' fill-opacity='.028'>AAGACAAAATAATAACTAGAAAGGAGTTGTATAACG CATGTGTATCGCATGT ATAGT</text><text x='-120' y='50' font-family='Menlo,monospace' font-size='14' fill='%23141414' fill-opacity='.028'>ATTAATTTCAACAACTG CATGTGTTTCGCATGT CTAATATGAAATTTTATTTTTGACC</text><text x='-40' y='78' font-family='Menlo,monospace' font-size='14' fill='%23141414' fill-opacity='.028'>TACATTGATGCGTCAACTGGTAATAC CATGTGAATCGCATGT ATCATCGATAC</text></svg>") 0 0/560px 84px,
    linear-gradient(180deg,#f6f2ea 0%,#ece5d8 100%) fixed;
  background-color:var(--bg);color:#141414;
  font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue',system-ui,sans-serif}
canvas.scene{position:fixed;inset:0;display:block;touch-action:none}

#hud{position:fixed;right:14px;bottom:18px;max-width:340px;background:#1d2119e8;color:#eee;
  border:1px solid #ffffff2b;border-radius:14px;box-shadow:0 8px 24px #000a;
  padding:10px 14px;font-size:12px;z-index:5;pointer-events:none;line-height:1.5;
  backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);opacity:0;transition:opacity .4s,transform .4s;transform:translateY(6px)}
#hud.show{opacity:1;transform:none}
#hud.live{pointer-events:auto}
#hud a{color:var(--bean);word-break:break-all}
#hud b{color:var(--bean)}
#hud .hud-t{font:700 13px 'Fredoka',system-ui,sans-serif;color:#fff;margin-bottom:2px;letter-spacing:.02em}
@media (max-width:760px){#hud{left:16px;right:16px;max-width:none;bottom:auto;top:14px}}

#boot{position:fixed;inset:0;z-index:100;background:var(--boot);display:grid;place-items:center;
  text-align:center;padding:24px;box-sizing:border-box;transition:opacity .5s}
#boot.out{opacity:0}
#boot[hidden]{display:none}
.boot-panel{width:min(340px,100%)}
.boot-cat{display:inline-block;margin:0 auto 12px;font:700 13px/1.2 Menlo,'DejaVu Sans Mono','Courier New',monospace;color:var(--ink);text-align:left;transform-origin:50% 90%;animation:bob .9s ease-in-out infinite alternate}
@keyframes bob{from{transform:translateY(0) rotate(-4deg) scaleY(1.02)}to{transform:translateY(-8px) rotate(4deg) scaleY(.97)}}
@media (prefers-reduced-motion:reduce){.boot-cat{animation:none}}
.boot-mark{font:700 clamp(46px,13vw,72px)/1 Menlo,'DejaVu Sans Mono','Courier New',monospace;
  letter-spacing:.03em;color:var(--ink);transform:rotate(-3deg)}
.boot-sub{display:inline-block;margin-top:8px;padding:2px 12px;border:3px solid var(--ink);border-radius:999px;
  background:var(--hl);font:700 15px 'Fredoka',system-ui,sans-serif;color:var(--ink);transform:rotate(2deg)}
#boot-bar{width:56%;height:12px;margin:30px auto 0;border:3px solid var(--ink);border-radius:999px;background:var(--track);overflow:hidden;box-sizing:border-box}
#boot-bar i{display:block;height:100%;width:0;background:var(--bean);transition:width .2s}
#boot-status{margin-top:14px;font:500 12px 'Fredoka',system-ui,sans-serif;color:var(--muted);letter-spacing:.04em;min-height:1em}
#boot.err #boot-status{color:#c0392b}
#term-input{position:fixed;left:0;bottom:0;width:1px;height:1px;opacity:0;border:0;padding:0;font-size:16px;pointer-events:none}

#bubble{position:fixed;left:0;top:0;z-index:4;max-width:260px;padding:9px 13px 10px;border:3px solid var(--ink);border-radius:18px;
  background:#fff;color:var(--ink);font:500 14px/1.35 'Fredoka',system-ui,sans-serif;pointer-events:none;
  opacity:0;transition:opacity .2s;margin-top:-14px;box-shadow:0 4px 0 #0003;word-wrap:break-word}
#bubble.show{opacity:1}
#bubble::after{content:'';position:absolute;left:50%;bottom:-11px;width:16px;height:16px;background:#fff;
  border-right:3px solid var(--ink);border-bottom:3px solid var(--ink);transform:translateX(-50%) rotate(45deg);border-bottom-right-radius:4px}
#bubble .to{color:#3d74b8;font-weight:700}
#bubble.thinking{padding:8px 14px}
#bubble .dots{display:inline-flex;gap:5px}
#bubble .dots i{width:7px;height:7px;border-radius:50%;background:var(--ink);animation:dot 1s infinite ease-in-out}
#bubble .dots i:nth-child(2){animation-delay:.15s}#bubble .dots i:nth-child(3){animation-delay:.3s}
@keyframes dot{0%,80%,100%{transform:translateY(0);opacity:.35}40%{transform:translateY(-4px);opacity:1}}
#livechat{position:fixed;left:14px;bottom:16px;z-index:5;width:min(330px,calc(100vw - 32px));background:#141812e6;color:#e8ece3;
  border:1px solid #ffffff26;border-radius:16px;box-shadow:0 8px 24px #0009;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
  font:13px/1.35 -apple-system,BlinkMacSystemFont,'Helvetica Neue',system-ui,sans-serif;overflow:hidden}
#livechat[hidden]{display:none}
#livechat header{display:flex;align-items:center;gap:7px;padding:8px 8px 8px 12px;border-bottom:1px solid #ffffff14;font:600 13px 'Fredoka',system-ui,sans-serif}
#livechat .dot{width:8px;height:8px;border-radius:50%;background:#777;flex:none}
#livechat.live .dot{background:#5ef38a;box-shadow:0 0 8px #5ef38a}
#livechat .st{color:#8b9384;font:500 11px 'Fredoka',system-ui,sans-serif;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#livechat ol{list-style:none;margin:0;padding:6px 12px 10px;display:flex;flex-direction:column;gap:5px;max-height:190px;overflow:hidden;justify-content:flex-end}
#livechat li{word-wrap:break-word;animation:pop .25s ease-out}
#livechat li .u{font-weight:700;margin-right:5px}
#livechat li.me{align-self:flex-end;background:var(--bean);color:var(--ink);padding:5px 10px;border-radius:12px 12px 4px 12px;max-width:88%}
#livechat li.me .u{color:#23508c}
#livechat li.think{color:#8b9384;font-style:italic}
@keyframes pop{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){#livechat li{animation:none}}
#voice-btn{border:1px solid #ffffff30;border-radius:999px;background:#ffffff10;color:#eee;
  font:500 11px 'Fredoka',system-ui,sans-serif;padding:4px 10px;cursor:pointer;flex:none}
#voice-btn:focus-visible{outline:2px solid var(--bean);outline-offset:2px}
@media (max-width:520px){#bubble{max-width:200px;font-size:13px}#livechat ol{max-height:96px}}

#disclaimer{position:fixed;right:14px;bottom:6px;margin:0;z-index:3;font:500 10.5px Menlo,'Courier New',monospace;color:#8a847a;pointer-events:none}
@media (max-width:760px){#disclaimer{right:auto;left:16px;bottom:auto;top:4px}}

#chat-form{display:flex;gap:6px;padding:8px;border-top:1px solid #ffffff14}
#chat-form input{min-width:0;background:#ffffff12;border:1px solid #ffffff26;border-radius:10px;color:#f3f3ef;padding:7px 9px;font:13px -apple-system,system-ui,sans-serif}
#chat-name{flex:0 0 74px}
#chat-input{flex:1}
#chat-form input:focus-visible,#chat-form button:focus-visible{outline:2px solid var(--bean);outline-offset:1px}
#chat-form button{flex:none;border:0;border-radius:10px;background:var(--bean);color:var(--ink);font:600 12px 'Fredoka',system-ui,sans-serif;padding:0 12px;cursor:pointer}
#thesis-dlg{max-width:min(620px,calc(100vw - 32px));max-height:calc(100vh - 60px);border:3px solid var(--ink);border-radius:14px;background:#fffdf7;color:var(--ink);padding:20px 22px;box-shadow:0 10px 0 #0002}
#thesis-dlg::backdrop{background:#14141466}
#thesis-dlg pre{margin:0 0 14px;white-space:pre-wrap;font:13px/1.55 Menlo,'DejaVu Sans Mono','Courier New',monospace}
#thesis-dlg button{border:2px solid var(--ink);border-radius:10px;background:var(--hl);font:600 13px 'Fredoka',system-ui,sans-serif;padding:6px 16px;cursor:pointer}
