:root {
  --bg: #f8f8fa;
  --surface: #ffffff;
  --surface-strong: #f2f2f5;
  --surface-soft: rgba(0, 0, 0, 0.02);
  --line: rgba(0, 0, 0, 0.08);
  --text: #1a1a2e;
  --muted: rgba(0, 0, 0, 0.55);
  --subtle: rgba(0, 0, 0, 0.36);
  --rose: #e8457a;
  --pink: #f472b6;
  --violet: #8b5cf6;
  --pearl: #fdf2f8;
  --red: #ef4444;
  --gold: #f59e0b;
  --cyan: #06b6d4;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.06), 0 20px 48px rgba(0, 0, 0, 0.06);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --max: 960px;
  --space-section: 48px;
  --space-card: 32px;
  --space-inner: 28px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }

html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- ambient (disabled for light theme) ---------- */
.ambient, .noise { display: none; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}

.brand-button, .step-nav button, .button, .text-link,
.toggle-button, .risk-badge, .dropzone, .modal-close { cursor: pointer; }

.brand-button {
  border: 0; background: transparent; color: var(--text);
  display: inline-flex; align-items: center; gap: 10px;
  text-align: left; padding: 0;
}

.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #fce7f3, #ede9fe);
  font-size: 15px; color: var(--rose);
}

.brand-button strong { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand-button small { display: block; color: var(--subtle); font-size: 11px; margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }
.session-controls { display: flex; align-items: center; gap: 8px; }

.step-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.step-nav button {
  border: 1px solid transparent; color: var(--subtle);
  background: transparent; border-radius: var(--radius-sm);
  padding: 6px 12px; font-size: 13px; font-weight: 500;
  transition: all 0.2s;
}
.step-nav button:hover { color: var(--text); background: rgba(0,0,0,0.04); }
.step-nav button.active {
  color: var(--text); background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.06);
}

.session-button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--rose), var(--violet));
  box-shadow: 0 10px 28px rgba(232, 69, 122, 0.18);
}

.session-button.secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.user-pill-mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--rose), var(--violet));
}

.user-pill-copy {
  display: grid;
  gap: 1px;
}

.user-pill-copy strong {
  font-size: 13px;
  line-height: 1.1;
}

.user-pill-copy span {
  font-size: 11px;
  color: var(--subtle);
}

/* ---------- layout ---------- */
.screens {
  width: min(var(--max), calc(100vw - 48px));
  margin: 0 auto;
  padding: 40px 0 100px;
}

.screen { display: none; animation: fade-up 0.3s ease; }
.screen.active { display: block; }

/* ---------- panel ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ---------- typography ---------- */
.eyebrow {
  display: inline-block;
  text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 11px; font-weight: 600; color: var(--rose);
  margin-bottom: 10px;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.03em; margin: 0; color: var(--text); }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin: 0; }
h3 { font-size: clamp(1.1rem, 2.2vw, 1.35rem); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; margin: 0; }
h4 { font-size: 1rem; font-weight: 600; margin: 0 0 10px; }
p { color: var(--muted); line-height: 1.7; font-size: 0.93rem; }
.lead { max-width: 560px; font-size: 0.95rem; color: var(--muted); }

/* ---------- HOME ---------- */
.home-shell {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

.home-intro {
  padding: var(--space-card);
  display: grid;
  gap: 24px;
  align-content: start;
  position: sticky;
  top: 72px;
}
.home-intro h1 { font-size: 24px; line-height: 1.35; }

.home-features { display: grid; gap: 12px; }
.home-feature {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface-strong); border: 1px solid var(--line);
}
.home-feature strong { font-size: 14px; display: block; margin-bottom: 4px; color: var(--text); }
.home-feature p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }

.home-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  text-align: center;
}
.home-stat strong { display: block; font-size: 20px; color: var(--rose); margin-bottom: 2px; font-weight: 700; }
.home-stat span { font-size: 12px; color: var(--subtle); }

.home-intro-header { display: grid; gap: 10px; }

.cta-row, .upload-actions, .report-actions, .helper-row, .modal-actions {
  display: flex; flex-wrap: wrap; gap: 10px;
}

/* ---------- ranking ---------- */
.ranking-panel { padding: var(--space-card); }
.ranking-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
.home-updated { color: var(--subtle); font-size: 12px; white-space: nowrap; padding-top: 4px; }
.ranking-subtitle { margin-top: 8px; max-width: 460px; }
.ranking-list { display: grid; gap: 6px; }

