/* ==========================================================================
   Ask The Oracle — styles
   Brand colors and fonts are in :root (light) and the dark theme block below.
   ========================================================================== */

:root {
  --bg: #FCFBF9;
  --surface: #FFFFFF;
  --surface-2: #FDFCFA;
  --sunken: #F4F2EE;
  --hover: #F3F0EB;
  --line: #E3DFD8;
  --line-strong: #D3CEC5;
  --ink: #261B32;
  --ink-2: #3A2E47;
  --muted: #5B5068;
  --faint: #857B90;
  --brand: #7C3AED;
  --brand-hover: #6D28D9;
  --brand-ink: #FFFFFF;
  --brand-soft: #EDE7F6;
  --user-bubble: #F1ECF7;
  --ok: #12B76A;
  --danger: #D92D20;
  --code-bg: #1B1426;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -6px rgba(16, 24, 40, .10);
  --shadow-lg: 0 2px 4px rgba(16, 24, 40, .04), 0 24px 48px -12px rgba(16, 24, 40, .22);

  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --r-xl: 20px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 10px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);

  /* set by JS for the open oracle */
  --a-color: #7C3AED;
    --gold: #7A4A0C;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0E0B14;
  --surface: #17121F;
  --surface-2: #120E19;
  --sunken: #1B1625;
  --hover: #221C2E;
  --line: #2A2436;
  --line-strong: #3A3249;
  --ink: #F3F0FA;
  --ink-2: #DDD6EA;
  --muted: #B9B2C8;
  --faint: #8F87A0;
  --brand: #8B5CF6;
  --brand-hover: #A78BFA;
  --brand-ink: #FFFFFF;
  --brand-soft: #251D36;
  --user-bubble: #241D33;
  --code-bg: #0A0810;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -6px rgba(0, 0, 0, .5);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 48px -12px rgba(0, 0, 0, .7);
    --gold: #EBCB86;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0B14;
    --surface: #17121F;
    --surface-2: #120E19;
    --sunken: #1B1625;
    --hover: #221C2E;
    --line: #2A2436;
    --line-strong: #3A3249;
    --ink: #F3F0FA;
    --ink-2: #DDD6EA;
    --muted: #B9B2C8;
    --faint: #8F87A0;
    --brand: #8B5CF6;
    --brand-hover: #A78BFA;
    --brand-ink: #FFFFFF;
    --brand-soft: #251D36;
    --user-bubble: #241D33;
    --code-bg: #0A0810;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 48px -12px rgba(0, 0, 0, .7);
        --gold: #EBCB86;
  color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
/* clip (html + body): glows that bleed past the edges never make the page scroll sideways.
   scrollbar-gutter: the width stays the same when the scrollbar goes away (entering a chat). */
html { -webkit-text-size-adjust: 100%; overflow-x: clip; overflow-y: auto; scrollbar-gutter: stable; } /* overflow-y set: the gutter only works on a scrolling root */
body { overflow-x: clip; }
html.boot-chat #home { display: none; } /* removed by juice.js as soon as the chat opens */
/* The chat fills the screen and scrolls inside (messages, panel): the page itself never scrolls,
   not even while the chat slides in (its 6px entrance used to show a scrollbar for a moment). */
/* Clip on body (not html): html keeps its stable scrollbar gutter, so the width does not change either. */
html:has(#chat:not([hidden])) body { overflow: clip; } /* on html, clip acts like hidden (scrollable by script); on body it truly cuts */
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background .3s var(--ease), color .3s var(--ease);
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, textarea { font: inherit; color: inherit; }
/* Phones: iPhone zooms into any field under 16px when it is tapped, so fields are 16px on touch screens. */
@media (pointer: coarse) { input, textarea, select { font-size: max(16px, 1em) !important; } }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
svg { display: block; }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }

/* ---------- primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-md);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .2s var(--ease), transform .15s var(--ease), box-shadow .2s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ink); color: var(--bg); box-shadow: var(--shadow-sm); }
.btn-primary:hover { color: var(--bg); background: var(--ink-2); }

.icon-btn {
  width: 36px; height: 36px; flex: none; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
  transition: background .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active { transform: scale(.92); }
.ic { flex: none; width: 18px; height: 18px; stroke-width: 1.75; }
.icon-btn .ic { width: 18px; height: 18px; }
.icon-btn .ic-more { stroke-width: 2.5; }
.icon-btn .ic.spin-in { animation: iconIn .45s var(--spring); }
@keyframes iconIn { from { transform: rotate(-90deg) scale(.4); opacity: 0; } }

.ghost-btn { height: 36px; padding: 0 12px; border-radius: var(--r-sm); font-size: 14px; font-weight: 500; color: var(--muted); transition: background .15s, color .15s; }
.ghost-btn:hover { background: var(--hover); color: var(--ink); }
.lang-select {
  height: 36px; padding: 0 28px 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background-color: var(--surface);
  color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.lang-select:hover { background-color: var(--hover); }
.lang-select:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.foot-links { display: flex; gap: 2px; }
.side-foot { flex-wrap: wrap; row-gap: 4px; }
.side-foot .lang-select { margin-inline-start: auto; max-width: 120px; }
.side-foot .ghost-btn { white-space: nowrap; height: 30px; padding: 0 8px; }
.side-foot .lang-select + .ghost-btn { margin-inline-start: 0; }
.side-foot .js-terms { margin-inline-start: 0; }
.ghost-btn { white-space: nowrap; }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); position: relative; flex: none; }
.live-dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--ok); opacity: 0; animation: ping 2.2s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.8); opacity: 0; } }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.logo:hover { color: var(--ink); }
.logo-mark { width: 34px; height: 34px; display: block; object-fit: contain; transition: transform .4s var(--spring); }
.logo:hover .logo-mark { transform: rotate(-8deg) scale(1.06); }
.logo-text { font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
/* Small phones: the site name stays on one line, the language menu gives way */
@media (max-width: 420px) { .topbar .lang-select, header .lang-select { max-width: 116px; } .logo-text { font-size: 15px; } }

/* ---------- views ---------- */
.view { animation: viewIn .5s var(--ease) both; }
@keyframes viewIn { from { transform: translateY(6px); } }

/* ==========================================================================
   HOME
   ========================================================================== */
