:root {
  --bg: #080b12;
  --bg-elev: #0f1420;
  --bg-card: #131927;
  --bg-card-2: #182032;
  --bg-input: #0b101b;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.30);
  --text: #e8edf7;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, 0.14);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --emerald: #34d399;
  --emerald-soft: rgba(52, 211, 153, 0.14);
  --radius: 14px;
  --shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(960px 440px at 10% -6%, rgba(56, 189, 248, 0.12), transparent 62%),
    radial-gradient(880px 440px at 90% -10%, rgba(251, 113, 133, 0.11), transparent 60%),
    radial-gradient(640px 400px at 50% 28%, rgba(167, 139, 250, 0.06), transparent 65%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Category colors */
.cat-personality { --cat-c: #38bdf8; --cat-bg: rgba(56, 189, 248, 0.14); }
.cat-dark_tension { --cat-c: #fb7185; --cat-bg: rgba(251, 113, 133, 0.14); }
.cat-emotional_drama { --cat-c: #a78bfa; --cat-bg: rgba(167, 139, 250, 0.14); }
.cat-family_hierarchy { --cat-c: #fbbf24; --cat-bg: rgba(251, 191, 36, 0.14); }
.cat-tropes_worldview { --cat-c: #34d399; --cat-bg: rgba(52, 211, 153, 0.14); }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px);
  background: rgba(8, 11, 18, 0.86);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1260px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #38bdf8, #a78bfa 52%, #fb7185);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
  color: #080b12;
  letter-spacing: -0.5px;
  box-shadow: 0 0 22px rgba(167, 139, 250, 0.35);
  flex-shrink: 0;
}
.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.brand-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.site-nav {
  display: flex;
  gap: 6px;
  background: var(--bg-elev);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.site-pill {
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.16s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.site-pill:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); text-decoration: none; }
.site-pill.active {
  background: linear-gradient(135deg, rgba(251, 113, 133, 0.22), rgba(167, 139, 250, 0.24));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.42);
}

/* Main container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 18px 64px;
}

/* Hero */
.hero {
  position: relative;
  border-radius: 18px;
  padding: 28px 26px;
  background:
    linear-gradient(135deg, rgba(56, 189, 248, 0.09), rgba(167, 139, 250, 0.09) 48%, rgba(251, 113, 133, 0.09)),
    var(--bg-card);
  border: 1px solid rgba(167, 139, 250, 0.26);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 22px;
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(56, 189, 248, 0.32);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.hero h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3.6vw, 34px);
  line-height: 1.25;
  font-weight: 900;
  background: linear-gradient(95deg, #f8fafc 20%, #bae6fd 60%, #fda4af 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-desc {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 14.5px;
  max-width: 780px;
}

/* Mode Selector */
.mode-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 680px;
  margin-bottom: 18px;
}
@media (max-width: 640px) {
  .mode-bar { grid-template-columns: 1fr; }
}
.mode-card {
  cursor: pointer;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(11, 16, 27, 0.78);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all 0.16s;
}
.mode-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.mode-card.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(167, 139, 250, 0.16));
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25);
}
.mode-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
}
.mode-card-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* One-line prompt box */
.prompt-spotlight {
  background: rgba(8, 11, 18, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.34);
  border-radius: 13px;
  padding: 14px 16px;
}
.prompt-spotlight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.prompt-spotlight-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #bae6fd;
  display: flex;
  align-items: center;
  gap: 7px;
}
.prompt-code-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
}
.prompt-code {
  flex: 1;
  min-width: 240px;
  margin: 0;
  padding: 11px 13px;
  border-radius: 9px;
  background: #060910;
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: #fff; text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  border: none;
  background: linear-gradient(135deg, #38bdf8, #818cf8 55%, #fb7185);
  color: #060910;
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.25);
}
.btn-primary:hover { filter: brightness(1.08); color: #060910; transform: translateY(-1px); }

.btn-soft {
  background: var(--accent-soft);
  border-color: rgba(56, 189, 248, 0.35);
  color: #bae6fd;
}
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 7px; }

/* Entry Tabs Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.entry-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
  background: var(--bg-elev);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
@media (max-width: 720px) {
  .entry-tabs { grid-template-columns: 1fr; }
}
.entry-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.entry-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.entry-tab.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(167, 139, 250, 0.20));
  color: #fff;
  border-color: rgba(56, 189, 248, 0.40);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Steps Grid */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}
@media (max-width: 760px) {
  .steps-grid { grid-template-columns: 1fr; }
}
.step-box {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px;
}
.step-num {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.step-box h4 { margin: 0 0 4px; font-size: 14px; }
.step-box p { margin: 0; font-size: 12.5px; color: var(--text-muted); }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12.5px; font-weight: 700; color: #cbd5e1; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
}
.field textarea { resize: vertical; min-height: 92px; line-height: 1.55; }

.shield-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--emerald-soft);
  border: 1px solid rgba(52, 211, 153, 0.34);
  color: #a7f3d0;
  font-size: 12.5px;
  margin-bottom: 16px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 14px;
}
.check-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* Progress Box */
.progress-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 11px;
  background: var(--bg-elev);
  border: 1px solid rgba(56, 189, 248, 0.32);
}
.progress-bar-bg {
  height: 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
  margin: 10px 0 8px;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #a78bfa, #fb7185);
  transition: width 0.35s ease;
}

