/* SkyMind answer surface
 * Load after skymind.css. Uses the existing token set and adds only what the
 * streaming answer needs, plus the reading-measure and focus-ring fixes.
 */

:root {
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --measure: 68ch;
  --read-size: 16.5px;
  --read-lead: 1.68;
  --focus: 0 0 0 2px var(--panel), 0 0 0 4px var(--brand);
  --ease: cubic-bezier(.32, .72, 0, 1);
}

/* ------------------------------------------------------------ focus ring */
/* The original stylesheet has no :focus-visible rule anywhere, so keyboard
   users get nothing on custom buttons. One token, applied once. */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 8px;
}

/* -------------------------------------------------------- reading measure */

.answer-body {
  max-width: var(--measure);
  font-size: var(--read-size);
  line-height: var(--read-lead);
  letter-spacing: -.003em;
  text-wrap: pretty;
}

.answer-body > * + * { margin-top: 1.05em; }
.answer-body > * + :is(h1, h2, h3) { margin-top: 1.9em; }
.answer-body :is(h1, h2, h3) + * { margin-top: .6em; }

.answer-body :is(h1, h2, h3) {
  line-height: 1.25;
  letter-spacing: -.022em;
  font-weight: 640;
  text-wrap: balance;
}
.answer-body h1 { font-size: 1.5em; }
.answer-body h2 { font-size: 1.24em; }
.answer-body h3 { font-size: 1.06em; }

.answer-body :is(ul, ol) { padding-left: 1.35em; }
.answer-body li + li { margin-top: .32em; }
.answer-body li > :is(ul, ol) { margin-top: .32em; }
.answer-body ul.loose li + li,
.answer-body ol.loose li + li { margin-top: .7em; }
.answer-body li::marker { color: var(--muted); }

.answer-body blockquote {
  border-left: 2px solid var(--line);
  padding-left: 1em;
  color: var(--muted);
}

.answer-body hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

.answer-body :not(pre) > code {
  font-family: var(--mono);
  font-size: .885em;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .1em .34em;
}

.answer-body img { max-width: 100%; height: auto; border-radius: 12px; }

/* --------------------------------------------------------------- caret */

.stream-caret {
  display: inline-block;
  width: .5em;
  height: 1.05em;
  margin-left: .08em;
  vertical-align: -.16em;
  border-radius: 2px;
  background: var(--brand);
  animation: caret-pulse 1.1s var(--ease) infinite;
}

@keyframes caret-pulse {
  0%, 42% { opacity: 1; }
  62%, 100% { opacity: .18; }
}

.answer-body.streaming { min-height: 2.2em; }

/* The status line reports a real backend stage. It is removed on completion
   rather than left behind as decoration. */
.stream-status {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 12px;
}
.stream-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand);
  animation: caret-pulse 1.4s var(--ease) infinite;
}

/* ----------------------------------------------------------- code shell */