.nav { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner { max-width: 1200px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nav-actions { display: flex; align-items: center; gap: 4px; }
.nav-actions .btn { margin-inline-start: 8px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px 48px; }

.hero {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 16px; padding: 72px 0 48px;
}
.hero::before {
  content: ""; position: absolute; inset: 0 -24px; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 60% 70% at 50% 40%, #000 20%, transparent 75%);
  opacity: .7;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; height: 32px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-2); box-shadow: var(--shadow-sm);
  animation: rise .6s var(--ease) both;
}
.hero-title {
  margin: 0; max-width: 820px; font-weight: 800; font-size: clamp(36px, 5.6vw, 60px);
  line-height: 1.04; letter-spacing: -.035em; animation: rise .6s var(--ease) .06s both;
}
.hero-sub { margin: 0; max-width: 560px; font-size: 18px; color: var(--muted); animation: rise .6s var(--ease) .12s both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.search {
  margin-top: 12px; width: 100%; max-width: 520px; height: 52px; display: flex; align-items: center; gap: 12px;
  padding: 0 10px 0 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  box-shadow: var(--shadow-md); transition: border-color .2s, box-shadow .2s; animation: rise .6s var(--ease) .18s both;
}
.search:focus-within { border-color: var(--brand); box-shadow: var(--shadow-md), 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.search .ic { width: 18px; height: 18px; color: var(--faint); stroke-width: 2; }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; font-weight: 500; }
.search input::placeholder { color: var(--faint); }
kbd { font-family: var(--mono); font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px; background: var(--surface-2); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.segmented { scroll-margin-top: 88px; position: relative; display: inline-flex; gap: 2px; padding: 4px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.segmented::-webkit-scrollbar { display: none; }
.seg-indicator { position: absolute; top: 4px; bottom: 4px; inset-inline-start: 0; width: 0; border-radius: 9px; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .35s var(--spring), width .35s var(--spring); }
.seg { position: relative; z-index: 1; height: 34px; padding: 0 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; transition: color .2s; }
.seg:hover { color: var(--ink); }
.seg[aria-pressed="true"] { color: var(--ink); }
.result-count { font-size: 13px; color: var(--muted); font-weight: 500; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card {
  --mx: 50%; --my: 50%;
  position: relative; display: flex; flex-direction: column; text-align: start; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 8px;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s var(--ease);
  animation: cardIn .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } }
.card::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--mx) var(--my), color-mix(in srgb, var(--c) 12%, transparent), transparent 45%);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--c) 40%, var(--line)); }
.card:hover::before { opacity: 1; }
.card:active { transform: translateY(-1px) scale(.99); }
.card.is-opening { transform: scale(.97); opacity: .7; transition-duration: .18s; }
.card > * { position: relative; z-index: 1; }
.card-art {
  aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 13%, var(--surface));
}
[data-theme="dark"] .card-art { background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.card-art .sa-av { width: 74%; aspect-ratio: 1; transition: transform .5s var(--spring); }
.card-art .sa-av.cover { width: 100%; height: 100%; aspect-ratio: auto; }
.card:hover .card-art .sa-av { transform: scale(1.07) translateY(-2px); }
.card:hover .card-art .sa-av.cover { transform: scale(1.04); }
.card-badge {
  position: absolute; top: 18px; inset-inline-start: 18px; z-index: 2; height: 24px; padding: 0 9px; display: inline-flex; align-items: center;
  border-radius: 999px; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--ink-2); backdrop-filter: blur(6px);
}
.card-body { padding: 14px 8px 6px; display: flex; flex-direction: column; gap: 2px; }
.card-name { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.card-topic { font-size: 14px; color: var(--muted); }
.card-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 4px; }
.card-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--muted); }
.card-tag i { width: 8px; height: 8px; border-radius: 3px; background: var(--c); }
.card-go {
  width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink);
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s, transform .35s var(--spring);
}
.card-go .ic { width: 16px; height: 16px; stroke-width: 2; }
.card:hover .card-go { background: var(--ink); color: var(--bg); border-color: var(--ink); transform: translateX(2px); }

.empty { text-align: center; color: var(--muted); padding: 48px 0; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* ==========================================================================
   AVATARS + RING
   ========================================================================== */
.sa-av { display: block; }
.sa-av svg, .sa-av img { width: 100%; height: 100%; display: block; }
.sa-av img { object-fit: contain; }
/* No picture yet (or the file is missing): show the first letter of the name. */
.sa-av { position: relative; container-type: inline-size; }
.sa-av:not(:has(img))::after {
  content: attr(data-initial); position: absolute; inset: 8%; border-radius: 50%; display: grid; place-items: center;
  background: var(--c, var(--a-color, var(--brand))); color: #fff; font-weight: 800; font-size: 46cqi; line-height: 1;
}
.sa-av.cover img { object-fit: cover; }

/* The ring shows friendship progress (--p, 0–100) and pulses while the oracle speaks. */
.ring {
  --p: 0; --size: 40px;
  position: relative; width: var(--size); height: var(--size); flex: none; border-radius: 50%; padding: 2px;
  background: conic-gradient(var(--a-color) calc(var(--p) * 1%), var(--line) 0);
  transition: --p .8s var(--ease);
}
.ring-pic { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; border: 2px solid var(--surface); background: color-mix(in srgb, var(--a-color) 14%, var(--surface)); display: grid; place-items: center; }
.ring-pic .sa-av { width: 86%; height: 86%; }
.ring-pic .sa-av.cover { width: 100%; height: 100%; }
.ring::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--a-color); opacity: 0; pointer-events: none; }
.ring.speaking::after { animation: speak 1.2s var(--ease) infinite; }
@keyframes speak { 0% { transform: scale(.94); opacity: .7; } 100% { transform: scale(1.18); opacity: 0; } }
.ring.pop { animation: ringPop .6s var(--spring); }
@keyframes ringPop { 40% { transform: scale(1.1); } }
.ring-sm { --size: 38px; }
.ring-lg { --size: 132px; padding: 3px; }
.ring-lg .ring-pic { border-width: 4px; }
@property --p { syntax: "<number>"; inherits: true; initial-value: 0; }

/* ==========================================================================
   CHAT SHELL
   ========================================================================== */
.view-chat {
  height: 100vh; height: 100dvh; display: grid; grid-template-columns: 288px minmax(0, 1fr) 328px;
  background: var(--surface); overflow: hidden;
}
.view-chat.no-panel { grid-template-columns: 288px minmax(0, 1fr) 0; }
.view-chat.no-panel .panel { visibility: hidden; }

