:root {
  --bg: #0b0f14;
  --card: #131923;
  --fg: #f1f5f9;
  --muted: #8b9cb0;
  --accent: #5cf2c0;
  --accent-warm: #ffb86c;
  --danger: #ff6b6b;
  --border: #1f2735;
  --radius: 14px;
  --font: -apple-system, "SF Pro Display", system-ui, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(ellipse at top, #0e1622 0%, var(--bg) 60%) fixed;
  color: var(--fg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.hero { text-align: center; margin-bottom: 28px; }
.hero .logo { font-size: 56px; line-height: 1; }
.hero h1 { font-size: 36px; margin: 6px 0 4px; letter-spacing: -0.02em; }
.hero .tag { color: var(--muted); margin: 0; font-size: 17px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 22px;
  margin-bottom: 18px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 50px -30px rgba(0, 0, 0, 0.6);
}
.card.hidden { display: none; }

.prompt { font-size: 17px; margin: 0 0 8px; }
.meta { color: var(--muted); font-size: 14px; margin: 0; }
.tiny { font-size: 12px; }

.scale-picker { margin: 18px 0 16px; display: flex; gap: 10px; align-items: center; }
.scale-picker label { color: var(--muted); font-size: 14px; }
.scale-picker select {
  flex: 1;
  background: #0d141e;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 10px 14px;
  background: #182233;
  color: var(--fg);
  transition: transform 0.05s ease, background 0.15s ease;
}
button:hover { background: #1f2b3f; }
button:active { transform: translateY(1px); }

button.primary {
  display: block;
  width: 100%;
  margin: 14px 0 6px;
  background: var(--accent);
  color: #07120c;
  font-weight: 700;
  border: 0;
  padding: 14px;
  font-size: 17px;
}
button.primary:hover { background: #6ffcc9; }

button.link {
  background: transparent;
  border: 0;
  color: var(--accent);
  padding: 6px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Quiz progress */
.progress {
  height: 4px;
  background: #19222f;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 18px;
}
.progress .bar { height: 100%; background: var(--accent); transition: width 0.25s ease; }

#q-title { font-size: 20px; margin: 6px 0 14px; }
.options { list-style: none; padding: 0; margin: 0; }
.options li {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  background: #0f1722;
  display: flex;
  gap: 10px;
  align-items: center;
}
.options li:hover { background: #15202f; }
.options li .letter {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  width: 24px;
  text-align: center;
}
.step { color: var(--muted); font-size: 13px; margin-top: 14px; text-align: right; }

/* Import dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 28px 14px;
  text-align: center;
  background: #0f1722;
  cursor: pointer;
  margin: 14px 0 8px;
}
.dropzone.drag { border-color: var(--accent); background: #112519; }

/* Result */
#result .face { font-size: 76px; text-align: center; }
#result h2 { text-align: center; margin: 6px 0 4px; font-size: 30px; letter-spacing: -0.02em; }
#result .tag { text-align: center; color: var(--muted); margin: 0 0 16px; }
.nice-bar {
  height: 12px;
  background: #19222f;
  border-radius: 6px;
  overflow: hidden;
  margin: 14px 0 6px;
}
#nice-bar-fill { height: 100%; background: linear-gradient(90deg, #ff6b6b 0%, var(--accent-warm) 50%, var(--accent) 100%); transition: width 0.5s ease; }
#result .blurb { background: #0f1722; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--fg); }

.share-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
}
.share-row button { padding: 10px 8px; font-size: 14px; }

footer {
  text-align: center;
  margin-top: 28px;
  font-size: 13px;
  color: var(--muted);
}
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* Step-by-step <details> blocks for the import flow */
.how {
  background: #0f1722;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0;
  font-size: 14px;
}
.how summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  user-select: none;
  padding: 4px 0;
}
.how summary::-webkit-details-marker { display: none; }
.how summary::before { content: '▸ '; transition: transform 0.15s; display: inline-block; }
.how[open] summary::before { transform: rotate(90deg); }
.how ol { margin: 10px 0 4px; padding-left: 22px; color: var(--muted); }
.how li { margin: 4px 0; }
.how a { color: var(--accent); }

.big-target { min-height: 56px; }   /* 56px is comfortably tappable on mobile */

@media (max-width: 480px) {
  main { padding: 20px 16px 32px; }
  .hero h1 { font-size: 32px; }
  .hero .logo { font-size: 48px; }
  .card { padding: 20px 16px; }
  .options li { padding: 14px; min-height: 56px; }  /* tap-target friendly */
  button { min-height: 48px; }
  button.primary { font-size: 18px; padding: 16px; }
  .share-row { grid-template-columns: 1fr 1fr; }
}

/* Larger phones / small tablets */
@media (min-width: 481px) and (max-width: 700px) {
  .share-row { grid-template-columns: repeat(3, 1fr); }
}

/* Barometer (opt-in global stats) */
.barometer {
  background: #0f1722;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 16px;
}
.barometer h3 { margin: 0 0 4px; font-size: 17px; }
.barometer .how { background: transparent; padding: 0; margin: 8px 0 12px; }
.barometer button.primary.outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  font-weight: 700;
  padding: 12px;
}
.barometer button.primary.outline:hover { background: rgba(92, 242, 192, 0.08); }
#barometer-result {
  margin-top: 12px;
  padding: 12px 14px;
  background: #0b1118;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  font-size: 16px;
}
#barometer-result.error { border-left-color: var(--danger); color: var(--muted); }
#barometer-result code { font-family: var(--mono); font-size: 13px; color: var(--accent); }
