:root {
  --bg: #0B1210;
  --bg-elev: #10201c;
  --bg-elev-2: #16302a;
  --text: #EAF3EF;
  --text-dim: #9db3ac;
  --mint: #38E1B0;
  --mint-dim: #1f6e59;
  --user-bubble: #1c3630;
  --ai-bubble: transparent;
  --border: #1e332d;
  --danger: #ff8383;
  --radius: 18px;
  --maxw: 780px;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; background: var(--mint); color: #06110d; padding: 8px 14px; border-radius: 10px; z-index: 999; }

#topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11,18,16,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 980px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
}
.icon-btn {
  background: none; border: none; color: var(--text);
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-elev); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); margin-right: auto; }
.orb {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 30% 30%, #7CFFDB, var(--mint) 55%, #0d8a6c 100%);
  box-shadow: 0 0 14px rgba(56,225,176,.55);
}
.wordmark { font-weight: 600; font-size: 1.05rem; letter-spacing: .2px; }
.wordmark b { font-weight: 800; color: var(--mint); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.account-btn {
  background: var(--mint); color: #06120d; border: none;
  font-weight: 700; font-size: .88rem;
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
}
.account-btn.signed-in { background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border); }

#history-drawer {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
}
#history-drawer[data-open="true"] { pointer-events: auto; }
.drawer-scrim {
  position: absolute; inset: 0; background: rgba(0,0,0,.5);
  opacity: 0; transition: opacity .2s;
}
#history-drawer[data-open="true"] .drawer-scrim { opacity: 1; }
.drawer-inner {
  position: absolute; top: 0; left: 0; bottom: 0; width: min(300px, 84vw);
  background: var(--bg-elev); border-right: 1px solid var(--border);
  padding: 16px; overflow-y: auto;
  transform: translateX(-100%); transition: transform .22s ease;
}
#history-drawer[data-open="true"] .drawer-inner { transform: translateX(0); }
.drawer-inner h2 { font-size: 1rem; margin: 4px 0 12px; }
#history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
#history-list li button {
  width: 100%; text-align: left; background: none; border: none; color: var(--text);
  padding: 10px 10px; border-radius: 10px; cursor: pointer; font-size: .9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#history-list li button:hover { background: var(--bg-elev-2); }
.drawer-empty { color: var(--text-dim); font-size: .85rem; }

#main { min-height: calc(100vh - 60px); }

.landing { max-width: var(--maxw); margin: 0 auto; padding: 40px 18px 60px; }
.hero { text-align: center; padding: 24px 0 8px; position: relative; }
.hero-orb {
  width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #a6ffe9, var(--mint) 55%, #0d8a6c 100%);
  box-shadow: 0 0 40px rgba(56,225,176,.45);
}
.hero h1 { font-size: clamp(1.6rem, 4.4vw, 2.6rem); line-height: 1.15; margin: 0 0 14px; font-weight: 800; }
.hero .lead { color: var(--text-dim); font-size: 1.02rem; max-width: 560px; margin: 0 auto; line-height: 1.55; }

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 26px; padding: 10px 10px 10px 18px;
}
.composer textarea {
  flex: 1; resize: none; background: none; border: none; outline: none;
  color: var(--text); font-size: 1rem; font-family: inherit; line-height: 1.4;
  max-height: 160px; padding: 6px 0;
}
.composer textarea::placeholder { color: var(--text-dim); }
.send-btn {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--mint); color: #06120d; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.send-btn:disabled { opacity: .4; cursor: default; }
.composer-landing { margin: 28px auto 0; max-width: 640px; }

.chip-row {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin: 16px auto 0; max-width: 640px;
}
.chip {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  font-size: .84rem; padding: 8px 14px; border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--mint-dim); }