/* ---- sidebar ---- */
.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); border-inline-end: 1px solid var(--line); padding: 14px 12px; gap: 10px; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.logo-sm .logo-mark { width: 30px; height: 30px; }
.logo-sm .logo-text { font-size: 15px; }
.side-search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s; }
.side-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.side-search .ic { width: 15px; height: 15px; color: var(--faint); stroke-width: 2; }
.side-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 14px; }
.side-search input::placeholder { color: var(--faint); }
.side-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 6px 8px 0; }
.convo-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; }
.convo {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: var(--r-md); text-align: start;
  transition: background .15s var(--ease);
}
.convo:hover { background: var(--hover); }
.convo[aria-current="true"] { background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.convo[aria-current="true"]::before { content: ""; position: absolute; inset-inline-start: -4px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--c); animation: grow .35s var(--spring); }
@keyframes grow { from { transform: scaleY(0); } }
.convo-pic { width: 40px; height: 40px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.convo-pic .sa-av { width: 86%; height: 86%; }
.convo-pic .sa-av.cover { width: 100%; height: 100%; }
.convo-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.convo-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.convo-name { font-size: 14px; font-weight: 600; }
.convo-time { font-size: 11px; color: var(--faint); flex: none; }
.convo-prev { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-lv { font-size: 11px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; flex: none; }
.convo-lv.bump { animation: bump .6s var(--spring); }
@keyframes bump { 40% { transform: scale(1.3); color: var(--c); border-color: var(--c); } }
.side-foot { display: flex; align-items: center; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.side-foot .ghost-btn { font-size: 13px; }

/* ---- room ---- */
.room { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.room-head { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--line); flex: none; }
.room-back { display: none; }
.room-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.room-name { font-size: 15px; font-weight: 700; }
.room-status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.room-status span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; transition: background .2s; }
.room-status.is-typing .status-dot { background: var(--a-color); animation: blinkDot 1s infinite; }
@keyframes blinkDot { 50% { opacity: .3; } }
.room-actions { display: flex; align-items: center; gap: 4px; }
.room-actions #panelBtn[aria-expanded="true"] { background: var(--hover); color: var(--ink); }

.menu { position: relative; }
.menu-list {
  position: absolute; inset-inline-end: 0; top: 44px; z-index: 40; min-width: 220px; padding: 6px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform-origin: top right; animation: menuIn .2s var(--ease);
}
@keyframes menuIn { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
.menu-list button { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border-radius: 9px; font-size: 14px; font-weight: 500; text-align: start; }
.menu-list button:hover { background: var(--hover); }
.menu-list button.danger { color: var(--danger); }
.menu-list .ic { width: 16px; height: 16px; color: var(--muted); }
.menu-list button.danger .ic { color: var(--danger); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

/* ---- messages ---- */
.messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; } /* the space of the scrollbar is kept: opening a chat never shakes the layout */
.thread { max-width: 780px; margin: 0 auto; padding: 32px 24px 24px; display: flex; flex-direction: column; gap: 26px; }

.msg { animation: msgIn .45s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } }
.msg-bot { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 14px; }
.msg-pic { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: color-mix(in srgb, var(--a-color) 14%, var(--surface)); }
.msg-pic .sa-av { width: 86%; height: 86%; }
.msg-pic .sa-av.cover { width: 100%; height: 100%; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-name { font-size: 14px; font-weight: 700; }
.msg-time { font-size: 12px; color: var(--faint); }
.msg-body { font-size: 15.5px; line-height: 1.7; color: var(--ink-2); overflow-wrap: anywhere; }
.msg-error .msg-body { color: var(--danger); }
.msg-me { align-self: flex-end; max-width: 82%; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.msg-me .msg-body { background: var(--user-bubble); color: var(--ink); padding: 10px 16px; border-radius: 18px 18px 6px 18px; white-space: pre-wrap; }
.msg-me .msg-time { padding-inline-end: 4px; opacity: 0; transition: opacity .2s; }
.msg-me:hover .msg-time { opacity: 1; }

.msg-body p { margin: 0 0 .75em; }
.msg-body > :last-child { margin-bottom: 0; }
.msg-body ul, .msg-body ol { margin: 0 0 .75em; padding-inline-start: 1.3em; }
.msg-body li { margin: .2em 0; }
.msg-body li::marker { color: var(--faint); }
.msg-body strong { font-weight: 700; color: var(--ink); }
.msg-body code { font-family: var(--mono); font-size: .86em; background: var(--sunken); border: 1px solid var(--line); padding: .1em .4em; border-radius: 6px; }
.msg-body a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.msg-body .code { margin: .4em 0 .9em; border-radius: 12px; overflow: hidden; background: var(--code-bg); border: 1px solid var(--line); }
.msg-body .code-head { display: flex; justify-content: space-between; align-items: center; height: 36px; padding: 0 6px 0 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); font-family: var(--mono); font-size: 12px; color: #9AA0AE; }
.msg-body .code-copy { height: 26px; padding: 0 10px; border-radius: 7px; font-size: 12px; font-weight: 600; color: #C9CDD6; }
.msg-body .code-copy:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.msg-body pre { margin: 0; padding: 14px; overflow-x: auto; }
.msg-body pre code { background: none; border: 0; padding: 0; color: #E6E8EE; font-size: 13.5px; line-height: 1.65; }
.stopped { color: var(--faint); font-style: italic; font-size: 14px; }
.caret { display: inline-block; width: 7px; height: 1.1em; margin-inline-start: 2px; vertical-align: -0.18em; border-radius: 2px; background: var(--a-color); animation: caret .9s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.msg-actions { display: flex; align-items: center; gap: 2px; margin: 6px 0 0 -6px; opacity: 0; transition: opacity .2s var(--ease); }
.msg-bot:hover .msg-actions, .msg-actions:focus-within, .msg-bot:last-child .msg-actions { opacity: 1; }
.act {
  height: 30px; min-width: 30px; padding: 0 7px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--faint); font-size: 12px; font-weight: 600; transition: background .15s, color .15s, transform .15s;
}
.act:hover { background: var(--hover); color: var(--ink); }
.act:active { transform: scale(.9); }
.act .ic { width: 16px; height: 16px; }
.act.liked { color: #E5484D; }
.act.liked .ic { fill: #E5484D; stroke: #E5484D; animation: heart .5s var(--spring); }
@keyframes heart { 0% { transform: scale(.3); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }
.msg-bot:has(.act.liked) .msg-actions { opacity: 1; }

.typing { display: inline-flex; gap: 5px; padding: 10px 0 4px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: typeDot 1.2s infinite var(--ease); }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typeDot { 0%, 70%, 100% { transform: translateY(0); opacity: .35; } 35% { transform: translateY(-4px); opacity: 1; } }

.gen-img { margin-top: 10px; width: min(380px, 100%); aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--sunken); border: 1px solid var(--line); position: relative; }
.gen-img img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; animation: imgIn .7s var(--ease); }
@keyframes imgIn { from { opacity: 0; filter: blur(14px); transform: scale(1.04); } }
.gen-img.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--surface) 70%, transparent) 50%, transparent 70%); background-size: 250% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.gen-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; text-align: center; font-size: 13px; color: var(--muted); }
.gen-placeholder .sa-av { width: 84px; height: 84px; }

.xp-float { position: fixed; z-index: 60; pointer-events: none; font-size: 12px; font-weight: 800; color: var(--a-color); animation: xpUp 1.1s var(--ease) forwards; white-space: nowrap; }
@keyframes xpUp { 0% { opacity: 0; transform: translate(-50%, 4px) scale(.8); } 20% { opacity: 1; transform: translate(-50%, -6px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -30px); } }

/* ---- composer ---- */
.composer-wrap { flex: none; padding: 0 24px 14px; }
.chips { max-width: 780px; margin: 0 auto 10px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
  transition: border-color .2s, background .2s, transform .2s var(--ease); animation: msgIn .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms);
}
.chip:hover { border-color: var(--a-color); background: color-mix(in srgb, var(--a-color) 7%, var(--surface)); }
.chip:active { transform: scale(.97); }
.composer {
  max-width: 780px; margin: 0 auto; border: 1px solid var(--line); border-radius: 18px; background: var(--surface);
  box-shadow: var(--shadow-md); transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow-md), 0 0 0 4px color-mix(in srgb, var(--a-color) 12%, transparent); }
.composer textarea { display: block; width: 100%; border: 0; outline: none; resize: none; background: transparent; padding: 14px 16px 4px; font-size: 16px; line-height: 1.5; max-height: 200px; }
.composer textarea::placeholder { color: var(--faint); }
.composer-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px; }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 600; border: 1px solid var(--line); transition: background .15s, color .15s; }
.tool-btn:hover { background: var(--hover); color: var(--ink); }
.tool-btn .ic { width: 16px; height: 16px; }
.counter { margin-inline-start: auto; font-size: 12px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger); }
.send {
  margin-inline-start: auto; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--sunken); color: var(--faint); transition: background .2s var(--ease), color .2s, transform .2s var(--spring);
}
.counter:not([hidden]) + .send { margin-inline-start: 0; }
.composer.ready .send, .send.is-stop { background: var(--ink); color: var(--bg); }
.composer.ready .send:hover { transform: translateY(-1px); }
.send:active { transform: scale(.9); }
.send .ic { width: 18px; height: 18px; stroke-width: 2.25; }
.send .i-stop { display: none; fill: currentColor; stroke: none; }
.send.is-stop .i-send { display: none; }
.send.is-stop .i-stop { display: block; }
.send.launch .i-send { animation: launch .4s var(--ease); }
@keyframes launch { 50% { transform: translateY(-12px); opacity: 0; } 51% { transform: translateY(12px); opacity: 0; } }
.disclaimer { max-width: 780px; margin: 8px auto 0; text-align: center; font-size: 12px; color: var(--faint); }

