/* AI assistant chat: the same look as the assistant demo on the home page, with the
   HashOps icosahedron as the assistant's "brain" (assets/brain.js). */
#market-assistant .mk-as-wrap { grid-template-columns: 240px minmax(0, 1fr); gap: 16px; min-height: 560px; }
#market-assistant .mk-as-side { background: rgba(255,255,255,.015); border-color: rgba(255,255,255,.07); padding: 10px; }
#market-assistant .mk-as-conv { border-radius: 10px; }
#market-assistant .mk-as-conv.active { background: rgba(78,225,255,.07); box-shadow: inset 2px 0 0 var(--cyan, #4ee1ff); }

#market-assistant .mk-as-main {
  position: relative; border: 1px solid rgba(255,255,255,.07); border-radius: var(--radius, 22px); overflow: hidden;
  background: radial-gradient(120% 70% at 50% 0%, rgba(78,225,255,.06), transparent 60%), linear-gradient(180deg, rgba(17,19,24,.92), rgba(10,11,14,.96));
  padding: 0 14px 14px;
}
#market-assistant .mk-as-main::before { content: ""; position: absolute; left: 24px; right: 24px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(78,225,255,.5), transparent); }

/* header with the brain */
.as-head { display: flex; align-items: center; gap: 14px; padding: 14px 4px 12px; border-bottom: 1px solid rgba(255,255,255,.06); transition: padding .35s ease; }
.as-brain { position: relative; flex: none; width: 62px; aspect-ratio: 1; border-radius: 50%; transition: width .45s cubic-bezier(.2,.8,.2,1); }
.as-brain::before { content: ""; position: absolute; inset: -14%; border-radius: 50%; background: radial-gradient(circle, rgba(78,225,255,.20), transparent 62%); opacity: .55; transition: opacity .4s, background .4s; pointer-events: none; }
.as-brain[data-state="thinking"]::before { opacity: 1; background: radial-gradient(circle, rgba(124,108,245,.32), rgba(78,225,255,.12) 45%, transparent 66%); animation: asGlow 1.6s ease-in-out infinite; }
.as-brain[data-state="answer"]::before { opacity: 1; background: radial-gradient(circle, rgba(105,230,166,.30), transparent 62%); }
.as-brain[data-state="error"]::before { opacity: 1; background: radial-gradient(circle, rgba(244,184,96,.30), transparent 62%); }
.as-brain .brain-canvas, .as-brain .brain-still { position: relative; display: block; width: 100% !important; height: 100% !important; }
.brain-still .b-edge { stroke: var(--cyan, #4ee1ff); } .brain-still .b-shell { stroke: rgba(124,108,245,.6); }
.as-brain[data-state="thinking"] .brain-still .b-edge { stroke: var(--violet, #7c6cf5); }
.as-brain[data-state="answer"] .brain-still .b-edge { stroke: var(--green, #69e6a6); }
.as-brain[data-state="error"] .brain-still .b-edge { stroke: var(--amber, #f4b860); }
@keyframes asGlow { 0%, 100% { transform: scale(.94); } 50% { transform: scale(1.06); } }
.as-head-txt { min-width: 0; }
.as-name { color: var(--cyan, #4ee1ff); font: 500 10px var(--mono, monospace); letter-spacing: .16em; text-transform: uppercase; }
.as-name::before { content: "✦ "; }
.as-state { margin-top: 4px; color: var(--muted, #959da8); font-size: 13px; }
.as-brain[data-state="thinking"] + .as-head-txt .as-state { color: #d6dce2; }

/* empty conversation: the brain big and centred, with suggestions */
.mk-as-main.is-empty .as-head { flex-direction: column; text-align: center; gap: 10px; padding: 34px 4px 6px; border-bottom: 0; }
.mk-as-main.is-empty .as-brain { width: 150px; }
.as-hello { max-width: 560px; margin: 0 auto; padding: 4px 8px 18px; text-align: center; }
.as-hello h3 { margin: 6px 0 8px; font-size: clamp(20px, 2.4vw, 26px); letter-spacing: -.03em; line-height: 1.15; color: #fff; }
.as-hello p { margin: 0 auto; max-width: 470px; color: var(--muted, #959da8); font-size: 14px; line-height: 1.6; }
.as-asks { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }
.as-ask { padding: 9px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.02); color: #c3c9d0; font: 500 13px var(--sans, Inter, sans-serif); cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.as-ask:hover, .as-ask:focus-visible { border-color: rgba(78,225,255,.45); color: var(--cyan, #4ee1ff); background: rgba(78,225,255,.05); outline: none; }

/* the conversation */
#market-assistant .mk-as-chat { border: 0; border-radius: 0; background: transparent; padding: 16px 4px; min-height: 340px; max-height: 560px; display: flex; flex-direction: column; gap: 14px; }
.mk-as-main.is-empty .mk-as-chat { min-height: 0; }
.as-msg { display: flex; }
.as-msg.user { justify-content: flex-end; }
.as-bubble { max-width: min(80%, 620px); padding: 11px 15px; border-radius: 16px 16px 5px 16px; background: #dffbff; color: #051114; font-size: 14px; font-weight: 500; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 0 30px rgba(78,225,255,.08); }
.as-card { max-width: min(92%, 760px); padding: 14px 18px 12px; border-radius: 16px 16px 16px 5px; background: #0b0d11; border: 1px solid rgba(255,255,255,.07); color: #d6dce2; font-size: 14px; line-height: 1.62; overflow-wrap: anywhere; animation: asIn .35s ease both; }
.as-card.quick { border-style: dashed; }
@keyframes asIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.as-who { margin-bottom: 8px; color: var(--cyan, #4ee1ff); font: 500 9.5px var(--mono, monospace); letter-spacing: .14em; text-transform: uppercase; }
.as-who::before { content: "✦ "; }
.as-md > :first-child { margin-top: 0; } .as-md > :last-child { margin-bottom: 0; }
.as-md p { margin: 0 0 10px; }
.as-md b { color: #fff; font-weight: 600; }
.as-md i { color: #e7ebef; }
.as-md code { padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.06); font: 500 12px var(--mono, monospace); color: #fff; }
.as-up { color: var(--green, #69e6a6); } .as-dn { color: var(--red, #ff6b6b); }
.as-md b .as-up, .as-md b .as-dn { font-weight: 600; }
.as-h { margin: 14px 0 6px; color: #fff; font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; }
.as-kv { width: 100%; margin: 6px 0 10px; border-collapse: collapse; font: 500 12px var(--mono, monospace); }
.as-kv td { padding: 7px 0; border-top: 1px solid rgba(255,255,255,.06); color: #aeb5be; vertical-align: top; }
.as-kv tr:first-child td { border-top: 0; }
.as-kv td:last-child { text-align: right; color: #fff; padding-left: 14px; }
.as-kv b { font-weight: 600; }
.as-tbl-wrap { overflow-x: auto; margin: 6px 0 10px; }
.as-tbl { width: 100%; border-collapse: collapse; font: 500 12px var(--mono, monospace); }
.as-tbl th { padding: 6px 10px 6px 0; text-align: left; color: #8a929c; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; font-size: 10px; border-bottom: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
.as-tbl td { padding: 7px 10px 7px 0; border-top: 1px solid rgba(255,255,255,.05); color: #d6dce2; }
.as-list { margin: 0 0 10px; padding-left: 20px; } .as-list li { margin: 3px 0; } .as-list li::marker { color: var(--cyan, #4ee1ff); }
.as-watch { display: flex; gap: 10px; align-items: baseline; margin: 10px 0 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(244,184,96,.18); background: rgba(244,184,96,.05); }
.as-watch > span { flex: none; color: var(--amber, #f4b860); font: 500 9.5px var(--mono, monospace); letter-spacing: .12em; text-transform: uppercase; }
.as-src { margin-top: 10px; color: #8a929c; font: 500 10px var(--mono, monospace); line-height: 1.6; }
.as-src > span { color: #a0a7b0; text-transform: uppercase; letter-spacing: .12em; margin-right: 8px; }
.as-src b { color: #aeb5be; font-weight: 500; }
.as-typing { color: var(--muted, #959da8); font-size: 13.5px; }
.as-dots { display: inline-flex; gap: 5px; margin-right: 8px; vertical-align: middle; }
.as-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan, #4ee1ff); animation: asDot 1.2s ease-in-out infinite; }
.as-dots i:nth-child(2) { animation-delay: .15s; background: var(--violet, #7c6cf5); } .as-dots i:nth-child(3) { animation-delay: .3s; background: var(--green, #69e6a6); }
@keyframes asDot { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* input */
#market-assistant .mk-as-input textarea { border-color: rgba(255,255,255,.1); background: rgba(5,6,8,.6); border-radius: 14px; }
#market-assistant .mk-as-input textarea:focus { border-color: rgba(78,225,255,.45); outline: none; box-shadow: 0 0 0 3px rgba(78,225,255,.08); }

@media (max-width: 767px) {
  #market-assistant .mk-as-wrap { grid-template-columns: 1fr; min-height: 0; }
  .as-brain { width: 52px; } .mk-as-main.is-empty .as-brain { width: 120px; }
  .as-card { max-width: 100%; padding: 12px 14px 10px; } .as-bubble { max-width: 88%; }
  #market-assistant .mk-as-chat { max-height: 62vh; }
}
@media (prefers-reduced-motion: reduce) {
  .as-card, .as-brain::before, .as-dots i { animation: none !important; }
  .as-brain, .as-head { transition: none; }
}