/* Manual Q&A items */
.manual-q-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 540px;
  overflow-y: auto;
  padding-right: 4px;
  margin: 14px 0;
}
.manual-q-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
}
.manual-q-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
}
.qid-badge {
  font-family: ui-monospace, monospace;
  font-weight: 800;
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}
.manual-q-prompt {
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: rgba(8, 11, 18, 0.65);
  border-radius: 8px;
  border-left: 3px solid var(--violet);
}

/* Gallery Grid */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 14px;
  flex-wrap: wrap;
}
.section-head h3 { margin: 0; font-size: 19px; font-weight: 800; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}
.specimen-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 16px;
  color: var(--text);
  text-decoration: none;
  transition: all 0.16s;
}
.specimen-card:hover {
  border-color: rgba(56, 189, 248, 0.50);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  text-decoration: none;
}
.specimen-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.specimen-name { font-size: 15px; font-weight: 800; }
.specimen-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #f0abfc;
  margin-bottom: 8px;
}
.specimen-roast {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.xp-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.xp-chip {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--cat-c, var(--accent));
  background: var(--cat-bg, var(--accent-soft));
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.specimen-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-dim);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding-top: 9px;
}

/* Report Page Specifics */
.lab-sheet {
  background:
    radial-gradient(600px 260px at 85% 0%, rgba(251, 113, 133, 0.12), transparent 65%),
    radial-gradient(600px 260px at 10% 0%, rgba(56, 189, 248, 0.10), transparent 65%),
    var(--bg-card);
  border: 1px solid rgba(167, 139, 250, 0.30);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.lab-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.25);
  padding-bottom: 18px;
  margin-bottom: 20px;
}
.specimen-stamp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--emerald);
  background: var(--emerald-soft);
  border: 1px solid rgba(52, 211, 153, 0.35);
  padding: 3px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.archetype-headline {
  margin: 4px 0 8px;
  font-size: clamp(22px, 3.6vw, 32px);
  font-weight: 900;
  background: linear-gradient(95deg, #fff 15%, #7dd3fc 58%, #fda4af 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.roast-box {
  background: rgba(8, 11, 18, 0.72);
  border-left: 4px solid var(--rose);
  border-radius: 0 11px 11px 0;
  padding: 14px 16px;
  font-size: 14.5px;
  color: #f1f5f9;
  margin-top: 14px;
}

.report-grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  margin-bottom: 20px;
}
@media (max-width: 860px) {
  .report-grid-2 { grid-template-columns: 1fr; }
}

.top5-list { display: flex; flex-direction: column; gap: 14px; }
.top5-row {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
}
.top5-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}
.top5-name { font-weight: 800; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.top5-score { font-family: ui-monospace, monospace; font-weight: 900; font-size: 16px; color: var(--cat-c, var(--accent)); }
.bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
  margin-bottom: 8px;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cat-c, #38bdf8), rgba(255, 255, 255, 0.85));
}
.top5-evidence {
  font-size: 12.5px;
  color: var(--text-muted);
  background: rgba(8, 11, 18, 0.55);
  padding: 7px 10px;
  border-radius: 7px;
}

.gauges-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.gauge-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
}
.gauge-label { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-top: 6px; }

.radar-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.switches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.switch-card {
  background: linear-gradient(135deg, rgba(251, 113, 133, 0.10), rgba(19, 25, 39, 0.96));
  border: 1px solid rgba(251, 113, 133, 0.35);
  border-radius: 12px;
  padding: 14px;
}
.ooc-card {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(19, 25, 39, 0.96));
  border: 1px solid rgba(251, 191, 36, 0.32);
  border-radius: 12px;
  padding: 14px;
}

/* 36-dim heatmap matrix */
.matrix-cats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.matrix-cat-col {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-top: 3px solid var(--cat-c);
  border-radius: 11px;
  padding: 12px;
}
.matrix-cat-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--cat-c);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}
.heat-row {
  display: grid;
  grid-template-columns: 62px 1fr 30px;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 12px;
}
.heat-bar-bg {
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}
.heat-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--cat-c);
}

/* Transcript details */
.transcript-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.msg-u {
  font-size: 13px;
  color: #93c5fd;
  margin-bottom: 5px;
}
.msg-a {
  font-size: 13.5px;
  color: #f1f5f9;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(8, 11, 18, 0.65);
  margin-bottom: 8px;
  white-space: pre-wrap;
}

/* Toast */
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid var(--accent);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.2s;
  z-index: 99;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}
.toast.show { opacity: 1; transform: translateY(0); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}
.badge-quick { background: var(--accent-soft); color: #7dd3fc; }
.badge-deep { background: var(--violet-soft); color: #ddd6fe; }
.muted { color: var(--text-muted); font-size: 13px; }
.empty-state { text-align: center; padding: 34px 16px; color: var(--text-muted); font-size: 13.5px; }
