/* Layout: a playful home (mascot hero, colour-tinted prompt cards, about) that hands off to a focused chat with a sticky composer and a sources drawer. */
:root {
  --bg: #f5f6fb; --surface: #ffffff; --ink: #191a3d; --muted: #5c6087; --line: #e1e3f0;
  --accent: #3a50f0; --accent-ink: #ffffff; --accent-soft: #e6e9ff;
  --sun: #ffc83d; --sun-deep: #e8a910; --pupil: #191a3d; --glow: #7df3ff; --blush: #ff8fa3;
  --metal-hi: #f4f6f9; --metal: #c7cdd6; --metal-deep: #8e97a5;
  --mint: #d9f5e8; --sky: #dcecff; --peach: #ffe3d6; --lemon: #fff3c4; --lilac: #ebe3ff; --rose: #ffdfe9;
  --ok: #0f8a5f; --ok-soft: #dcf5ea; --warn: #9a6500; --warn-soft: #fff1cf; --err: #c0392b; --err-soft: #fde4e0;
  --display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --gl: max(16px, env(safe-area-inset-left, 0px));
  --gr: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11122a; --surface: #1b1d3b; --ink: #eef0ff; --muted: #a4a8cf; --line: #2d3058;
    --accent: #8b9bff; --accent-ink: #11122a; --accent-soft: #272b5c;
    --mint: #173a30; --sky: #182c4d; --peach: #3d241c; --lemon: #3a3215; --lilac: #2a2350; --rose: #3d1f2c;
    --ok: #5fd3a3; --ok-soft: #163a2d; --warn: #f0c060; --warn-soft: #3a2f14; --err: #ff8f80; --err-soft: #3d1f1c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11122a; --surface: #1b1d3b; --ink: #eef0ff; --muted: #a4a8cf; --line: #2d3058;
  --accent: #8b9bff; --accent-ink: #11122a; --accent-soft: #272b5c;
  --mint: #173a30; --sky: #182c4d; --peach: #3d241c; --lemon: #3a3215; --lilac: #2a2350; --rose: #3d1f2c;
  --ok: #5fd3a3; --ok-soft: #163a2d; --warn: #f0c060; --warn-soft: #3a2f14; --err: #ff8f80; --err-soft: #3d1f1c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--body); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; letter-spacing: -.02em; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .02em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wrap { max-width: 1080px; margin: 0 auto; padding-left: var(--gl); padding-right: var(--gr); }

/* ---------- header ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
header .wrap { display: flex; align-items: center; gap: 12px; padding-block: 10px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; font: 800 22px var(--display); letter-spacing: -.03em; }
.logo b { color: var(--accent); }
nav { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.link { background: none; border: 0; padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--muted); }
.link:hover { color: var(--ink); background: var(--surface); }
.demo { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; padding-left: 8px; border-left: 1px solid var(--line); }
.demo select { font: 12px var(--body); padding: 3px 4px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }

/* ---------- mascot: a little robot whose antenna is a question mark ---------- */
.yogi { --s: 40px; --px: 0%; --py: 0%; display: inline-block; vertical-align: middle; width: var(--s); height: var(--s); position: relative; flex: none; }
.bot { position: absolute; inset: 0; transform-origin: 50% 100%; animation: breathe 4.5s ease-in-out infinite; transition: transform .3s; }
.bot-q { position: absolute; left: 50%; top: -8%; transform: translateX(-50%); transform-origin: 50% 100%;
         font: 800 calc(var(--s) * .42) / 1 var(--display); color: var(--accent); animation: bob 2.6s ease-in-out infinite; }
.bot-q::before { content: "?"; }
.bot-head { position: absolute; left: 11%; right: 11%; top: 30%; bottom: 2%; background: linear-gradient(150deg, var(--metal-hi), var(--metal) 60%, var(--metal-deep)); border-radius: 32% 32% 28% 28%;
            box-shadow: inset 0 calc(var(--s) * -.06) 0 var(--metal-deep); }
.ear { position: absolute; top: 34%; width: 12%; height: 30%; background: var(--metal-deep); border-radius: 40%; }
.ear.l { left: -9%; } .ear.r { right: -9%; }
.visor { position: absolute; left: 13%; right: 13%; top: 16%; height: 56%; background: var(--pupil); border-radius: 30%;
         display: flex; align-items: center; justify-content: center; gap: 20%; overflow: hidden; }
.eye { width: 19%; height: 44%; margin-top: -10%; background: var(--glow); border-radius: 50%; box-shadow: 0 0 calc(var(--s) * .06) var(--glow);
       transform: translate(var(--px), var(--py)); transition: transform .12s, height .2s; animation: blink 5s infinite; }
.mouth { position: absolute; left: 50%; bottom: 13%; width: 22%; height: 12%; transform: translateX(-50%);
         border: calc(var(--s) * .025) solid var(--glow); border-top: 0; border-radius: 0 0 99px 99px; transition: all .2s; }
.cheek { position: absolute; bottom: 12%; width: 13%; height: 8%; border-radius: 50%; background: var(--blush); opacity: .6; }
.cheek.l { left: 6%; } .cheek.r { right: 6%; }

.bot-top { position: absolute; left: 0; top: 0; width: var(--s); height: var(--s); }
.yogi.full { height: calc(var(--s) * 1.75); }
.neck { position: absolute; left: 43%; width: 14%; top: calc(var(--s) * .93); height: calc(var(--s) * .08); background: var(--metal-deep); }
.torso { position: absolute; left: 22%; right: 22%; top: calc(var(--s) * .98); height: calc(var(--s) * .48); border-radius: 26% 26% 30% 30%;
         background: linear-gradient(150deg, var(--metal-hi), var(--metal) 60%, var(--metal-deep));
         box-shadow: inset 0 calc(var(--s) * -.05) 0 var(--metal-deep); display: grid; place-items: center; }
.panel { width: 56%; height: 38%; background: var(--pupil); border-radius: 22%; display: flex; align-items: center; justify-content: center; gap: 12%; }
.panel i { width: 16%; aspect-ratio: 1; border-radius: 50%; background: var(--glow); animation: led 1.6s infinite; }
.panel i:nth-child(2) { background: var(--sun); animation-delay: .3s; }
.panel i:nth-child(3) { background: var(--blush); animation-delay: .6s; }
.arm { position: absolute; top: calc(var(--s) * 1.02); width: 10%; height: calc(var(--s) * .36); border-radius: 99px;
       background: linear-gradient(90deg, var(--metal-hi), var(--metal-deep)); transform-origin: 50% 8%;
       transition: transform .35s cubic-bezier(.3, 1.5, .5, 1); }
.arm::after { content: ""; position: absolute; bottom: -12%; left: -30%; right: -30%; aspect-ratio: 1; border-radius: 50%; background: var(--metal-deep); }
.arm.l { left: 13%; transform: rotate(14deg); }
.arm.r { right: 13%; transform: rotate(-14deg); }
.legs { position: absolute; left: 31%; right: 31%; top: calc(var(--s) * 1.43); height: calc(var(--s) * .26); display: flex; justify-content: space-between; }
.leg { width: 30%; position: relative; background: linear-gradient(90deg, var(--metal), var(--metal-deep)); border-radius: 0 0 40% 40%; }
.leg::after { content: ""; position: absolute; bottom: -6%; left: -35%; right: -35%; height: 30%; background: var(--metal-deep); border-radius: 99px 99px 40% 40%; }
.yogi.full[data-mood="idle"] .arm.r { animation: wave 6s ease-in-out infinite; }
.yogi.full[data-mood="thinking"] .arm.r { transform: rotate(-155deg); }
.yogi.full[data-mood="thinking"] .panel i { animation-duration: .5s; }
.yogi.full[data-mood="happy"] .arm.l { transform: rotate(150deg); }
.yogi.full[data-mood="happy"] .arm.r { transform: rotate(-150deg); }
.yogi.full[data-mood="confused"] .arm.l { transform: rotate(55deg); }
.yogi.full[data-mood="confused"] .arm.r { transform: rotate(-55deg); }
.yogi.full[data-mood="sad"] .arm.l { transform: rotate(3deg); }
.yogi.full[data-mood="sad"] .arm.r { transform: rotate(-3deg); }
@keyframes wave { 0%, 78%, 100% { transform: rotate(-14deg); } 84%, 94% { transform: rotate(-150deg); } 89% { transform: rotate(-120deg); } }
@keyframes led { 50% { opacity: .3; } }

.yogi[data-mood="thinking"] .bot { animation: wobble .9s ease-in-out infinite; }
.yogi[data-mood="thinking"] .bot-q { animation: wiggle .5s ease-in-out infinite; }
.yogi[data-mood="thinking"] .eye { transform: translate(30%, -35%); }
.yogi[data-mood="thinking"] .mouth { width: 10%; height: 14%; border-top: calc(var(--s) * .025) solid var(--glow); border-radius: 50%; }
.yogi[data-mood="happy"] .bot { animation: hop .5s ease-out 2; }
.yogi[data-mood="happy"] .bot-q { animation: pop .4s ease-out; }
.yogi[data-mood="happy"] .bot-q::before { content: "!"; }
.yogi[data-mood="happy"] .eye { height: 14%; background: transparent; box-shadow: none; animation: none; transform: none;
                                border: calc(var(--s) * .03) solid var(--glow); border-bottom: 0; border-radius: 99px 99px 0 0; }
.yogi[data-mood="happy"] .mouth { width: 30%; height: 16%; }
.yogi[data-mood="confused"] .bot { transform: rotate(-10deg); animation: none; }
.yogi[data-mood="confused"] .bot-q { font-size: calc(var(--s) * .56); top: -22%; animation: wiggle 1s ease-in-out infinite; }
.yogi[data-mood="confused"] .eye:first-child { height: 16%; animation: none; }
.yogi[data-mood="confused"] .mouth { height: 0; border-radius: 0; border-bottom-width: calc(var(--s) * .025); }
.yogi[data-mood="sad"] .bot-q { transform: translateX(-20%) rotate(55deg); animation: none; opacity: .7; }
.yogi[data-mood="sad"] .eye { transform: translate(0, 35%); height: 30%; animation: none; }
.yogi[data-mood="sad"] .mouth { border-top: calc(var(--s) * .025) solid var(--glow); border-bottom: 0; border-radius: 99px 99px 0 0; bottom: 10%; }
@keyframes breathe { 50% { transform: scale(1.02, .98); } }
@keyframes bob { 50% { transform: translate(-50%, -8%) rotate(-7deg); } }
@keyframes wiggle { 25% { transform: translateX(-50%) rotate(-18deg); } 75% { transform: translateX(-50%) rotate(18deg); } }
@keyframes pop { 50% { transform: translateX(-50%) scale(1.5); } }
@keyframes wobble { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
@keyframes hop { 40% { transform: translateY(-16%) scale(.96, 1.05); } 70% { transform: translateY(0) scale(1.05, .95); } }
@keyframes blink { 0%, 94%, 100% { height: 44%; } 97% { height: 6%; } }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.25fr .75fr; gap: 40px; align-items: center; padding-block: 56px 40px; }
.hero h1 { font-size: clamp(32px, 4.6vw, 50px); line-height: 1.05; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: 18px; color: var(--muted); max-width: 34em; margin: 18px 0 26px; }
.stage { position: relative; z-index: 1; display: flex; justify-content: center; padding-top: 70px; }
.hero .composer { position: relative; z-index: 2; }
.hero-bot { position: relative; }
/* A small Yogi pops out of the home chat box and stands on its top edge. */
.box-wrap { position: relative; padding-top: 96px; margin-top: -18px; }
.walker { position: absolute; left: 18px; top: 46px; z-index: 1; }   /* 96px gap + 6px overlap - 56px robot height */
.walker .yogi { --s: 32px; display: block; cursor: pointer; }
.hero-bot .pop { white-space: normal; width: max-content; max-width: 210px; }
.stage .yogi { --s: clamp(96px, 11vw, 124px); cursor: pointer; }
.say { margin-top: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 4px 18px;
       padding: 10px 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(25, 26, 61, .08); max-width: 210px; }
.say small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 8px; padding-block: 28px 24px; }
  .stage { order: -1; padding-top: 64px; }
  .stage .yogi { --s: 78px; }
}

