:root {
  --bg: #030408;
  --panel: rgba(12, 15, 28, 0.74);
  --panel-strong: rgba(15, 18, 34, 0.92);
  --text: #f6f8ff;
  --muted: #a9b0c7;
  --dim: #747b91;
  --line: rgba(255, 255, 255, 0.12);
  --pink: #ff3ecf;
  --blue: #67d8ff;
  --violet: #9968ff;
  --good: #83ffd2;
  --danger: #ff6682;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.52);
  --gradient: linear-gradient(135deg, var(--blue), var(--pink));
  --gradient-soft: linear-gradient(135deg, rgba(103,216,255,.22), rgba(255,62,207,.20));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background:
  radial-gradient(circle at 10% 10%, rgba(103, 216, 255, 0.18), transparent 35%),
  radial-gradient(circle at 88% 18%, rgba(255, 62, 207, 0.17), transparent 34%),
  radial-gradient(circle at 50% 95%, rgba(153, 104, 255, 0.16), transparent 42%),
  var(--bg); }

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.noise {
  position: fixed; inset: 0; pointer-events: none; opacity: .14; z-index: 0;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

.site-shell { position: relative; z-index: 1; min-height: 100vh; }
.nav {
  width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 760; letter-spacing: -0.02em; }
.logo-mark {
  width: 42px; height: 42px; border-radius: 16px; position: relative;
  background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--gradient) border-box;
  border: 1.6px solid transparent; box-shadow: 0 0 34px rgba(103,216,255,.16), 0 0 34px rgba(255,62,207,.12);
}
.logo-mark::before {
  content: ""; position: absolute; inset: 9px 10px 9px 9px; border-radius: 42% 58% 52% 48%;
  border: 2px solid transparent; background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--gradient) border-box;
}
.logo-mark::after {
  content: "A"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 14px; font-weight: 800; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav-links { display: flex; align-items: center; gap: 22px; color: var(--muted); font-size: 14px; }
.nav-links a:hover { color: var(--text); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255,255,255,.055); color: var(--text); cursor: pointer; transition: .2s ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(103,216,255,.45); background: rgba(255,255,255,.09); }
.btn-primary { border: 0; background: var(--gradient); color: #030408; font-weight: 760; box-shadow: 0 16px 50px rgba(255,62,207,.18), 0 16px 50px rgba(103,216,255,.15); }
.btn-ghost { background: transparent; }

.hero { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 76px 0 64px; display: grid; grid-template-columns: 1.05fr .95fr; gap: 54px; align-items: center; }
.badge { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid rgba(103,216,255,.28); border-radius: 999px; background: rgba(103,216,255,.08); color: #dff8ff; font-size: 13px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 20px var(--good); }
h1 { margin: 20px 0 18px; font-size: clamp(48px, 8vw, 90px); line-height: .93; letter-spacing: -0.07em; }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; color: var(--muted); font-size: clamp(17px, 2vw, 21px); line-height: 1.65; max-width: 650px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.hero-card {
  position: relative; min-height: 560px; border-radius: 34px; border: 1px solid rgba(255,255,255,.12); background: linear-gradient(180deg, rgba(20,24,42,.72), rgba(7,8,16,.82));
  box-shadow: var(--shadow); overflow: hidden; padding: 26px;
}
.hero-card::before { content:""; position:absolute; inset:-2px; background: radial-gradient(circle at 30% 14%, rgba(103,216,255,.2), transparent 28%), radial-gradient(circle at 72% 22%, rgba(255,62,207,.22), transparent 28%); pointer-events: none; }
.face-frame { position: absolute; inset: 72px 70px 86px; border-radius: 48% 52% 44% 56% / 40% 44% 56% 60%; border: 3px solid transparent; background: linear-gradient(#080a13,#080a13) padding-box, var(--gradient) border-box; filter: drop-shadow(0 0 24px rgba(103,216,255,.22)) drop-shadow(0 0 24px rgba(255,62,207,.16)); }
.face-frame::before { content:""; position:absolute; width: 42%; height: 50%; right: 18%; top: 26%; border-right: 3px solid var(--pink); border-bottom: 3px solid var(--blue); transform: skew(-12deg); opacity:.9; }
.float-card { position:absolute; left:26px; right:26px; bottom:24px; border:1px solid rgba(255,255,255,.13); background: rgba(4,6,12,.72); backdrop-filter: blur(18px); border-radius: 24px; padding: 18px; }
.chat-line { display:flex; gap:12px; align-items:flex-start; margin: 10px 0; color: var(--muted); font-size: 14px; line-height:1.5; }
.dot-avatar { width: 28px; height: 28px; flex:0 0 28px; border-radius: 50%; background: var(--gradient); }
.wave { height: 34px; display:flex; align-items:center; gap:4px; margin-top: 14px; }
.wave span { width: 4px; border-radius: 999px; background: var(--gradient); animation: wave 1.4s ease-in-out infinite; }
.wave span:nth-child(1){height:12px}.wave span:nth-child(2){height:22px;animation-delay:.08s}.wave span:nth-child(3){height:30px;animation-delay:.16s}.wave span:nth-child(4){height:18px;animation-delay:.24s}.wave span:nth-child(5){height:26px;animation-delay:.32s}.wave span:nth-child(6){height:14px;animation-delay:.4s}
@keyframes wave { 0%,100% { transform: scaleY(.5); opacity:.5 } 50% { transform: scaleY(1); opacity:1 } }

.section { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 58px 0; }
.section h2 { font-size: clamp(34px, 5vw, 58px); letter-spacing: -0.055em; margin: 0 0 14px; }
.section-intro { color: var(--muted); max-width: 760px; line-height: 1.65; font-size: 18px; }
.grid-3 { display:grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
.feature { border:1px solid rgba(255,255,255,.12); background: var(--panel); border-radius: 26px; padding: 24px; min-height: 220px; position:relative; overflow:hidden; }
.feature::before { content:""; position:absolute; inset:0; background: radial-gradient(circle at top left, rgba(103,216,255,.13), transparent 34%), radial-gradient(circle at bottom right, rgba(255,62,207,.12), transparent 34%); opacity:.8; }
.feature > * { position:relative; }
.feature h3 { margin: 16px 0 10px; font-size: 20px; }
.feature p { color: var(--muted); line-height: 1.6; margin: 0; }
.icon { width:44px; height:44px; border-radius: 16px; border: 1px solid rgba(255,255,255,.13); background: var(--gradient-soft); display:grid; place-items:center; }
.cta { border:1px solid rgba(255,255,255,.12); background: linear-gradient(135deg, rgba(103,216,255,.14), rgba(255,62,207,.13)); border-radius: 32px; padding: 34px; display:flex; align-items:center; justify-content:space-between; gap:20px; }
.cta h2 { margin: 0; }
.footer { color: var(--dim); border-top:1px solid rgba(255,255,255,.08); padding: 28px 0; width:min(1160px, calc(100% - 32px)); margin: 0 auto; display:flex; justify-content:space-between; gap:16px; flex-wrap:wrap; }

/* Chat app */
.chat-page { height: 100vh; overflow: hidden; display: grid; grid-template-columns: 292px 1fr; background: var(--bg); }
.sidebar { border-right:1px solid rgba(255,255,255,.1); background: rgba(4,6,12,.72); backdrop-filter: blur(22px); padding: 18px; display:flex; flex-direction:column; min-width:0; }
.side-top { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom: 18px; }
.side-section-title { color: var(--dim); text-transform:uppercase; letter-spacing:.12em; font-size:11px; margin: 16px 0 10px; }
.companion-list { display:flex; flex-direction:column; gap: 8px; overflow:auto; }
.companion { display:flex; align-items:center; gap:12px; padding: 12px; border-radius: 18px; border:1px solid transparent; color: var(--muted); cursor:pointer; }
.companion.active, .companion:hover { background: rgba(255,255,255,.06); border-color: rgba(103,216,255,.18); color: var(--text); }
.companion-avatar { width:36px; height:36px; border-radius:50%; background: var(--gradient); flex:0 0 36px; box-shadow: 0 0 26px rgba(255,62,207,.16); }
.sidebar-bottom { margin-top:auto; display:grid; gap:10px; }
.status-pill { border:1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); color: var(--muted); border-radius: 16px; padding: 10px 12px; font-size: 13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.main-chat { display:flex; flex-direction:column; min-width:0; position:relative; }
.chat-header { height:72px; display:flex; align-items:center; justify-content:space-between; padding: 0 24px; border-bottom:1px solid rgba(255,255,255,.09); background: rgba(4,6,12,.5); backdrop-filter: blur(16px); }
.header-title { display:flex; align-items:center; gap:12px; }
.header-title strong { display:block; }
.header-title span { display:block; color: var(--dim); font-size:13px; margin-top:2px; }
.chat-actions { display:flex; align-items:center; gap:10px; }
.messages { flex:1; overflow:auto; padding: 28px min(8vw, 94px); display:flex; flex-direction:column; gap:18px; }
.empty-state { margin:auto; text-align:center; max-width:620px; }
.empty-state .logo-mark { margin: 0 auto 22px; width:70px; height:70px; border-radius: 24px; }
.empty-state h1 { font-size: clamp(38px, 6vw, 62px); margin:0 0 14px; }
.empty-state p { color: var(--muted); line-height:1.65; }
.message { display:flex; gap:14px; max-width:860px; }
.message.user { align-self:flex-end; flex-direction:row-reverse; }
.message .bubble { padding: 15px 17px; border-radius: 22px; line-height:1.62; white-space:pre-wrap; border:1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.055); }
.message.user .bubble { background: linear-gradient(135deg, rgba(103,216,255,.16), rgba(255,62,207,.13)); }
.message.assistant .bubble { background: rgba(12,15,28,.76); }
.message-avatar { width:34px; height:34px; border-radius:50%; flex:0 0 34px; background: rgba(255,255,255,.12); }
.message.assistant .message-avatar { background: var(--gradient); }
.composer-wrap { padding: 18px min(8vw, 94px) 24px; border-top:1px solid rgba(255,255,255,.08); background: linear-gradient(180deg, rgba(3,4,8,.2), rgba(3,4,8,.9)); }
.composer { display:flex; gap:12px; align-items:flex-end; border:1px solid rgba(255,255,255,.13); background: rgba(13,15,28,.86); border-radius: 26px; padding: 10px; box-shadow: 0 14px 54px rgba(0,0,0,.25); }
.composer textarea { flex:1; min-height:44px; max-height:160px; resize:none; border:0; outline:0; background: transparent; color: var(--text); padding: 11px 10px; line-height:1.45; }
.composer textarea::placeholder { color: var(--dim); }
.round-btn { width:44px; height:44px; border-radius:50%; border:0; cursor:pointer; color:#030408; background: var(--gradient); font-weight:800; }
.login-card { width:min(460px, calc(100% - 32px)); margin:auto; border:1px solid rgba(255,255,255,.12); background: var(--panel-strong); border-radius:28px; padding: 26px; box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 10px; font-size: 28px; letter-spacing: -.04em; }
.login-card p { margin:0 0 18px; color:var(--muted); line-height:1.55; }
.form { display:grid; gap:12px; }
.input { width:100%; min-height:46px; border-radius:16px; border:1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.055); color:var(--text); padding: 0 14px; outline:0; }
.input:focus { border-color: rgba(103,216,255,.5); }
.form-row { display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
.error { color: var(--danger); font-size:13px; min-height:18px; }
.hidden { display:none !important; }
.mobile-menu { display:none; }

@media (max-width: 880px) {
  .nav-links { display:none; }
  .hero { grid-template-columns:1fr; padding-top: 38px; }
  .hero-card { min-height:440px; }
  .grid-3 { grid-template-columns:1fr; }
  .cta { flex-direction:column; align-items:flex-start; }
  .chat-page { grid-template-columns:1fr; }
  .sidebar { position:fixed; z-index:20; inset:0 auto 0 0; width:292px; transform: translateX(-104%); transition:.22s ease; }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display:inline-flex; }
  .messages, .composer-wrap { padding-left:16px; padding-right:16px; }
}

/* Chat layout stability fix: keep the composer pinned and make only the message area scroll. */
html, body { height: 100%; }
.chat-body {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}
.chat-body .site-shell {
  height: 100dvh;
  min-height: 100dvh;
  overflow: auto;
}
.chat-page {
  position: fixed;
  inset: 0;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}
.sidebar {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.companion-list {
  min-height: 0;
  overflow-y: auto;
}
.main-chat {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chat-header {
  flex: 0 0 72px;
  min-height: 72px;
  z-index: 6;
}
.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-bottom: 32px;
}
.messages::-webkit-scrollbar,
.companion-list::-webkit-scrollbar {
  width: 10px;
}
.messages::-webkit-scrollbar-track,
.companion-list::-webkit-scrollbar-track {
  background: rgba(255,255,255,.035);
  border-radius: 999px;
}
.messages::-webkit-scrollbar-thumb,
.companion-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(103,216,255,.85), rgba(255,62,207,.85));
  border: 2px solid rgba(3,4,8,.9);
  border-radius: 999px;
}
.messages,
.companion-list {
  scrollbar-color: rgba(255,62,207,.75) rgba(255,255,255,.04);
  scrollbar-width: thin;
}
.composer-wrap {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 7;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.composer {
  width: min(100%, 1220px);
  margin: 0 auto;
}
.message {
  max-width: min(860px, 82%);
}
.message .bubble {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 880px) {
  .chat-page { grid-template-columns: 1fr; }
  .main-chat { width: 100vw; }
  .sidebar { height: 100dvh; max-height: 100dvh; }
  .messages { padding: 18px 14px 24px; }
  .composer-wrap { padding: 12px 14px max(14px, env(safe-area-inset-bottom)); }
  .message { max-width: 92%; }
  .chat-header { padding-left: 14px; padding-right: 14px; }
}

/* Plans page */
.plans-hero {
  width: min(980px, calc(100% - 32px));
  margin: 76px auto 34px;
  text-align: center;
}
.plans-hero h1 {
  margin: 18px auto 12px;
  font-size: clamp(42px, 7vw, 82px);
  line-height: .94;
  letter-spacing: -0.065em;
}
.plans-hero p {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.75;
}
.plans-grid {
  width: min(1160px, calc(100% - 32px));
  margin: 42px auto 92px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.plan-card {
  position: relative;
  min-height: 360px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.035));
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.plan-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: radial-gradient(circle at 15% 0%, rgba(103,216,255,.22), transparent 34%), radial-gradient(circle at 100% 8%, rgba(255,62,207,.18), transparent 32%);
  pointer-events: none;
  opacity: .74;
}
.plan-card > * {
  position: relative;
  z-index: 1;
}
.featured-plan {
  border-color: rgba(255, 62, 207, .42);
  transform: translateY(-12px);
}
.plan-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--gradient);
  color: #07101b;
  font-size: .78rem;
  font-weight: 800;
}
.plan-kicker {
  margin: 0 0 10px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .78rem;
  font-weight: 800;
}
.plan-card h2 {
  margin: 0 0 12px;
  font-size: 2.2rem;
  letter-spacing: -0.04em;
}
.plan-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}
.plan-price {
  margin: 32px 0 20px;
  font-size: 3rem;
  font-weight: 850;
  letter-spacing: -0.055em;
}
.plan-price span {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0;
}
.plan-button {
  width: 100%;
  justify-content: center;
}

