* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #08080e;
  --bg2: #0d0d1a;
  --bg3: #13132a;
  --surface: #1a1a35;
  --surface2: #222248;
  --border: #2a2a50;
  --text: #e4e4f0;
  --text2: #9898b8;
  --text3: #686888;
  --accent: #06b6d4;
  --accent2: #0891b2;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;
  --mono: 'SF Mono','Fira Code','Fira Mono',Menlo,Consolas,monospace;
}
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: #67e8f9; }
::selection { background: rgba(6,182,212,.3); color: #fff; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* Nav */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(8,8,14,.8); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
nav .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
nav .logo { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
nav .logo span { color: var(--accent); }
nav .nav-links { display: flex; gap: 24px; align-items: center; }
nav .nav-links a { color: var(--text2); font-size: 14px; font-weight: 500; transition: color .2s; }
nav .nav-links a:hover { color: var(--text); }
.nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff !important; font-size: 13px; font-weight: 600;
  transition: background .2s, transform .15s;
}
.nav-btn:hover { background: var(--accent2); transform: translateY(-1px); }

/* Hero */
.hero {
  padding: 140px 0 80px; text-align: center;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(6,182,212,.08) 0%, transparent 70%),
              radial-gradient(ellipse 40% 30% at 80% 100%, rgba(16,185,129,.05) 0%, transparent 60%);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: 100px;
  background: rgba(6,182,212,.1); color: var(--accent);
  font-size: 13px; font-weight: 600; margin-bottom: 24px;
  border: 1px solid rgba(6,182,212,.2);
}
.hero h1 { font-size: clamp(40px,6vw,68px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.hero h1 span { background: linear-gradient(135deg, var(--accent), #67e8f9, var(--green)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p {
  font-size: clamp(16px,2vw,20px); color: var(--text2); max-width: 640px;
  margin: 20px auto 36px; line-height: 1.7;
}
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; transition: all .2s;
  border: none; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(6,182,212,.25); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface2); border-color: var(--accent); transform: translateY(-2px); }

/* Stats bar */
.stats-bar {
  display: flex; justify-content: center; gap: 48px; padding: 48px 0 32px;
  flex-wrap: wrap;
}
.stat { text-align: center; }
.stat-num { font-size: 32px; font-weight: 800; color: var(--text); }
.stat-num .accent { color: var(--accent); }
.stat-num .green { color: var(--green); }
.stat-label { font-size: 13px; color: var(--text3); margin-top: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }

/* Sections */
.section { padding: 80px 0; }
.section-title {
  font-size: clamp(24px,3vw,36px); font-weight: 700; letter-spacing: -.02em;
  text-align: center; margin-bottom: 16px;
}
.section-sub { color: var(--text2); text-align: center; max-width: 560px; margin: 0 auto 48px; font-size: 16px; }

/* Architecture */
.arch-grid { display: flex; flex-direction: column; gap: 16px; max-width: 800px; margin: 0 auto; }
.arch-tier {
  display: flex; gap: 20px; align-items: flex-start;
  padding: 24px; border-radius: var(--radius);
  background: var(--bg2); border: 1px solid var(--border);
  transition: border-color .2s, transform .15s;
}
.arch-tier:hover { border-color: var(--accent); transform: translateX(4px); }
.arch-num {
  width: 40px; height: 40px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.arch-num.t0 { background: rgba(6,182,212,.15); color: var(--accent); }
.arch-num.t1 { background: rgba(16,185,129,.15); color: var(--green); }
.arch-num.t2 { background: rgba(245,158,11,.15); color: var(--amber); }
.arch-content h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.arch-content p { font-size: 14px; color: var(--text2); line-height: 1.6; }
.arch-tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; margin-top: 8px;
}
.arch-tag.t0 { background: rgba(6,182,212,.1); color: var(--accent); }
.arch-tag.t1 { background: rgba(16,185,129,.1); color: var(--green); }
.arch-tag.t2 { background: rgba(245,158,11,.1); color: var(--amber); }
.arch-arrow { text-align: center; color: var(--text3); font-size: 20px; }

/* Features */
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.feature-card {
  padding: 28px; border-radius: var(--radius);
  background: var(--bg2); border: 1px solid var(--border);
  transition: border-color .2s, transform .15s;
}
.feature-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.feature-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 14px; }
.feature-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text2); line-height: 1.6; }

