/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --pink: #ff6b9d;
  --pink-dark: #e5457a;
  --pink-light: #ffd1e0;
  --purple: #c084fc;
  --bg: #0f0a1a;
  --bg-card: #1a1230;
  --text: #f0e6ff;
  --text-muted: #a89bc2;
  --radius: 12px;
  --max-width: 480px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  line-height: 1.5;
}

/* === Language toggle === */
.lang-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--text-muted);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  z-index: 100;
  transition: all 0.2s;
}
.lang-toggle:hover { color: var(--pink); border-color: var(--pink); }

/* === Sections === */
.section {
  width: 100%;
  max-width: var(--max-width);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  animation: fadeIn 0.4s ease;
}
.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Landing header (inside form) === */
.form-section h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  text-align: center;
}
.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 40px;
  text-align: center;
}

/* === Buttons === */
.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 14px 40px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255, 107, 157, 0.3); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--pink);
  border: 2px solid var(--pink);
  border-radius: var(--radius);
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--pink); color: white; }

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--text-muted);
  border-radius: var(--radius);
  padding: 12px 32px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-outline:hover { color: var(--text); border-color: var(--text); }

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 12px;
  transition: color 0.2s;
}
.btn-text:hover { color: var(--text); }

/* === Form === */
.form-section { padding-top: 40px; }
.form-section h2 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 32px;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.form-group {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.range-display {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--pink);
  margin-bottom: 8px;
}

/* Slider wrapper & emoji-as-handle */
.slider-wrap {
  position: relative;
}
.slider-emoji {
  position: absolute;
  font-size: 22px;
  line-height: 1;
  transform: translate(-50%, -50%);
  transition: transform 0.15s;
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
  user-select: none;
  z-index: 2;
}
input[type="range"]:hover ~ .slider-emoji,
input[type="range"]:active ~ .slider-emoji,
.dual-range:hover ~ .slider-emoji,
.dual-range:active ~ .slider-emoji {
  transform: translate(-50%, -50%) scale(1.25);
}

/* Range sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  border: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  border: none;
  box-shadow: none;
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  border: none;
  box-shadow: none;
}
input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--pink), var(--purple));
}

.dual-range {
  position: relative;
  height: 30px;
}
.dual-range::before,
.dual-range::after {
  content: '';
  position: absolute;
  top: 50%;
  height: 6px;
  transform: translateY(-50%);
  border-radius: 3px;
  pointer-events: none;
}
.dual-range::before {
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.08);
}
.dual-range::after {
  left: var(--fill-left, 0%);
  right: calc(100% - var(--fill-right, 100%));
  background: linear-gradient(90deg, var(--pink), var(--purple));
}
.dual-range input[type="range"] {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  pointer-events: none;
  background: transparent;
}
.dual-range input[type="range"]::-moz-range-track {
  background: transparent;
}
.dual-range input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto;
}
.dual-range input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
}

/* Chip selector */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 8px 16px;
  border-radius: 100px;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover {
  border-color: rgba(255, 107, 157, 0.4);
  background: rgba(255, 107, 157, 0.06);
  color: var(--text);
}
.chip:active {
  transform: scale(0.95);
}
.chip.active {
  background: rgba(255, 107, 157, 0.15);
  border-color: var(--pink);
  color: var(--pink);
  font-weight: 600;
}

/* Toggle rows */
.toggles-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  -webkit-tap-highlight-color: transparent;
  transition: all 0.25s;
}
.toggle-row.on {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  border-color: transparent;
}
.toggle-row.on .toggle-label {
  color: white;
  font-weight: 600;
}
.toggle-label {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
}
.toggle-emoji-fixed {
  font-size: 1.2rem;
  margin-right: 8px;
  flex-shrink: 0;
}
.toggle-switch {
  display: none;
}
.toggle-input {
  display: none;
}

/* Cherry pick button */
.btn-cherry-pick {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 10px 0;
  text-align: center;
  font-family: inherit;
  transition: all 0.2s;
  margin-top: 10px;
}
.btn-cherry-pick:hover {
  color: var(--pink);
  border-color: rgba(255, 107, 157, 0.4);
  background: rgba(255, 107, 157, 0.06);
}