@media (max-width: 880px) {
  .plans-grid {
    grid-template-columns: 1fr;
  }
  .featured-plan {
    transform: none;
  }
  .plan-card {
    min-height: 300px;
  }
}

.audio-unlock.hidden, .audio-status.hidden { display: none !important; }
.audio-unlock { white-space: nowrap; }
.audio-status { display: inline-flex; margin-top: 14px; }
@media (max-width: 760px) {
  .chat-actions { gap: 8px; }
  .audio-unlock { display: inline-flex; }
}

.plans-status { display: inline-flex; margin-top: 18px; max-width: min(760px, 100%); white-space: normal; }
.plan-features { margin: 18px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.65; }
.plan-button:disabled { opacity: .55; cursor: not-allowed; }

/* Offline chat/auth split: account access can work while the RunPod GPU pod is down. */
.message.system {
  align-self: center;
  max-width: min(720px, 92%);
}
.message.system .message-avatar {
  display: none;
}
.message.system .bubble,
.chat-offline-status {
  border-color: rgba(103,216,255,.24);
  background: rgba(103,216,255,.08);
  color: #dff8ff;
}
.composer textarea:disabled {
  cursor: not-allowed;
  color: var(--dim);
}
.composer button:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}

/* Brand image */
.brand-logo {
  width: 54px;
  height: 54px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 22px rgba(103,216,255,.16)) drop-shadow(0 0 18px rgba(255,62,207,.12));
}
.footer-links,
.legal-inline {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.footer-links a,
.legal-inline a {
  color: var(--dim);
}
.footer-links a:hover,
.legal-inline a:hover {
  color: var(--text);
}
.legal-inline {
  justify-content: center;
  font-size: 13px;
}
.legal-inline-sidebar {
  justify-content: flex-start;
}

/* Homepage portrait card */
.hero-card {
  display: flex;
  align-items: stretch;
}
.hero-companion-shell {
  position: absolute;
  inset: 28px 28px 128px;
  border-radius: 30px;
  overflow: hidden;
  background: linear-gradient(180deg, #f7f8fc 0%, #e8eef8 100%);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 20px 44px rgba(0,0,0,.24);
}
.hero-companion {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 55%;
  transform: scale(1.06);
}
.dot-avatar-image {
  object-fit: cover;
  display: block;
}

/* Chat companion imagery */
.companion-avatar-img {
  object-fit: cover;
  display: block;
  background: rgba(255,255,255,.08);
}
.companion-disabled {
  opacity: .8;
}
.companion-disabled small {
  color: var(--dim);
}
.chat-page {
  grid-template-columns: 292px 280px minmax(0, 1fr);
}
.companion-stage {
  border-right: 1px solid rgba(255,255,255,.08);
  background: rgba(8,11,20,.78);
  backdrop-filter: blur(18px);
  padding: 20px 18px;
  display: flex;
  min-width: 0;
}
.companion-stage-card {
  width: 100%;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: var(--shadow);
}
.companion-stage-copy {
  padding: 18px 18px 10px;
}
.stage-kicker {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.companion-stage-copy h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -.05em;
}
.companion-stage-copy p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}
.companion-stage-art {
  flex: 1;
  min-height: 0;
  margin: 12px;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, #f7f8fc 0%, #e8eef8 100%);
}
.companion-stage-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.header-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}
.empty-state-logo {
  width: 76px;
  height: 76px;
  margin: 0 auto 22px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 22px rgba(103,216,255,.14)) drop-shadow(0 0 18px rgba(255,62,207,.14));
}
.message.assistant .message-avatar {
  background-image: url('/assets/images/liana.png');
  background-size: cover;
  background-position: center 16%;
  box-shadow: 0 0 24px rgba(255,62,207,.16);
}