/* Code block */
.code-block {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin: 0 auto;
  max-width: 640px;
}
.code-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text3); font-weight: 500;
}
.code-dot { width: 10px; height: 10px; border-radius: 50%; }
.code-dot.r { background: #ef4444; }
.code-dot.y { background: var(--amber); }
.code-dot.g { background: var(--green); }
.code-block pre { padding: 20px; overflow-x: auto; font-size: 13px; line-height: 1.7; font-family: var(--mono); color: var(--text); }
.code-block code { font-family: var(--mono); }
.code-keyword { color: #c084fc; }
.code-string { color: #34d399; }
.code-comment { color: #6b7280; }
.code-fn { color: #60a5fa; }
.code-const { color: #f472b6; }

/* CLI demo */
.cli-demo {
  max-width: 640px; margin: 32px auto 0;
  background: #0a0a0f; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  font-family: var(--mono); font-size: 13px; line-height: 1.8;
}
.cli-prompt { color: var(--green); }
.cli-comment { color: var(--text3); }
.cli-arrow { color: var(--accent); }
.cli-allow { color: var(--green); font-weight: 600; }
.cli-block { color: var(--red); font-weight: 600; }
.cli-flag { color: var(--amber); font-weight: 600; }

/* Playground page */
.playground { padding-top: 80px; }
.playground-input-section { padding: 40px 0 24px; }
.playground-input-section textarea {
  width: 100%; min-height: 140px; padding: 16px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--mono); font-size: 14px; line-height: 1.6;
  resize: vertical; outline: none; transition: border-color .2s;
}
.playground-input-section textarea:focus { border-color: var(--accent); }
.playground-controls {
  display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
}
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-btn {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text2); font-size: 12px;
  font-weight: 500; cursor: pointer; transition: all .2s;
}
.preset-btn:hover { border-color: var(--accent); color: var(--text); background: var(--surface2); }
.preset-btn.active { border-color: var(--accent); background: rgba(6,182,212,.1); color: var(--accent); }

/* Results */
.results-panel {
  display: none; padding: 24px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg2);
  margin-top: 24px;
}
.results-panel.visible { display: block; animation: fadeUp .3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.result-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.verdict-badge {
  padding: 8px 20px; border-radius: 100px; font-size: 18px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}
.verdict-badge.allow { background: rgba(16,185,129,.1); color: var(--green); border: 1px solid rgba(16,185,129,.3); }
.verdict-badge.flag { background: rgba(245,158,11,.1); color: var(--amber); border: 1px solid rgba(245,158,11,.3); }
.verdict-badge.block { background: rgba(239,68,68,.1); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.result-score { font-size: 14px; color: var(--text2); }
.result-score strong { color: var(--text); }
.result-meta { margin-left: auto; text-align: right; font-size: 12px; color: var(--text3); }

/* Score bar */
.score-bar-wrap { margin-bottom: 20px; }
.score-bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text3); margin-bottom: 4px; }
.score-bar {
  height: 8px; border-radius: 4px; background: var(--surface);
  overflow: hidden; position: relative;
}
.score-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width .5s ease, background .5s ease;
  position: relative;
}
.score-bar-fill.allow { background: var(--green); }
.score-bar-fill.flag { background: var(--amber); }
.score-bar-fill.block { background: var(--red); }
.score-thresholds { position: relative; height: 0; }
.score-thresholds .tick {
  position: absolute; top: -20px; width: 1px; height: 12px;
  background: var(--text3); transform: translateX(-50%);
}
.score-thresholds .tick-label { position: absolute; top: -4px; font-size: 10px; color: var(--text3); transform: translateX(-50%); }

/* Details grid */
.result-details { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.result-detail-card {
  padding: 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.result-detail-card h4 { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.result-detail-card .value { font-size: 14px; color: var(--text); font-weight: 500; }
.reason-item {
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
  display: flex; gap: 8px; align-items: flex-start;
}
.reason-item:last-child { border-bottom: none; }
.reason-weight {
  flex-shrink: 0; padding: 1px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
}
.reason-weight.high { background: rgba(239,68,68,.1); color: var(--red); }
.reason-weight.med { background: rgba(245,158,11,.1); color: var(--amber); }
.reason-weight.low { background: rgba(6,182,212,.1); color: var(--accent); }
.reason-code { color: var(--accent); font-family: var(--mono); font-size: 12px; }
.reason-msg { color: var(--text2); font-size: 12px; margin-top: 2px; }
.result-sanitized {
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--bg3); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 12px; color: var(--text2);
  margin-top: 16px; word-break: break-all; max-height: 120px; overflow-y: auto;
}

/* Footer */
footer {
  border-top: 1px solid var(--border); padding: 40px 0;
  text-align: center; color: var(--text3); font-size: 13px;
}
footer a { color: var(--text2); }
footer a:hover { color: var(--text); }
footer .footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 12px; }

/* Responsive */
@media (max-width: 640px) {
  .hero { padding: 100px 0 60px; }
  .stats-bar { gap: 24px; }
  .result-details { grid-template-columns: 1fr; }
  nav .nav-links .nav-hide { display: none; }
}

/* Loading spinner */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Highlight styles for detected text */
.highlight-wrap { line-height: 2; }
.highlight-match {
  background: rgba(239,68,68,.15);
  border-radius: 3px; padding: 1px 0;
  border-bottom: 2px solid var(--red);
}