/* Cherry pick panel */
.cherry-pick-panel {
  margin-top: 8px;
  animation: fadeIn 0.3s ease;
}
.checkbox-section {
  margin-bottom: 14px;
}
.checkbox-section:last-child {
  margin-bottom: 0;
}
.checkbox-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.checkbox-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cb-label {
  display: flex;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  padding: 6px 0;
  -webkit-tap-highlight-color: transparent;
}
.cb-label span {
  margin-left: 8px;
}
.cb-label input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}
.cb-label input[type="checkbox"]:checked {
  background: rgba(255, 107, 157, 0.2);
  border-color: var(--pink);
}
.cb-label input[type="checkbox"]:checked::after {
  content: attr(data-emoji);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  line-height: 1;
}

.btn-submit { margin-top: 24px; }

/* === Result === */
.result-section {
  text-align: center;
  padding-top: 15vh;
}
.result-section h2 {
  font-size: 1.3rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.result-number {
  font-size: 4rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  word-break: break-word;
}
.result-label {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 4px;
}
.result-label-above {
  margin-bottom: 0;
}
.result-label-below {
  margin-top: 0;
  margin-bottom: 8px;
}
.snarky-comment {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 32px;
  min-height: 1.5em;
}
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  width: 100%;
}
.result-actions > button {
  min-width: 0;
  flex: 1 1 auto;
}
.disclaimer {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 24px;
  line-height: 1.4;
}
.data-source {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: 8px;
}
.disclaimer a,
.data-source a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.disclaimer a:hover,
.data-source a:hover {
  color: var(--pink);
}

/* === Modal === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 12px;
}
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  position: relative;
}
.modal-content p { margin-bottom: 20px; }
.modal-content input[type="email"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 2px solid #3d3160;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 16px;
}
.modal-content input[type="email"]:focus { border-color: var(--pink); outline: none; }
.email-error { color: #ff4444; font-size: 0.85rem; margin: -8px 0 12px; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* === Breakdown / Funnel === */
.breakdown-section {
  padding-top: 40px;
  text-align: center;
}
.breakdown-section h2 {
  font-size: 1.3rem;
  margin-bottom: 24px;
  color: var(--text-muted);
}
.funnel-step {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.funnel-step::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--w, 100%);
  background: linear-gradient(135deg, rgba(255, 107, 157, 0.15), rgba(192, 132, 252, 0.1));
  transition: width 0.8s ease;
}
.funnel-label {
  position: relative;
  font-weight: 600;
  font-size: 0.9rem;
}
.funnel-value {
  position: relative;
  font-weight: 700;
  color: var(--pink);
  font-size: 0.95rem;
}

/* === Responsive — mobile-first === */

/* Tiny screens (320px–374px) */
@media (max-width: 374px) {
  body { padding: 12px 8px; }
  .lang-toggle { top: 10px; right: 8px; padding: 5px 10px; font-size: 12px; }
  .form-section h1 { font-size: 1.8rem; }
  .subtitle { font-size: 0.95rem; margin-bottom: 28px; }
  .form-section h2 { font-size: 1.2rem; margin-bottom: 24px; }
  .form-group { padding: 12px 14px; }
  .range-display { font-size: 1rem; }
  .chip { padding: 6px 12px; font-size: 0.8rem; }
  .btn-primary { padding: 12px 20px; font-size: 1rem; }
  .btn-secondary { padding: 10px 20px; font-size: 0.9rem; }
  .btn-outline { padding: 10px 20px; font-size: 0.9rem; }
  .result-section { padding-top: 10vh; }
  .result-number { font-size: 2.8rem; }
  .result-section h2 { font-size: 1.1rem; }
  .snarky-comment { font-size: 1rem; }
  .result-actions { gap: 8px; }
  .modal-content { padding: 24px 16px; }
  .funnel-step { padding: 12px 14px; }
  .funnel-label { font-size: 0.8rem; }
  .funnel-value { font-size: 0.85rem; }
  .toggle-row { padding: 12px 14px; }
  .toggle-label { font-size: 0.95rem; }
  .breakdown-section h2 { font-size: 1.1rem; }
}

/* Small screens (375px–479px) */
@media (min-width: 375px) and (max-width: 479px) {
  body { padding: 16px 12px; }
  .form-section h1 { font-size: 2.1rem; }
  .result-number { font-size: 3.2rem; }
}

/* Medium+ screens */
@media (min-width: 600px) {
  .form-section h1 { font-size: 3.5rem; }
  .result-number { font-size: 5rem; }
}
