:root {
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --text: #234e46;
  --muted: #637e75;
  --small: 13px;
  --body: 14px;
  --heading: 22px;
  --display: 36px;
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; background: #258e91; color: var(--text); font: var(--body)/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { transition: background .18s, color .18s; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #87c9af; outline-offset: 4px; }
svg { display: block; width: 20px; height: 20px; flex-shrink: 0; }
#water-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.app-shell { position: relative; z-index: 1; display: flex; height: 100dvh; }
.sidebar { width: 242px; flex: 0 0 242px; padding: 24px 18px; display: flex; flex-direction: column; color: #e5f6ef; background: #123f4680; backdrop-filter: blur(24px); border-right: 1px solid #effff51a; }
.sidebar.collapsed { display: none; }
.brand-row { display: flex; align-items: center; gap: 10px; margin: 0 4px 30px; }
.brand-mark { display: flex; align-items: center; gap: 3px; transform: rotate(-20deg); width: 24px; }
.brand-mark span { width: 5px; height: 15px; background: #b0e5cf; border-radius: 5px; }
.brand-mark span:nth-child(2) { height: 22px; }
.brand-name { font-size: var(--heading); font-weight: 550; letter-spacing: -.05em; }
.brand-dot { color: #b5ead4; }
.icon-button { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 8px; color: inherit; border: 0; border-radius: 10px; background: transparent; }
.icon-button:hover { background: #eafff51a; }
.sidebar-close { margin-left: auto; }
.new-chat-button { padding: 12px; text-align: left; color: #f0fff8; border: 1px solid #daf5e72e; border-radius: 10px; background: #ffffff0a; font-size: var(--small); }
.new-chat-button:hover { background: #ffffff15; }
.plus { margin-right: 8px; font-size: 18px; line-height: 1; }
.history-label { margin: 28px 10px 8px; color: #c1d8cf; font-size: var(--small); }
.empty-history { margin: 8px 10px; color: #a2bfb6; font-size: var(--small); }
.chat-list { display: grid; gap: 3px; }
.chat-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px; border: 0; border-radius: 9px; text-align: left; color: #d6ebe2; background: transparent; font-size: var(--small); }
.chat-item:hover, .chat-item.active { color: #f3fff8; background: #effff518; }
.chat-item-dot { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: #aed8c3; opacity: .65; }
.chat-item.active .chat-item-dot { background: #d4f7dc; opacity: 1; box-shadow: 0 0 0 3px #d4f7dc18; }
.chat-item-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-spacer { flex: 1; }
.model-card { margin-top: 24px; padding: 16px 10px; border-top: 1px solid #e2ffee25; }
.model-card-top { display: flex; align-items: center; gap: 7px; color: #b7d1c5; font-size: var(--small); }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: #b1cbbb; }
.model-name { margin: 12px 0 2px; font-weight: 500; }
.model-meta { color: #bad3c8; font-size: var(--small); }
.learn-link { border: 0; background: none; color: #e1f8ea; margin-top: 16px; padding: 0; font-size: var(--small); }
.learn-link span { margin-left: 4px; }
.sidebar-footer { display: flex; justify-content: space-between; padding: 0 10px; color: #b0c9bd; font-size: var(--small); }
.footer-wave { font-size: 20px; line-height: 1; }
.chat-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; height: 76px; padding: 0 28px; flex-shrink: 0; color: #f0fff6; background: linear-gradient(#144a4a15,transparent); }
.context-title { display: flex; align-items: baseline; gap: 14px; font-weight: 500; font-size: 18px; letter-spacing: -.03em; }
.context-model { font-size: var(--small); font-weight: 400; letter-spacing: 0; opacity: .8; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
#top-lab { width: auto; gap: 8px; padding: 8px 12px; font-size: var(--small); border: 1px solid #e8fff52c; background: #13434a38; backdrop-filter: blur(12px); }
#top-lab:hover { background: #13434a65; }
.conversation { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 20px 40px 46px; width: 100%; max-width: 860px; margin: auto; }
.conversation:has(.messages:empty) { justify-content: center; padding-bottom: 100px; }
.welcome-block { text-align: center; margin-bottom: 28px; color: #f3fff7; text-shadow: 0 2px 20px #164f4a55; }
h1 { font-size: var(--display); letter-spacing: -.045em; line-height: 1.25; font-weight: 450; margin: 0 0 12px; }
.welcome-block p { font-size: var(--body); margin: 0; color: #edfff6; }
.messages { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #e1fff44d transparent; padding: 16px 0; display: flex; flex-direction: column; gap: 20px; }
.messages:empty { display: none; }
.message { display: flex; gap: 10px; align-items: start; }
.message.user { justify-content: flex-end; }
.message-bubble { max-width: 85%; padding: 14px 18px; border-radius: 16px; white-space: pre-wrap; line-height: 1.7; backdrop-filter: blur(15px); }
.message.assistant .message-bubble { color: #264c43; background: #ecfff4dc; }
.message.user .message-bubble { color: #f0fff8; background: #194c4bc4; }
.message-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #e7fff3; background: #18483b5c; flex-shrink: 0; }
.typing { display: flex; gap: 5px; }
.typing i { width: 5px; height: 5px; background: #488176; border-radius: 50%; animation: blink 1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .3; } }
.composer-wrap { width: 100%; margin: 0 auto; }
.composer { border: 1px solid #e9fff9b3; background: #f0fff5cc; backdrop-filter: blur(22px); padding: 20px; border-radius: 20px; box-shadow: 0 10px 50px #0e54551a; }
.composer:focus-within { border-color: #f3fff8; box-shadow: 0 0 0 3px #e7fff32b; }
.composer textarea { width: 100%; display: block; border: 0; outline: none; resize: none; background: none; color: #21483f; font-size: var(--body); line-height: 1.6; min-height: 44px; max-height: 160px; }
.composer textarea::placeholder { color: #658178; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; padding-top: 6px; }
.hint { font-size: var(--small); color: #6a8377; }
.send-button { display: grid; place-items: center; background: #275d52; color: #f6fff7; border: 0; border-radius: 50%; width: 34px; height: 34px; padding: 8px; }
.send-button:hover { background: #1e4b42; }
.send-button:disabled { opacity: .45; cursor: default; }
.composer-note { text-align: center; color: #e9fff3; font-size: var(--small); margin-top: 14px; text-shadow: 0 1px 8px #174c4b; }
.lab-panel { position: fixed; z-index: 5; inset: 0 0 0 auto; height: 100dvh; width: min(600px,100vw); padding: 28px; overflow-y: auto; overscroll-behavior: contain; background: #f1f8f3; transform: translateX(100%); transition: transform .3s; box-shadow: -10px 0 80px #063b3a30; scrollbar-width: thin; }
.lab-panel.open { transform: none; }
.lab-panel-header { display: flex; justify-content: space-between; align-items: start; }
.lab-kicker { color: var(--muted); font-size: var(--small); }
.lab-panel h2 { font-size: 28px; font-weight: 500; letter-spacing: -.04em; margin: 6px 0 0; }
.lab-intro, .lab-copy { font-size: var(--body); color: #607a70; line-height: 1.7; }
.lab-intro { margin: 18px 0 24px; }
.lab-tabs { display: flex; gap: 4px; border-bottom: 1px solid #264e4026; padding-bottom: 18px; }
.lab-tabs button { padding: 9px 12px; border: 0; border-radius: 9px; color: #58746a; background: none; font-size: var(--small); }
.lab-tabs button[aria-pressed="true"] { background: #2e6456; color: #fff; }
#lab-content { padding-bottom: 20px; }
#lab-content h3 { font-size: 18px; font-weight: 500; letter-spacing: -.025em; margin: 26px 0 12px; }
.token-stream { display: flex; flex-wrap: wrap; gap: 5px; margin: 20px 0; }
.token-pill { padding: 8px 10px; font-size: var(--small); border: 1px solid #3e6a5333; border-radius: 7px; color: #3b6557; background: #e7f1e9; }
.token-pill.accent { background: #2e6855; border-color: #2e6855; color: #fff; }
.vector-equation { display: grid; gap: 10px; }
.vector-equation>div,.vector-result { display: flex; flex-direction: column; gap: 7px; border-radius: 8px; padding: 14px; background: #e0eee3; }
.vector-equation span,.vector-result span { font-size: var(--small); color: #5c7c69; }
.vector-equation strong,.vector-result strong { font: var(--small)/1.6 var(--mono); color: #255942; }
.vector-equation>b { text-align: center; font-weight: 400; color: #7b9c87; }
.vector-result { background: #d3e8da; }
.math-equation { font: 17px/1.8 var(--sans); text-align: center; color: #325e4a; padding: 22px 0; }
.math-equation small { font-size: var(--small); color: #6c8676; }
.code-block { margin: 20px 0 0; padding: 16px; border-radius: 10px; background: #1c3e34; color: #e0f0e1; font: 12px/1.9 var(--mono); overflow-x: auto; }
.attention-head,.attention-row { display: grid; grid-template-columns: 80px repeat(5,minmax(0,1fr)); gap: 4px; margin-bottom: 4px; }
.attention-head span { font-size: 11px; overflow: hidden; text-overflow: ellipsis; text-align: center; padding: 6px 0; }
.attention-row>button { font-size: 12px; text-align: right; border: 0; background: none; color: #54735e; }
.attention-cell { display: grid; place-items: center; height: 42px; border-radius: 5px; font-size: 12px; background: color-mix(in srgb,#409c74 calc(var(--weight)*100%),#e3eee4); color: #24523d; }
.attention-cell.masked { background: repeating-linear-gradient(135deg,#e5ebe6,#e5ebe6 2px,#edf2ee 2px,#edf2ee 6px); color: #93aa98; }
.attention-row.selected .attention-cell { outline: 1px solid #43845e; outline-offset: -1px; }
.viz-caption { font-size: var(--small); color: var(--muted); margin: 16px 0; line-height: 1.7; }
.layer-stack { display: grid; grid-template-columns: repeat(12,1fr); gap: 4px; margin: 20px 0; }
.layer-stack button { padding: 10px 0; border: 0; border-radius: 5px; background: #deede2; color: #4a7359; font-size: 12px; }
.layer-stack button.active { background: #3e7252; color: #fff; }
.block-flow { display: flex; flex-direction: column; align-items: center; padding: 20px 5px; border: 1px solid #43725233; border-radius: 10px; }
.block-flow span,.block-flow strong { border: 1px solid #527d5130; border-radius: 8px; padding: 10px; background: #e6f0e6; font-size: var(--small); font-weight: 400; }
.block-flow i { padding: 8px; font-size: var(--small); color: #6d926b; }
.temperature { display: flex; justify-content: space-between; margin: 20px 0 12px; }
#temperature { width: 100%; display: block; accent-color: #3b7350; }
.range-labels { display: flex; justify-content: space-between; font-size: var(--small); color: var(--muted); margin: 8px 0 24px; }
.prob-bars { display: grid; gap: 8px; }
.prob-row { display: grid; grid-template-columns: 62px 1fr 48px; gap: 10px; align-items: center; font-size: var(--small); }
.prob-track { height: 10px; background: #dbeadf; border-radius: 5px; overflow: hidden; }
.prob-fill { display: block; height: 100%; background: #68a47a; transition: width .18s; border-radius: inherit; }
.prob-value { text-align: right; }
.sample-button { padding: 10px 16px; border: 0; border-radius: 8px; color: #fff; background: #396b4b; font-size: var(--small); }
#sample-result { min-height: 42px; font-size: var(--small); }
.lab-foot { padding-top: 20px; border-top: 1px solid #264e4026; font-size: var(--small); color: var(--muted); }
.panel-scrim { position: fixed; z-index: 4; inset: 0; background: #07302d30; opacity: 0; pointer-events: none; transition: opacity .3s; }
.panel-scrim.open { opacity: 1; pointer-events: auto; }
.still-water { background: radial-gradient(ellipse at 20% 10%,#80c6ac,transparent),repeating-radial-gradient(ellipse at 65% 45%,#419c94 0px,#208a85 20px,#4aaca1 22px,#278f8b 26px); }
@media(max-width:760px) {
  :root { --display: 28px; }
  .sidebar { position: fixed; z-index: 3; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; width: 242px; }
  .sidebar.collapsed { display: flex; }
  .sidebar.open { transform: none; box-shadow: 12px 0 80px #0537303a; }
  .topbar { padding: 0 16px; gap: 8px; height: 66px; }
  .context-model { display: none; }
  .topbar-actions { gap: 6px; }
  #top-lab { padding: 8px 10px; }
  #top-lab svg { display: none; }
  .conversation { padding: 14px 20px 26px; }
  .conversation:has(.messages:empty) { padding-bottom: 90px; }
  .welcome-block { margin-bottom: 24px; }
  .composer { padding: 16px; }
  .message-bubble { max-width: 90%; }
  .lab-panel { padding: 24px 18px; }
  .lab-tabs button { padding: 9px 10px; }
  .attention-head,.attention-row { grid-template-columns: 66px repeat(5,minmax(0,1fr)); gap: 3px; }
  .attention-head span { font-size: 10px; }.attention-row>button { font-size: 11px; }.attention-cell { font-size: 11px; }
  .token-pill { padding: 7px; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation: none !important; transition: none !important; } }

[hidden] { display: none !important; }
.chat-list { min-height: 0; overflow-y: auto; display: block; scrollbar-width: thin; }
.chat-item { margin-bottom: 3px; }
.message-error { border: 1px solid #bfa67c; }

.lab-foot a { display: block; color: #426b53; margin-top: 10px; }

/* The explainer is a compact model lab: one title, one active stage, one visual. */
.lab-panel { width: min(560px, 100vw); padding: 30px 32px 26px; }
.lab-panel-header { padding-bottom: 20px; border-bottom: 1px solid #264e4026; }
.lab-kicker { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.lab-panel h2 { font-size: 30px; margin-top: 7px; }
.lab-intro { margin: 16px 0 20px; font-size: 13px; color: #658078; }
.lab-tabs { gap: 6px; padding: 0; border-bottom: 0; }
.lab-tabs button { flex: 1; padding: 10px 8px; border: 1px solid #315f4d22; background: #e9f2eb; font-size: 12px; }
.lab-tabs button[aria-pressed="true"] { border-color: #2e6456; background: #2e6456; }
#lab-content { padding-top: 8px; }
#lab-content h3 { font-size: 21px; margin: 26px 0 8px; }
.lab-copy { max-width: 470px; margin: 0; font-size: 13px; line-height: 1.65; }
.token-stream { margin: 18px 0 16px; }
.token-pill { font-size: 12px; padding: 8px 10px; }
.vector-equation { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.vector-equation>b { display: none; }
.vector-equation>div { min-height: 86px; padding: 13px; }
.vector-equation .vector-result { grid-column: 1 / -1; min-height: auto; }
.vector-equation span, .vector-result span { font-size: 11px; }
.vector-equation strong, .vector-result strong { font-size: 12px; }
.math-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; margin-top: 12px; border-radius: 9px; color: #416d56; background: #e0eee3; }
.math-card span { font-size: 11px; color: #6a8773; }
.math-card strong { font-size: 14px; font-weight: 500; }
.math-equation { margin: 16px 0; padding: 14px 16px; border-radius: 9px; color: #39654d; background: #e0eee3; font-size: 16px; }
.attention-grid { margin-top: 16px; }
.attention-cell { height: 39px; }
.code-block { margin-top: 16px; font-size: 11px; line-height: 1.7; }
.viz-caption { margin: 12px 0; font-size: 12px; }
.layer-stack { margin: 16px 0; }
.block-flow { padding: 16px 5px; }
.block-flow span, .block-flow strong { padding: 9px 12px; font-size: 12px; }
.lab-foot { margin-top: 8px; padding-top: 16px; }
@media(max-width:760px) {
  .lab-panel { padding: 22px 18px; }
  .lab-panel h2 { font-size: 27px; }
  .lab-tabs { gap: 3px; }
  .lab-tabs button { padding: 9px 5px; font-size: 11px; }
  .vector-equation { grid-template-columns: 1fr; }
  .vector-equation .vector-result { grid-column: auto; }
  .math-card { align-items: flex-start; flex-direction: column; gap: 6px; }
}
