/* resolve oracle — body elements on the apex/sportshome design system (chrome.css tokens).
   Chrome (.bar/.ticker/.menu/.foot/.wordmark/.btn/.container) is sportshome verbatim; these
   oracle-* classes are the ask→answer UI, prefixed so nothing collides with the chrome. */

:root {
  --oracle: #6E45B0;   /* CTA purple — the hex "oracle" uses elsewhere on the site */
  /* de-purple the Oracle boxes to the apex charcoal scheme (were saturated purples
     #2F2247 / #3B2C55 — now neutral charcoal in the --bg #1E1A22 family) */
  --inset: #2A2530;
  --line: #38333F;
  --line-soft: #262029;
  --line-dashed: #423B4A;
}

.oracle {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  padding: 72px 0 96px;
}
.oracle .wordmark { font-size: clamp(44px, 8vw, 80px); }
.oracle-tagline {
  color: var(--text-2);
  font-size: clamp(18px, 2vw, 21px);
  margin: 26px 0 42px;
}

/* ── side-runner example prompts: angled + glowing, different heights L vs R.
   Click fills the ask box. Hidden when the viewport is too narrow to hold them. */
.runner {
  position: fixed;
  z-index: 1;
  max-width: 380px;
  font-family: var(--sans);
  font-size: clamp(24px, 2.9vw, 36px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
  text-decoration: none;
  cursor: pointer;
  opacity: .92;
  transition: opacity .2s, filter .2s, transform .2s;
}
.runner:hover { opacity: 1; filter: brightness(1.18); }
.runner-left {
  left: calc((100vw - 860px) / 4); top: 44%;   /* centered in the gutter: equidistant from screen edge & chat box */
  transform: rotate(-45deg);
  transform-origin: left center;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(194, 199, 183, .45), 0 0 6px rgba(194, 199, 183, .55);
}
.runner-left:hover { transform: rotate(-45deg) scale(1.04); }
.runner-right {
  right: calc((100vw - 860px) / 4); top: 57.5%;
  transform: rotate(45deg);
  transform-origin: right center;
  text-align: right;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(194, 199, 183, .45), 0 0 6px rgba(194, 199, 183, .55);
}
.runner-right:hover { transform: rotate(45deg) scale(1.04); }
@media (max-width: 1200px) { .runner { display: none; } }

/* ── runner background videos: mirror the detector's side-strip treatment
   (fixed 20vw strips, fade-masked edges, right one mirrored). Opacity 60% per spec
   (detector uses 0.4). Text + all content sit above (z-index below). ── */
.oracle-runner {
  position: fixed;
  top: 0;
  height: 100vh;
  width: 26vw;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  display: block;
  pointer-events: none;
  opacity: 0.4;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%);
          mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%);
}
.oracle-runner.left  { left: 0; }
.oracle-runner.right { right: 0; transform: scaleX(-1); }
@media (max-width: 1100px) { .oracle-runner { display: none; } }
/* keep all real content (and the angled text runners) above the videos */
main, .foot { position: relative; z-index: 1; }
.ticker { position: relative; z-index: 2; }

/* ── ask box ── */
.oracle-ask {
  display: flex;
  gap: 10px;
  text-align: left;
}
.oracle-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  padding: 14px 16px;
  transition: border-color .15s, box-shadow .15s;
}
.oracle-input::placeholder { color: var(--text-3); }
.oracle-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(194, 199, 183, .18);
}
.oracle-ask .btn.primary { padding: 13px 22px; }