/* ---- profile panel ---- */
.panel { min-height: 0; overflow-y: auto; background: var(--surface-2); border-inline-start: 1px solid var(--line); }
.panel-inner { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.profile-card { border-radius: 20px; overflow: hidden; background: var(--surface); border: 1px solid color-mix(in srgb, var(--a-color) 22%, var(--line)); box-shadow: 0 10px 30px -18px color-mix(in srgb, var(--a-color) 60%, transparent); transition: border-color .4s var(--ease); }
.profile-art {
  position: relative; aspect-ratio: 16 / 11; display: grid; place-items: center; overflow: hidden; transition: background .4s var(--ease), box-shadow .4s var(--ease);
  background: linear-gradient(160deg, color-mix(in srgb, var(--a-color) 30%, var(--surface)), color-mix(in srgb, var(--a-color) 8%, var(--surface)) 75%);
}
.profile-blob { position: absolute; width: 60%; aspect-ratio: 1; border-radius: 50%; inset-inline-start: -14%; top: -22%; background: color-mix(in srgb, var(--a-color) 40%, transparent); filter: blur(28px); opacity: .55; pointer-events: none; }
.profile-blob.b2 { inset-inline-start: auto; top: auto; inset-inline-end: -16%; bottom: -30%; background: color-mix(in srgb, var(--a-color) 30%, #fff); opacity: .45; }
.profile-art .ring-lg { box-shadow: 0 0 0 8px color-mix(in srgb, var(--surface) 55%, transparent), 0 14px 30px -10px color-mix(in srgb, var(--a-color) 70%, transparent); }
.profile-card .profile-head { padding: 14px 16px 4px; }
.friend-block { margin: 10px 14px 14px; padding: 12px; border-radius: 14px; background: color-mix(in srgb, var(--a-color) 7%, var(--surface-2)); display: flex; flex-direction: column; gap: 10px; }
/* Friendship block: text in the character's own dark color, a chunky glossy bar */
.friend-block { --a-ink: color-mix(in srgb, var(--a-color) 62%, var(--ink)); background: color-mix(in srgb, var(--a-color) 10%, var(--surface)); }
.friend-block .block-title { color: var(--a-ink); }
.friend-block .level-chip { background: var(--a-color); color: #fff; box-shadow: 0 3px 10px -3px color-mix(in srgb, var(--a-color) 70%, transparent); }
.friend-block .muted-row { color: var(--a-ink); font-weight: 600; }
.friend-block #xpNext { opacity: .75; font-weight: 500; }
.friend-block .xp-track { height: 14px; padding: 2px; background: color-mix(in srgb, var(--a-color) 16%, var(--surface)); box-shadow: inset 0 1px 2px color-mix(in srgb, var(--a-color) 25%, transparent); }
.friend-block .xp-track i {
  min-width: 10px; background-color: var(--a-color);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 55%), repeating-linear-gradient(-45deg, rgba(255, 255, 255, .18) 0 8px, transparent 8px 16px);
  background-size: 100% 100%, 32px 100%; animation: xpStripes 1.2s linear infinite;
  box-shadow: 0 0 10px color-mix(in srgb, var(--a-color) 55%, transparent);
}
@keyframes xpStripes { to { background-position: 0 0, 32px 0; } }
.profile-art::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(color-mix(in srgb, var(--a-color) 30%, transparent) 1px, transparent 1px); background-size: 16px 16px; opacity: .5; -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 30%, #000 80%); mask-image: radial-gradient(circle at 50% 50%, transparent 30%, #000 80%); }
.profile-art .ring { animation: float 5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-5px); } }
.profile-head { text-align: center; }
.profile-name { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.profile-meta { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.card-block { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.block-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.block-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.level-chip { height: 24px; padding: 0 9px; border-radius: 999px; display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; color: var(--ink); background: color-mix(in srgb, var(--a-color) 14%, var(--surface)); }
.level-chip.bump { animation: bump2 .6s var(--spring); }
@keyframes bump2 { 40% { transform: scale(1.18); } }
.xp-track { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.xp-track i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--a-color); transition: width .8s var(--ease); position: relative; }
.xp-track.flash i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent); animation: sweep .8s var(--ease); }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.muted-row { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.stat strong { font-size: 18px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat strong.tick { animation: tick .45s var(--spring); }
@keyframes tick { 40% { transform: translateY(-3px); color: var(--a-color); } }
.stat span { font-size: 12px; color: var(--muted); }
.prompt-list { display: flex; flex-direction: column; gap: 4px; margin: 0 -6px -6px; }
.prompt { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px; text-align: start; font-size: 13.5px; font-weight: 500; color: var(--ink-2); transition: background .15s; }
.prompt:hover { background: var(--hover); }
.prompt .ic { width: 14px; height: 14px; color: var(--faint); stroke-width: 2; transition: transform .25s var(--spring), color .2s; }
.prompt:hover .ic { transform: translateX(3px); color: var(--ink); }
.scrim { display: none; }
.panel-close { display: none; align-self: flex-end; margin: -6px -6px -8px 0; }

/* ==========================================================================
   OVERLAYS
   ========================================================================== */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; white-space: nowrap;
  background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: toastIn .4s var(--spring) both;
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px) scale(.98); } }
.toast.level { padding: 10px 18px 10px 10px; gap: 12px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.toast-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--a-color); color: #fff; animation: iconIn .6s var(--spring) .1s both; }
.toast-icon .ic { width: 18px; height: 18px; fill: currentColor; stroke-width: 1.5; }
.toast-text { display: flex; flex-direction: column; line-height: 1.3; }
.toast-text small { font-size: 12px; font-weight: 500; color: var(--muted); }

