:root{color-scheme:dark;--bg:#06070b;--boot:#f4f7ec;--ink:#141414;--bean:#7ed957;--track:#dfe8d2;--muted:#6f7568}
html,body{margin:0;height:100%;overflow:hidden;background:
    radial-gradient(ellipse at 50% 44%,#f4ffc4b3 0%,#f4ffc400 42%),
    radial-gradient(#ffffff2e 1.6px,transparent 1.8px) 0 0/24px 24px,
    linear-gradient(160deg,#1f7a45 0%,#4fae33 48%,#b9ee6e 100%) fixed;
  background-color:#4fae33;color:#eef;
  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-bean{width:92px;height:auto;display:block;margin:0 auto 14px;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-bean{animation:none}}
.boot-mark{font:700 clamp(46px,13vw,72px)/1 'Fredoka','Arial Rounded MT Bold',system-ui,sans-serif;
  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(--bean);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:#3f9a2a;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:#1d4d10}
#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}}
