:root {
  --ink: #17171f;
  --ink-soft: #55556b;
  --muted: #8888a0;
  --bg: #fafaf9;
  --card: #ffffff;
  --border: #ecebf3;
  --primary: #5b3df6;
  --primary-dark: #4527e0;
  --accent: #ff7a45;
  --accent-soft: #fff1ea;
  --primary-soft: #f0edff;
  --success: #1f9d55;
  --success-soft: #eafaf0;
  --danger: #e0355b;
  --danger-soft: #fdeaef;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(23, 23, 31, 0.06);
  --shadow-lg: 0 20px 60px rgba(23, 23, 31, 0.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: 'Sora', 'Inter', sans-serif; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
a { color: inherit; text-decoration: none; }

.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250,250,249,0.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 19px; display: flex; gap: 8px; align-items: center; }
.nav-links { display: flex; align-items: center; gap: 22px; font-size: 14.5px; font-weight: 500; }
.nav-links a { color: var(--ink-soft); transition: color .15s; }
.nav-links a:hover { color: var(--ink); }
.nav-usage { font-size: 13px; color: var(--muted); margin-right: 4px; padding: 5px 10px; background: var(--primary-soft); border-radius: 20px; }
#navUserArea { display: flex; align-items: center; gap: 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 14.5px;
  padding: 11px 20px; border-radius: 11px; border: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(91,61,246,0.28); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f5f5f8; }
.btn-lg { padding: 14px 26px; font-size: 15.5px; border-radius: 13px; }
.btn-small { padding: 8px 16px; font-size: 13.5px; border-radius: 9px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.screen { display: none; animation: fadeIn .35s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.screen-narrow { max-width: 640px; margin: 48px auto; padding: 0 20px; }
.screen-wide { max-width: 880px; margin: 48px auto; padding: 0 20px; }

.hero { padding: 96px 24px 72px; background: radial-gradient(1200px 500px at 50% -10%, #efe9ff 0%, rgba(239,233,255,0) 60%), var(--bg); }
.hero-inner { max-width: 760px; margin: 0 auto; text-align: center; }
.hero-badge {
  display: inline-block; font-size: 13px; font-weight: 600; color: var(--primary-dark);
  background: var(--primary-soft); padding: 7px 14px; border-radius: 20px; margin-bottom: 22px;
}
.hero h1 { font-size: 46px; line-height: 1.12; font-weight: 800; }
.grad-text { background: linear-gradient(100deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { display: block; margin: 22px auto 0; font-size: 17.5px; line-height: 1.6; color: var(--ink-soft); max-width: 560px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.hero-note { margin-top: 18px; font-size: 13.5px; color: var(--muted); }

.features { padding: 20px 24px 80px; }
.features-inner { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px; box-shadow: var(--shadow); }
.feature-icon { font-size: 30px; margin-bottom: 14px; }
.feature-card h3 { font-size: 17px; margin-bottom: 8px; }
.feature-card p { font-size: 14.5px; color: var(--ink-soft); line-height: 1.55; }

.pricing { padding: 20px 24px 100px; }
.pricing-inner { max-width: 1080px; margin: 0 auto; text-align: center; }
.pricing-inner h2 { font-size: 32px; }
.pricing-sub { margin-top: 10px; color: var(--ink-soft); font-size: 15.5px; }
.pricing-grid { margin-top: 40px; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; text-align: left; }
.plan-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 22px; display: flex; flex-direction: column; box-shadow: var(--shadow); position: relative;
}
.plan-card.featured { border: 2px solid var(--primary); box-shadow: var(--shadow-lg); transform: translateY(-6px); }
.plan-badge {
  position: absolute; top: -12px; right: 18px; background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
}
.plan-name { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 17px; }
.plan-price { font-size: 30px; font-weight: 800; margin: 10px 0 4px; font-family: 'Sora', sans-serif; }
.plan-price span { font-size: 13px; font-weight: 500; color: var(--muted); }
.plan-features { list-style: none; padding: 0; margin: 18px 0 22px; display: flex; flex-direction: column; gap: 9px; }
.plan-features li { font-size: 13.5px; color: var(--ink-soft); padding-left: 20px; position: relative; }
.plan-features li:before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 700; }
.plan-current { text-align: center; font-size: 13px; font-weight: 600; color: var(--primary); padding: 10px; }

.site-footer { text-align: center; padding: 32px 24px 48px; color: var(--muted); font-size: 13.5px; }

.auth-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px 32px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 24px; }
.auth-sub { margin-top: 6px; color: var(--ink-soft); font-size: 14.5px; }
#authForm { margin-top: 24px; display: flex; flex-direction: column; gap: 6px; }
#authForm label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-top: 10px; }
#authForm input {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); font-size: 14.5px; font-family: inherit;
}
#authForm input:focus { outline: none; border-color: var(--primary); }
#authForm button { margin-top: 18px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--ink-soft); }
.auth-switch a { color: var(--primary); font-weight: 600; margin-left: 4px; }

.alert { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin: 14px 0; }
.alert-error { background: var(--danger-soft); color: var(--danger); }

.dash-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-header h2 { font-size: 26px; }
.usage-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 20px; min-width: 220px; box-shadow: var(--shadow); }
.usage-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.usage-bar-track { height: 8px; background: var(--border); border-radius: 8px; margin: 10px 0 8px; overflow: hidden; }
.usage-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 8px; transition: width .3s ease; }
.usage-text { font-size: 13px; color: var(--ink-soft); }
.usage-upgrade { display: inline-block; margin-top: 10px; font-size: 12.5px; font-weight: 700; color: var(--primary); }

.setup-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.setup-label { display: block; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 0 12px; }
.setup-label:first-child { margin-top: 0; }

.chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.chip {
  border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; transition: all .15s; background: #fff; position: relative;
}
.chip:hover { border-color: var(--primary); }
.chip.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.chip.locked { opacity: .5; cursor: not-allowed; }
.chip.locked:hover { border-color: var(--border); }
.chip .lock-tag { margin-left: auto; font-size: 10.5px; background: var(--accent-soft); color: var(--accent); padding: 2px 6px; border-radius: 8px; }
.chip-grid-style .chip { flex-direction: column; align-items: flex-start; gap: 4px; }
.chip-grid-style .chip small { font-weight: 400; color: var(--muted); font-size: 11.5px; }

.custom-role { margin-top: 12px; }
.custom-role input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); font-size: 14px; font-family: inherit;
}