.ranking-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 18px; border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid transparent;
  transition: background 0.2s;
}
.ranking-row:hover { background: rgba(0,0,0,0.04); }

.ranking-row-top {
  background: linear-gradient(90deg, #fdf2f8, #f5f3ff);
  border-color: rgba(232,69,122,0.08);
}
.ranking-row-top:hover { background: linear-gradient(90deg, #fce7f3, #ede9fe); }

.ranking-main { display: flex; align-items: center; gap: 14px; }
.ranking-index {
  min-width: 36px; color: var(--rose);
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ranking-id { font-size: 14px; font-weight: 600; font-family: "SF Mono", "Fira Code", "Menlo", monospace; letter-spacing: 0.02em; color: var(--text); }
.ranking-row-top .ranking-id { font-size: 15px; }
.ranking-count { color: var(--subtle); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.button {
  border: 0; border-radius: var(--radius-sm); padding: 10px 20px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  transition: all 0.2s;
}
.button:hover { transform: translateY(-1px); }
.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button-primary {
  color: #fff; background: var(--rose);
}
.button-primary:hover { box-shadow: 0 4px 16px rgba(232,69,122,0.2); background: #d63d6e; }

.button-secondary {
  color: var(--text); background: var(--surface-strong);
  border: 1px solid var(--line);
}
.button-secondary:hover { background: rgba(0,0,0,0.06); }

.button-ghost, .text-link {
  color: var(--muted); background: transparent; border: 0;
}
.button-ghost:hover, .text-link:hover { color: var(--text); }
.button-block { width: 100%; }

/* ---------- AUTH ---------- */
.auth-toggle {
  display: inline-grid; grid-template-columns: 1fr 1fr;
  padding: 3px; border-radius: var(--radius-sm);
  background: var(--surface-strong); margin-bottom: 8px;
}
.toggle-button {
  border: 0; border-radius: 6px; background: transparent;
  color: var(--subtle); padding: 8px 16px; font-weight: 600; font-size: 14px;
  transition: all 0.2s;
}
.toggle-button.active {
  color: #fff; background: var(--rose);
}

.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 5px; }
.auth-form span { font-size: 13px; color: var(--subtle); font-weight: 500; }
.auth-form input {
  width: 100%; border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 10px 14px; color: var(--text); font: inherit; font-size: 15px;
  transition: border-color 0.2s;
}
.auth-form input:focus { outline: none; border-color: var(--rose); }
.hidden-field { display: none; }
.text-link { border: 0; padding: 0; font: inherit; font-size: 14px; }

/* ---------- lists ---------- */
.story-list, .side-points, .detail-list {
  list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px;
}
.story-list li, .side-points li, .detail-list li {
  padding-left: 16px; position: relative; color: var(--muted); font-size: 14px; line-height: 1.6;
}
.story-list li::before, .side-points li::before, .detail-list li::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--rose); position: absolute; left: 0; top: 0.65em;
}

/* ---------- chips ---------- */
.chip, .score-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line);
  color: var(--muted); background: var(--surface-strong);
}
.chip-hot { background: #fef2f2; color: var(--red); border-color: rgba(239,68,68,0.15); }

/* ---------- UPLOAD ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 28px; }

.quota-card {
  min-width: 96px; padding: 12px 16px;
  border-radius: var(--radius-md); text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.quota-card small { color: var(--subtle); font-size: 11px; display: block; margin-bottom: 3px; }
.quota-card strong { font-size: 1.8rem; display: block; font-weight: 700; color: var(--rose); }

.upload-layout { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 24px; }

.upload-panel { padding: var(--space-inner); display: grid; gap: 18px; }

.dropzone {
  width: 100%; min-height: 200px; border-radius: var(--radius-lg);
  border: 2px dashed rgba(0,0,0,0.12);
  background: var(--surface-strong);
  color: var(--text); display: grid; place-items: center; text-align: center;
  gap: 8px; padding: 28px; transition: all 0.2s;
}
.dropzone:hover { border-color: var(--rose); background: #fdf2f8; }
.dropzone strong { font-size: 1rem; font-weight: 600; }
.dropzone span:last-child { color: var(--subtle); font-size: 13px; }
.dropzone-icon {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 10px; background: rgba(0,0,0,0.04); font-size: 1.1rem;
}

.file-list-header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 13px; color: var(--subtle);
}
.file-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.file-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); padding: 10px 14px;
}
.file-meta strong { display: block; font-size: 14px; margin-bottom: 2px; }
.file-meta span, .history-meta span { color: var(--subtle); font-size: 12px; }
.status-pill {
  border-radius: 6px; padding: 3px 8px;
  color: var(--muted); font-size: 11px; font-weight: 600;
  background: var(--surface-strong); border: 1px solid var(--line);
}

.helper-panel { padding: var(--space-inner); display: grid; gap: 18px; align-content: start; }

.capability-list { display: grid; gap: 10px; }
.capability-card {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-strong);
}
.capability-card strong { font-size: 14px; color: var(--text); }
.capability-card span { font-size: 12px; color: var(--rose); }
.capability-card p { margin: 0; font-size: 13px; line-height: 1.6; }
.capability-card-empty span { color: var(--subtle); }

.tool-section { display: grid; gap: 6px; }
.tool-label { font-size: 12px; color: var(--subtle); text-transform: uppercase; letter-spacing: 0.04em; padding-left: 2px; }

.download-link {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  text-decoration: none; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-strong); transition: all 0.2s;
}
.download-link:hover { background: #fdf2f8; border-color: rgba(232,69,122,0.15); }
.download-link span { font-size: 13px; color: var(--muted); }
.download-link strong { color: var(--text); font-size: 14px; }

.resource-link {
  display: block; text-decoration: none; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-strong);
  color: var(--muted); font-size: 14px; transition: all 0.2s;
}
.resource-link:hover { background: rgba(0,0,0,0.04); }
.helper-copy { margin: 0; font-size: 13px; color: var(--muted); }

.risk-note {
  padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px;
  background: #fef2f2; border: 1px solid rgba(239,68,68,0.12);
}
.risk-note strong { font-size: 12px; display: block; margin-bottom: 4px; color: var(--red); }
.risk-note p { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.5; }

.tip-box {
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: #fdf2f8; border: 1px solid rgba(232,69,122,0.08);
  font-size: 13px;
}
.tip-box p { font-size: 13px; color: var(--muted); }

/* ---------- WAITING ---------- */
.waiting-shell {
  text-align: center; padding: 48px var(--space-card);
  display: grid; gap: 28px; align-content: center;
}

.orbital-loader { width: 80px; height: 80px; margin: 0 auto; position: relative; }
.orbital-loader span {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid var(--line);
  animation: orbit 4s linear infinite;
}
.orbital-loader span:nth-child(2) { inset: 10px; animation-duration: 2.8s; animation-direction: reverse; }
.orbital-loader span:nth-child(3) {
  inset: 22px; background: linear-gradient(135deg, #fce7f3, #ede9fe);
  border: 0; animation: pulse 1.8s ease infinite;
}

.progress-block { width: min(440px, 100%); margin: 0 auto; }
.progress-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 13px; color: var(--muted); margin-bottom: 8px;
}
.progress-bar { width: 100%; height: 5px; border-radius: 999px; background: var(--surface-strong); overflow: hidden; }
.progress-fill {
  width: 12%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--rose), var(--violet));
  transition: width 0.4s ease;
}

