:root {
  --ink: #2a1726;
  --ink-soft: #6e5468;
  --bg: #fff8f1;
  --card: #ffffff;
  --red: #e8384f;
  --fuchsia: #d6348a;
  --orange: #f5841f;
  --accent: #d6348a;
  --accent-soft: #fbe1ee;
  --grad: linear-gradient(120deg, var(--red), var(--fuchsia) 55%, var(--orange));
  --line: #f1e2d7;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  position: sticky;
  top: 0;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.brand .lab {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  border-radius: 6px;
  background: var(--line);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--grad);
  width: 0%;
  transition: width 0.3s ease;
}

#progressLabel {
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.hidden { display: none !important; }

.chapter-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.chapter-sub {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.question-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.question-prompt {
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 0.98rem;
}

.help-text {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: -6px;
  margin-bottom: 10px;
}

.chip-group, .options-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--ink);
  transition: all 0.15s ease;
}

.chip:hover { border-color: var(--accent); }
.chip.selected {
  background: var(--grad);
  border-color: var(--fuchsia);
  color: #fff;
}

.scale-row {
  display: flex;
  gap: 8px;
}

.scale-btn {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  font-weight: 600;
}

.scale-btn.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
}

textarea { min-height: 80px; resize: vertical; }

.matrix-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.matrix-row:last-child { border-bottom: none; }
.matrix-label { font-size: 0.88rem; }

.scale-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.section-note {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
}

select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

.photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.photo-thumb {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
}

button.primary, button.secondary {
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
}

button.primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 16px rgba(214, 52, 138, 0.28);
}
button.primary:hover { filter: brightness(0.94); }
button.secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}
button.secondary:hover { border-color: var(--accent); }

.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
}
.chapter-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}
.chapter-dot.done { background: var(--grad); }
.chapter-dot.current { background: var(--ink); }

.match-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.match-score {
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.3;
}

.result-subheading {
  font-weight: 700;
  font-size: 0.85rem;
  margin-top: 16px;
  margin-bottom: 6px;
  color: var(--ink);
}

.reason-list {
  margin: 0;
  padding-left: 20px;
  font-size: 0.9rem;
  color: var(--ink);
}

.reason-list li {
  margin-bottom: 4px;
}

.difference-text {
  font-size: 0.9rem;
  color: var(--ink-soft);
  background: #f5f2f0;
  border-radius: 8px;
  padding: 10px 12px;
}

.essence-qa {
  margin-bottom: 12px;
}

.essence-question {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 2px;
}

.essence-answer {
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.4;
}

.dim-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 4px 0;
  color: var(--ink-soft);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--fuchsia);
  box-shadow: 0 0 0 3px var(--fuchsia-soft, #fbe1ee);
}

.legal-box { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.legal-check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.88rem; color: var(--ink-soft); line-height: 1.45; cursor: pointer; }
.legal-check input { width: auto; margin-top: 3px; accent-color: var(--fuchsia); flex-shrink: 0; }
.legal-check a { color: var(--fuchsia); font-weight: 600; }

.code-input { font-size: 1.6rem; letter-spacing: 0.4em; text-align: center; font-weight: 700; }
.code-links { display: flex; justify-content: space-between; margin-top: 12px; }
.link-button { background: none; border: none; padding: 4px 0; color: var(--fuchsia); font-weight: 600; font-size: 0.88rem; cursor: pointer; }
.link-button:disabled { color: var(--ink-soft); cursor: default; font-weight: 500; }
