:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent-bg: #eff6ff;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.15rem; }
.brand-badge {
  background: var(--text);
  color: #38bdf8;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
}
.brand-tld { color: var(--primary); }
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-links a { text-decoration: none; color: var(--muted); font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover { color: var(--text); }

/* Hero */
.hero { padding: 56px 0 28px; text-align: center; }
.pill {
  display: inline-block;
  background: var(--accent-bg);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.15; margin-bottom: 14px; letter-spacing: -0.02em; }
.hero-sub { max-width: 660px; margin: 0 auto; color: var(--muted); font-size: 1.1rem; }

/* Sections & Cards */
.section { padding: 36px 0; }
.section-alt { background: #f1f5f9; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { margin-bottom: 22px; }
.section-head h2 { font-size: 1.6rem; margin-bottom: 6px; }
.section-head p { color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: 1fr 1.15fr; gap: 24px; align-items: start; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h2 { font-size: 1.25rem; }
.badge { background: var(--accent-bg); color: var(--primary); font-size: 0.8rem; font-weight: 700; padding: 4px 10px; border-radius: 6px; }

/* Mode Toggle */
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--bg); padding: 6px; border-radius: 10px; margin-bottom: 20px; }
.mode-btn {
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}
.mode-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* Forms */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }

.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.btn-primary, .btn-outline, .btn-dark {
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary { background: var(--primary); color: #fff; flex: 1; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-dark { background: var(--text); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

.quick-roles { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.quick-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }

/* Results */
.results-list { display: flex; flex-direction: column; gap: 12px; }
.result-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--bg);
}
.result-text { font-weight: 500; font-size: 0.98rem; margin-bottom: 10px; color: var(--text); }
.result-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.char-pill { font-size: 0.78rem; color: var(--muted); }
.result-actions { display: flex; gap: 6px; }

.affiliate-box {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--accent-bg);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.affiliate-box p { font-size: 0.85rem; color: var(--muted); }

/* Sandbox & Previews */
.meter-row { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 20px; font-size: 0.88rem; }
.counter-ok { font-weight: 700; color: #15803d; }
.counter-warn { font-weight: 700; color: #b91c1c; }
.hook-badge { color: var(--muted); }

.preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.preview-card { border: 1px solid var(--border); border-radius: 10px; padding: 16px; background: var(--bg); }
.preview-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 12px; }
.mock-user { display: flex; gap: 10px; align-items: flex-start; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; font-size: 0.85rem; }
.mock-name { font-weight: 700; font-size: 0.9rem; }
.mock-headline { font-size: 0.85rem; color: var(--muted); word-break: break-word; }
.mock-meta { font-size: 0.78rem; color: #64748b; margin-top: 2px; }

.mock-resume { text-align: center; background: #fff; padding: 14px; border: 1px solid var(--border); border-radius: 6px; }
.resume-name { font-weight: 800; letter-spacing: 0.08em; font-size: 0.95rem; }
.resume-headline { font-size: 0.85rem; font-weight: 600; color: var(--primary); margin: 4px 0; }
.resume-meta { font-size: 0.72rem; color: var(--muted); }

/* Role Library */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.role-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.role-card:hover { border-color: var(--primary); }
.role-card h3 { font-size: 1rem; margin-bottom: 6px; }
.role-card p { font-size: 0.82rem; color: var(--muted); }

/* FAQ */
.faq-wrap { max-width: 780px; }
.faq-wrap h2 { margin-bottom: 16px; }
details { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; margin-bottom: 10px; }
summary { font-weight: 700; cursor: pointer; }
details p { margin-top: 8px; color: var(--muted); font-size: 0.95rem; }

/* Drawer */
.drawer { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: none; justify-content: flex-end; z-index: 50; }
.drawer.open { display: flex; }
.drawer-panel { width: min(420px, 100%); background: var(--surface); height: 100%; padding: 24px; overflow-y: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.saved-list { display: flex; flex-direction: column; gap: 12px; }

/* Footer & Toast */
.site-footer { padding: 28px 0; border-top: 1px solid var(--border); background: var(--surface); font-size: 0.9rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--text); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 60;
}
.toast.show { opacity: 1; }

@media (max-width: 860px) {
  .grid-2, .preview-grid { grid-template-columns: 1fr; }
  .nav-links a { display: none; }
}