.modal { position: fixed; inset: 0; z-index: 90; background: rgba(8, 9, 12, .5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; max-width: 560px; width: 100%; max-height: 85vh; overflow: auto; box-shadow: var(--shadow-lg); animation: modalIn .35s var(--spring); }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-card h2 { margin: 0 0 12px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.modal-body { color: var(--ink-2); margin-bottom: 20px; }
.lightbox { cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 16px; animation: modalIn .35s var(--spring); }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1200px) {
  .view-chat, .view-chat.no-panel { grid-template-columns: 272px minmax(0, 1fr); }
  .panel {
    position: fixed; top: 0; inset-inline-end: 0; bottom: 0; z-index: 50; width: min(360px, 92vw);
    box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .4s var(--ease), visibility .4s;
    visibility: hidden;
  }
  .view-chat.panel-open .panel { transform: none; visibility: visible; }
  .panel-close { display: inline-flex; }
  .view-chat.panel-open .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(8, 9, 12, .35); animation: fade .2s; }
}
@media (max-width: 860px) {
  .view-chat, .view-chat.no-panel { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .room-back { display: inline-flex; margin-inline-start: -8px; }
  .room-head { padding: 0 10px 0 14px; gap: 10px; }
  .thread { padding: 20px 16px 16px; gap: 22px; }
  .composer-wrap { padding: 0 12px calc(10px + env(safe-area-inset-bottom)); }
  .disclaimer { display: none; }
  .msg-actions { opacity: 1; }
  .msg-me .msg-time { opacity: 1; }
}
@media (max-width: 560px) {
  .nav-inner { padding: 12px 16px; }
  .nav-actions .ghost-btn { display: none; }
  .wrap { padding: 0 16px 40px; }
  .hero { padding: 44px 0 32px; }
  .hero-sub { font-size: 16px; }
  kbd { display: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { border-radius: 16px; padding: 6px; }
  .card-art { border-radius: 11px; }
  .card-body { padding: 10px 6px 2px; }
  .card-name { font-size: 15px; }
  .card-topic { font-size: 12.5px; }
  .card-foot { padding: 8px 6px 2px; }
  .card-tag { font-size: 11px; }
  .card-go { width: 28px; height: 28px; }
  .card-badge { top: 12px; inset-inline-start: 12px; }
  .tool-btn span { display: none; }
  .toast { white-space: normal; max-width: 92vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   CONVERSATION WELCOME
   ========================================================================== */
.messages.at-welcome .thread { min-height: 100%; justify-content: center; }
.welcome { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 24px 0 8px; }
.ring-xl { --size: 112px; padding: 3px; }
.ring-xl .ring-pic { border-width: 4px; }
.welcome-ring { animation: welcomePop .7s var(--spring) both; }
@keyframes welcomePop { from { opacity: 0; transform: scale(.8) translateY(8px); } }
.welcome-ring .ring-pic { position: relative; }
.welcome-ring::before {
  content: ""; position: absolute; inset: -18px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, color-mix(in srgb, var(--a-color) 22%, transparent) 0%, transparent 70%);
  animation: breathe 4s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.08); opacity: .7; } }
.welcome-head { animation: rise .6s var(--ease) .08s both; }
.welcome-name { margin: 4px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -.025em; }
.welcome-meta { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.welcome-hello { max-width: 520px; font-size: 16px; animation: rise .6s var(--ease) .14s both; }
.starters { width: 100%; max-width: 640px; margin-top: 10px; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.starter {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 40px 14px 14px;
  text-align: start; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease), background .25s;
  animation: rise .55s var(--ease) both; animation-delay: calc(.2s + var(--i, 0) * 70ms);
}
.starter:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--a-color) 45%, var(--line)); box-shadow: var(--shadow-md); background: color-mix(in srgb, var(--a-color) 4%, var(--surface)); }
.starter:active { transform: translateY(0) scale(.98); }
.starter-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.starter-kind .ic { width: 13px; height: 13px; stroke-width: 2.2; color: var(--a-color); }
.starter-text { font-size: 14px; font-weight: 600; color: var(--ink-2); line-height: 1.4; }
.starter > .ic-arrow { position: absolute; inset-inline-end: 14px; top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--faint); transition: transform .3s var(--spring), color .2s; }
.starter:hover > .ic-arrow { transform: translateX(3px); color: var(--a-color); }

/* ==========================================================================
   THINKING STATE
   ========================================================================== */
