/* The Business Brain (homepage #brain and /brain/): only pages with the Brain load this file.
   The scene (.bb-*) is Andrew's Neural Interface prototype, scoped so its class names can't touch the rest of the Academy.
   Its palette: --bb-bg #0A0D0F, coral #E8584A, gold #F0C33C, teal #8FB3B5. The scene is always dark, in either theme. */
.bb { --bb-bg: #0A0D0F; --bb-coral: #E8584A; --bb-gold: #F0C33C; --bb-teal: #8FB3B5; --bb-ease: cubic-bezier(.16,1,.3,1); max-width: 1100px; margin: 0 auto; }
.brain-page { max-width: 1140px; margin: 0 auto; padding: 18px 16px 10px; }
.brain-home { overflow: hidden; }
.brain-home-h { font-size: clamp(1.7rem, 6vw, 2.6rem); line-height: 1.1; margin: 6px 0 8px; }
.brain-home-h .accent, .brain-ask h1 .accent { color: var(--teal); }
.brain-full { margin-top: 14px; text-align: center; font-size: .9rem; }
.brain-full a { text-decoration: underline; text-underline-offset: 3px; }

/* the scene */
.bb-stage { position: relative; margin: 16px 0 0; }
.bb-scene { position: relative; width: 100%; aspect-ratio: 3/2; perspective: 1400px; touch-action: pan-y; cursor: crosshair; -webkit-tap-highlight-color: transparent; user-select: none;
  -webkit-user-select: none; scroll-margin-top: 76px; }
.bb-card { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; border-radius: 6px; }
.bb-layer { position: absolute; pointer-events: none; user-select: none; transform-style: preserve-3d; will-change: transform; }
.bb-bg { inset: 0; border-radius: 6px; background: radial-gradient(circle, rgba(143,179,181,.16) .9px, transparent 1.3px) 0 0/2.15% 3.22%, radial-gradient(ellipse at 70% 52%, #0e1417, var(--bb-bg) 60%);
  box-shadow: 0 30px 80px -30px #000, 0 0 0 1px #ffffff0d; }
.bb-brk { position: absolute; width: 2.2%; aspect-ratio: 1; border: 1.5px solid #8FB3B5aa; }
.bb-brk.tl { left: 1.6%; top: 2.4%; border-right: 0; border-bottom: 0; } .bb-brk.tr { right: 1.6%; top: 2.4%; border-left: 0; border-bottom: 0; }
.bb-brk.bl { left: 1.6%; bottom: 2.4%; border-right: 0; border-top: 0; } .bb-brk.br { right: 1.6%; bottom: 2.4%; border-left: 0; border-top: 0; }
#bb-gl { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; mix-blend-mode: screen; border-radius: 6px; }
.bb-frag { pointer-events: auto; cursor: grab; transition: filter .3s; touch-action: none; }
.bb-frag img { width: 100%; height: 100%; display: block; pointer-events: none; object-fit: contain; }
.bb-frag.grab, .bb-frag.hot, .bb-frag:focus-visible { filter: drop-shadow(0 0 18px rgba(240,195,60,.55)) brightness(1.5); outline: none; }
.bb-frag.grab { cursor: grabbing; }
.bb-tag { position: absolute; left: 50%; top: -6%; translate: -50% -100%; font-family: var(--font-mono); font-size: clamp(8px, .8vw, 11px); letter-spacing: .2em; color: var(--bb-gold); white-space: nowrap;
  opacity: 0; transition: opacity .25s; border: 1px solid #F0C33C55; padding: 3px 7px; background: #0A0D0Fcc; }
.bb-frag.grab .bb-tag, .bb-frag:hover .bb-tag, .bb-frag.hot .bb-tag, .bb-frag:focus-visible .bb-tag { opacity: 1; }
.bb-hud { opacity: .35; transition: opacity .6s; } .bb-scene.on .bb-hud, .bb-scene.powered .bb-hud { opacity: 1; }
.bb-hud svg { width: 100%; height: 100%; overflow: visible; }
.bb-ring { transform-origin: 50% 50%; transform-box: fill-box; }
.bb-ring.r1 { animation: bb-spin 40s linear infinite; } .bb-ring.r2 { animation: bb-spin 26s linear infinite reverse; } .bb-ring.r3 { animation: bb-spin 60s linear infinite; }
@keyframes bb-spin { to { transform: rotate(360deg); } }
.bb-read { font-family: var(--font-mono); font-size: 2.4px; letter-spacing: .3px; fill: var(--bb-teal); opacity: .8; }
.bb-scan { inset: 0; border-radius: 6px; overflow: hidden; opacity: 0; transition: opacity .5s; }
.bb-scene.on .bb-scan, .bb-scene.powered .bb-scan { opacity: 1; }
.bb-scan::after { content: ""; position: absolute; left: 0; right: 0; height: 18%; top: -20%;
  background: linear-gradient(180deg, transparent 55%, rgba(143,179,181,.04) 88%, rgba(143,179,181,.13) 97%, transparent); animation: bb-scanline 4.5s cubic-bezier(.45,0,.55,1) infinite; }
@keyframes bb-scanline { to { top: 105%; } }
canvas.bb-fx { position: absolute; inset: -4%; width: 108%; height: 108%; pointer-events: none; z-index: 6; }
.bb-ripple { position: absolute; z-index: 7; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; border: 1px solid var(--bb-teal); pointer-events: none; animation: bb-rip .7s var(--bb-ease) forwards; }
@keyframes bb-rip { to { transform: scale(14); opacity: 0; } }
.bb-toast { position: absolute; right: 4%; top: 6%; z-index: 9; font-family: var(--font-mono); font-size: clamp(9px, .9vw, 12px); letter-spacing: .24em; color: var(--bb-gold); border: 1px solid #F0C33C55;
  background: #0A0D0Fcc; padding: 6px 10px; opacity: 0; transform: translateY(-6px); transition: opacity .3s, transform .3s var(--bb-ease); pointer-events: none; }
.bb-toast.show { opacity: 1; transform: none; }
.bb-statusline { position: absolute; left: 3.5%; bottom: 4.5%; z-index: 8; display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: .66rem;
  letter-spacing: .1em; text-transform: uppercase; color: #8FB3B5; pointer-events: none; max-width: 60%; }
.brain-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #E8584A; box-shadow: 0 0 10px #E8584A; animation: brain-beat 1.6s ease-in-out infinite; }
.bb.thinking .brain-dot { background: #F0C33C; box-shadow: 0 0 12px #F0C33C; animation-duration: .45s; }
@keyframes brain-beat { 0%, 100% { opacity: .45; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
#brain-canvas { position: absolute; inset: 0; display: block; z-index: 3; touch-action: manipulation; border-radius: 6px; }
.brain-tip { position: absolute; z-index: 10; max-width: 240px; padding: 10px 12px; border-radius: 4px; background: rgba(10,13,15,.95); border: 1px solid #E8584A88; border-left: 2px solid #E8584A;
  color: #EDF3F3; font-size: .84rem; line-height: 1.35; box-shadow: 0 8px 30px rgba(0,0,0,.5), 0 0 24px #E8584A22; }
.brain-tip strong { display: block; font-family: var(--font-display); }
.brain-tip span { display: block; color: #8FB3B5; font-size: .74rem; margin: 2px 0 6px; }
.brain-tip-go { min-height: 40px; padding: 6px 0; border: 0; background: none; color: #F0C33C; font: 600 .84rem var(--font-body); cursor: pointer; }

/* the Brain's voice: big text and the HAL-style prompt panel. Over the scene on wide screens, under it on phones */
.bb-voice { display: flex; flex-direction: column; gap: 10px; padding: 12px 2px 0; }
.bb-say { font-family: var(--font-display); color: var(--text); font-weight: 400; font-size: 1.35rem; line-height: 1.2; letter-spacing: -.01em; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.bb-say.empty { color: var(--text-dim); }
.bb-say .interim { color: var(--text-faint); }
.bb-say .w { display: inline-block; animation: bb-w .5s var(--bb-ease) both; }
.bb-say .cmd { color: var(--bb-gold); }
@keyframes bb-w { from { opacity: 0; transform: translateY(.4em); filter: blur(6px); } }
.bb-prompt { display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; gap: 4px 10px; max-width: 100%; padding: 12px 16px 12px 14px; border: 1px solid #8FB3B544; border-left: 2px solid var(--bb-coral);
  background: linear-gradient(90deg, #0A0D0Fee, #0A0D0Fcc); font-family: var(--font-mono); font-size: .84rem; letter-spacing: .04em; color: #e4eeee; box-shadow: 0 0 24px #E8584A22; min-height: 4.4em; }
.bb-prompt .k { color: var(--bb-coral); letter-spacing: .2em; white-space: nowrap; flex-basis: 100%; font-size: .78em; }
.bb-prompt .t { white-space: normal; }
.bb-prompt .caret { display: inline-block; width: .55em; height: 1em; background: var(--bb-teal); vertical-align: -2px; margin-left: -6px; animation: bb-blink .9s steps(1) infinite; }
@keyframes bb-blink { 50% { opacity: 0; } }
@media (min-width: 760px) {
  .bb-voice { position: absolute; left: 4.5%; top: 14%; width: 38%; z-index: 8; pointer-events: none; padding: 0; gap: 16px; }
  .bb-say { color: #E9EFEF; font-size: clamp(1.4rem, 2.8vw, 2.4rem); -webkit-line-clamp: 4; font-weight: 300; }
  .bb-say.empty { color: #8FB3B5; }
  .bb-say .interim { color: #8FB3B5; }
}
@media (max-width: 640px) { .bb-scene { aspect-ratio: 1/1; } .bb-statusline { max-width: 80%; font-size: .6rem; } }

/* the question box, the mic and sound buttons */
.bb .brain-form { margin-top: 14px; max-width: none; }
.bb-round { flex: none; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-panel); color: var(--text-dim); display: grid; place-items: center; cursor: pointer;
  transition: border-color .3s, box-shadow .3s, color .3s; }
.bb-round:hover { border-color: var(--teal); color: var(--text); }
.bb-round svg { width: 45%; height: 45%; }
#bb-mic.rec { color: #E8584A; border-color: #E8584A; box-shadow: 0 0 0 calc(var(--lv, 0) * 18px) #E8584A33, 0 0 24px #E8584A55; }
#bb-snd[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); }
.bb-status { margin-top: 8px; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); text-align: right; }
.bb .brain-chips { justify-content: flex-start; }
/* the 2D fallback: no icons, HUD or voice controls */
.bb-flat .bb-frag, .bb-flat .bb-hud, .bb-flat #bb-gl, .bb-flat .bb-fx, .bb-flat #bb-mic, .bb-flat #bb-snd, .bb-flat .bb-status, .bb-flat .bb-voice { display: none !important; }

.brain-ask { padding: 26px 2px 6px; text-align: center; }
.brain-ask .hero-eyebrow { margin-bottom: 12px; }
.brain-ask h1 { font-size: clamp(1.9rem, 7vw, 2.8rem); line-height: 1.1; letter-spacing: -.01em; }
.brain-ask h1 .accent { color: var(--teal); text-shadow: 0 0 24px color-mix(in srgb, var(--teal) 45%, transparent); }
.brain-sub { color: var(--text-dim); margin: 12px auto 18px; max-width: 560px; font-size: .98rem; }
.brain-form { display: flex; gap: 8px; max-width: 620px; margin: 0 auto; }
.brain-form input { flex: 1; min-width: 0; min-height: 52px; padding: 12px 14px; font: 1rem var(--font-body); color: var(--text); background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 10px; }
.brain-form input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 25%, transparent); }
.brain-form .btn { min-height: 52px; padding: 10px 20px; border-radius: 10px; }
.brain-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 4px; }
.brain-chip { min-height: 40px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-panel); color: var(--text-dim);
  font: .84rem var(--font-body); cursor: pointer; text-align: left; }
.brain-chip:hover { border-color: var(--teal); color: var(--text); }

.brain-teach { margin: 22px 0 6px; padding: 18px 16px 16px; border: 1px solid color-mix(in srgb, var(--teal) 45%, var(--border)); border-radius: 14px; background: var(--bg-panel);
  scroll-margin-top: 76px; animation: bt-in .45s ease-out; }
@keyframes bt-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.bt-eyebrow, .bt-step { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); }
.bt-head h2 { font-size: 1.3rem; line-height: 1.25; margin: 6px 0 4px; }
.bt-from { color: var(--text-faint); font-size: .82rem; }
.bt-from a { text-decoration: underline; text-underline-offset: 2px; }
.bt-unsure { color: var(--coral); font-size: .88rem; margin: 4px 0; }
.bt-bar { display: flex; gap: 5px; margin: 14px 0 12px; }
.bt-bar span { flex: 1; height: 4px; border-radius: 2px; background: var(--bg-panel-2); transition: background .3s; }
.bt-bar span.done { background: color-mix(in srgb, var(--teal) 55%, transparent); }
.bt-bar span.now { background: var(--teal); box-shadow: 0 0 8px var(--teal); }
.bt-card { display: none; }
.bt-card.on { display: block; animation: bt-card .35s ease-out; }
@keyframes bt-card { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.bt-card h3 { font-size: 1.12rem; margin: 6px 0 4px; }
.bt-card p { margin: 8px 0; line-height: 1.6; }
.bt-obj { color: var(--text-dim); font-size: .9rem; font-style: italic; }
.bt-more, .bt-hint { color: var(--text-dim); font-size: .9rem; }
.bt-term { margin: 8px 0 10px; padding: 10px 12px; border-left: 3px solid var(--gold); background: var(--bg-panel-2); border-radius: 0 8px 8px 0; font-size: .92rem; }
.bt-term span { display: block; font-family: var(--font-mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 2px; }
.bt-q { font-weight: 600; }
.bt-card textarea { width: 100%; padding: 10px 12px; margin: 4px 0 10px; font: .95rem var(--font-body); color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; resize: vertical; }
.bt-card textarea:focus { outline: none; border-color: var(--teal); }
.bt-answer { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--teal-dim); font-size: .93rem; animation: bt-in .3s ease-out; }
.bt-answer span { display: block; font-family: var(--font-mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); margin-bottom: 3px; }
.bt-help-q { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.bt-help { display: flex; gap: 8px; flex-wrap: wrap; }
.bt-help .btn[aria-pressed="true"] { background: var(--teal); color: var(--on-teal); }
.bt-thanks { color: var(--text-dim); font-size: .88rem; min-height: 1.2em; }
.bt-course { margin: 14px 0 6px; padding: 16px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--coral) 45%, var(--border)); background: linear-gradient(135deg, var(--coral-dim), var(--bg-panel) 70%); }
.bt-course > span { display: block; font-family: var(--font-mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--coral); margin-bottom: 4px; }
.bt-course p { margin: 4px 0 12px; }
.bt-course .btn { display: flex; width: 100%; justify-content: center; text-align: center; white-space: normal; }
.bt-course .bt-also { margin: 10px 0 0; font-size: .86rem; color: var(--text-dim); }
.bt-course .bt-also a { text-decoration: underline; text-underline-offset: 2px; }
.bt-deeper { display: inline-block; margin: 8px 0 4px; font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; }
.bt-related { margin-top: 12px; }
.bt-related > span { display: block; font-family: var(--font-mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }
.bt-related .brain-chip { display: block; width: 100%; margin-bottom: 6px; }
.bt-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.bt-nav .btn { min-width: 110px; }
.bt-nav .btn:disabled { visibility: hidden; }

.brain-memory { margin: 22px 0 6px; padding: 16px; border: 1px dashed var(--border); border-radius: 14px; }
.bm-head h2 { font-size: 1.05rem; }
.bm-head span { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em; color: var(--text-faint); }
.brain-memory .brain-chips { justify-content: flex-start; }
.bm-forget { min-height: 40px; margin-top: 6px; padding: 6px 0; border: 0; background: none; color: var(--text-faint); font: .8rem var(--font-body); text-decoration: underline; cursor: pointer; }
.brain-note { margin: 20px auto 10px; max-width: 600px; text-align: center; color: var(--text-faint); font-size: .8rem; }

@media (min-width: 760px) { .brain-page { padding-top: 28px; } .brain-teach { padding: 24px 26px 20px; } .bt-head h2 { font-size: 1.5rem; } }
@media (max-width: 400px) { .brain-form { gap: 6px; } .brain-form .btn { padding: 10px 14px; } .bb-round { width: 46px; height: 52px; border-radius: 10px; } }
@media (prefers-reduced-motion: reduce) { .bb-ring.r1, .bb-ring.r2, .bb-ring.r3, .bb-scan::after, .bb-say .w, .brain-dot, .brain-teach, .bt-card.on, .bt-answer { animation: none; } }
.bb [hidden], .brain-page [hidden] { display: none !important; }
/* the homepage's big uppercase buttons are for its hero; inside the Brain, buttons stay ordinary */
.page-catalogue .bb .btn { font-family: var(--font-body); font-weight: 600; font-size: .9rem; letter-spacing: 0; text-transform: none; min-height: 48px; padding: 10px 18px; }
.page-catalogue .bb .brain-form .btn { min-height: 52px; }

/* ── the homepage welcome (brain-welcome.js): the prototype's full-screen opening, scoped under .bb-boot ── */
html.bb-welcoming, html.bb-welcoming body { overflow: hidden; }
.bb-boot { --bg: #0A0D0F; --coral: #E8584A; --gold: #F0C33C; --teal: #8FB3B5; --ease: cubic-bezier(.16,1,.3,1);
  position: fixed; inset: 0; z-index: 1000; background: #06080A; color: var(--teal); font-family: var(--font-mono), ui-monospace, Menlo, monospace;
  display: grid; place-items: center; clip-path: inset(0 0 0 0); transition: clip-path .7s cubic-bezier(.7,0,.3,1), opacity .4s .55s; }
.bb-boot button { font: inherit; }
.bb-boot.out { clip-path: inset(50% 0 50% 0); opacity: 0; pointer-events: none; }
.bb-boot::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, rgba(143,179,181,.12) .8px, transparent 1.2px) 0 0/28px 28px;
  -webkit-mask: radial-gradient(ellipse at center, #000 30%, transparent 75%); mask: radial-gradient(ellipse at center, #000 30%, transparent 75%); }
.bb-boot::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px); pointer-events: none; }
.bb-boot .sweep { position: absolute; left: 0; right: 0; height: 2px; top: 0; background: linear-gradient(90deg, transparent, var(--teal), transparent); box-shadow: 0 0 24px var(--teal); opacity: .6; animation: bbb-sweep 2.4s cubic-bezier(.45,0,.55,1) infinite; }
@keyframes bbb-sweep { to { top: 100%; } }
.bb-boot .frame { position: absolute; inset: clamp(14px, 4vw, 48px); pointer-events: none; }
.bb-boot .frame i { position: absolute; width: 28px; height: 28px; border: 1.5px solid var(--teal); opacity: 0; animation: bbb-fin .6s var(--ease) forwards; }
.bb-boot .frame i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; } .bb-boot .frame i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; animation-delay: .1s; }
.bb-boot .frame i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; animation-delay: .2s; } .bb-boot .frame i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; animation-delay: .3s; }
@keyframes bbb-fin { from { opacity: 0; transform: scale(1.8); } to { opacity: 1; transform: none; } }
.bb-boot .boot-in { position: relative; width: min(720px, 88vw); }
.bb-boot .boot-log { font-size: clamp(10px, 1.4vw, 13px); letter-spacing: .14em; line-height: 2; min-height: 8.5em; color: #7f9c9e; }
.bb-boot .boot-log .ok { color: var(--gold); }
.bb-boot .boot-log div { white-space: nowrap; overflow: hidden; }
.bb-boot .boot-title { font-family: "Helvetica Neue", Arial, sans-serif; font-weight: 200; font-size: clamp(44px, 11vw, 128px); letter-spacing: .32em; color: #EAF2F2;
  margin: .15em 0 .1em -.04em; text-shadow: 0 0 30px rgba(143,179,181,.45); min-height: 1.2em; line-height: 1.2; }
.bb-boot .boot-title .g { color: var(--coral); }
.bb-boot .gate { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; align-content: center; gap: 22px; background: #06080A; transition: opacity .5s, transform .6s var(--ease); }
.bb-boot .gate.gone { opacity: 0; transform: scale(1.06); pointer-events: none; }
.bb-boot .gate-ring { position: relative; width: clamp(120px, 22vw, 190px); aspect-ratio: 1; margin-bottom: 6px; }
.bb-boot .gate-ring i { position: absolute; inset: 0; border-radius: 50%; border: 1px solid #8FB3B555; animation: bbb-gpulse 2.8s cubic-bezier(.2,.6,.3,1) infinite; }
.bb-boot .gate-ring i:nth-child(2) { animation-delay: .93s; } .bb-boot .gate-ring i:nth-child(3) { animation-delay: 1.86s; }
.bb-boot .gate-ring b { position: absolute; inset: 38%; border-radius: 50%; background: radial-gradient(circle, #ffd9d2 0, #E8584A 35%, #7a1d14 70%, transparent 72%);
  box-shadow: 0 0 30px #E8584A, 0 0 80px #E8584A66; animation: bbb-gbreath 2.8s ease-in-out infinite; }
@keyframes bbb-gpulse { from { transform: scale(.45); opacity: 0; } 25% { opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
@keyframes bbb-gbreath { 50% { transform: scale(.86); filter: brightness(.75); } }
.bb-boot .gate-kick, .bb-boot .boot-kick { font-size: clamp(11px, 1.5vw, 14px); letter-spacing: .5em; text-transform: uppercase; color: var(--coral); }
.bb-boot .gate-kick { text-align: center; margin-right: -.5em; }
.bb-boot .gate-go { min-height: 48px; padding: 0 26px; border: 1px solid var(--coral); background: #E8584A1a; color: #fff; letter-spacing: .28em; text-transform: uppercase; font-size: 12px; cursor: pointer; transition: background .3s, box-shadow .3s; }
.bb-boot .gate-go:hover, .bb-boot .gate-go:focus-visible { background: #E8584A40; box-shadow: 0 0 24px #E8584A55; }
.bb-boot .gate-quiet { min-height: 44px; background: none; border: 0; color: #7f9c9e; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; cursor: pointer; padding: 8px;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: #7f9c9e55; }
.bb-boot .gate-quiet:hover { color: var(--teal); }
.bb-boot button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.bb-boot.charge .boot-in { animation: bbb-vib .06s linear infinite; }
.bb-boot.charge .boot-title { text-shadow: 0 0 40px #fff, 0 0 90px var(--coral); color: #fff; transition: text-shadow .4s, color .4s; }
.bb-boot.charge::after { background: repeating-linear-gradient(0deg, rgba(232,88,74,.08) 0 1px, transparent 1px 3px); }
.bb-boot .flash { position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: #fff; box-shadow: 0 0 30px #fff, 0 0 80px var(--coral); transform: scaleX(0); opacity: 0; pointer-events: none; z-index: 4; }
.bb-boot.out .flash { animation: bbb-fl .9s var(--ease) forwards; }
@keyframes bbb-fl { 0% { transform: scaleX(0); opacity: 1; } 35% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
@keyframes bbb-vib { 0% { transform: translate(0,0); } 25% { transform: translate(1.5px,-1px); } 50% { transform: translate(-1.5px,1px); } 75% { transform: translate(1px,1.5px); } 100% { transform: translate(0,0); } }
.bb-boot .boot-kick { margin-bottom: 14px; opacity: 0; animation: bbb-fin .8s .2s var(--ease) forwards; }
.bb-boot .boot-greet { font-family: "Helvetica Neue", Arial, sans-serif; font-weight: 300; font-size: clamp(15px, 2vw, 22px); line-height: 1.45; color: #dfe9e9; margin-top: 18px; min-height: 2.9em; max-width: 34em; }
.bb-boot .boot-greet .caret { display: inline-block; width: .5em; height: 1em; background: var(--coral); vertical-align: -2px; margin-left: 3px; animation: bb-blink .9s steps(1) infinite; }
.bb-boot .boot-rule { height: 1px; background: linear-gradient(90deg, var(--coral), var(--teal) 40%, transparent); transform-origin: left; transform: scaleX(0); transition: transform 1.1s var(--ease); }
.bb-boot.ready .boot-rule { transform: none; }
.bb-boot .boot-sub { margin-top: 14px; font-size: clamp(10px, 1.4vw, 13px); letter-spacing: .3em; text-transform: uppercase; opacity: 0; transition: opacity .6s .3s; }
.bb-boot.ready .boot-sub { opacity: .8; }
.bb-boot .boot-btns { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; opacity: 0; transform: translateY(8px); transition: opacity .6s .5s, transform .6s .5s var(--ease); }
.bb-boot.ready .boot-btns { opacity: 1; transform: none; }
.bb-boot .boot-btns button { min-height: 46px; padding: 0 22px; border: 1px solid var(--coral); background: #E8584A1a; color: #fff; letter-spacing: .24em; text-transform: uppercase; font-size: 12px; cursor: pointer; transition: background .3s, box-shadow .3s; }
.bb-boot .boot-btns button:hover { background: #E8584A40; box-shadow: 0 0 24px #E8584A55; }
@media (prefers-reduced-motion: reduce) { .bb-boot .sweep, .bb-boot .gate-ring i, .bb-boot .gate-ring b, .bb-boot.charge .boot-in { animation: none; } }

/* ── the Brain as the top of the homepage ── */
.home-hero-brain .home-hero-inner { min-height: 0; padding-top: 56px; justify-content: flex-start; }
.home-hero-brain h1 { margin-bottom: 14px; }
.home-hero-brain .bb { width: 100%; margin-top: 18px; }
.home-hero-brain .hero-cta { margin: 26px 0 0; }
.home-hero-brain .stats { margin-top: 26px; }
@media (max-width: 860px) { .home-hero-brain .home-hero-inner { padding-top: 24px; } .home-hero-brain .hero-sub { font-size: 1rem; } }
@media (min-width: 861px) {
  .home-hero-brain h1 { font-size: clamp(2.6rem, 1.2rem + 3vw, 3.8rem); max-width: none; }
  .home-hero-brain .bb-scene { max-height: max(420px, calc(100vh - 150px)); }
}

/* ── topics in place of the search (round 4) ── */
.bb-controls { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.bb .bb-topics { justify-content: flex-start; margin: 0; }
.bb-topics .brain-chip[aria-pressed="true"] { border-color: var(--teal); color: var(--text); background: var(--teal-dim); }
.bb-topics .bb-surprise { border-color: color-mix(in srgb, var(--coral) 70%, var(--border)); color: var(--text); font-weight: 600; }
.bb-buttons { display: flex; align-items: center; gap: 10px; }
.bb-buttons .bb-status { margin: 0 0 0 auto; }
.bt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bt-actions .btn { flex: 1 1 auto; justify-content: center; text-align: center; }
.bt-head h2 { font-size: 1.15rem; }
@media (min-width: 760px) { .bb-controls { flex-direction: row; align-items: flex-start; justify-content: space-between; } .bb-buttons { flex: none; } .bt-actions .btn { flex: none; } }

/* ── brain regions (round 5) ── */
.bb-region { position: absolute; z-index: 9; max-width: 250px; padding: 9px 12px; border-radius: 4px; pointer-events: none; background: rgba(10,13,15,.92);
  border: 1px solid #8FB3B566; border-left: 2px solid #F0C33C; color: #EDF3F3; font-size: .82rem; line-height: 1.35; box-shadow: 0 8px 26px rgba(0,0,0,.45); }
.bb-region strong { display: block; font-family: var(--font-display); }
.bb-region span { display: block; color: #AEBEC0; font-size: .76rem; }
.bb-region em { display: block; font-style: normal; color: #F0C33C; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em; margin-top: 3px; }
.bb-topics .brain-chip { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.15; padding: 7px 13px; }
.bb-topics .brain-chip small { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); margin-top: 2px; }
/* the icons and HUD wait for the 3D scene to place them (otherwise they pile up in a corner while it loads) */
.bb:not(.bb-3d) .bb-frag, .bb:not(.bb-3d) .bb-hud { visibility: hidden; }

/* ── /brain/ as a full-screen app (round 6): no site frame, the brain fills the screen, the lesson is a sheet over it ── */
body.page-brain-app { background: #06080A; overflow: hidden; }
.page-brain-app > .topbar, .page-brain-app > footer { display: none; }
.brain-app { position: fixed; inset: 0; color: #EDF3F3;
  --bg: #0A0D0F; --bg-panel: #11171A; --bg-panel-2: #1A2226; --border: #2B363B; --text: #EDF3F3; --text-dim: #AEBEC0; --text-faint: #798B8F;
  --teal: #4DD6C7; --teal-dim: #123330; --teal-vivid: #4DD6C7; --teal-vivid-hover: #6FE0D3; --on-teal: #06201D; --coral: #FF8A65; --coral-dim: #3A2018; --gold: #F0C33C; }
.brain-app .bb { max-width: none; height: 100%; margin: 0; }
.brain-app .bb-stage { position: absolute; inset: 0; margin: 0; }
.brain-app .bb-scene { aspect-ratio: auto; width: 100%; height: 100%; max-height: none; scroll-margin-top: 0; }
.brain-app .bb-bg, .brain-app #bb-gl, .brain-app .bb-card { border-radius: 0; }
.brain-app .bb-bg { box-shadow: none; }
.brain-app .bb-brk { display: none; }
.bb-appbar { position: absolute; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px; background: linear-gradient(#06080Acc, transparent); pointer-events: none; }
.bb-appbar a { pointer-events: auto; }
.bb-appbar-home { display: flex; align-items: center; gap: 8px; color: #EDF3F3; font-family: var(--font-display); font-weight: 700; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; min-height: 44px; }
.bb-appbar-home .mark { width: 28px; height: 28px; color: #4DD6C7; }
.bb-enter-academy { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid #E8584A; background: #E8584A1a; color: #fff;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; border-radius: 3px; }
.bb-enter-academy:hover { background: #E8584A40; }
.brain-app .bb-statusline { left: 14px; top: calc(62px + env(safe-area-inset-top)); bottom: auto; }
/* the controls: topics along the bottom, then the mic and sound */
.brain-app .bb-controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 15; margin: 0; gap: 8px; flex-direction: column;
  padding: 26px 12px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, #06080Af2 34%); }
.brain-app .bb-topics { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.brain-app .bb-topics::-webkit-scrollbar { display: none; }
.brain-app .bb-topics .brain-chip { flex: none; background: #11171Acc; }
.brain-app .bb-voice { position: absolute; left: 6%; right: 6%; top: auto; bottom: calc(150px + env(safe-area-inset-bottom)); width: auto; z-index: 8; pointer-events: none; padding: 0; gap: 10px; }
.brain-app .bb-say { color: #E9EFEF; font-weight: 300; font-size: 1.3rem; -webkit-line-clamp: 2; }
.brain-app .bb-say.empty { color: #8FB3B5; }
.brain-app .brain-memory, .brain-app .brain-note { display: none !important; }
@media (min-width: 760px) {
  .brain-app .bb-voice { left: 4.5%; right: auto; top: 16%; bottom: auto; width: 36%; gap: 16px; }
  .brain-app .bb-say { font-size: clamp(1.4rem, 2.6vw, 2.3rem); -webkit-line-clamp: 4; }
  .brain-app .bb-controls { flex-direction: row; align-items: flex-end; justify-content: space-between; padding: 30px 24px 18px; }
  .brain-app .bb-topics { flex-wrap: wrap; }
}
/* the lesson sheet: up from the bottom on a phone, in from the right on a wide screen; "peek" shows just its top */
.brain-app .brain-teach { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 30; margin: 0; max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 16px 16px 0 0; border: 1px solid #4DD6C766; border-bottom: 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); background: #0E1417f7;
  box-shadow: 0 -20px 60px #000a; transform: translateY(102%); transition: transform .45s cubic-bezier(.16,1,.3,1); animation: none; scroll-margin-top: 0; }
.brain-app .brain-teach.open { transform: none; }
.brain-app .brain-teach.peek { transform: translateY(calc(100% - 118px - env(safe-area-inset-bottom))); overflow: hidden; cursor: pointer; }
.brain-app .brain-teach.peek .bt-head h2 { font-size: 1rem; }
.bt-close { float: right; width: 44px; height: 44px; margin: -8px -6px 0 8px; border: 1px solid #2B363B; border-radius: 50%; background: transparent; color: #AEBEC0; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.bt-close:hover { color: #fff; border-color: #4DD6C7; }
.brain-app .brain-teach.peek .bt-close { display: none; }
@media (min-width: 760px) {
  .brain-app .brain-teach { left: auto; top: 0; bottom: 0; width: min(460px, 42vw); max-height: none; border-radius: 0; border: 0; border-left: 1px solid #4DD6C766;
    padding: 76px 22px 22px; transform: translateX(102%); }
  .brain-app .brain-teach.peek { transform: translateX(calc(100% - 0px)); }
}
@media (prefers-reduced-motion: reduce) { .brain-app .brain-teach { transition: none; } }
/* peek above the topic row; the Brain's words above the peek */
.brain-app .brain-teach.peek { bottom: var(--bb-ctrl-h, 124px); left: 8px; right: 8px; border-bottom: 1px solid #4DD6C766; border-radius: 14px; max-height: 104px;
  transform: none; padding-top: 12px; padding-bottom: 12px; z-index: 16; }
.brain-app .brain-teach.peek .bt-from, .brain-app .brain-teach.peek .bt-actions, .brain-app .brain-teach.peek .bt-bar, .brain-app .brain-teach.peek .bt-cards, .brain-app .brain-teach.peek .bt-nav { display: none; }
.brain-app .brain-teach.peek .bt-head h2::after { content: " Open →"; color: #4DD6C7; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; white-space: nowrap; }
.brain-app .bb-voice { bottom: calc(var(--bb-ctrl-h, 124px) + 116px); }
.bb-enter-academy { white-space: nowrap; }
@media (max-width: 420px) { .bb-enter-academy { font-size: .64rem; letter-spacing: .08em; padding: 8px 10px; } .bb-appbar-home span { display: none; } }
@media (min-width: 760px) {
  .brain-app .brain-teach.peek { left: auto; right: 24px; bottom: calc(var(--bb-ctrl-h, 90px) + 12px); top: auto; width: min(380px, 34vw); max-height: 110px; border: 1px solid #4DD6C766; border-radius: 14px; padding: 14px 18px; }
  .brain-app .bb-voice { bottom: auto; }
}
@media (max-width: 759px) { .brain-app .bb-say { display: none; } }

/* ── written micro lessons (spec/micro-lesson.md) ── */
.bt-why { font-family: var(--font-display); font-size: 1.12rem; line-height: 1.4; color: var(--text); margin: 6px 0 10px; }
.bt-illus { display: inline-block; font-family: var(--font-mono); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); border-radius: 3px; padding: 2px 7px; margin-top: 4px; }
.bt-ours { margin: 12px 0 4px; padding: 10px 12px; border-radius: 8px; background: var(--bg-panel-2); }
.bt-ours summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.bt-ours p { margin: 8px 0; font-size: .95rem; }
.bt-ours-ans { color: var(--teal); }
.bt-take { font-family: var(--font-display); font-size: 1.08rem; line-height: 1.45; padding: 12px 14px; border-left: 3px solid var(--teal); background: var(--teal-dim); border-radius: 0 8px 8px 0; }
.bt-planned { color: var(--text-dim); font-size: .86rem; }
.bt-card [data-bt="plan"][aria-pressed="true"] { background: var(--teal); color: var(--on-teal); }
.bt-click { margin: 10px 0 12px; padding: 12px 14px; border-radius: 8px; border: 1px dashed color-mix(in srgb, var(--coral) 60%, var(--border)); }
.bt-click > span { display: block; font-family: var(--font-mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--coral); margin-bottom: 4px; }
.bt-further { font-size: .93rem; color: var(--text); }
/* the header's two buttons side by side, so the lesson starts higher on a phone */
.bt-head .bt-actions { flex-wrap: nowrap; }
.bt-head .bt-actions .btn { flex: 1 1 0; min-height: 42px; padding: 8px 10px; font-size: .84rem; }
.brain-app .bt-head h2 { font-size: 1.05rem; }