/* Legal / terms pages */
.subtle-page,
.terms-page {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 86px;
}
.subtle-hero {
  max-width: 820px;
  margin: 0 auto 26px;
  text-align: center;
}
.subtle-hero h1 {
  font-size: clamp(42px, 6.5vw, 78px);
  letter-spacing: -.065em;
  line-height: .96;
  margin-bottom: 12px;
}
.legal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 30px;
}
.legal-card {
  padding: 28px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 28px;
  background: rgba(255,255,255,.045);
  box-shadow: var(--shadow);
}
.legal-card h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 30px;
  letter-spacing: -.04em;
}
.legal-card p {
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 18px;
}
.legal-card-muted {
  background: rgba(255,255,255,.03);
}
.terms-hero {
  margin-bottom: 18px;
}
.terms-content {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 30px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 28px;
  background: rgba(255,255,255,.04);
  box-shadow: var(--shadow);
}
.terms-content h2 {
  font-size: 28px;
  letter-spacing: -.04em;
  margin: 32px 0 10px;
}
.terms-content h2:first-child {
  margin-top: 0;
}
.terms-content p {
  color: var(--muted);
  line-height: 1.8;
  margin: 0;
}

@media (max-width: 1100px) {
  .chat-page {
    grid-template-columns: 292px minmax(0, 1fr);
  }
  .companion-stage {
    display: none;
  }
}

