* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1c1c26;
  --border: #2a2a3a;
  --primary: #ff4d6d;
  --primary-glow: rgba(255,77,109,0.3);
  --accent: #a855f7;
  --text: #f0f0f8;
  --muted: #7a7a9a;
  --radius: 12px;
}
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; line-height: 1.6; }
a { color: inherit; text-decoration: none; }

/* Buttons */
.btn-primary { background: var(--primary); color: white; padding: 12px 24px; border-radius: var(--radius); font-weight: 600; transition: all 0.2s; display: inline-block; border: none; cursor: pointer; font-size: 15px; }
.btn-primary:hover { background: #e63d5a; transform: translateY(-1px); box-shadow: 0 8px 24px var(--primary-glow); }
.btn-ghost { border: 1px solid var(--border); color: var(--text); padding: 12px 24px; border-radius: var(--radius); font-weight: 600; transition: all 0.2s; display: inline-block; background: transparent; cursor: pointer; font-size: 15px; }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-lg { padding: 16px 36px; font-size: 17px; }
.btn-full { width: 100%; text-align: center; display: block; }

/* Nav */
.nav { position: sticky; top: 0; z-index: 100; background: rgba(10,10,15,0.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 16px 0; }
.nav-inner { max-width: 1100px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 20px; font-weight: 700; }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: var(--muted); font-size: 15px; transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }

/* Hero */
.hero { max-width: 1100px; margin: 0 auto; padding: 80px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }
.hero h1 { font-size: 52px; font-weight: 800; line-height: 1.1; margin-bottom: 20px; }
.gradient-text { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-sub { color: var(--muted); font-size: 18px; margin-bottom: 32px; max-width: 440px; }
.hero-note { color: var(--muted); font-size: 13px; margin-top: 12px; }
.hero-gremlins { display: flex; flex-direction: column; gap: 12px; }

/* Gremlin Cards */
.gremlin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; position: relative; transition: all 0.2s; }
.gremlin-card.featured { border-color: var(--primary); box-shadow: 0 0 24px var(--primary-glow); }
.gremlin-badge, .plan-badge { position: absolute; top: -10px; right: 16px; background: var(--primary); color: white; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.5px; }
.gremlin-avatar { font-size: 28px; margin-bottom: 6px; }
.gremlin-name { font-weight: 700; font-size: 17px; }
.gremlin-tag { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.gremlin-preview { color: var(--text); font-size: 14px; font-style: italic; background: var(--surface2); padding: 10px 14px; border-radius: 8px; border-left: 3px solid var(--primary); }

/* How it works */
.how-it-works { background: var(--surface); padding: 80px 24px; text-align: center; }
.how-it-works h2, .plans h2 { font-size: 36px; font-weight: 800; margin-bottom: 12px; }
.steps { display: flex; gap: 40px; max-width: 900px; margin: 48px auto 0; }
.step { flex: 1; }
.step-num { width: 48px; height: 48px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; margin: 0 auto 16px; }
.step h3 { font-size: 18px; margin-bottom: 8px; }
.step p { color: var(--muted); }

/* Plans */
.plans { padding: 80px 24px; text-align: center; max-width: 1100px; margin: 0 auto; }
.plans-sub { color: var(--muted); margin-bottom: 48px; }
.plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.plan-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 24px; position: relative; text-align: left; }
.plan-card.featured { border-color: var(--primary); box-shadow: 0 0 32px var(--primary-glow); }
.plan-name { font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.plan-price { font-size: 40px; font-weight: 800; margin-bottom: 24px; }
.plan-price span { font-size: 16px; color: var(--muted); font-weight: 400; }
.plan-features { list-style: none; margin-bottom: 28px; display: flex; flex-direction: column; gap: 10px; }
.plan-features li { color: var(--muted); font-size: 15px; }
.plan-features li:first-child { color: var(--text); }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 48px 24px; text-align: center; }
.footer-inner { max-width: 600px; margin: 0 auto; }
.footer .logo { margin-bottom: 12px; }
.footer p { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.footer-legal a { color: var(--primary); }

/* Auth pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-box { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; }
.auth-logo { text-align: center; font-size: 32px; margin-bottom: 8px; }
.auth-title { text-align: center; font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 32px; font-size: 14px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.form-group input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; color: var(--text); font-size: 15px; transition: border-color 0.2s; }
.form-group input:focus { outline: none; border-color: var(--primary); }
.auth-footer { text-align: center; margin-top: 20px; color: var(--muted); font-size: 14px; }
.auth-footer a { color: var(--primary); font-weight: 600; }
.error-msg { background: rgba(255,77,109,0.1); border: 1px solid var(--primary); color: var(--primary); padding: 12px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; display: none; }

/* Chat page */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.sidebar-title { font-weight: 700; }
.pack-badge { font-size: 11px; background: var(--primary); color: white; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; font-weight: 700; }
.gremlin-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.gremlin-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; cursor: pointer; transition: all 0.15s; border: 1px solid transparent; }
.gremlin-item:hover { background: var(--surface2); }
.gremlin-item.active { background: var(--surface2); border-color: var(--primary); }
.gremlin-item-avatar { font-size: 28px; }
.gremlin-item-info { flex: 1; min-width: 0; }
.gremlin-item-name { font-weight: 600; font-size: 15px; }
.gremlin-item-tag { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.upgrade-banner { background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 10px; padding: 14px; text-align: center; margin-bottom: 12px; }
.upgrade-banner p { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.upgrade-banner a { font-size: 12px; background: white; color: var(--primary); padding: 5px 14px; border-radius: 20px; font-weight: 700; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.user-name { font-size: 14px; font-weight: 600; }
.user-pack { font-size: 12px; color: var(--muted); }
.logout-btn { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.logout-btn:hover { color: var(--primary); }

/* Chat area */
.chat-area { display: flex; flex-direction: column; }
.chat-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; }
.chat-gremlin-avatar { font-size: 36px; }
.chat-gremlin-name { font-weight: 700; font-size: 18px; }
.chat-gremlin-status { font-size: 13px; color: #4ade80; }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.message { display: flex; gap: 10px; max-width: 75%; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message-bubble { padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.5; }
.message.gremlin .message-bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 4px 16px 16px 16px; }
.message.user .message-bubble { background: var(--primary); border-radius: 16px 4px 16px 16px; }
.message-avatar { font-size: 24px; align-self: flex-end; }
.typing-indicator { display: none; align-items: center; gap: 6px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px 16px 16px 16px; width: fit-content; }
.typing-dot { width: 8px; height: 8px; background: var(--muted); border-radius: 50%; animation: typing 1.2s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }
.chat-input-area { padding: 20px 24px; border-top: 1px solid var(--border); display: flex; gap: 12px; }
.chat-input { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; color: var(--text); font-size: 15px; resize: none; max-height: 120px; font-family: inherit; }
.chat-input:focus { outline: none; border-color: var(--primary); }
.send-btn { background: var(--primary); border: none; border-radius: 12px; padding: 14px 20px; color: white; cursor: pointer; font-size: 18px; transition: all 0.2s; align-self: flex-end; }
.send-btn:hover { background: #e63d5a; transform: translateY(-1px); }
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 40px; }
.empty-state .big-avatar { font-size: 72px; margin-bottom: 16px; }
.empty-state h3 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 8px; }

/* Admin / HQ */
.hq-layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.hq-nav { background: var(--surface); border-right: 1px solid var(--border); padding: 24px 0; }
.hq-logo { padding: 0 20px 24px; font-weight: 700; font-size: 16px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.hq-link { display: block; padding: 10px 20px; color: var(--muted); font-size: 14px; transition: all 0.15s; }
.hq-link:hover, .hq-link.active { color: var(--text); background: var(--surface2); }
.hq-main { padding: 40px; }
.hq-title { font-size: 28px; font-weight: 800; margin-bottom: 32px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 40px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-value { font-size: 36px; font-weight: 800; }
.stat-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; padding: 40px 20px; }
  .hero h1 { font-size: 36px; }
  .hero-gremlins { display: none; }
  .steps { flex-direction: column; }
  .plans-grid { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