.waiting-steps {
  list-style: none; width: min(440px, 100%); margin: 0 auto;
  padding: 0; display: grid; gap: 6px;
}
.waiting-step {
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px;
  border: 1px solid transparent; color: var(--subtle);
  background: var(--surface-strong);
}
.waiting-step.active {
  color: var(--rose); border-color: rgba(232,69,122,0.15);
  background: #fdf2f8;
}
.waiting-step.done { color: var(--muted); }

/* ---------- REPORT ---------- */
#screen-report.active { display: grid; gap: 20px; }
#report-capture { display: grid; gap: 24px; }

.report-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 4px; }
.report-header p { margin-top: 4px; }

.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.score-card { padding: 22px; overflow: hidden; position: relative; }
.score-card span { font-size: 13px; color: var(--subtle); font-weight: 500; }
.score-card strong { display: block; font-size: 2.2rem; font-weight: 700; margin: 6px 0 8px; color: var(--text); }
.score-card p { font-size: 13px; line-height: 1.5; }
.score-card::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; }
.accent-fire::after { background: linear-gradient(90deg, var(--gold), var(--red)); }
.accent-love::after { background: linear-gradient(90deg, var(--rose), var(--pink)); }
.accent-cold::after { background: linear-gradient(90deg, var(--cyan), var(--violet)); }

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.evidence-card {
  padding: 18px 18px 16px;
  display: grid;
  gap: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,248,250,0.96));
}

