/* Base: fonts, theme tokens, scrollbars, and the chat conversation */

/* self-hosted JetBrains Mono: the panel's mono face */
@font-face { font-family: "JetBrains Mono"; font-style: normal;
  font-weight: 400; font-display: swap;
  src: url(/static/fonts/jbmono-400.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal;
  font-weight: 700; font-display: swap;
  src: url(/static/fonts/jbmono-700.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal;
  font-weight: 800; font-display: swap;
  src: url(/static/fonts/jbmono-800.woff2) format("woff2"); }
:root {
  /* neutral grey surfaces with no brown tint, warm text, one clay accent */
  --bg: #0c0b0f; --chatbg: #110f14; --panel: #19181e;
  --panel2: #211e27; --border: #2c2933;
  --text: #d4cfde; --dim: #958da9; --dim2: #aca5bc; --faint: #6f6880;
  --box: #1a1722; --boxtext: #d8d4e2;
  --composerbox: #221e2c; --composerborder: #4a4266;
  --accent: #b8a9e6; --accent2: #c0b3e0;
  --green: #4ea774; --red: #e2605b;
  --amber: #e0a640; --flag: #7fa7d6; --radius: 10px;
  --tok-kw: #c678dd; --tok-str: #98c379; --tok-num: #d19a66;
  --tok-com: #768390; --tok-bi: #61afef;
  --hov: rgba(167,139,250,.09); --hodb: rgba(167,139,250,.28);
  --hovt: #a996d8;
}
* { box-sizing: border-box; margin: 0; }
/* one minimal dark scrollbar: a track-less thumb that brightens on hover
   (Firefox via scrollbar-*, Chromium via the webkit pseudos) */
* { scrollbar-width: thin;
  scrollbar-color: rgba(199,183,150,.24) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner {
  background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(163,173,194,.22);
  border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(163,173,194,.4); }
a { color: var(--accent2); text-decoration: underline;
  text-underline-offset: 2px; text-decoration-color: rgba(149,137,240,.4);
  transition: color .12s; }
a:hover { color: #b7adf9; text-decoration-color: rgba(183,173,249,.9); }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 Geist, Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
:focus-visible { outline: 2px solid var(--accent);
  outline-offset: 2px; }
.app { position: relative; height: 100vh; }

.railbtn { position: fixed; z-index: 20; top: 14px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 8px 12px;
  font-size: 13px; cursor: pointer; display: none; }
.railbtn:hover { border-color: var(--hodb); }

/* ---- chat conversation, centered to the whole screen ---- */
.chatcol { position: absolute; inset: 0; display: flex;
  flex-direction: column; background: var(--chatbg);
  /* Geist for the interface, Newsreader for longform, JetBrains Mono for code */
  font-family: Geist, "Inter", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Helvetica, Arial, sans-serif; }
.chathead { padding: 13px 18px; display: flex; align-items: center;
  gap: 12px; position: sticky; top: 0; z-index: 12;
  background: var(--chatbg); transition: box-shadow .2s; }
.chathead.scrolled { box-shadow: 0 8px 14px -12px rgba(0,0,0,.95); }
.chathead .title { font-size: 14px; font-weight: 600; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: left; }
.iconbtn { background: var(--panel); border: 1px solid var(--border);
  color: var(--dim); border-radius: 9px; font-size: 12.5px;
  font-weight: 600; padding: 7px 11px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: border-color .15s, background .15s, color .15s; }
.iconbtn:hover { color: var(--text); border-color: var(--hodb);
  background: var(--panel2); }
.messages { flex: 1; overflow-y: auto; display: flex;
  flex-direction: column; overflow-anchor: none; }
.thread { max-width: 780px; margin: 0 auto; padding: 26px 20px 10px;
  display: flex; flex-direction: column; gap: 24px;
  /* fills the space the week row and course tree leave, so the welcome
     centers in its own zone and the tree stays above the fold */
  flex: 1 0 auto; width: 100%; }
.msg.user { align-self: flex-end; background: var(--box);
  color: var(--boxtext); border: none; border-radius: 18px;
  padding: 10px 16px; font-size: 16px; line-height: 1.5; max-width: 85%;
  white-space: pre-wrap; word-wrap: break-word; }
/* answers read like Claude's app on a phone (measured against it,
   2026-10-30): the interface sans at 15.5px on 23px lines, the same
   x-height, tight paragraphs, bold that reads as bold */
.msg.assistant { align-self: stretch; font-size: 15.5px;
  line-height: 1.5; color: var(--text); font-weight: 430;
  font-family: Geist, Inter, ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; }
.msg.assistant .content strong, .msg.assistant .content b
  { font-weight: 680; color: var(--text); }
.msg.assistant .content p { margin: 0 0 9px; }
.msg.assistant .content p:last-child { margin: 0; }
.msg.assistant .content ul, .msg.assistant .content ol
  { margin: 0 0 9px; padding-left: 1.5em; }
.msg.assistant .content li { margin: 0 0 4px; padding-left: .15em; }
.msg.assistant .content li:last-child { margin-bottom: 0; }
.msg.assistant .content li > ul, .msg.assistant .content li > ol
  { margin: 4px 0 0; }
.msg.assistant .content li::marker { color: var(--text); }
.msg.assistant .content :is(ul, ol):last-child { margin-bottom: 0; }
.msg.assistant .content code { background: var(--panel);
  padding: 1px 5px; border-radius: 5px; font-size: 13px;
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo,
    monospace; }
/* fenced blocks carry a header (language + copy); the code inside resets
   the inline-code pill look */
.msg.assistant .content pre { background: var(--panel);
  border: none; border-radius: 12px;
  padding: 0; overflow: hidden; margin: 0 0 10px; }
.msg.assistant .content pre code { display: block; background: none;
  padding: 12px 14px; border-radius: 0; overflow-x: auto;
  font-size: 13px; }
.chead { display: flex; justify-content: space-between;
  align-items: center; padding: 5px 8px 5px 12px;
  border-bottom: 1px solid var(--border); font-size: 11px;
  color: var(--dim); font-weight: 600; }
.chead .ccopy { background: none; border: none; color: var(--dim);
  font-size: 11px; font-weight: 600; cursor: pointer; padding: 2px 8px;
  border-radius: 6px; font-family: inherit; }
.chead .ccopy:hover { color: var(--text); background: var(--panel2); }
.msg.assistant .content h1, .msg.assistant .content h2,
.msg.assistant .content h3 { font-size: 16.5px; font-weight: 680;
  line-height: 1.35; margin: 16px 0 6px;
  background: none; color: var(--text); filter: none;
  -webkit-background-clip: initial; background-clip: initial; }
.msg.assistant .content a { color: var(--accent);
  text-decoration: underline; text-decoration-color: color-mix(
  in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 2px; }
.msg.assistant .content p { text-wrap: pretty; }
/* chrome inside an answer stays sans even though the prose is serif */
.msg.assistant .content :is(h1, h2, h3):first-child { margin-top: 0; }
.msg.assistant .content blockquote { margin: 0 0 9px;
  padding: 2px 0 2px 14px; border-left: 3px solid var(--border);
  color: var(--dim); }
.msg.assistant .content hr { border: 0; border-top: 1px solid
  var(--border); margin: 20px 0; }
.msg.assistant .content table { display: block; overflow-x: auto;
  border-collapse: collapse; margin: 4px 0 10px; }
.msg.assistant .content th, .msg.assistant .content td
  { border: 1px solid var(--border); padding: 4px 9px;
    font-size: 13px; text-align: left; }
.lv .md table { display: block; overflow-x: auto;
  border-collapse: collapse; margin: 4px 0 10px; }
.lv .md th, .lv .md td { border: 1px solid var(--border);
  padding: 4px 9px; font-size: 13px; text-align: left; }

/* the model's thinking: streams open, folds when the answer starts, tap
   to reopen. Muted on purpose: a dim line, not a box */
.think { margin: 0 0 4px; }
.think.hidden { display: none; }
.thinkhead { display: flex; align-items: center; gap: 7px; width: 100%;
  padding: 2px 0; background: none; border: none; color: var(--dim);
  font-size: 13px; cursor: pointer; text-align: left;
  font-family: inherit; }
.thinkhead:hover { color: var(--text); }
.thinkhead .chev { display: inline-block; font-size: 10px;
  transition: transform .15s; }
.think.open .thinkhead .chev { transform: rotate(90deg); }
.thinkbody { display: none; padding: 2px 0 8px; font-size: 12.5px;
  line-height: 1.55; color: var(--dim); white-space: pre-wrap;
  max-height: 240px; overflow-y: auto; }
.think.open .thinkbody { display: block; }
.thinkcopy { margin-left: auto; flex-shrink: 0; border: none;
  background: none; color: var(--dim); font-size: 11px;
  cursor: pointer; padding: 2px 6px; border-radius: 6px;
  font-family: inherit; }
.thinkcopy:hover { color: var(--text);
  background: rgba(255,255,255,.05); }
/* live header while thinking: spinner plus a rotating fragment of the
   reasoning (or a quote while it warms up) */
.thinklive { flex: 1; min-width: 0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; font-weight: 400;
  font-style: italic; opacity: .85; transition: opacity .25s; }
.thinkspin { flex: none; margin-left: auto; width: 10px; height: 10px;
  border: 2px solid var(--dim); border-top-color: var(--accent);
  border-radius: 50%; animation: thinkspin .9s linear infinite; }
@keyframes thinkspin { to { transform: rotate(360deg); } }
.think.done .thinkspin, .think.done .thinklive { display: none; }
/* no streaming caret: the thinking spinner owns the "working" signal */
/* newly typed characters fade in instead of popping */
.mblock { contain: layout style; }
.mtail { contain: layout style; }
.charfade { animation: charfade .3s ease-out; }
@keyframes charfade { from { opacity: 0; } }

/* files fed to the model this turn: one single-line strip with horizontal
   scroll, so the row stays one pill tall for any file count */
.srcbar { display: flex; flex-wrap: nowrap; gap: 6px;
  margin-bottom: 7px; overflow-x: auto; scrollbar-width: none; }
.srcbar::-webkit-scrollbar { display: none; }
.srcpill { display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 9px; font-size: 12px;
  color: var(--text); cursor: pointer; font-family: inherit;
  white-space: nowrap; flex-shrink: 0; max-width: 78%;
  overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.srcpill:hover { border-color: var(--hodb); color: var(--hovt); }

/* ghost pills claim a pill's exact height without painting */
.srcpill.ghost { visibility: hidden; }

/* the strip fades in once the files are known */
.srcbar.filled .srcpill { animation: pillin .32s ease both; }
@keyframes pillin {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: none; }
}

/* actions under an assistant message: copy always, regenerate on the
   thread's last answer; dim until hover */
.msgactions { display: flex; gap: 4px; margin-top: 8px; opacity: .55;
  transition: opacity .15s; }
.msg.assistant:hover .msgactions,
.msg.assistant:focus-within .msgactions { opacity: 1; }
@media (hover: none) { .msgactions { opacity: .55; } }
.msgactions .act { background: none; border: none; color: var(--dim);
  font-size: 15px; font-weight: 500; padding: 3px 8px;
  border-radius: 6px; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 4px; }
.msgactions .act:hover { color: var(--text); background: var(--panel2); }
.msgactions .act.hidden { display: none; }

/* a failed turn reads as one calm row with a retry, not a stack trace */
.chatfail { display: flex; align-items: center; gap: 10px;
  color: var(--dim); font-size: 13.5px; }
.chatfail .retry { background: var(--panel2); border: 1px solid
  var(--border); color: var(--text); font-size: 12.5px; font-weight: 600;
  border-radius: 8px; padding: 4px 12px; cursor: pointer;
  font-family: inherit; }
.chatfail .retry:hover { border-color: var(--hodb);
  color: var(--hovt); }

/* the jump to latest button: a small round arrow centred just above the
   composer (inside .inputwrap), so it never covers the thread's middle */
.jumpwrap { position: absolute; left: 0; right: 0; bottom: 100%;
  display: flex; justify-content: center; margin-bottom: 8px;
  pointer-events: none; z-index: 4; }
#jumpbtn { pointer-events: auto; width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel2); border: 1px solid var(--border);
  color: var(--text); border-radius: 50%; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.3);
  transition: border-color .15s, color .15s; }
#jumpbtn:hover { border-color: var(--hodb); color: var(--hovt); }
#jumpbtn.hidden { display: none; }

/* the file input itself never shows: the ＋ opens it */
#filepicker { display: none; }

.hello { color: var(--dim); font-size: 13.5px; text-align: center;
  margin: auto; max-width: 460px; }
/* the recharge card: calm, violet, one countdown */
.chatlock { padding: 30px 20px; }
.lockbig { font-size: 16px; font-weight: 650; color: var(--text);
  margin-bottom: 10px; }
.lockcount { font-size: 26px; font-weight: 700;
  color: var(--accent2); font-variant-numeric: tabular-nums;
  letter-spacing: .02em; margin-bottom: 8px; }
.locksub { font-size: 11.5px; color: var(--dim); }
.chips { display: flex; flex-direction: column; gap: 6px; max-width: 780px;
  width: 100%; margin: 0 auto; padding: 0 20px 10px; }

/* boot: the server didn't answer the key check; the key stays, it retries */
.bootwait { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 80; padding: 10px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border);
  color: var(--dim2); font: 500 13px/1.3 Geist, Inter, system-ui, sans-serif; white-space: nowrap; }

/* opened with no network (boot.js): a quiet note at the bottom, then gone */
.offlinechip { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); z-index: 90; padding: 10px 16px; border-radius: 12px;
  background: var(--panel2); border: 1px solid var(--border); color: var(--dim);
  font-size: 13px; white-space: nowrap; transition: opacity .6s; }
.offlinechip.fade { opacity: 0; pointer-events: none; }