section.block { padding-block: 40px; }
.block-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.block-head h2 { font-size: clamp(26px, 4vw, 36px); }
.block-head p { margin: 4px 0 0; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { text-align: left; border: 0; border-radius: 20px; padding: 18px; min-height: 140px; display: flex; flex-direction: column; justify-content: space-between; gap: 16px;
        background: var(--tint); transition: transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.card:hover { transform: translateY(-4px) rotate(-1deg); }
.card:nth-child(even):hover { transform: translateY(-4px) rotate(1deg); }
.card .mono { color: var(--muted); display: flex; justify-content: space-between; }
.card strong { font: 700 20px/1.2 var(--display); letter-spacing: -.01em; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--ink); background: transparent; border-radius: 99px; padding: 8px 16px; font-weight: 700; font-size: 14px; }
.btn:hover { background: var(--ink); color: var(--bg); }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; counter-reset: s; }
.steps li { list-style: none; counter-increment: s; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--sun); color: var(--pupil); font: 800 18px var(--display); margin-bottom: 12px; }
.steps h3 { font-size: 20px; margin-bottom: 4px; }
.steps p { margin: 0; color: var(--muted); }
.steps ol { padding: 0; margin: 0; display: contents; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; gap: 18px; } }

footer { padding-block: 20px; color: var(--muted); font-size: 13px; }
.foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 24px; }
.about-hero { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: end; padding-block: 56px 24px; }
.eyebrow { font: 500 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.about-hero h1 { font-size: clamp(36px, 6vw, 60px); line-height: 1; font-weight: 800; margin-top: 10px; }
.about-hero p { font-size: 18px; color: var(--muted); max-width: 36em; margin: 16px 0 0; }
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pillar { background: var(--tint); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.pillar .mono { color: var(--muted); }
.pillar h3 { font-size: 21px; }
.pillar p { margin: 0; color: var(--muted); }
.about-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 40px; padding-block: 24px 48px; }
.about-grid h2 { font-size: clamp(26px, 4vw, 34px); margin-bottom: 14px; }
.values { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 12px; color: var(--muted); max-width: 36em; }
.values strong { color: var(--ink); }
.founder { color: var(--muted); margin: 0; }
.contact { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 10px; align-self: start; }
.contact a { font: 700 22px var(--display); color: var(--accent); text-decoration: none; word-break: break-word; }
.contact a:hover { text-decoration: underline; }
@media (max-width: 760px) {
  .about-hero { grid-template-columns: 1fr; padding-block: 32px 16px; }
  .about-hero .yogi { display: none; }
  .pillars, .about-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ---------- composer ---------- */
.composer { background: var(--surface); border: 1.5px solid var(--line); border-radius: 22px; padding: 10px 10px 8px 14px; transition: border-color .2s, box-shadow .2s; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.composer.over { border-color: var(--accent); border-style: dashed; background: var(--accent-soft); }
.composer textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font: 17px/1.45 var(--body); padding: 6px 0; min-height: 34px; max-height: 180px; }
.composer textarea::placeholder { color: var(--muted); }
.crow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.modes { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.mode { border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: 4px 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.mode[aria-checked="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.send { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); margin-left: auto; transition: transform .15s; }
.send:hover:not(:disabled) { transform: scale(1.08) rotate(-8deg); }
.send:disabled { opacity: .35; cursor: not-allowed; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 4px 0; min-height: 1em; }
.hint.err { color: var(--err); }
.files { display: flex; flex-wrap: wrap; gap: 6px; }
.files:not(:empty) { margin-bottom: 6px; }
.file { display: inline-flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 5px 6px 5px 8px; font-size: 13px; max-width: 100%; }
.file .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.file .st { font-size: 11px; padding: 1px 7px; border-radius: 99px; }
.st.busy { background: var(--warn-soft); color: var(--warn); }
.st.ready { background: var(--ok-soft); color: var(--ok); }
.st.failed { background: var(--err-soft); color: var(--err); }
.file button { border: 0; background: none; color: var(--muted); padding: 0 4px; font-size: 16px; line-height: 1; }
.ring { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--warn-soft); border-top-color: var(--warn); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- chat ---------- */
#chat { min-height: calc(100dvh - 62px); display: flex; flex-direction: column; }
.thread { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 28px var(--gr) 24px var(--gl); display: flex; flex-direction: column; gap: 26px; }
.q { align-self: flex-end; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 20px 20px 4px 20px; max-width: 85%; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.q .att { display: block; font-size: 12px; opacity: .75; margin-top: 2px; }
.reply { display: flex; gap: 12px; align-items: flex-start; }
.reply .yogi { --s: 38px; margin-top: 2px; }
.a { flex: 1; min-width: 0; }
.a p { margin: 0 0 10px; } .a p:last-child { margin-bottom: 0; }
.a ul { margin: 0 0 10px; padding-left: 20px; } .a li { margin-bottom: 4px; }
.basis { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; margin-bottom: 8px; }
.basis.files { background: var(--ok-soft); color: var(--ok); }
.basis.general { background: var(--lilac); color: var(--ink); }
.thinking { color: var(--muted); font-size: 14px; display: flex; gap: 8px; align-items: center; padding-top: 8px; }
.dots i { display: inline-block; width: 6px; height: 6px; margin: 0 1px; border-radius: 50%; background: var(--muted); animation: dot 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-4px); opacity: .4; } }
.cite { border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 6px; font: 700 11px var(--mono); padding: 1px 5px; margin: 0 1px; vertical-align: 1px; }
.cite.on, .cite:hover { background: var(--accent); color: var(--accent-ink); }
.tools { display: flex; gap: 4px; margin-top: 10px; flex-wrap: wrap; }
.tool { border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tool:hover { color: var(--ink); border-color: var(--ink); }
.tool.picked { background: var(--accent-soft); color: var(--accent); border-color: transparent; animation: hop .4s; }
.nope { border: 1.5px dashed var(--line); border-radius: 16px; padding: 12px 14px; color: var(--muted); }
.nope strong { color: var(--ink); display: block; margin-bottom: 2px; }
.mode[disabled] { opacity: .45; cursor: not-allowed; }
.nope [data-msg] { display: block; margin: 2px 0 8px; }
.nope .rid { display: block; margin-top: 6px; font-size: 12px; }
.nope .pages-head { margin: 8px 0 4px; font-size: 13px; font-weight: 600; color: var(--ink); }
.nope .pages { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pagelink { text-align: left; }
.notes { margin-top: 10px; display: grid; gap: 6px; }
.note { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-left: 3px solid var(--sun); border-radius: 10px; padding: 6px 10px; }
.src-note { font-size: 12px; margin: 0 0 6px; padding: 4px 8px; border-radius: 8px; background: var(--lemon); color: var(--ink); }
.dock { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 16px var(--gr) calc(12px + env(safe-area-inset-bottom, 0px)) var(--gl); }
.dock .composer { max-width: 760px; margin: 0 auto; }
.dock .hint { max-width: 760px; margin: 6px auto 0; padding-inline: 4px; }

/* walking robot + speech bubble */
.dock-inner { max-width: 760px; margin: 0 auto; position: relative; }
.dock .composer { position: relative; z-index: 1; }
.pop { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-30%); white-space: nowrap; pointer-events: none;
       background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 7px 13px;
       font: 700 15px var(--display); box-shadow: 0 6px 20px rgba(25, 26, 61, .12); }
.pop.show { animation: popin .4s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes popin { from { opacity: 0; transform: translate(-30%, 10px) scale(.4); } to { opacity: 1; transform: translate(-30%, 0) scale(1); } }
.yogi.walking[data-mood] .bot { animation: walkbob .36s ease-in-out infinite alternate; }
.yogi.full.walking[data-mood] .leg:first-child { transform-origin: 50% 0; animation: step .36s ease-in-out infinite alternate; }
.yogi.full.walking[data-mood] .leg:last-child { transform-origin: 50% 0; animation: step .36s ease-in-out infinite alternate-reverse; }
.yogi.full.walking[data-mood] .arm.l { animation: swing .36s ease-in-out infinite alternate-reverse; }
.yogi.full.walking[data-mood] .arm.r { animation: swing .36s ease-in-out infinite alternate; }
.yogi.climbing[data-mood] .bot { animation: none; }
.yogi.climbing[data-mood] .eye { transform: translate(0, -35%); }
.yogi.full.climbing[data-mood] .arm.l { animation: reachL .4s ease-in-out infinite alternate; }
.yogi.full.climbing[data-mood] .arm.r { animation: reachR .4s ease-in-out infinite alternate; }
.yogi.full.climbing[data-mood] .leg:first-child { transform-origin: 50% 0; animation: step .4s ease-in-out infinite alternate; }
.yogi.full.climbing[data-mood] .leg:last-child { transform-origin: 50% 0; animation: step .4s ease-in-out infinite alternate-reverse; }
@keyframes reachL { from { transform: rotate(150deg); } to { transform: rotate(178deg); } }
@keyframes reachR { from { transform: rotate(-178deg); } to { transform: rotate(-150deg); } }
/* the big home robot dances for 2s, then stands still for a minute (timed in the script) */
#heroBot:not(.dancing)[data-mood="idle"] .arm.r { animation: none; }
.yogi.full.dancing[data-mood="idle"] .bot { animation: groove 1.6s ease-in-out infinite; }
.yogi.full.dancing[data-mood="idle"] .bot-q { animation: qspin 1.6s ease-in-out infinite; }
.yogi.full.dancing[data-mood="idle"] .arm.l { animation: discoL 1.6s ease-in-out infinite; }
.yogi.full.dancing[data-mood="idle"] .arm.r { animation: discoR 1.6s ease-in-out infinite; }
.yogi.full.dancing[data-mood="idle"] .leg:first-child { transform-origin: 50% 0; animation: kick 1.6s ease-in-out infinite; }
.yogi.full.dancing[data-mood="idle"] .leg:last-child { transform-origin: 50% 0; animation: kick 1.6s ease-in-out infinite .8s; }
.yogi.full.dancing[data-mood="idle"] .panel i { animation-duration: .4s; }
@keyframes groove { 0%, 100% { transform: rotate(-7deg); } 25%, 75% { transform: translateY(-6%); } 50% { transform: rotate(7deg); } }
@keyframes qspin { 0%, 100% { transform: translateX(-50%) rotate(-15deg); } 50% { transform: translateX(-50%) rotate(15deg) translateY(-10%); } }
@keyframes discoL { 0%, 100% { transform: rotate(155deg); } 25% { transform: rotate(60deg); } 50% { transform: rotate(150deg); } 75% { transform: rotate(20deg); } }
@keyframes discoR { 0%, 100% { transform: rotate(-20deg); } 25% { transform: rotate(-150deg); } 50% { transform: rotate(-60deg); } 75% { transform: rotate(-155deg); } }
@keyframes kick { 0%, 40%, 100% { transform: rotate(0deg); } 20% { transform: rotate(-24deg); } }
.hero-bot.grooving::before, .hero-bot.grooving::after { content: "♪"; position: absolute; top: 30%; font: 700 22px var(--display); color: var(--accent);
                                      opacity: 0; animation: note 1.5s ease-out infinite; pointer-events: none; }
.hero-bot.grooving::before { left: -18px; }
.hero-bot.grooving::after { content: "♫"; right: -20px; animation-delay: .5s; }
@keyframes note { 0% { opacity: 0; transform: translateY(10px) rotate(-10deg); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-50px) rotate(15deg); } }
/* logo: Yogi meditating in lotus pose, eyes closed, floating gently */
.yogi.meditate { width: calc(var(--s) * 1.2); height: calc(var(--s) * 1.5); }
.yogi.meditate::before { content: ""; position: absolute; inset: 15% -12% 0; border-radius: 50%;
                         background: radial-gradient(closest-side, var(--accent-soft), transparent); animation: aura 4s ease-in-out infinite; }
.yogi.meditate .bot { animation: levitate 4s ease-in-out infinite; }
.yogi.meditate .bot-top { left: calc(var(--s) * .1); }
.yogi.meditate .bot-q { animation: bob 4s ease-in-out infinite; }
.yogi.meditate .eye { height: 10%; background: transparent; box-shadow: none; animation: none; transform: none;
                      border-bottom: calc(var(--s) * .035) solid var(--glow); border-radius: 0 0 99px 99px; }
.yogi.meditate .neck { left: calc(var(--s) * .53); width: calc(var(--s) * .14); }
.yogi.meditate .torso { left: calc(var(--s) * .32); right: auto; width: calc(var(--s) * .56); height: calc(var(--s) * .36); }
.yogi.meditate .arm { top: calc(var(--s) * 1.01); width: calc(var(--s) * .1); height: calc(var(--s) * .32); }
.yogi.meditate .arm.l { left: calc(var(--s) * .29); transform: rotate(38deg); }
.yogi.meditate .arm.r { left: auto; right: calc(var(--s) * .29); transform: rotate(-38deg); }
.lotus { position: absolute; left: calc(var(--s) * .04); width: calc(var(--s) * 1.12); top: calc(var(--s) * 1.2); height: calc(var(--s) * .26); }
.lotus::before, .lotus::after { content: ""; position: absolute; top: 0; width: 62%; height: 100%; border-radius: 99px;
                                background: linear-gradient(180deg, var(--metal-hi), var(--metal) 55%, var(--metal-deep)); }
.lotus::before { left: 0; transform: rotate(6deg); }
.lotus::after { right: 0; transform: rotate(-6deg); box-shadow: calc(var(--s) * -.02) 0 0 var(--metal-deep); }
@keyframes levitate { 50% { transform: translateY(-7%); } }
@keyframes aura { 50% { opacity: .45; transform: scale(.9); } }
@keyframes walkbob { to { transform: translateY(-5%); } }
@keyframes step { from { transform: rotate(18deg); } to { transform: rotate(-18deg); } }
@keyframes swing { from { transform: rotate(32deg); } to { transform: rotate(-32deg); } }

/* quiz */
.quiz { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px; position: relative; overflow: hidden; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); margin-bottom: 8px; }
.pips { display: flex; gap: 4px; } .pips i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.pips i.ok { background: var(--ok); } .pips i.no { background: var(--err); } .pips i.now { background: var(--accent); }
.quiz-q { font: 700 20px/1.25 var(--display); margin: 0 0 12px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .opts { grid-template-columns: 1fr; } }
.opt { text-align: left; border: 1.5px solid var(--line); background: var(--bg); border-radius: 14px; padding: 10px 12px; font-weight: 600; transition: transform .15s; }
.opt:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.opt:disabled { cursor: default; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.opt.wrong { border-color: var(--err); background: var(--err-soft); color: var(--err); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.why { margin: 12px 0 0; color: var(--muted); }
.quiz .row { display: flex; justify-content: flex-end; margin-top: 12px; }
.score { font: 800 44px var(--display); margin: 4px 0; }
.confetti { position: absolute; top: -10px; width: 8px; height: 12px; border-radius: 2px; animation: fall 1.4s ease-in forwards; pointer-events: none; }
@keyframes fall { to { transform: translateY(260px) rotate(540deg); opacity: 0; } }

/* sources drawer */
.drawer { position: fixed; z-index: 8; top: calc(62px + env(safe-area-inset-top, 0px)); right: 0; bottom: 0; width: min(380px, 100%);
          background: var(--surface); border-left: 1px solid var(--line); padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) 18px;
          overflow-y: auto; box-shadow: -12px 0 32px rgba(25, 26, 61, .1); animation: slide .25s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.drawer-head h3 { font-size: 20px; }
.src { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; font-size: 14px; transition: border-color .2s, box-shadow .2s; }
.src.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.src-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-weight: 700; }
.src-top .mono { color: var(--muted); font-weight: 500; }
.src-doc { font-size: 12px; color: var(--muted); margin-bottom: 6px; overflow-wrap: anywhere; }
.src blockquote { margin: 0; padding-left: 10px; border-left: 3px solid var(--sun); color: var(--muted); white-space: pre-wrap; }
@media (max-width: 760px) {
  .drawer { top: auto; left: 0; width: 100%; max-height: 62vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 22px 22px 0 0;
            padding-left: var(--gl); padding-right: var(--gr); box-shadow: 0 -12px 32px rgba(25, 26, 61, .14); }
  @keyframes slide { from { transform: translateY(40px); opacity: 0; } }
  .demo { border-left: 0; padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Cloudflare preview: coming-soon states (additive) ---------- */
.preview-bar { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line); font-size: 14px; text-align: center; padding: 8px var(--gr) 8px var(--gl); }
.preview-bar strong { font-weight: 700; }
.soon-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-family: var(--mono); font-size: 10px; letter-spacing: .04em; vertical-align: middle; }
.link[disabled], .btn[disabled], .card[disabled], .icon-btn[disabled] { opacity: .5; cursor: not-allowed; }
.card[disabled]:hover { transform: none; box-shadow: none; }
.composer textarea:disabled { cursor: not-allowed; background: transparent; }

