:root {
  color-scheme: light;
  --ink: #19172a;
  --muted: #6d6a7e;
  --brand: #6c4ff8;
  --brand-dark: #5035d5;
  --soft: #f0edff;
  --line: #e7e4ef;
  --paper: #ffffff;
  --bg: #f7f6fb;
  --shadow: 0 24px 70px rgba(60, 43, 130, .14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  background: rgba(255,255,255,.88);
  border-bottom: 1px solid rgba(231,228,239,.8);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  color: #fff; border-radius: 12px; background: linear-gradient(135deg, var(--brand), #9d82ff);
  box-shadow: 0 9px 22px rgba(108,79,248,.25);
}
.topnav { display: flex; gap: 24px; margin-left: auto; color: var(--muted); font-size: 14px; }
.topnav a:hover { color: var(--ink); }

.button {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 20px; border: 1px solid transparent; border-radius: 14px;
  cursor: pointer; font-weight: 750; transition: transform .18s, box-shadow .18s, background .18s;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--brand); box-shadow: 0 12px 26px rgba(108,79,248,.25); }
.button-primary:hover { background: var(--brand-dark); }
.button-secondary, .button-ghost { color: var(--ink); background: white; border-color: var(--line); }
.button-danger { color: #b12638; background: #fff; border-color: #efc4ca; }
.button-ghost { min-height: 40px; padding-inline: 16px; }

.hero {
  min-height: 690px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(430px, .9fr);
  gap: 72px;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 72px 24px 82px;
  position: relative;
}
.hero::before {
  content: ""; position: absolute; z-index: -1; width: min(520px, 100%); height: 520px; right: 0; top: 12px;
  border-radius: 50%; background: radial-gradient(circle, rgba(157,130,255,.22), rgba(157,130,255,0) 68%);
}
.eyebrow { color: var(--brand); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1 { max-width: 670px; margin: 18px 0 22px; font-size: clamp(44px, 5vw, 70px); line-height: .99; letter-spacing: -.055em; }
h1 span { color: var(--brand); }
.hero-copy > p { max-width: 600px; margin: 0; color: var(--muted); font-size: 19px; line-height: 1.55; }
.hero-actions { display: flex; gap: 12px; margin-top: 30px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-top: 28px; color: var(--muted); font-size: 13px; }
.trust-row span::before { content: "✓"; margin-right: 7px; color: #238557; font-weight: 900; }

.chat-card {
  overflow: hidden; min-height: 555px; display: flex; flex-direction: column;
  border: 1px solid rgba(227,222,241,.9); border-radius: 28px; background: white; box-shadow: var(--shadow);
}
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px 14px; }
.chat-title { display: block; font-weight: 800; }
.chat-status { display: block; margin-top: 5px; color: #268259; font-size: 12px; }
.balance-pill { padding: 8px 11px; color: var(--brand); border-radius: 12px; background: var(--soft); font-size: 13px; }
.model-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 14px; border-bottom: 1px solid var(--line); }
.model-tab { padding: 8px 12px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; white-space: nowrap; }
.model-tab.active { color: var(--brand); background: var(--soft); font-weight: 800; }
.model-tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; padding: 12px 14px 0; }
.tier-button { display: flex; flex-direction: column; gap: 5px; padding: 11px 8px; min-width: 0; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: white; cursor: pointer; text-align: left; }
.tier-button.active { border-color: var(--brand); background: var(--soft); box-shadow: inset 0 0 0 1px var(--brand); }
.tier-button strong { font-size: 12px; overflow-wrap: anywhere; }
.tier-button span { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.tier-button small { margin-top: auto; padding-top: 3px; color: var(--brand); font-weight: 750; }
.model-pricing { margin: 10px 14px 14px; padding: 12px; border-radius: 13px; background: var(--bg); font-size: 12px; line-height: 1.5; }
.model-pricing-head { display: flex; flex-wrap: wrap; gap: 5px 12px; justify-content: space-between; align-items: center; }
.model-pricing-head > span { color: var(--muted); font-size: 10px; }
.model-pricing p { margin: 6px 0; color: var(--muted); }
.token-prices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.token-prices dt { color: var(--muted); font-size: 11px; }
.token-prices dd { margin: 2px 0 0; font-weight: 800; }
.model-pricing summary { color: var(--brand); cursor: pointer; padding: 4px 0; }
.model-tab:focus-visible, .tier-button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chat-note a { color: var(--brand); text-decoration: underline; }
.messages { flex: 1; min-height: 310px; max-height: 360px; overflow-y: auto; padding: 18px; background: #fbfaff; }
.message { display: flex; gap: 9px; max-width: 88%; margin-bottom: 14px; }
.message > div { padding: 11px 13px 9px; border-radius: 16px 16px 16px 4px; background: white; border: 1px solid var(--line); }
.message p { margin: 0; font-size: 14px; line-height: 1.45; }
.message small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.message.user { justify-content: flex-end; margin-left: auto; }
.message.user > div { color: white; border: 0; border-radius: 16px 16px 4px 16px; background: var(--brand); }
.message.user small { color: rgba(255,255,255,.72); text-align: right; }
.avatar { flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; color: var(--brand); border-radius: 9px; background: var(--soft); font-size: 12px; font-weight: 900; }
.composer { display: flex; gap: 8px; margin: 14px 14px 5px; padding: 6px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.composer input { min-width: 0; flex: 1; padding: 7px 9px; border: 0; outline: 0; color: var(--ink); }
.composer button { width: 40px; height: 40px; border: 0; border-radius: 12px; color: white; background: var(--brand); cursor: pointer; font-size: 20px; }
.chat-note { margin: 3px 0 12px; color: var(--muted); text-align: center; font-size: 10px; }

.plans-section { padding: 90px 24px 104px; background: white; }
.section-heading { max-width: 720px; margin: 0 auto 38px; text-align: center; }
h2 { margin: 12px 0; font-size: clamp(32px, 4vw, 48px); letter-spacing: -.045em; }
.section-heading p { margin: 0; color: var(--muted); line-height: 1.55; }
.plans-grid { max-width: 1000px; margin: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
.plan-card { position: relative; padding: 26px; border: 1px solid var(--line); border-radius: 22px; background: white; }
.plan-card.featured { border: 2px solid var(--brand); transform: translateY(-8px); box-shadow: 0 22px 45px rgba(85,62,185,.12); }
.plan-badge { position: absolute; right: 18px; top: 18px; padding: 5px 8px; border-radius: 99px; color: var(--brand); background: var(--soft); font-size: 10px; font-weight: 800; }
.plan-name { color: var(--muted); font-size: 14px; }
.plan-card h3 { margin: 14px 0 8px; font-size: 34px; }
.plan-card p { min-height: 44px; margin: 0 0 22px; color: var(--muted); }
.plan-card .button { width: 100%; }

.safety { max-width: 1180px; margin: auto; padding: 88px 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.safety div { padding: 26px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.65); }
.safety span { color: var(--brand); font-weight: 900; }
.safety h3 { margin: 24px 0 8px; }
.safety p { margin: 0; color: var(--muted); line-height: 1.5; }
footer { min-height: 120px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px max(24px, calc((100vw - 1180px) / 2)); border-top: 1px solid var(--line); background: white; }
footer p { color: var(--muted); font-size: 12px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translate(-50%, 120px); padding: 12px 16px; border-radius: 12px; color: white; background: #242135; box-shadow: 0 12px 34px rgba(0,0,0,.24); opacity: 0; transition: .25s; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
.modal-backdrop { position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(24,21,42,.56); backdrop-filter: blur(8px); }
.modal-backdrop[hidden] { display: none; }
.auth-modal { position: relative; width: min(100%, 430px); padding: 30px; border-radius: 24px; background: white; box-shadow: 0 30px 90px rgba(20,14,50,.3); }
.auth-modal h2 { margin: 18px 0 8px; font-size: 30px; text-align: left; }
.auth-modal > p { color: var(--muted); line-height: 1.5; }
.auth-modal form { display: grid; gap: 10px; margin-top: 20px; }
.auth-modal label { font-size: 13px; font-weight: 800; }
.auth-modal input { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; outline: 0; }
.auth-modal input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--soft); }
.modal-close { position: absolute; right: 18px; top: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--muted); background: var(--bg); cursor: pointer; font-size: 24px; }
.link-button { padding: 8px; border: 0; color: var(--brand); background: transparent; cursor: pointer; }
.form-error { min-height: 20px; margin: 12px 0 0 !important; color: #b8303f !important; font-size: 13px; }
.profile-balance { margin: 18px 0; padding: 16px; border-radius: 15px; color: var(--brand); background: var(--soft); font-size: 18px; }
.profile-balance b { font-size: 28px; }
.profile-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.profile-note { margin-bottom: 0; font-size: 12px; }
.legal-page { max-width: 820px; margin: auto; padding: 64px 22px 100px; }
.legal-page article { padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: #fff; }
.legal-page h1 { font-size: 42px; line-height: 1.05; }
.legal-page h2 { text-align: left; font-size: 24px; }
.legal-page p, .legal-page li { color: var(--muted); line-height: 1.65; }
.legal-page .draft { padding: 12px; border-radius: 12px; color: #8a5a00; background: #fff3cf; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .topnav { display: none; }
  .topbar .button { margin-left: auto; }
  .hero { grid-template-columns: 1fr; gap: 48px; padding-top: 54px; }
  .hero-copy { text-align: center; }
  .hero-copy > p { margin-inline: auto; }
  .hero-actions, .trust-row { justify-content: center; }
  .chat-card { width: min(100%, 610px); margin: auto; }
  .plans-grid, .safety { grid-template-columns: 1fr; }
  .plan-card.featured { transform: none; }
}
@media (max-width: 560px) {
  .topbar { height: 64px; padding-inline: 16px; }
  .topbar .button { min-height: 38px; padding-inline: 12px; }
  h1 { font-size: 42px; }
  .hero { padding: 42px 14px 62px; }
  .hero-copy > p { font-size: 16px; }
  .hero-actions { flex-direction: column; }
  .chat-card { min-height: 535px; border-radius: 22px; }
  .model-tabs { gap: 4px; padding-inline: 10px; }
  .model-tab { padding-inline: 10px; font-size: 14px; }
  .plans-section, .safety { padding-inline: 16px; }
  footer { flex-direction: column; align-items: flex-start; }
  .profile-actions { grid-template-columns: 1fr; }
}
