:root {
  --bg: #000000;
  --surface: #1E1E1E;
  --elevated: #2A2A2A;
  --border: #363636;
  --fg: #F2F4F0;
  --fg-2: #7E837C;
  --fg-on-accent: #000000;
  --accent: #C0FF42;
  --accent-light: #D3FF7A;
  --accent-hover: #B1F91F;
  --accent-press: #94D80E;
  --font-display: 'Anton', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent-light); }

h1, h2 {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0;
  margin: 0;
}

.rule { width: 72px; height: 5px; background: var(--accent); margin-bottom: 20px; }
.overline {
  font-weight: 600; font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--fg-2); margin: 0 0 12px;
}

.btn {
  display: inline-block; width: 100%;
  background: var(--accent); color: var(--fg-on-accent);
  font-family: var(--font-body); font-weight: 700; font-size: 15px;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 18px 40px; border: none; border-radius: 999px; cursor: pointer;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { background: var(--accent-press); }
.btn:disabled { opacity: .6; cursor: default; }

/* ---------- login ---------- */
.login { min-height: 100%; display: flex; align-items: center; padding: 48px 24px; }
.login-box { width: 100%; max-width: 440px; margin: 0 auto; }
.login h1 { font-size: clamp(72px, 20vw, 112px); line-height: 0.95; }
.tagline {
  font-weight: 700; font-size: 20px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--accent); margin: 8px 0 24px;
}
.lead { color: var(--fg); margin: 0 0 32px; font-size: 17px; }
.label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.login input {
  width: 100%; font: inherit; font-size: 17px; color: var(--fg);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 16px; outline: none;
}
.login input:focus { border-color: var(--fg-2); }
.error { color: #FF8A7A; min-height: 1.6em; font-size: 15px; margin: 12px 0 0; }
.small { font-size: 14px; color: var(--fg-2); margin-top: 24px; }

/* ---------- app ---------- */
.app { height: 100%; height: 100dvh; display: flex; flex-direction: column; max-width: 820px; margin: 0 auto; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--surface);
}
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand-name { font-family: var(--font-display); font-size: 28px; line-height: 1; text-transform: uppercase; }
.brand-sub {
  font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--fg-2); white-space: nowrap;
}
.top-actions { display: flex; align-items: center; gap: 14px; }
.remaining { font-size: 13px; color: var(--fg-2); white-space: nowrap; }
.remaining b { color: var(--accent); font-weight: 700; }
.link-btn {
  background: none; border: none; color: var(--fg); font: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--accent-light); }

.messages { flex: 1; overflow-y: auto; padding: 24px 16px 8px; scroll-behavior: smooth; }

.welcome { padding: 8px 0 16px; }
.welcome h2 { font-size: clamp(38px, 9vw, 56px); line-height: 0.98; margin-bottom: 16px; }
.welcome p { margin: 0 0 24px; max-width: 560px; }
.suggestions { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.chip {
  background: transparent; color: var(--fg); border: 1px solid var(--border);
  font: inherit; font-size: 15px; font-weight: 600; text-align: left;
  padding: 12px 18px; border-radius: 999px; cursor: pointer;
}
.chip:hover { background: rgba(242,244,240,0.08); border-color: var(--fg-2); }

.msg { margin: 0 0 20px; max-width: 100%; overflow-wrap: anywhere; }
.msg.user {
  margin-left: auto; width: fit-content; max-width: 85%;
  background: var(--surface); padding: 12px 16px; border-radius: 16px 16px 4px 16px;
  white-space: pre-wrap;
}
.msg.bot .who {
  font-weight: 700; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--fg-2); margin-bottom: 6px;
}
.msg.bot .body p { margin: 0 0 12px; }
.msg.bot .body p:last-child { margin-bottom: 0; }
.msg.bot .body ul, .msg.bot .body ol { margin: 0 0 12px; padding-left: 22px; }
.msg.bot .body li { margin-bottom: 4px; }
.msg.bot .body strong { font-weight: 700; }
.msg.bot .body em { font-style: italic; }
.msg.bot .body code { background: var(--elevated); padding: 1px 6px; border-radius: 4px; font-size: 0.92em; }
.msg.bot .body h3, .msg.bot .body h4 { font-size: 16px; font-weight: 700; margin: 16px 0 8px; }
.msg.err .body { color: #FF8A7A; }

.typing { display: inline-flex; gap: 5px; padding: 6px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-2); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.composer {
  display: flex; align-items: flex-end; gap: 10px;
  margin: 8px 16px 6px; padding: 8px 8px 8px 18px;
  background: var(--surface); border-radius: 26px;
}
.composer textarea {
  flex: 1; resize: none; border: none; outline: none; background: transparent;
  color: var(--fg); font: inherit; font-size: 16px; line-height: 1.5;
  max-height: 160px; padding: 9px 0;
}
.composer textarea::placeholder { color: var(--fg-2); }
.send {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--accent); color: var(--fg-on-accent); cursor: pointer;
  display: grid; place-items: center;
}
.send:hover { background: var(--accent-hover); }
.send:disabled { background: var(--elevated); color: var(--fg-2); cursor: default; }

.foot {
  font-size: 12px; color: var(--fg-2); text-align: center;
  padding: 4px 16px calc(10px + env(safe-area-inset-bottom));
}
.foot a { color: var(--fg); }

@media (max-width: 520px) {
  .brand-sub { display: none; }
  .top-actions { gap: 12px; }
}