.thinking { display: inline-flex; align-items: center; gap: 10px; padding: 6px 0 2px; }
.thinking .typing { padding: 0; }
.thinking .typing span { background: var(--a-color); }
.thinking-text {
  font-size: 14px; font-weight: 600;
  background: linear-gradient(90deg, var(--faint) 25%, var(--ink) 50%, var(--faint) 75%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 1.8s linear infinite; transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.thinking-text.swap-out { opacity: 0; transform: translateY(-5px); }
.thinking-text.swap-in { animation: shine 1.8s linear infinite, swapIn .35s var(--ease); }
@keyframes shine { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes swapIn { from { opacity: 0; transform: translateY(5px); } }

/* ==========================================================================
   VIEW TRANSITIONS (card → chat, oracle switch, theme reveal)
   ========================================================================== */
html.vt-nav .view { animation: none; }
/* The page itself swaps instantly (fading the whole screen out and in looked like a flash);
   only the avatar and the greeting glide to their new place. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
/* Entrance animations play once, on the first load. After that, screens appear in place
   instead of fading in again (which felt like a page refresh). */
html.played :is(.view, .eyebrow, .hero-title, .hero-sub, .search, .card, .welcome-ring, .welcome-head, .welcome-hello, .starter) { animation: none; }
::view-transition-group(sa-hero),
::view-transition-group(sa-hello-av),
::view-transition-group(sa-hello-text) { animation-duration: .55s; animation-timing-function: cubic-bezier(.2, .9, .25, 1); z-index: 10; }
::view-transition-old(sa-hero), ::view-transition-new(sa-hero),
::view-transition-old(sa-hello-av), ::view-transition-new(sa-hello-av) { height: 100%; width: auto; left: 50%; transform: translateX(-50%); animation-duration: .55s; }
::view-transition-old(sa-hello-text), ::view-transition-new(sa-hello-text) { height: auto; width: 100%; animation-duration: .4s; }
html.theme-vt body { transition: none; }
html.theme-vt::view-transition-old(root), html.theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.theme-vt::view-transition-old(root) { z-index: 1; }
html.theme-vt::view-transition-new(root) { z-index: 2; }

@media (max-width: 560px) {
  .welcome { padding-top: 8px; }
  .ring-xl { --size: 96px; }
  .welcome-name { font-size: 22px; }
  .starters { grid-template-columns: 1fr; }
}

/* ==========================================================================
   CONFIRM DIALOG (replaces the browser's own confirm box)
   ========================================================================== */
.confirm.out { opacity: 0; transition: opacity .15s; }
.confirm-card { max-width: 400px; text-align: center; padding: 28px 24px 22px; }
.confirm-icon { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.confirm-icon .ic { width: 22px; height: 22px; }
.confirm-card h2 { font-size: 18px; margin-bottom: 6px; }
.confirm-card .modal-body { margin-bottom: 22px; font-size: 15px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: var(--shadow-sm); }
.btn-danger:hover { filter: brightness(1.08); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ==========================================================================
   ATTACHMENTS (documents and photos)
   ========================================================================== */
.attach-preview { display: flex; padding: 12px 12px 0; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%; padding: 6px 6px 6px 6px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 13px; animation: msgIn .25s var(--ease) both;
}
.attach-chip .ic { width: 18px; height: 18px; }
.attach-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }
.attach-icon { width: 40px; height: 40px; border-radius: 8px; flex: none; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); }
.attach-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.attach-name { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.attach-meta { color: var(--muted); font-size: 12px; }
.attach-chip.is-loading .attach-icon { animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .45; } }
.attach-x { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); flex: none; }
.attach-x:hover { background: var(--hover); color: var(--ink); }
.attach-x .ic { width: 16px; height: 16px; }
.composer.drag { border-color: var(--a-color, var(--brand)); background: color-mix(in srgb, var(--a-color, var(--brand)) 6%, var(--surface)); }
/* In the sent message */
.msg-files { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-photo { max-width: min(260px, 70vw); max-height: 260px; border-radius: 14px; display: block; cursor: zoom-in; border: 1px solid var(--line); }
.msg-doc { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-2); max-width: 260px; }
.msg-doc .ic { width: 16px; height: 16px; color: var(--brand); flex: none; }
.msg-doc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================================================
   MICROPHONE (speech to text)
   ========================================================================== */
.composer-bar .mic-btn { margin-inline-start: auto; width: 36px; height: 36px; border-radius: 10px; color: var(--muted); }
.composer-bar .mic-btn + .send, .composer-bar .counter + .mic-btn { margin-inline-start: 0; }
.composer-bar .counter:not([hidden]) + .mic-btn { margin-inline-start: 0; }
.mic-btn .ic { width: 18px; height: 18px; }
.mic-btn:hover { color: var(--ink); background: var(--hover); }
.mic-btn.is-on { color: #fff; background: var(--danger); position: relative; }
.mic-btn.is-on::after { content: ""; position: absolute; inset: -4px; border-radius: 13px; border: 2px solid var(--danger); animation: speak 1.2s var(--ease) infinite; pointer-events: none; }
.composer.listening { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); }
.composer.listening textarea::placeholder { color: var(--danger); }

/* Read aloud button: preparing (spinner) and playing (stop) */
.act.is-playing, .act.is-loading { color: var(--a-color, var(--brand)); background: color-mix(in srgb, var(--a-color, var(--brand)) 12%, transparent); }
.act.is-playing .ic { fill: currentColor; }
.act.is-loading { position: relative; }
.act.is-loading .ic { opacity: .35; }
.act.is-loading::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.msg-bot:has(.act.is-playing, .act.is-loading) .msg-actions { opacity: 1; }

/* Parts of the interface the site owner can turn off in the admin panel (Interface tab).
   app.js adds a class like "ui-no-likes" to <html> for each part that is off. */
.ui-no-profile #panelBtn, .ui-no-profile .panel, .ui-no-profile .scrim { display: none !important; }
.ui-no-friendship .card-badge, .ui-no-friendship .convo-lv, .ui-no-friendship #friendBlock,
.ui-no-friendship .stat:has(#statXp), .ui-no-friendship .xp-float { display: none !important; }
.ui-no-friendship .ring { background: var(--line); }
.ui-no-likes .js-like, .ui-no-likes .stat:has(#statLikes) { display: none !important; }
.ui-no-friendship.ui-no-likes .stats { display: none; }
.ui-no-copy .js-copy { display: none !important; }
.ui-no-menu .room-actions .menu { display: none !important; }
.ui-no-search .hero .search, .ui-no-search .side-search { display: none !important; }
.ui-no-categories #cats { display: none !important; }
.ui-no-starters .starters, .ui-no-starters #promptBlock { display: none !important; }
.ui-no-theme .js-theme { display: none !important; }
.ui-no-langmenu .js-lang { display: none !important; }
.ui-no-disclaimer .disclaimer { display: none !important; }

.foot-links { flex-wrap: wrap; justify-content: flex-end; }
.foot-links a.ghost-btn { display: inline-flex; align-items: center; color: var(--muted); }

/* Composer bar: attach and image on the left; counter, microphone and send always on the right */
.composer-bar .bar-grow { flex: 1; }
.composer-bar .counter, .composer-bar .mic-btn, .composer-bar .send { margin-inline-start: 0; }
.composer textarea { overflow-y: hidden; }

/* ==========================================================================
   HERO EFFECTS: a soft color aurora and floating characters behind the title.
   Chosen in the admin panel (Interface > Top animation). Respects "reduce motion".
   ========================================================================== */
.hero { isolation: isolate; }
.hero > :not(.hero-fx) { position: relative; z-index: 1; }
.hero-fx { position: absolute; inset: -56px -64px 0; z-index: 0; pointer-events: none; }
html:not(.hero-aurora):not(.hero-both) .aurora,
html:not(.hero-characters):not(.hero-both) .hero-pals { display: none; }

.aurora { position: fixed; inset: 0 0 auto 0; height: 900px; overflow: hidden; z-index: 0;
  /* the middle stays clear (title and search always easy to read), and the bottom fades out,
     so no color shape ever ends in a straight line */
  -webkit-mask-image: radial-gradient(ellipse 38% 55% at 50% 30%, transparent 45%, #000 100%), linear-gradient(#000 45%, transparent 92%);
  -webkit-mask-composite: source-in;
  mask-image: radial-gradient(ellipse 38% 55% at 50% 30%, transparent 45%, #000 100%), linear-gradient(#000 45%, transparent 92%);
  mask-composite: intersect; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .26; will-change: transform; }
.aurora i:nth-child(1) { width: 520px; height: 520px; inset-inline-start: -200px; top: -220px; background: #7C3AED; animation: auroraA 22s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { width: 480px; height: 480px; inset-inline-end: -180px; top: -200px; background: #C026D3; animation: auroraB 28s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { width: 380px; height: 380px; inset-inline-start: -160px; top: 340px; background: #E0A84B; opacity: .14; animation: auroraC 34s ease-in-out infinite alternate; }
@keyframes auroraA { to { transform: translate(60px, 40px) scale(1.12); } }
@keyframes auroraB { to { transform: translate(-50px, 60px) scale(.92); } }
@keyframes auroraC { to { transform: translate(40px, -50px) scale(1.15); } }
[data-theme="dark"] .aurora i { opacity: .42; }
[data-theme="dark"] .aurora i:nth-child(3) { opacity: .3; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .aurora i { opacity: .42; }
  :root:not([data-theme="light"]) .aurora i:nth-child(3) { opacity: .3; }
}

.hero-pals { position: absolute; inset: 0; --px: 0; --py: 0; }
.pal { position: absolute; inset-inline-start: var(--x); top: var(--y); width: var(--s); height: var(--s); pointer-events: auto;
  transform: translate(calc(var(--px) * var(--depth) * 1px), calc(var(--py) * var(--depth) * 1px));
  transition: transform .6s cubic-bezier(.2, .8, .2, 1); opacity: 0; animation: palIn .8s var(--ease) both; animation-delay: calc(var(--i) * 90ms + 200ms); }
.pal-in { display: block; width: 100%; height: 100%; animation: palFloat var(--d) ease-in-out infinite alternate; animation-delay: var(--dl); }
.pal-face { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
  background: color-mix(in srgb, var(--c) 18%, var(--surface)); border: 2px solid var(--surface);
  box-shadow: 0 10px 28px -10px color-mix(in srgb, var(--c) 55%, transparent), 0 2px 6px rgba(16, 24, 40, .06);
  transition: transform .35s var(--spring), box-shadow .35s; }
.pal-face img { width: 88%; height: 88%; object-fit: contain; }
.pal:hover .pal-face, .pal:focus-visible .pal-face { transform: scale(1.14) rotate(-4deg); box-shadow: 0 14px 34px -10px color-mix(in srgb, var(--c) 70%, transparent); }
.pal::after { content: attr(data-name); position: absolute; left: 50%; top: calc(100% + 6px); transform: translate(-50%, 4px); white-space: nowrap;
  font-size: 12px; font-weight: 700; color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: 3px 9px; border-radius: 99px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; box-shadow: var(--shadow-sm); }
.pal:hover::after, .pal:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
[data-theme="dark"] .pal-face { border-color: color-mix(in srgb, var(--c) 45%, var(--surface)); box-shadow: 0 0 26px -6px color-mix(in srgb, var(--c) 60%, transparent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pal-face { border-color: color-mix(in srgb, var(--c) 45%, var(--surface)); box-shadow: 0 0 26px -6px color-mix(in srgb, var(--c) 60%, transparent); }
}
@keyframes palFloat { from { transform: translateY(-7px) rotate(-2deg); } to { transform: translateY(7px) rotate(2deg); } }
@keyframes palIn { from { opacity: 0; scale: .6; } to { opacity: 1; scale: 1; } }
@media (max-width: 760px) {
  .hero-fx { inset: -24px -12px 0; }
  .pal:nth-child(n+5) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .aurora i, .pal, .pal-in { animation: none !important; }
  .pal { opacity: 1; }
}

/* ---- right-to-left languages: arrows point the other way ---- */
[dir="rtl"] .prompt svg, [dir="rtl"] .starter svg:last-child, [dir="rtl"] .back svg, [dir="rtl"] .card-go svg { transform: scaleX(-1); }

/* ==========================================================================
   CARD DRAWS (Ask The Oracle): the Draw cards menu and the cards in the visitor's message
   ========================================================================== */
.composer { position: relative; }
.draw-menu {
  position: absolute; bottom: calc(100% + 8px); inset-inline-start: 10px; z-index: 30; min-width: 220px; padding: 6px;
  display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); animation: menuIn .18s var(--ease);
}
.draw-menu[hidden] { display: none; }
.draw-menu button {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 12px; border-radius: 8px;
  text-align: start; font-weight: 600; color: var(--ink);
}
.draw-menu button small { color: var(--muted); font-weight: 500; font-size: 12px; }
.draw-menu button:hover, .draw-menu button:focus-visible { background: var(--hover); outline: none; }
@keyframes menuIn { from { opacity: 0; transform: translateY(6px); } }

.draw { margin-bottom: 8px; }
.draw-title { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--gold, var(--muted)); }
.draw-title .ic, .draw-title svg { width: 16px; height: 16px; }
.draw-answer {
  display: inline-block; margin: 0 0 10px; padding: 4px 12px; border-radius: 999px; font-weight: 800; letter-spacing: .02em;
  background: var(--brand-soft); color: var(--brand);
}
.draw-answer.is-no { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.draw-answer.is-maybe { background: var(--sunken); color: var(--ink-2); }
.draw-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.tcard { margin: 0; width: 104px; display: grid; gap: 6px; animation: cardIn .6s var(--spring) both; animation-delay: calc(var(--i) * .18s); }
.tcard-face {
  display: block; aspect-ratio: 480 / 832; border-radius: 10px; overflow: hidden; background: var(--sunken);
  box-shadow: 0 6px 18px -8px rgba(20, 8, 40, .55); border: 1px solid var(--line);
}
.tcard-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tcard.is-rev .tcard-face img { transform: rotate(180deg); }
.tcard figcaption { display: grid; gap: 1px; font-size: 12px; line-height: 1.3; }
.tcard figcaption strong { font-size: 12.5px; color: var(--ink); }
.tcard figcaption span { color: var(--muted); }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) rotateY(80deg); } }
.msg-me .draw { text-align: start; }
/* Messages shown again (reopening a chat, a refresh) appear in place: their cards do not deal again */
.msg[style*="animation: none"] .tcard { animation: none; }
@media (max-width: 760px) { .tcard { width: 88px; } }
@media (prefers-reduced-motion: reduce) { .tcard, .draw-menu { animation: none; } }

/* Header (Ask The Oracle, same as Ask the Skies): 64px bar with a line under it and the categories as links */
.nav { border-bottom-color: var(--line); background: color-mix(in srgb, var(--bg) 80%, transparent); }
.nav-inner { max-width: 1180px; height: 64px; padding-block: 0; justify-content: flex-start; gap: 16px; }
.nav .logo-text { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-inline-start: 12px; }
.nav-links a { padding: 8px 12px; border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--muted); white-space: nowrap; transition: background .15s, color .15s; }
.nav-links a:hover, .nav-links a[aria-current="true"] { background: var(--surface-2); color: var(--ink); }
.nav-actions { margin-inline-start: auto; }
@media (max-width: 900px) { .nav-links { display: none; } .nav .logo-text { font-size: 16px; } }
@media (max-width: 480px) { .nav-inner { gap: 8px; } .nav .lang-select { max-width: 84px; } }

/* ==========================================================================
   HERO (Ask The Oracle): text on the left, the zodiac wheel and cards on the right
   ========================================================================== */
.hero-grid { width: 100%; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: 32px; }
.hero-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; text-align: start; }
.hero-copy .hero-title { max-width: 15ch; font-size: clamp(40px, 4.6vw, 68px); }
.hero-copy .hero-sub { max-width: 36ch; }
.hero-title .hero-gold { color: var(--gold); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 6px; animation: rise .6s var(--ease) .18s both; }
.hero-cta { height: 48px; padding: 0 22px 0 16px; gap: 10px; border-radius: 12px; font-weight: 700;
  background: var(--brand); color: var(--brand-ink); box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--brand) 70%, transparent); }