.pillrow { display: flex; gap: 10px; }
.pill {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--border); display: flex; align-items: center;
  justify-content: center; font-weight: 700; cursor: pointer; transition: all .15s; background: #fff;
}
.pill:hover { border-color: var(--primary); }
.pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.progress-line { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; font-weight: 600; }
.question { font-size: 19px; font-weight: 700; line-height: 1.4; margin-bottom: 20px; font-family: 'Sora', sans-serif; }
.controlsrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mic-btn {
  display: flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 24px; border: none; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 700;
}
.mic-btn.recording { background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(224,53,91,.4); } 70% { box-shadow: 0 0 0 12px rgba(224,53,91,0); } 100% { box-shadow: 0 0 0 0 rgba(224,53,91,0); } }
textarea#typedAnswer {
  width: 100%; margin-top: 14px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); font-size: 14px;
  font-family: inherit; min-height: 90px; resize: vertical;
}
.transcript-box {
  background: #faf9fc; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-top: 16px;
  font-size: 14.5px; line-height: 1.55; min-height: 44px; white-space: pre-wrap;
}
#submitBtn, #nextBtn { margin-top: 16px; }
.loading { color: var(--muted); font-size: 13.5px; font-style: italic; margin-top: 14px; }
.feedback-box { background: var(--success-soft); border: 1px solid #cdecd9; border-radius: 12px; padding: 16px 18px; margin-top: 16px; }
.feedback-box h3 { font-size: 12px; text-transform: uppercase; color: var(--success); letter-spacing: .04em; margin-bottom: 8px; }
.feedback-box #feedbackText { font-size: 14px; line-height: 1.6; color: #235c37; }
.stat-row { display: flex; gap: 20px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.stat-row b { color: var(--ink); }
.summary-text { font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; margin: 18px 0; color: var(--ink-soft); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(23,23,31,0.5); display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px; backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 32px; max-width: 900px; width: 100%; max-height: 86vh; overflow-y: auto;
  position: relative; box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute; top: 18px; right: 18px; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted);
}
.modal h2 { font-size: 22px; }

.tools-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px; box-shadow: var(--shadow); margin-top: 20px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 12px; }
.tool-tile {
  border: 1.5px solid var(--border); border-radius: 12px; padding: 16px; cursor: pointer; background: #fff; transition: all .15s;
}
.tool-tile:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.tool-tile-icon { font-size: 22px; margin-bottom: 8px; }
.tool-tile-name { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.tool-tile-desc { font-size: 12.5px; color: var(--muted); line-height: 1.4; }

.tool-tabs { display: flex; gap: 8px; margin: 20px 0; flex-wrap: wrap; }
.tool-tab {
  padding: 9px 16px; border-radius: 20px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  background: #fff; border: 1.5px solid var(--border); color: var(--ink-soft); transition: all .15s;
}
.tool-tab:hover { border-color: var(--primary); }
.tool-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tool-panel.hidden { display: none; }

.tool-usage { font-size: 12.5px; font-weight: 600; color: var(--primary-dark); background: var(--primary-soft); display: inline-block; padding: 5px 12px; border-radius: 20px; margin-bottom: 16px; }
.tool-panel input[type="text"], .tool-panel input[type="file"] {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); font-size: 14px; font-family: inherit; margin-bottom: 4px;
}
.tool-textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); font-size: 14px;
  font-family: inherit; min-height: 140px; resize: vertical; margin-bottom: 4px;
}
.tool-panel .setup-label:first-of-type { margin-top: 0; }
.tool-panel button.btn { margin-top: 18px; }
.tool-result {
  background: #faf9fc; border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-top: 18px;
  font-size: 14px; line-height: 1.65; white-space: pre-wrap;
}
.tool-result ul.jd-question-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.tool-result ul.jd-question-list li { padding: 12px 14px; background: #fff; border: 1px solid var(--border); border-radius: 10px; font-weight: 600; font-size: 14px; }

@media (max-width: 760px) {
  .nav-links { gap: 12px; font-size: 13px; }
  .hero h1 { font-size: 32px; }
  .features-inner { grid-template-columns: 1fr; }
  .dash-header { flex-direction: column; }
}
