/* Base */
:root {
  --bg: #0b1020;
  --surface: #121734;
  --surface-2: #0f1430;
  --text: #e8ebff;
  --muted: #a9b1d6;
  --brand: #6c7bff;
  --brand-2: #6cf5ff;
  --accent: #3ee2a8;
  --warn: #ff9f6e;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(26,33,80,0.8), transparent),
    radial-gradient(1200px 600px at 100% 0%, rgba(19,32,82,0.7), transparent),
    linear-gradient(120deg, #0b1020, #0b1020);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
}

.bg-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.35; }

.container { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(130%) blur(8px); background: color-mix(in oklab, var(--bg), transparent 65%); border-bottom: 1px solid rgba(255,255,255,0.06); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.3px; }
.brand-name { font-size: 1.05rem; }
.logo-dot { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 0 18px rgba(108, 123, 255, 0.75); }
.nav { display: inline-flex; align-items: center; gap: 14px; }
.nav-link { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.nav-link:hover { color: var(--text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; text-decoration: none; color: var(--text); background: transparent; cursor: pointer; transition: transform 0.06s ease, background 0.2s ease, border 0.2s ease; }
.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.18); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border: none; color: #05060f; font-weight: 700; box-shadow: 0 8px 24px rgba(108, 123, 255, 0.25); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: rgba(255,255,255,0.05); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 18px; font-size: 1.05rem; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.icon-btn { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.16); }
.icon { width: 18px; height: 18px; display: inline-block; }

/* Hero */
.hero { padding: 56px 0 24px; }
.hero-inner { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 28px; align-items: center; }
.hero h1 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 44px); line-height: 1.1; letter-spacing: -0.02em; }
.hero p { color: var(--muted); margin: 8px 0; }
.hero-ctas { margin-top: 18px; display: flex; gap: 12px; }
.hero-art { position: relative; min-height: 260px; }
.blob { width: 100%; height: 260px; border-radius: 24px; background: conic-gradient(from 180deg at 50% 50%, rgba(108,123,255,0.3), rgba(108,245,255,0.25), rgba(62,226,168,0.25), rgba(108,123,255,0.3)); filter: blur(20px) saturate(140%); box-shadow: inset 0 0 140px rgba(108,123,255,0.28); }

.hero .brand-glow { background: linear-gradient(90deg, #c6d0ff, #6cf5ff, #3ee2a8); -webkit-background-clip: text; background-clip: text; color: transparent; animation: hue 12s linear infinite; }
@keyframes hue { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }

/* Sections */
.section { padding: 42px 0; }
.section-alt { background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0)); border-top: 1px solid rgba(255,255,255,0.06); }

h2 { margin: 0 0 16px; letter-spacing: -0.01em; }

.card { background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; padding: 18px; box-shadow: 0 6px 24px rgba(0,0,0,0.24); }
.card:hover { box-shadow: 0 10px 30px rgba(108,123,255,0.16); transform: translateY(-1px); transition: all .2s ease; }
.card-title { margin: 0 0 8px; }

.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.about-img { width: 100%; height: 220px; object-fit: cover; border-radius: 12px; border: 1px solid rgba(255,255,255,0.06); }

/* Auth */
.auth-container { max-width: 520px; }
.auth-card { padding: 0; overflow: hidden; }
.tabbar { display: grid; grid-template-columns: 1fr 1fr; }
.tab { background: transparent; border: none; color: var(--muted); padding: 14px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.06); }
.tab.active { color: var(--text); border-bottom: 2px solid var(--brand); font-weight: 700; }
.auth-form { display: none; padding: 18px; }
.auth-form.active { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 0.95rem; color: var(--muted); }
input { padding: 12px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.04); color: var(--text); }
input:focus { outline: none; border-color: rgba(108,123,255,0.6); box-shadow: 0 0 0 3px rgba(108,123,255,0.18); }

/* Study */
.study-card { max-width: 760px; margin: 0 auto; text-align: center; }
.video-wrap { background: #060916; border-radius: 12px; border: 1px solid rgba(255,255,255,0.06); overflow: hidden; }
video { width: 100%; max-height: 60vh; display: block; background: #000; }
.actions { margin-top: 14px; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 8px 0 0; }

/* Results */
.results-container h1 { margin-top: 0; }
.results-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.meter { position: relative; height: 12px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--brand-2)); transition: width 420ms cubic-bezier(.2,.8,.2,1); box-shadow: inset 0 0 8px rgba(62,226,168,0.35); position: relative; }
.meter span::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent); transform: translateX(-100%); animation: sweep 2.8s ease-in-out infinite; }
@keyframes sweep { 0% { transform: translateX(-100%); } 50% { transform: translateX(0%); } 100% { transform: translateX(100%); } }
.meter-warn span { background: linear-gradient(90deg, #ff6e6e, var(--warn)); }
.suggestions { margin: 0; padding-left: 18px; color: var(--muted); }
.ai-reco-placeholder { min-height: 140px; border: 1px dashed rgba(255,255,255,0.14); border-radius: 10px; padding: 12px; color: var(--muted); position: relative; overflow: hidden; }
.ai-reco { animation: typeIn 900ms steps(30, end) 1; white-space: pre-wrap; }

@keyframes typeIn {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

/* Chat */
.chat-messages { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 10px; }
.chat-msg { padding: 6px 0; border-bottom: 1px dashed rgba(255,255,255,0.06); }
.chat-msg:last-child { border-bottom: none; }
.chat-input input { transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; margin-left: 6px; opacity: 0.9; }
.typing-dots span { width: 6px; height: 6px; background: var(--muted); border-radius: 50%; display: inline-block; animation: bounce 1.2s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: .6; } 40% { transform: scale(1); opacity: 1; } }

/* Skeleton */
.skeleton { position: relative; overflow: hidden; background: rgba(255,255,255,0.06); border-radius: 8px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0% { transform: translateX(-100%);} 100% { transform: translateX(100%);} }
.skeleton.block { height: 18px; margin: 6px 0; }

/* Confetti */
.confetti-canvas { position: fixed; inset: 0; z-index: 30; pointer-events: none; }

/* Modal */
.modal.hidden { display: none; }
.modal .backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(3px); }
.modal .modal-card { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 16px; width: min(92vw, 420px); box-shadow: 0 12px 40px rgba(0,0,0,0.4); }
.modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* Connection pill */
.conn-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); color: var(--muted); font-size: 12px; }
.conn-pill.ok { color: #0f0; border-color: rgba(0,255,0,0.25); }
.conn-pill.warn { color: #ffb000; border-color: rgba(255,176,0,0.25); }
.conn-pill.err { color: #ff6060; border-color: rgba(255,96,96,0.25); }

/* Footer */
.site-footer { border-top: 1px solid rgba(255,255,255,0.06); padding: 18px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }

/* Responsive */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .about-grid { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr; }
}