.code-shell {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel2);
}
.code-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px 7px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.code-lang {
  flex: 1;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.code-tool {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.code-tool:hover { background: var(--panel2); color: var(--text); }

.code-shell pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
}
.code-shell.wrap pre { white-space: pre-wrap; word-break: break-word; }
.code-shell.expanded {
  position: fixed;
  inset: 4vh 4vw;
  z-index: 90;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.code-shell.expanded pre { flex: 1; }
body.code-expanded { overflow: hidden; }

/* An unclosed fence is still arriving. Marked, not hidden. */
.code-shell.open .code-lang::after {
  content: ' · writing';
  color: var(--brand);
}

/* -------------------------------------------------------------- tables */

.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.table-scroll table { border-collapse: collapse; width: 100%; font-size: 14px; }
.table-scroll :is(th, td) { padding: 9px 13px; border-bottom: 1px solid var(--line); text-align: left; }
.table-scroll th { background: var(--panel2); font-weight: 620; font-size: 12.5px; color: var(--muted); }
.table-scroll tr:last-child td { border-bottom: 0; }

/* ----------------------------------------------------------- citations */

.citation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  margin: 0 1px;
  vertical-align: .1em;
  border: 0;
  border-radius: 5px;
  background: var(--brandSoft);
  color: var(--brand);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s var(--ease);
}
.citation:hover { background: var(--brand); color: #fff; }

.source-card.flash { animation: source-flash .55s var(--ease); }
@keyframes source-flash {
  0% { box-shadow: 0 0 0 0 var(--brand); }
  100% { box-shadow: 0 0 0 6px transparent; }
}

/* Sources land during the stream, not after it. */
.source-card.arriving { animation: source-arrive .34s var(--ease) both; }
@keyframes source-arrive {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .stream-caret, .stream-status-dot { animation: none; opacity: 1; }
  .source-card.arriving, .source-card.flash { animation: none; }
  * { transition-duration: .01ms !important; }
}

/* SkyMind Ultra 1.7 — Frontier Studio adaptive answer cards */
.studio-answer-summary{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:14px;align-items:center;margin:14px 0;padding:16px;border:1px solid var(--line);border-radius:20px;background:linear-gradient(145deg,color-mix(in srgb,var(--brand) 12%,var(--panel)),var(--panel))}.studio-answer-mark{width:48px;height:48px;border-radius:15px;display:grid;place-items:center;background:var(--brandSoft);color:var(--brand);font-size:20px}.studio-answer-summary span,.studio-answer-release span,.studio-answer-test span{font-size:8px;text-transform:uppercase;letter-spacing:.09em;color:var(--brand)}.studio-answer-summary h3,.studio-answer-release h3{margin:4px 0;font-size:17px}.studio-answer-summary p{margin:0;color:var(--muted);font-size:10px;line-height:1.55}.studio-answer-stats{text-align:right}.studio-answer-stats b{display:block;font:800 24px var(--mono)}.studio-answer-stats span,.studio-answer-stats small{display:block;color:var(--muted);font-size:8px}.studio-answer-manifest{margin:12px 0;padding:14px;border:1px solid var(--line);border-radius:18px;background:var(--panel)}.studio-answer-files{display:flex;flex-wrap:wrap;gap:6px}.studio-answer-files code{max-width:100%;overflow:hidden;text-overflow:ellipsis;border:1px solid var(--line);background:var(--panel2);border-radius:999px;padding:6px 9px;font-size:8px}.studio-answer-manifest>small{display:block;margin-top:10px;color:var(--muted);font-size:8px}.studio-answer-test{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:12px 0;padding:14px;border:1px solid var(--line);border-radius:18px;background:var(--panel)}.studio-answer-test.status-failed{border-color:color-mix(in srgb,var(--red) 35%,var(--line))}.studio-answer-test.status-warning{border-color:color-mix(in srgb,var(--amber) 35%,var(--line))}.studio-answer-test strong{display:block;margin-top:3px;font:800 24px var(--mono)}.studio-answer-test strong small{font-size:9px;color:var(--muted)}.studio-answer-test p{font-size:9px;color:var(--muted)}.studio-answer-release{display:flex;align-items:center;justify-content:space-between;gap:14px;margin:12px 0;padding:15px;border:1px solid var(--line);border-radius:18px;background:var(--panel)}.studio-answer-release code{display:block;color:var(--muted);font-size:8px;word-break:break-all}.studio-answer-release>div:last-child{display:flex;gap:7px;flex-wrap:wrap}.studio-answer-release a{border:1px solid color-mix(in srgb,var(--brand) 30%,var(--line));background:var(--brandSoft);color:var(--brand);border-radius:10px;padding:8px 10px;font-size:8px;font-weight:850;white-space:nowrap}
@media(max-width:620px){.studio-answer-summary{grid-template-columns:auto minmax(0,1fr)}.studio-answer-stats{grid-column:1/-1;text-align:left;display:flex;align-items:baseline;gap:7px}.studio-answer-release,.studio-answer-test{align-items:flex-start;flex-direction:column}}
/* SkyMind Ultra 1.8 Cognitive Network answer card */
.cognitive-answer-card{border:1px solid var(--line);background:radial-gradient(circle at 8% 0,color-mix(in srgb,var(--brand) 18%,transparent),transparent 42%),var(--panel);border-radius:22px;padding:16px;margin:12px 0}.cognitive-answer-head{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px}.cognitive-answer-orb{width:44px;height:44px;border-radius:15px;display:grid;place-items:center;color:#fff;background:linear-gradient(145deg,var(--brand),#26bca0);box-shadow:0 12px 28px color-mix(in srgb,var(--brand) 28%,transparent)}.cognitive-answer-head span,.cognitive-answer-plan span{display:block;color:var(--brand);font-size:8px;text-transform:uppercase;letter-spacing:.09em;font-weight:850}.cognitive-answer-head h3{font-size:15px;margin:3px 0}.cognitive-answer-head p{font-size:9px;color:var(--muted);margin:0}.cognitive-answer-head button{border:1px solid color-mix(in srgb,var(--brand) 28%,var(--line));background:var(--brandSoft);color:var(--brand);border-radius:10px;padding:8px 10px;font-size:8px;font-weight:850;cursor:pointer}.cognitive-answer-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:7px;margin-top:12px}.cognitive-answer-stats>div{border:1px solid var(--line);background:var(--panel2);border-radius:11px;padding:9px}.cognitive-answer-stats strong{font:800 14px var(--mono)}.cognitive-answer-stats span{display:block;color:var(--muted);font-size:7px;text-transform:uppercase;margin-top:3px}.cognitive-answer-notice,.cognitive-answer-plan{display:flex;align-items:center;gap:9px;border-top:1px solid var(--line);padding-top:10px;margin-top:10px}.cognitive-answer-notice b{border-radius:999px;background:color-mix(in srgb,var(--amber) 15%,transparent);color:var(--amber);padding:4px 7px;font-size:7px;text-transform:uppercase}.cognitive-answer-notice span,.cognitive-answer-plan strong{font-size:9px}.cognitive-answer-plan{display:grid;grid-template-columns:auto minmax(0,1fr) auto}.cognitive-answer-plan small{font-size:7px;color:var(--muted)}.cognitive-answer-events{display:grid;gap:5px;margin-top:10px}.cognitive-answer-events>div{display:grid;grid-template-columns:auto minmax(0,1fr);gap:7px;font-size:8px}.cognitive-answer-events b{color:var(--brand)}.cognitive-answer-events span{color:var(--muted)}@media(max-width:620px){.cognitive-answer-head{grid-template-columns:auto minmax(0,1fr)}.cognitive-answer-head button{grid-column:1/-1}.cognitive-answer-stats{grid-template-columns:repeat(2,1fr)}}

/* SkyMind 1.9 project mini-app actions */
.studio-answer-actions{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:7px;padding-top:3px}.studio-answer-actions button{border:1px solid color-mix(in srgb,var(--brand) 28%,var(--line));background:var(--brandSoft);color:var(--brand);border-radius:10px;padding:8px 10px;font-size:8px;font-weight:850;cursor:pointer}.studio-answer-actions button:first-child{border-color:var(--brand);background:var(--brand);color:#fff}.studio-answer-actions button:hover{filter:brightness(.97);transform:translateY(-1px)}