.showcase { margin-top: 56px; text-align: center; }
.showcase h2 { font-size: 1.4rem; margin: 0 0 4px; }
.showcase-sub { color: var(--text-dim); margin: 0 0 20px; font-size: .92rem; }
.category-tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px; }
.category-tab {
  background: none; border: 1px solid var(--border); color: var(--text-dim);
  font-size: .8rem; padding: 6px 13px; border-radius: 999px; cursor: pointer;
}
.category-tab[aria-pressed="true"] { background: var(--mint); color: #06120d; border-color: var(--mint); font-weight: 700; }

.solutions-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px; text-align: left;
}
.solution-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; display: flex; flex-direction: column; gap: 6px;
}
.solution-card h3 { margin: 0; font-size: .98rem; }
.solution-card p { margin: 0; color: var(--text-dim); font-size: .84rem; line-height: 1.4; }
.status-badge {
  align-self: flex-start; font-size: .68rem; font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
}
.status-badge.live { background: rgba(56,225,176,.16); color: var(--mint); }
.status-badge.building { background: rgba(255,200,87,.16); color: #ffc857; }
.status-badge.planned { background: rgba(255,255,255,.08); color: var(--text-dim); }

.plans-teaser { margin-top: 56px; text-align: center; }
.plans-teaser h2 { font-size: 1.4rem; margin: 0 0 4px; }
.plans-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-top: 20px;
}
.plan-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px; padding: 20px 14px;
}
.plan-card.featured { border-color: var(--mint); box-shadow: 0 0 0 1px var(--mint) inset; }
.plan-card h3 { margin: 0 0 6px; font-size: .95rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; }
.plan-card .price { font-size: 1.6rem; font-weight: 800; margin: 0 0 4px; }
.plan-card .price span { font-size: .75rem; font-weight: 500; color: var(--text-dim); }
.plan-card p.note { color: var(--text-dim); font-size: .78rem; margin: 0; }

.chat { display: flex; flex-direction: column; height: calc(100vh - 60px); max-width: var(--maxw); margin: 0 auto; }
#thread { flex: 1; overflow-y: auto; padding: 20px 16px 10px; }
.msg { display: flex; gap: 10px; margin-bottom: 20px; max-width: 100%; }
.msg .avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; margin-top: 2px; }
.msg.user .avatar { background: var(--bg-elev-2); }
.msg.assistant .avatar { background: radial-gradient(circle at 30% 30%, #a6ffe9, var(--mint) 55%, #0d8a6c 100%); }
.msg .bubble { line-height: 1.55; font-size: .97rem; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { flex-direction: row-reverse; margin-left: auto; }
.msg.user .bubble { background: var(--user-bubble); padding: 10px 14px; border-radius: 16px; }
.msg .route-tag { display: block; margin-top: 6px; font-size: .72rem; color: var(--text-dim); }
.msg .route-tag a { color: var(--mint); text-decoration: none; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100%{opacity:.2} 40%{opacity:1} }

.composer-dock { padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg); }
.disclaimer { text-align: center; color: var(--text-dim); font-size: .72rem; margin: 8px 0 0; }

#notice {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--bg-elev-2); color: var(--text); padding: 10px 18px; border-radius: 12px;
  font-size: .85rem; z-index: 60; display: none; box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
#notice.show { display: block; }

dialog#modal { background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 24px; max-width: 360px; width: calc(100vw - 40px); }
dialog#modal::backdrop { background: rgba(0,0,0,.55); }
dialog#modal h2 { margin-top: 0; }
dialog#modal .button { display: inline-block; background: var(--mint); color: #06120d; font-weight: 700; padding: 10px 18px; border-radius: 999px; text-decoration: none; margin-top: 10px; }
dialog#modal .row { display: flex; gap: 10px; margin-top: 14px; }

@media (max-width: 640px) {
  .wordmark { font-size: .98rem; }
  .hero { padding-top: 8px; }
  .composer-landing { margin-top: 20px; }
  .solutions-grid { grid-template-columns: 1fr 1fr; }
  .plans-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .solutions-grid { grid-template-columns: 1fr; }
}