.evidence-label {
  font-size: 12px;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.evidence-value {
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.evidence-meta {
  font-size: 12px;
  color: var(--muted);
}

.evidence-meta.pending { color: var(--subtle); }
.evidence-meta.approx { color: #9a3412; }

.risk-strip {
  padding: 22px; display: flex;
  justify-content: space-between; align-items: center; gap: 20px;
}
.risk-copy { flex: 1; }
.risk-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.risk-badge {
  border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 12px; color: var(--muted); font-size: 13px; font-weight: 500;
  background: var(--surface-strong); transition: all 0.2s;
}
.risk-badge:hover { background: #fdf2f8; border-color: rgba(232,69,122,0.15); color: var(--rose); }

.chart-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.chart-panel { padding: 22px; min-height: 300px; }
.chart-panel-wide { grid-column: 1 / -1; }

.heatmap-panel {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.heatmap-shell {
  display: grid;
  gap: 10px;
}

.heatmap-hours {
  display: grid;
  grid-template-columns: 72px repeat(24, minmax(0, 1fr));
  gap: 4px;
}

.heatmap-hour-label {
  font-size: 10px;
  color: var(--subtle);
  text-align: center;
}

.heatmap-body {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
}

.heatmap-days {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  gap: 4px;
}

.heatmap-day-label {
  min-height: 24px;
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 4px;
}

.heatmap-cell {
  --heat: 0;
  min-height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(244, 63, 94, calc(0.08 + var(--heat) * 0.24));
  background: linear-gradient(
    180deg,
    rgba(251, 113, 133, calc(0.08 + var(--heat) * 0.48)),
    rgba(244, 63, 94, calc(0.12 + var(--heat) * 0.68))
  );
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.36);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.heatmap-cell.pending {
  background: linear-gradient(180deg, rgba(244,114,182,0.08), rgba(139,92,246,0.08));
}

.heatmap-cell:hover {
  transform: translateY(-1px);
}

.heatmap-note {
  font-size: 13px;
  color: var(--muted);
}

.catchphrase-panel,
.wordcloud-panel,
.love-keywords-panel {
  padding: 24px;
}

.catchphrase-grid,
.wordcloud-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 18px;
}

.catchphrase-col h4,
.wordcloud-col h4 {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.catchphrase-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: phrase;
}

.catchphrase-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--text);
}

.catchphrase-list li::before {
  counter-increment: phrase;
  content: counter(phrase);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--surface-alt, #f0f0f0);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.catchphrase-list li.empty-state::before {
  content: none;
}

.catchphrase-phrase {
  flex: 1;
}

.catchphrase-count {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.wordcloud-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  min-height: 120px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-alt, #f8f8f8);
}

.wordcloud-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.1;
}

.wordcloud-tag.tier-1 {
  color: var(--rose);
  font-weight: 700;
}

.wordcloud-tag.tier-2 {
  color: #f59e0b;
  font-weight: 600;
}

.wordcloud-tag.tier-3 {
  color: var(--muted);
  font-weight: 400;
}

.love-keywords-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.keyword-bar-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-alt, #f8f8f8);
}

.keyword-bar-label {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.keyword-bar-track {
  display: flex;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--line);
}

.keyword-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.keyword-bar-fill.side-user {
  background: var(--rose);
}

.keyword-bar-fill.side-contact {
  background: var(--cyan);
}

.keyword-bar-counts {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.language-conclusions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.conclusion-tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(232, 69, 122, 0.12);
  color: var(--rose);
  font-size: 13px;
  font-weight: 500;
}

.conclusion-tag.muted {
  background: rgba(107, 114, 128, 0.12);
  color: var(--muted);
}

.section-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 14px;
}

.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.detail-card { padding: 22px; }

.strategist-panel { padding: 24px; }
.strategist-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }

.verdict-panel { padding: 24px; }
.verdict-panel p { margin-top: 10px; }
.verdict-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line);
}