.hero-cta:hover { background: var(--brand-hover); color: var(--brand-ink); }
.hero-cta .ic { width: 18px; height: 18px; }
.hero-meet { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink-2); padding: 10px 4px; }
.hero-meet:hover { color: var(--gold); }
[dir="rtl"] .hero-arrow { transform: scaleX(-1); }
.hero-art-wrap { position: relative; width: 100%; max-width: 560px; justify-self: center; aspect-ratio: 4 / 3; animation: heroArtIn .9s var(--ease) .12s both; }
.hero-aura {
  position: absolute; inset: 8%; border-radius: 50%; pointer-events: none; filter: blur(8px);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 26%, transparent), color-mix(in srgb, var(--brand) 14%, transparent) 55%, transparent);
}
.hero-float { position: relative; width: 100%; height: 100%; }
.hero-art { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 24px 32px rgba(40, 20, 80, .18)); }
[data-theme="dark"] .hero-art { filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .4)); }
/* The light only crosses the art itself: the layer is masked by the same picture */
.hero-sheen { position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  -webkit-mask: url("../img/hero.webp") center / contain no-repeat; mask: url("../img/hero.webp") center / contain no-repeat; }
.hero-sheen span { position: absolute; top: 0; bottom: 0; left: -50%; width: 50%; opacity: 0;
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, .28) 50%, transparent 80%); }
@keyframes heroArtIn { from { opacity: 0; transform: scale(.96); } }
@keyframes heroBob { 50% { transform: translateY(-12px) rotate(-.6deg); } }
@keyframes heroAura { 50% { opacity: .65; transform: scale(1.05); } }
@keyframes heroSheen { 0% { left: -50%; opacity: 0; } 8% { opacity: 1; } 30%, 100% { left: 110%; opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .hero-float { animation: heroBob 7s ease-in-out infinite; }
  .hero-aura { animation: heroAura 6s ease-in-out infinite; }
  .hero-sheen span { animation: heroSheen 14s ease-in-out 1.6s infinite; }
}
@media (prefers-reduced-motion: reduce) { .hero-art-wrap, .hero-actions { animation: none; } }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 8px; }
  .hero-art-wrap { order: -1; max-width: 400px; }
  .hero-copy { align-items: center; text-align: center; }
  .hero-copy .hero-title { max-width: none; }
  .hero-actions { justify-content: center; }
}

/* Oracle portraits are 4:5: the home cards show the whole portrait in its own shape; the round avatars
   (chat, side list, profile) frame it near the top so the face sits in the circle */
.sa-av.cover img { object-position: 50% 18%; }
.card-art:has(.sa-av.cover) { aspect-ratio: 4 / 5; }
.card-art .sa-av.cover img { object-position: 50% 50%; }

/* 18+ gate (Ask The Oracle): the moon in the brand colour, and the page stays behind it */
.gate .gate-icon { background: var(--brand-soft); color: var(--brand); }
.gate .btn-primary { background: var(--brand); color: var(--brand-ink); }
.gate .btn-primary:hover { background: var(--brand-hover); color: var(--brand-ink); }

/* End of assets/css/style.css */
