:root {
  --bg: #efe3ca;
  --surface: #fffdf8;
  --ink: #2a2016;
  --ink-soft: #6b5c47;
  --accent: #6b4f31;
  --accent-strong: #4a3520;
  --border: #ddccaa;
  --danger: #a23b2e;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
}

h1, h2 {
  font-family: inherit;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 16px;
}

h1 {
  font-size: 1.9rem;
}

h2 {
  font-size: 1.3rem;
}

p {
  margin: 0 0 14px;
}

.shell {
  max-width: 700px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 20px 40px;
}

.topbar {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding-bottom: 12px;
  z-index: 5;
}

.progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.topbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 22px;
  margin-top: 8px;
}

.section-label {
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.lang-btn {
  background: none;
  border: none;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  cursor: pointer;
}

.lang-btn.active {
  background: var(--accent-strong);
  color: #fff;
}

.reset-link {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.reset-link:hover {
  color: var(--accent-strong);
}

.stage {
  flex: 1;
  display: flex;
  align-items: flex-start;
  padding-top: 24px;
}

/* Google Forms-style card: white sheet on the page background, with a colored top edge. */
.screen {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  border-top: 8px solid var(--accent-strong);
  box-shadow: 0 1px 3px rgba(42, 32, 22, 0.08), 0 10px 26px rgba(42, 32, 22, 0.07);
  padding: 34px 36px 30px;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.intro-art {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.intro-art svg {
  overflow: visible;
}

.intro-art .drop {
  fill: var(--bg);
  stroke: var(--border);
  stroke-width: 2;
}

.intro-art .parasite {
  fill: none;
  stroke: var(--accent-strong);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.intro-art .parasite circle {
  stroke: none;
  fill: var(--accent-strong);
}

@media (prefers-reduced-motion: no-preference) {
  .intro-art .drop {
    transform-origin: 80px 90px;
    animation: intro-drop-breathe 4s ease-in-out infinite;
  }
  .intro-art .parasite {
    transform-origin: 77px 90px;
    animation: intro-parasite-wiggle 5s ease-in-out infinite;
  }
}

@keyframes intro-drop-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes intro-parasite-wiggle {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

.intro-screen p {
  color: var(--ink-soft);
}

.promise-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.promise-box p {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
}

.promise-icon {
  font-size: 1.2rem;
  line-height: 1.3;
  flex-shrink: 0;
}

.reveal-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0;
  text-align: left;
}

.reveal-card h2 {
  font-size: 1.15rem;
  margin-bottom: 4px;
  text-align: center;
}

.mascot {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}

.mascot .mascot-body {
  fill: var(--surface);
  stroke: var(--accent-strong);
  stroke-width: 2;
}

.mascot .mascot-antenna,
.mascot .mascot-limb {
  fill: none;
  stroke: var(--accent-strong);
  stroke-width: 3;
  stroke-linecap: round;
}

.mascot .mascot-antenna-tip {
  fill: var(--accent-strong);
}

.mascot .mascot-eye {
  fill: var(--ink);
}

.mascot .mascot-eye-shine {
  fill: #fff;
}

.mascot .mascot-mouth {
  fill: none;
  stroke: var(--accent-strong);
  stroke-width: 3;
  stroke-linecap: round;
}

.mascot .mascot-blush {
  fill: var(--accent);
  opacity: 0.25;
}

@media (prefers-reduced-motion: no-preference) {
  .mascot svg {
    animation: mascot-bounce 2.6s ease-in-out infinite;
    transform-origin: 80px 150px;
  }
}

@keyframes mascot-bounce {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-4px) rotate(2deg); }
}

.send-hint {
  color: var(--ink-soft);
  font-size: 0.82rem;
  margin: 8px 0 0;
}

.send-hint.send-error {
  color: var(--danger);
}

.reveal-intro {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-bottom: 18px;
}

.reveal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.reveal-parasite-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.reveal-parasite-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-strong);
}

.reveal-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.reveal-trait {
  flex: 1 1 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reveal-trait-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.reveal-trait-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.reveal-narrative {
  font-style: italic;
  color: var(--ink);
  margin: 0;
}

.reveal-quote-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-top: 16px;
  margin-bottom: 4px;
}

.reveal-quote {
  margin: 0;
  padding-left: 14px;
  border-left: 3px solid var(--accent-strong);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.required-mark {
  color: var(--danger);
}

.hint {
  color: var(--ink-soft);
  font-size: 0.92rem;
  white-space: pre-line;
}

.question-body {
  margin-top: 18px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.option {
  display: flex;
  align-items: center;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 11px 12px;
  margin: 0 -12px;
  width: calc(100% + 24px);
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease;
}

.option:hover {
  background: rgba(74, 53, 32, 0.06);
}

.option.selected {
  background: rgba(74, 53, 32, 0.09);
  font-weight: 600;
}

.option-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.option-indicator {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  position: relative;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.indicator-radio {
  border-radius: 50%;
}

.indicator-checkbox {
  border-radius: 4px;
}

.option.selected .option-indicator {
  border-color: var(--accent-strong);
}

.option.selected .indicator-radio::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  background: var(--accent-strong);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.option.selected .indicator-checkbox {
  background: var(--accent-strong);
}

.option.selected .indicator-checkbox::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.option-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.option-group-title,
.matrix-group-title {
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-strong);
  background: var(--bg);
  margin: 26px 0 10px;
  padding: 10px 14px;
  border-left: 4px solid var(--accent-strong);
  border-radius: 0 10px 10px 0;
}

.option-group-title:first-child,
.matrix-group-title:first-child {
  margin-top: 0;
}

/* Picker gallery: pick by icon, not by reading — see .card-option below. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
}

.card-grid .option-group-title {
  grid-column: 1 / -1;
}

.card-option {
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 8px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 108px;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.card-option:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card-option.selected {
  border-color: var(--accent-strong);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--accent-strong);
}

.card-option.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-strong);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-option .option-head {
  flex-direction: column;
  gap: 6px;
}

.card-option .option-icon {
  font-size: 2.6rem;
  line-height: 1;
}

.card-option .option-label {
  font-size: 0.82rem;
  line-height: 1.25;
  text-align: center;
}

.option-label {
  font-weight: 600;
}

.other-field {
  margin-top: 10px;
  width: 100%;
  padding: 8px 2px 9px;
  border: none;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  background: transparent;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--ink);
}

.other-field:focus {
  outline: none;
  border-bottom-color: var(--accent-strong);
}

.combobox {
  position: relative;
}

.combobox-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(42, 32, 22, 0.12);
  max-height: 260px;
  overflow-y: auto;
  z-index: 10;
}

.combobox-option {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

.combobox-option:hover,
.combobox-option.active {
  background: var(--bg);
}

.text-field {
  width: 100%;
  padding: 8px 2px 10px;
  border: none;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  background: transparent;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
}

.text-field:focus {
  outline: none;
  border-bottom-color: var(--accent-strong);
}

.textarea-field {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  min-height: 120px;
  resize: vertical;
}

.textarea-field:focus {
  outline: none;
  border-color: var(--accent-strong);
}

.text-field::placeholder,
.textarea-field::placeholder,
.other-field::placeholder {
  color: var(--ink-soft);
  opacity: 0.65;
}

.scale-infographic {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px 4px 0;
  position: relative;
}

.scale-infographic::before {
  content: '';
  position: absolute;
  top: 20px;
  left: calc(10% + 4px);
  right: calc(10% + 4px);
  height: 3px;
  background: linear-gradient(to right, #efe3ca, #4a3520);
  border-radius: 2px;
  z-index: 0;
}

.scale-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.scale-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  color: var(--ink);
}

.scale-dot[data-level='3'],
.scale-dot[data-level='4'] {
  color: #fff;
}

.scale-word {
  font-size: 0.68rem;
  line-height: 1.15;
  color: var(--ink-soft);
  text-align: center;
}

.matrix-rows {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.matrix-row {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.matrix-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.matrix-desc {
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

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

.scale-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.scale-btn[data-level='3'],
.scale-btn[data-level='4'] {
  color: #fff;
}

.scale-btn:hover {
  transform: translateY(-2px);
}

.scale-btn.selected {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink);
  transform: scale(1.08);
}

.matrix-other {
  margin-top: 10px;
}

.suggestion-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}

.suggestion-box p {
  margin: 0 0 8px;
}

.suggestion-text {
  color: var(--ink-soft);
  font-style: italic;
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-size: 0.88rem;
  margin: 12px 0 0;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 26px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-strong);
  color: #fff;
}

.btn-primary:hover {
  background: #38270f;
}

.btn-ghost {
  background: transparent;
  color: var(--accent-strong);
  border: none;
  padding: 12px 14px;
}

.btn-ghost:hover {
  background: rgba(74, 53, 32, 0.08);
}

.thankyou-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.summary {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.summary h2 {
  font-size: 1.2rem;
}

.summary-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.summary-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) minmax(80px, 2fr) 20px;
  align-items: center;
  gap: 10px;
}

.summary-icon {
  font-size: 1.1rem;
  text-align: center;
}

.summary-label {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-bar-track {
  display: block;
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.summary-bar-fill {
  display: block;
  height: 100%;
  background: var(--accent-strong);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.summary-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: right;
}

@media (max-width: 520px) {
  .shell {
    padding: 16px 14px 28px;
  }
  .screen {
    padding: 24px 20px 22px;
  }
  h1 {
    font-size: 1.5rem;
  }
  h2 {
    font-size: 1.15rem;
  }
  .nav-row {
    flex-direction: column-reverse;
  }
  .btn {
    width: 100%;
  }
  .scale-btn {
    width: 36px;
    height: 36px;
  }
  .summary-row {
    grid-template-columns: 20px minmax(0, 1fr) minmax(60px, 1.4fr) 18px;
  }
  .topbar-actions {
    gap: 10px;
  }
}