/* ── the 7.5-million-year progress bar (plays on every ask) ── */
.oracle-compute { margin: 64px auto 0; }
.oracle-compute-label {
  font-family: var(--mono);
  letter-spacing: .42em;
  font-size: 13px;
  color: var(--accent);
  opacity: .85;
  margin-bottom: 18px;
}
.oracle-bar {
  height: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.oracle-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cta-bg), var(--accent));
  box-shadow: 0 0 12px rgba(194, 199, 183, .45);
}
.oracle-years {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ── the answer ── */
.oracle-answer {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px 30px;
  margin-top: 32px;
}
.oracle-answer-q {
  color: var(--text-2);
  font-size: 14px;
  border-bottom: 1px dashed var(--line-dashed);
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.oracle-answer-q::before { content: "Q  "; color: var(--accent); font-weight: 600; }
.oracle-answer-body { color: var(--text); line-height: 1.62; text-align: left; }   /* B6/B1: body reads left, not inherited-center */
.oracle-answer-body h1, .oracle-answer-body h2, .oracle-answer-body h3 {
  color: var(--accent); letter-spacing: -.01em; margin: 1.1em 0 .5em; line-height: 1.2;
}
.oracle-answer-body h1 { font-size: 24px; }
.oracle-answer-body h2 { font-size: 20px; }
.oracle-answer-body h3 { font-size: 17px; }
.oracle-answer-body p { margin: .7em 0; }
.oracle-answer-body table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 14px; }
.oracle-answer-body th, .oracle-answer-body td { border: 1px solid var(--line); padding: 7px 11px; text-align: left; }
.oracle-answer-body th { color: var(--accent); font-weight: 600; }
.oracle-answer-body code { font-family: var(--mono); background: var(--inset); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.oracle-answer-body blockquote { border-left: 3px solid var(--accent); margin: 12px 0; padding: 2px 16px; color: var(--text-2); }
.oracle-answer-body ul, .oracle-answer-body ol { margin: .5em 0; padding-left: 1.3em; }
.oracle-answer-body li { margin: .25em 0; }

/* ── chat window (a real chat: scrollable log + pinned composer) ── */
.oracle-chat {
  display: flex; flex-direction: column;
  height: min(88vh, 940px);
  max-width: 860px; margin: 18px auto;
  padding: 0;                       /* kill the hero layout's 72/96 padding that black-gapped
                                       the top of the header and the bottom of the box */
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.oracle-chat-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--inset);
}
.oracle-chat-head .wordmark { font-size: 20px; margin: 0; }
.oracle-newthread {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  color: var(--text-3); background: transparent; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.oracle-newthread:hover { color: var(--accent); border-color: var(--accent); }

.oracle-chat-log {
  flex: 1 1 auto; overflow-y: auto; padding: 22px 22px 8px;
  display: flex; flex-direction: column; gap: 18px;
}
.oracle-chat-empty { margin: auto; text-align: center; color: var(--text-3); }
.oracle-chat-empty .oracle-tagline { margin: 0; }

/* messages */
.msg { max-width: 88%; display: flex; flex-direction: column; gap: 6px; }
.msg-label { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--text-3); }
.msg-you { align-self: flex-end; align-items: flex-end; }
.msg-you .msg-text {
  background: var(--accent); color: var(--bg, #14121a);
  padding: 10px 15px; border-radius: 14px 14px 4px 14px; line-height: 1.5;
}
.msg-oracle { align-self: flex-start; width: 88%; }
.msg-oracle .oracle-answer-body {
  background: var(--inset); border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px; padding: 16px 18px;
}
.msg-oracle .oracle-sources { margin-top: 14px; }
.msg.pending .oracle-compute { margin: 0; }
.msg.pending .oracle-answer-body { padding: 14px 18px; }

/* citation footnotes (superscript refs in body + numbered list at bottom) */
.fn-ref {
  font-size: .68em; font-weight: 700; color: var(--accent);
  padding: 0 1px; vertical-align: super; line-height: 0;
}
.oracle-footnotes-wrap { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.oracle-footnotes {
  margin: 10px 0 0; padding-left: 1.5em;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2); line-height: 1.5;
}
.oracle-footnotes li { margin: 5px 0; padding-left: 4px; }
.oracle-footnotes li::marker { color: var(--accent); }
.oracle-footnotes a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.oracle-footnotes a:hover { color: var(--accent); }
.fn-sport { color: var(--text-3); font-size: .85em; letter-spacing: .06em; }

/* per-conversation cost warning */
.msg-warn {
  align-self: center; max-width: 92%; text-align: center;
  font-family: var(--mono); font-size: 12px; letter-spacing: .02em;
  color: #e0a23b; background: rgba(224, 162, 59, .10);
  border: 1px solid rgba(224, 162, 59, .45); border-radius: 10px;
  padding: 8px 16px; display: inline-flex; align-items: center; gap: 7px;
}

/* composer pinned to the bottom */
.oracle-composer {
  flex: 0 0 auto; display: flex; gap: 10px; align-items: center;
  padding: 14px 16px; border-top: 1px solid var(--line); background: var(--inset);
}
.oracle-composer-input {
  flex: 1 1 auto; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 12px 18px; font-size: 15px; outline: none;
}
.oracle-composer-input:focus { border-color: var(--accent); }
.oracle-send {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--accent); color: var(--bg, #14121a); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
  transition: filter .15s;
}
.oracle-send:hover { filter: brightness(1.1); }
.oracle-send:disabled { opacity: .5; cursor: default; }

/* ── sources (citations) ── */
.oracle-sources { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.sources-title { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--text-3); margin-bottom: 12px; }
.source-row { display: flex; align-items: baseline; gap: 10px; font-family: var(--mono); font-size: 13px; color: var(--text-2); padding: 3px 0; }
.src-ref { color: var(--accent); font-weight: 600; min-width: 36px; }
.src-sport { margin-left: auto; font-size: 11px; letter-spacing: .06em; color: var(--text-3); border: 1px solid var(--line); padding: 1px 7px; border-radius: 999px; }
.src-note { color: var(--text-3); font-size: 12px; margin-top: 12px; font-style: italic; }
.answer-error { color: var(--danger-text, #d49696); }

@media (max-width: 620px) {
  .oracle { padding: 44px 0 64px; }
  .oracle-ask { flex-direction: column; }
  .oracle-ask .btn.primary { justify-content: center; }
  .oracle-answer { padding: 20px 18px; }
  /* chat window fills the phone screen (composer pinned to the bottom edge), instead of a
     fixed 74vh box that left dead space below the composer. 100dvh tracks the mobile
     browser bar/keyboard; the ~112px offset clears the sticky chrome (ticker + bar). */
  .oracle.oracle-chat {
    height: calc(100dvh - 112px);
    max-width: 100%;
    margin: 0;
    padding: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
  .oracle-chat-log { padding: 16px 14px 6px; }
  .oracle-composer { padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
}

/* ── auth state ──────────────────────────────────────────────────
   The oracle went public 2026-08-02. The page previously had NO logged-in
   state at all — a hardcoded "log in" link that said "log in" forever, which
   is why a signed-in user still looked signed out. The server stamps
   data-auth="in"/"out" on <body> and these two rules pick the right nav and
   the right centre block. Server-rendered, so the live composer never flashes
   in front of an anonymous visitor. */
body[data-auth="out"] [data-auth-in] { display: none !important; }
body[data-auth="in"]  [data-auth-out] { display: none !important; }
/* Before the server marks the page (local dev / direct file open), show the
   signed-out chrome — the safe default is "you are not signed in". */
body:not([data-auth]) [data-auth-in] { display: none !important; }

/* signed-out: composer and its affordances go away entirely */
body[data-auth="out"] .oracle-composer,
body[data-auth="out"] #new-thread,
body[data-auth="out"] #chat-empty { display: none; }
body[data-auth="out"] .runner { pointer-events: none; }

/* Reuses .oracle-tagline above it for the headline, so type + spacing stay
   canon; only the supporting paragraph and CTA are new. */
.oracle-locked-body {
  color: var(--text-2); font-size: 15px; line-height: 1.65;
  margin: 0 auto 30px; max-width: 52ch;
}
.oracle-locked-cta { text-decoration: none; }
.oracle-locked-note { color: var(--text-3); font-size: 12.5px; margin: 20px 0 0; }
.oracle-locked-note a { color: var(--text-2); }
