/* flowAI — dark, ChatGPT-class UI */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1117;
  --bg2: #171923;
  --bg3: #1f2230;
  --border: #2a2e3f;
  --text: #e8eaf2;
  --muted: #9aa0b4;
  --accent: #6d5efc;
  --accent2: #22d3ee;
  --grad: linear-gradient(135deg, #6d5efc, #22d3ee);
  --radius: 14px;
  --side-w: 264px;
}
html, body { height: 100%; }
body {
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: var(--accent2); text-decoration: none; }

.app { display: flex; height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--side-w); min-width: var(--side-w);
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: margin .2s ease;
}
.sidebar.hidden-side { margin-left: calc(-1 * var(--side-w)); }
.side-top { padding: 14px 12px 8px; }
.brand { display: flex; align-items: center; gap: 8px; padding: 4px 6px 14px; }
.logo { width: 26px; height: 26px; }
.wordmark { font-size: 19px; letter-spacing: .2px; color: var(--text); font-weight: 300; }
.wordmark b { font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.btn-new {
  width: 100%; text-align: left; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg3); transition: background .15s;
  font-weight: 500;
}
.btn-new:hover { background: #262a3b; }

.chat-list { flex: 1; overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.chat-item {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 8px; color: var(--muted);
  white-space: nowrap; overflow: hidden;
}
.chat-item span { overflow: hidden; text-overflow: ellipsis; flex: 1; text-align: left; }
.chat-item:hover { background: var(--bg3); color: var(--text); }
.chat-item.active { background: var(--bg3); color: var(--text); }
.chat-del { opacity: 0; font-size: 12px; padding: 2px 5px; border-radius: 6px; }
.chat-item:hover .chat-del { opacity: .7; }
.chat-del:hover { background: #3a2430; color: #ff7a90; opacity: 1 !important; }
.list-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #6b7089; padding: 10px 10px 4px; }

.side-bottom { padding: 12px; border-top: 1px solid var(--border); }
.upsell { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: linear-gradient(160deg, #1d2030, #171923); margin-bottom: 12px; }
.upsell-title { font-weight: 600; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.upsell-sub { font-size: 12.5px; color: var(--muted); margin: 4px 0 10px; }
.btn-upsell { width: 100%; padding: 7px; border-radius: 8px; background: var(--bg3); border: 1px solid var(--border); color: var(--muted); font-size: 13px; cursor: default; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; flex: none;
}
.user-av { background: #34405c; }
.side-user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.side-user-meta b { font-size: 13.5px; }
.side-user-meta span { font-size: 12px; color: var(--muted); }

/* ---------- Main ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: rgba(15,17,23,.8); backdrop-filter: blur(8px);
}
.icon-btn { padding: 6px 10px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--bg3); color: var(--text); }
.model-pick select {
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 7px 10px; font: inherit; font-weight: 500; outline: none; cursor: pointer;
}
.monet-pick select { color: var(--muted); max-width: 210px; }
.monet-pick select:has(option:checked:not([value=""])) { color: var(--text); }
.monet-desc {
  font-size: 12.5px; color: var(--muted);
  margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 34vw;
}
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.badge-beta { font-size: 11px; padding: 3px 8px; border-radius: 20px; border: 1px solid var(--border); color: var(--muted); letter-spacing: .5px; }
.btn-share { padding: 7px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg3); font-size: 13.5px; }
.btn-share:hover { background: #262a3b; }

/* ---------- Scroll / hero ---------- */
.scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.hero { max-width: 760px; margin: 0 auto; padding: 9vh 24px 24px; text-align: center; }
.hero-logo { width: 52px; height: 52px; margin-bottom: 18px; }
.hero h1 { font-size: 28px; font-weight: 650; }
.hero-sub { color: var(--muted); margin: 8px 0 30px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card {
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg2); transition: border-color .15s, background .15s;
  font-size: 20px;
}
.card:hover { border-color: #3d4258; background: var(--bg3); }
.card span { display: flex; flex-direction: column; font-size: 14px; }
.card b { font-weight: 600; }
.card i { font-style: normal; color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- Thread ---------- */
.thread { max-width: 760px; margin: 0 auto; padding: 18px 20px 30px; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 12px; }
.msg .avatar.ai-av { background: var(--grad); color: #fff; }
.msg-body { min-width: 0; flex: 1; }
.msg-name { font-size: 13px; font-weight: 600; margin-bottom: 3px; color: var(--muted); }
.msg.user .msg-name { color: var(--muted); }
.msg-content { overflow-wrap: break-word; }
.msg.user .msg-content { white-space: pre-wrap; }

/* markdown */
.msg-content p { margin: 0 0 10px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content h1, .msg-content h2, .msg-content h3 { margin: 14px 0 8px; line-height: 1.3; }
.msg-content h1 { font-size: 20px; } .msg-content h2 { font-size: 18px; } .msg-content h3 { font-size: 16px; }
.msg-content ul, .msg-content ol { margin: 0 0 10px 22px; }
.msg-content li { margin: 3px 0; }
.msg-content table { border-collapse: collapse; margin: 8px 0 12px; font-size: 14px; display: block; overflow-x: auto; }
.msg-content th, .msg-content td { border: 1px solid var(--border); padding: 6px 12px; }
.msg-content th { background: var(--bg3); }
.msg-content code { background: var(--bg3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.msg-content pre { background: #12141d; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; overflow-x: auto; margin: 8px 0 12px; }
.msg-content pre code { background: none; border: none; padding: 0; }
.msg-content blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--muted); margin: 8px 0; }
.msg-content hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

.cursor { display: inline-block; width: 8px; height: 16px; background: var(--accent2); vertical-align: -2px; margin-left: 2px; border-radius: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.msg-tools { display: flex; gap: 6px; margin-top: 8px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-tools { opacity: 1; }
.tool-btn { font-size: 12px; color: var(--muted); padding: 4px 9px; border: 1px solid var(--border); border-radius: 7px; }
.tool-btn:hover { background: var(--bg3); color: var(--text); }

.err { color: #ff8a9a; font-size: 13.5px; }

/* ---------- Hotspots (monetisation: concept pills) ---------- */
.hotspots { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.pill {
  padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg3);
  font-size: 12.5px; font-weight: 500; color: var(--accent2);
  transition: border-color .15s, background .15s, transform .1s;
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pill:hover {
  border-color: var(--accent); background: #232741;
  transform: translateY(-1px);
}

/* Hotspots 2: emoji + colored text links with divider rules */
.hs-links { gap: 10px 34px; }
.hs-links.hs-top { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 14px; }
.hs-links.hs-bottom { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 14px; }
.hotlink {
  background: none; border: none; padding: 2px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px; font-weight: 500; color: #33d6e8;
  cursor: pointer; transition: color .15s;
  white-space: nowrap;
}
.hotlink:hover { color: #7ce7f2; text-decoration: underline; text-underline-offset: 3px; }

/* Hotspots 3: inline highlighted commercial terms inside the answer */
.inline-hot {
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; font-weight: 650; color: #33d6e8;
  cursor: pointer; transition: color .15s;
}
.inline-hot:hover { color: #7ce7f2; text-decoration: underline; text-underline-offset: 3px; }

/* Ads impl 1: iframe ad slots */
.adslot { width: 100%; border: 0; display: block; margin: 8px 0; }

/* Ads impl 4: citation sources */
.cite-sup { color: var(--accent2); font-size: 11px; vertical-align: super; text-decoration: none; margin: 0 2px; font-weight: 600; }
.cite-sup:hover { text-decoration: underline; }
.cite-sources { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-top: 12px; background: var(--bg2); }
.cite-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: #6b7089; margin-bottom: 6px; }
.cite-item { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; min-width: 0; }
.cite-num { color: var(--muted); font-size: 12px; flex: none; }
.cite-item a { color: #6ea8ff; font-size: 13.5px; font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cite-item a:hover { text-decoration: underline; }
.cite-url { color: #3fb950; font-size: 11.5px; flex: none; }

/* Ads impl 5: hover cards */
.hover-hot { background: rgba(51,214,232,.13); border-radius: 4px; padding: 0 3px; }
.hovercard {
  position: fixed; z-index: 100; width: 340px;
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
  background: #1d2030; border: 1px solid #3d4258; border-radius: 12px;
  box-shadow: 0 10px 34px rgba(0,0,0,.55);
}
.hc-cta {
  align-self: flex-start; color: #fff; background: var(--grad);
  border-radius: 8px; padding: 5px 12px; font-size: 12.5px; text-decoration: none; font-weight: 600;
}

/* shared DOM ad card (impl 5 + 6) */
.int-ad { display: flex; gap: 12px; text-decoration: none; align-items: flex-start; }
.int-ad img { width: 64px; height: 64px; border-radius: 8px; flex: none; }
.int-ad .tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.int-ad .t { color: #6ea8ff; font-size: 14px; font-weight: 600; line-height: 1.3; }
.int-ad:hover .t { text-decoration: underline; }
.int-ad .u { color: #3fb950; font-size: 11px; }
.int-ad .d { color: var(--muted); font-size: 12.5px; line-height: 1.4; }

/* Ads impl 6: thinking-time interstitial + collapsed pill */
.interstitial { border: 1px dashed #3d4258; border-radius: 12px; padding: 12px; margin: 4px 0 12px; background: var(--bg2); }
.int-head { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: #6b7089; margin-bottom: 8px; }
.ad-pill-line { display: flex; gap: 8px; align-items: center; font-size: 12.5px; margin: 2px 0 10px; color: var(--muted); }
.ad-pill-line span { border: 1px solid var(--border); border-radius: 5px; padding: 0 6px; font-size: 10.5px; color: #8c93ad; }
.ad-pill-line a { color: #6ea8ff; text-decoration: none; }
.ad-pill-line a:hover { text-decoration: underline; }

/* Ads impl 9: AI's Pick verdict */
.msg-content blockquote.ai-pick {
  border-left: 3px solid var(--accent);
  background: rgba(109,94,252,.09);
  padding: 10px 14px; border-radius: 0 10px 10px 0;
  color: var(--text);
}
.pick-tag {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .8px;
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
  color: #8c93ad; margin-left: 8px; vertical-align: 2px;
}

/* Ads impl 6: featured comparison row */
.featured-row { background: rgba(109,94,252,.10) !important; }
.featured-row td { border-color: #4a4470 !important; }
.featured-badge {
  display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .8px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 700; margin-bottom: 2px;
}
.featured-link { color: #6ea8ff !important; font-weight: 600; text-decoration: none; }
.featured-link:hover { text-decoration: underline; }

/* Ads impl 7: embedded product carousel */
.carousel { display: flex; gap: 10px; overflow-x: auto; margin: 12px 0; padding-bottom: 6px; }
.car-card {
  min-width: 150px; max-width: 150px; flex: none;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg2);
  padding: 10px; text-decoration: none; display: flex; flex-direction: column; gap: 5px;
  transition: border-color .15s, background .15s;
}
.car-card:hover { border-color: #3d4258; background: var(--bg3); }
.car-card img { width: 100%; height: 78px; object-fit: cover; border-radius: 8px; }
.car-t { color: #6ea8ff; font-size: 12.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.car-p { color: #3fb950; font-size: 13px; font-weight: 700; }
.car-u { color: #6b7089; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Ads impl 8: follow-up chips */
.followups { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fchip {
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px;
  font-size: 13px; color: var(--text); background: var(--bg3); text-decoration: none;
  transition: border-color .15s, background .15s;
}
.fchip:hover { border-color: #3d4258; background: #262a3b; }
.fchip-sp { color: #ffd479; border-color: #6d5a2b; background: #241f14; }
.fchip-sp:hover { border-color: #8a733a; background: #2c2618; }
.fchip-tag { font-size: 9.5px; border: 1px solid #6d5a2b; border-radius: 4px; padding: 0 4px; margin-left: 4px; color: #b3945a; vertical-align: 1px; }

/* Ads impl 2: right-hand sponsored rail */
.adrail {
  width: 330px; min-width: 330px;
  border-left: 1px solid var(--border);
  background: var(--bg2);
  display: none; flex-direction: column;
  overflow-y: auto;
}
.adrail.visible { display: flex; }
.adrail-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: #6b7089; padding: 14px 16px 8px;
}
.adrail-body { padding: 0 12px 16px; }
.adrail-body .adslot { margin: 0; }
@media (max-width: 1100px) { .adrail { display: none !important; } }

/* ---------- Sponsored slot (phase 2 — Yahoo ads) ---------- */
.sponsored {
  border: 1px solid #3d4258; border-radius: var(--radius);
  padding: 12px 14px; background: linear-gradient(160deg, #1c2133, #171923);
  margin-top: 10px;
}
.sponsored-tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: #8c93ad; margin-bottom: 6px; }
.sponsored a { font-weight: 600; }
.sponsored p { font-size: 13.5px; color: var(--muted); margin: 4px 0 0; }

/* ---------- Composer ---------- */
.composer-wrap { padding: 10px 20px 14px; }
.composer {
  max-width: 760px; margin: 0 auto; position: relative;
  display: flex; align-items: flex-end;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 18px;
  padding: 10px 52px 10px 16px;
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: #4a4f6a; box-shadow: 0 0 0 3px rgba(109,94,252,.12); }
.composer textarea {
  flex: 1; background: none; border: none; outline: none; resize: none;
  color: var(--text); font: inherit; max-height: 200px; line-height: 1.5;
}
.composer textarea::placeholder { color: #6b7089; }
.send {
  position: absolute; right: 9px; bottom: 8px;
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad); color: #fff; transition: opacity .15s, transform .1s;
}
.send:disabled { opacity: .35; cursor: default; }
.send:not(:disabled):hover { transform: scale(1.05); }
.send.stop { background: #3a3f55; }
.hidden { display: none !important; }
.disclaimer { text-align: center; font-size: 12px; color: #6b7089; margin-top: 10px; }
.disclaimer a { color: #6b7089; text-decoration: underline; }

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2e3247; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 820px) {
  .cards { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; height: 100%; }
}