.qr-placeholder {
  border: 2px dashed var(--line); border-radius: var(--radius-md);
  min-height: 100px; min-width: 100px;
  display: grid; place-items: center;
  color: var(--subtle); font-size: 12px;
  background: var(--surface-strong); text-align: center; padding: 12px;
}
.qr-placeholder-small { min-height: 72px; min-width: 72px; }

/* ---------- ACCOUNT ---------- */
.account-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 24px; }
.history-panel, .settings-panel { padding: var(--space-inner); }
.settings-panel { display: grid; gap: 14px; align-content: start; }

.history-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.history-item {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface-strong); padding: 12px 14px;
}
.history-meta strong { display: block; font-size: 14px; margin-bottom: 2px; }
.history-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.switch-row {
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}
.switch-row input { width: 40px; height: 22px; }

.pay-entry { display: grid; gap: 8px; padding-top: 10px; }
.pay-entry p { font-size: 13px; }

/* ---------- PAYWALL ---------- */
.paywall-shell { display: grid; gap: 28px; }
.paywall-hero { padding: var(--space-card); background: linear-gradient(160deg, #fdf2f8, #f5f3ff 60%, var(--surface)); }

.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pricing-card { padding: 22px; }
.pricing-card h3 { font-size: 1.6rem; margin: 6px 0; }
.pricing-card.featured {
  background: linear-gradient(160deg, #fdf2f8, #fff 60%);
  border-color: rgba(232,69,122,0.15);
  box-shadow: 0 4px 20px rgba(232,69,122,0.08);
}

.payment-footer {
  padding: 22px; display: flex;
  justify-content: space-between; align-items: center; gap: 24px;
}

/* ---------- toast ---------- */
.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  min-width: 200px; max-width: min(320px, calc(100vw - 32px));
  padding: 10px 16px; border-radius: var(--radius-md); font-size: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: translateY(0); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
}
.modal-backdrop.hidden { display: none; }

.modal-card {
  position: relative; width: min(440px, 100%);
  padding: 24px; border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.auth-modal-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: var(--surface-strong); color: var(--text);
  font-size: 16px; transition: background 0.2s;
}
.modal-close:hover { background: rgba(0,0,0,0.08); }

/* ---------- utility ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

canvas { width: 100% !important; max-height: 280px; }

/* ---------- animations ---------- */
@keyframes orbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.05); opacity: 1; }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .home-shell,
  .upload-layout, .account-grid,
  .score-grid, .evidence-grid, .detail-grid, .strategist-grid,
  .catchphrase-grid, .wordcloud-grid, .love-keywords-grid,
  .pricing-grid, .chart-grid { grid-template-columns: 1fr; }

  .home-intro { position: static; }

  .risk-strip, .payment-footer, .topbar, .topbar-actions,
  .report-header, .page-head, .verdict-footer {
    flex-direction: column; align-items: flex-start;
  }
  .step-nav { justify-content: flex-start; }
  .session-controls { width: 100%; justify-content: space-between; }
  .heatmap-hours { grid-template-columns: 56px repeat(24, minmax(0, 1fr)); }
  .heatmap-body { grid-template-columns: 56px 1fr; }
}

@media (max-width: 640px) {
  .screens { width: min(100vw - 24px, var(--max)); padding-top: 20px; }
  .topbar { padding: 10px 16px; }

  .home-intro, .ranking-panel, .waiting-shell,
  .upload-panel, .helper-panel, .history-panel, .settings-panel,
  .score-card, .evidence-card, .detail-card, .chart-panel, .heatmap-panel,
  .risk-strip, .strategist-panel, .verdict-panel,
  .paywall-hero, .pricing-card, .payment-footer, .modal-card {
    padding: 18px;
  }

  h1 { font-size: 1.8rem; }

  .ranking-row { flex-direction: column; align-items: flex-start; }
  .home-stats { grid-template-columns: repeat(3, 1fr); }
  .ranking-main { gap: 10px; }
  .ranking-row-top .ranking-id { font-size: 14px; }

  .cta-row, .upload-actions, .report-actions, .modal-actions, .session-controls { width: 100%; }
  .button { width: 100%; justify-content: center; text-align: center; }
  .quota-card { width: 100%; }
  .step-nav { width: 100%; }
  .step-nav button, .session-button { width: auto; }
  .user-pill { width: calc(100% - 70px); }
  .heatmap-hours { display: none; }
  .heatmap-body { grid-template-columns: 48px 1fr; }
  .heatmap-cell { min-height: 20px; }
}