@media (max-width: 880px) {
  .hero-companion-shell {
    inset: 20px 20px 124px;
  }
  .legal-grid {
    grid-template-columns: 1fr;
  }
}


/* Mobile Chrome viewport guard: keep the same visual design, but prevent Chrome
   from laying out the chat as a wide desktop grid and then zooming the page out. */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
img,
svg,
canvas,
video {
  max-width: 100%;
}
.chat-body,
.chat-body #loginView,
.chat-body #chatView {
  width: 100%;
  max-width: 100vw;
}
.chat-body .site-shell {
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.login-card {
  max-width: calc(100vw - 32px);
}

@supports (height: 100svh) {
  .chat-body,
  .chat-body .site-shell,
  .chat-page,
  .sidebar,
  .main-chat {
    height: 100svh;
    max-height: 100svh;
  }
}

@media (hover: none) and (pointer: coarse) {
  .chat-page {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100vw;
    max-width: 100vw;
  }
  .companion-stage {
    display: none !important;
  }
  .main-chat {
    width: 100%;
    max-width: 100vw;
  }
  .sidebar {
    position: fixed;
    z-index: 20;
    inset: 0 auto 0 0;
    width: min(292px, calc(100vw - 28px));
    transform: translateX(-104%);
    transition: .22s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-menu {
    display: inline-flex;
  }
}

@media (max-width: 520px), (hover: none) and (pointer: coarse) and (max-width: 760px) {
  .chat-header {
    min-height: 68px;
    height: auto;
    padding: 10px 12px;
    gap: 8px;
  }
  .chat-actions {
    gap: 8px;
  }
  .chat-actions .btn {
    min-height: 38px;
    padding: 0 12px;
  }
  .header-title {
    min-width: 0;
  }
  .header-title > div {
    min-width: 0;
  }
  .header-title span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Mobile Chrome homepage width fix.
   Keep the same design, but prevent intrinsic image sizes and desktop grid widths
   from expanding the layout viewport on iOS/Android Chrome. */
html,
body {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}
.site-shell,
main {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
}
.brand-logo {
  width: 54px !important;
  height: 54px !important;
  min-width: 54px !important;
  max-width: 54px !important;
  max-height: 54px !important;
  flex: 0 0 54px !important;
  object-fit: contain !important;
}
.brand {
  min-width: 0;
  max-width: 100%;
}
.brand span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 880px), (hover: none) and (pointer: coarse) {
  .nav,
  .hero,
  .section,
  .footer,
  .plans-hero,
  .plans-grid,
  .subtle-page,
  .terms-page {
    width: calc(100vw - 28px) !important;
    max-width: calc(100vw - 28px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  .nav {
    padding: 18px 0 !important;
  }
  .nav-links {
    display: none !important;
  }
  .hero {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    gap: 34px !important;
    align-items: stretch !important;
    padding: 42px 0 54px !important;
  }
  .hero > * {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .hero h1,
  h1 {
    font-size: clamp(38px, 12vw, 54px) !important;
    line-height: .96 !important;
  }
  .hero p {
    max-width: 100% !important;
    font-size: 16px !important;
  }
  .hero-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: clamp(470px, 132vw, 620px) !important;
    border-radius: 28px !important;
  }
  .hero-companion-shell {
    inset: 18px 18px 116px !important;
    border-radius: 24px !important;
  }
  .float-card {
    left: 18px !important;
    right: 18px !important;
    bottom: 18px !important;
  }
  .grid-3,
  .plans-grid,
  .legal-grid {
    grid-template-columns: 1fr !important;
  }
  .cta {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
}

@media (max-width: 420px), (hover: none) and (pointer: coarse) and (max-width: 520px) {
  .brand-logo {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    max-height: 46px !important;
    flex-basis: 46px !important;
  }
  .hero-card {
    min-height: clamp(450px, 138vw, 590px) !important;
  }
}

