/* ==========================================================================
   Design System — derived from fictional_minds_bestiary.html
   ========================================================================== */

:root {
  --bg: #0f1114;
  --surface: #181b20;
  --surface-hover: #1f2329;
  --border: #2a2e35;
  --text: #d4d4d8;
  --text-muted: #8b8d94;
  --text-heading: #f0f0f2;
  --accent: #c4956a;
  --accent-dim: #8a6a4e;

  --score-1: #3b2024; --score-2: #3d2826; --score-3: #3e3125;
  --score-4: #3a3524; --score-5: #333724; --score-6: #2b3826;
  --score-7: #243a2b; --score-8: #1f3a35; --score-9: #1d3740;
  --score-10: #1c3348;

  --score-text-1: #e07070; --score-text-2: #d8805e; --score-text-3: #cc944e;
  --score-text-4: #c0a244; --score-text-5: #b0ae40; --score-text-6: #92b44a;
  --score-text-7: #6cb85c; --score-text-8: #50b87e; --score-text-9: #44b4a0;
  --score-text-10: #42aec4;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Screen system
   ========================================================================== */

.screen {
  display: none;
  opacity: 0;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.screen--active {
  display: block;
  animation: fadeUp 600ms ease forwards;
}

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

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3 {
  font-family: 'Newsreader', serif;
  color: var(--text-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 { font-size: 2.8rem; line-height: 1.1; margin-bottom: 16px; }
h2 { font-size: 1.8rem; line-height: 1.2; margin-bottom: 12px; }
h3 { font-size: 1.25rem; line-height: 1.3; margin-bottom: 8px; }

.subtitle {
  font-family: 'Newsreader', serif;
  font-style: italic;
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 620px;
  line-height: 1.5;
}

.accent-label {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ==========================================================================
   Landing screen
   ========================================================================== */

.landing-content { margin-top: 60px; }

.landing-content h1 { margin-bottom: 20px; }

.landing-intro {
  color: var(--text);
  font-size: 1rem;
  max-width: 600px;
  margin-bottom: 32px;
  line-height: 1.7;
}

.dimension-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 36px;
}

.dimension-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}

.dimension-chip .dim-q {
  font-family: 'Newsreader', serif;
  font-style: italic;
  color: var(--text-heading);
  font-size: 1rem;
}

.dimension-chip .dim-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 2px;
}

.time-estimate {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 36px;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn--primary {
  background: var(--accent);
  color: #0f1114;
}

.btn--primary:hover { background: #d4a57a; }

.btn--primary:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--secondary:hover { background: var(--surface-hover); }

.btn--skip {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 6px;
}

.btn--skip:hover { color: var(--text); border-color: var(--text-muted); }

/* ==========================================================================
   Progress bar
   ========================================================================== */

.progress-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  padding: 16px 0 12px;
  margin-bottom: 24px;
}

.progress-track {
  display: flex;
  gap: 6px;
  align-items: center;
}

.progress-segment {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.3s ease;
}

.progress-segment--done { background: var(--accent); }
.progress-segment--active { background: var(--accent-dim); }

.progress-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 8px;
}

/* ==========================================================================
   Quiz — Round + Entity cards
   ========================================================================== */

.round-header {
  margin-bottom: 28px;
}

.round-header .round-number {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 4px;
}

.round-header .round-framing {
  font-family: 'Newsreader', serif;
  font-style: italic;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.5;
  margin-top: 8px;
}

.entity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  transition: opacity 0.4s ease, max-height 0.4s ease;
  overflow: hidden;
}

.entity-card--skipped {
  opacity: 0.4;
  max-height: 80px !important;
  padding: 16px 24px;
}

.entity-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.entity-name {
  font-family: 'Newsreader', serif;
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--text-heading);
}

.entity-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.entity-meta .entity-type {
  color: var(--accent-dim);
  font-weight: 500;
}

.entity-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.entity-skip-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* ==========================================================================
   Sliders
   ========================================================================== */

.slider-group {
  margin-bottom: 16px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.slider-question {
  font-size: 0.9rem;
  color: var(--text);
}

.slider-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.slider-badge--unset {
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.65rem;
  width: auto;
  padding: 0 8px;
}

.slider-badge--pulse {
  animation: badgePulse 200ms ease;
}

@keyframes badgePulse {
  50% { transform: scale(1.15); }
}

/* Custom range slider */
.slider-track {
  position: relative;
  width: 100%;
  height: 24px;
  display: flex;
  align-items: center;
}

.slider-track input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  position: relative;
}

/* Fill via linear-gradient trick */
.slider-track input[type="range"] {
  --pct: 0%;
  background: linear-gradient(to right, var(--fill-color, var(--accent-dim)) var(--pct), var(--border) var(--pct));
}

/* Thumb */
.slider-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 0 0 0 rgba(196, 149, 106, 0);
  transition: box-shadow 0.15s ease;
  cursor: grab;
}

.slider-track input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 0 0 0 rgba(196, 149, 106, 0);
  transition: box-shadow 0.15s ease;
  cursor: grab;
}

.slider-track input[type="range"]:hover::-webkit-slider-thumb {
  box-shadow: 0 0 12px rgba(196, 149, 106, 0.4);
}

.slider-track input[type="range"]:hover::-moz-range-thumb {
  box-shadow: 0 0 12px rgba(196, 149, 106, 0.4);
}

/* Unset slider hides thumb */
.slider-track--unset input[type="range"]::-webkit-slider-thumb {
  opacity: 0;
}

.slider-track--unset input[type="range"]::-moz-range-thumb {
  opacity: 0;
}

.slider-track--unset input[type="range"] {
  background: var(--border);
}

.slider-below {
  min-height: 2.6em;
  margin-top: 4px;
}

.slider-anchor {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.slider-hint-row {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.slider-hint-text {
  font-style: italic;
}

/* ==========================================================================
   Quiz navigation
   ========================================================================== */

.round-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.round-nav .entity-count {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ==========================================================================
   Submission screen
   ========================================================================== */

.submission-content {
  text-align: center;
  padding-top: 80px;
}

.submission-content h2 {
  font-size: 2.2rem;
  margin-bottom: 16px;
}

.submission-content p {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 1rem;
}

.submission-warning {
  color: var(--score-text-3);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ==========================================================================
   Results screen
   ========================================================================== */

.results-section {
  margin-bottom: 48px;
}

.results-section h2 {
  margin-bottom: 16px;
}

.results-section h3 {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'DM Sans', sans-serif;
}

/* Predicted scores grid */
.predicted-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.predicted-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  opacity: 0;
  animation: staggerIn 400ms ease forwards;
}

.predicted-card .pred-dim {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.predicted-card .pred-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1.3rem;
}

.predicted-card .pred-question {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
}

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

/* Insights */
.insights-list {
  list-style: none;
}

.insights-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  animation: fadeUp 600ms ease forwards;
}

.insights-list li:last-child { border-bottom: none; }

/* Disclaimer */
.disclaimer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-style: italic;
  margin-top: 20px;
}

/* Distinctive ratings */
.distinctive-list {
  list-style: none;
}

.distinctive-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.5;
}

.distinctive-list li:last-child { border-bottom: none; }

.distinctive-entity {
  font-family: 'Newsreader', serif;
  font-weight: 600;
  color: var(--text-heading);
}

.distinctive-dim {
  color: var(--accent);
  font-weight: 500;
}

.distinctive-pct {
  color: var(--text-muted);
}

/* Framework summary */
.framework-list {
  list-style: none;
}

.framework-list li {
  padding: 8px 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.framework-list li::before {
  content: "\2022";
  color: var(--accent);
  margin-right: 10px;
}

/* Aggregate explore */
.aggregate-info {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ==========================================================================
   Radar chart
   ========================================================================== */

.radar-section {
  margin: 32px 0 24px;
}

.radar-chart-container {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.radar-svg {
  width: 100%;
  max-width: 420px;
  height: auto;
}

.radar-grid-ring {
  fill: none;
  stroke: var(--border);
  stroke-width: 1;
}

.radar-axis {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.radar-label {
  fill: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  dominant-baseline: middle;
}

/* Chip bar */
.radar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.radar-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-left-color: var(--border);
  background: transparent;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.radar-chip:hover { border-color: var(--text-muted); }

.radar-chip--active {
  color: var(--text-heading);
  border-color: transparent;
  border-left-width: 3px;
}

.radar-chip--disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Legend */
.radar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-bottom: 8px;
}

.radar-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.radar-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ==========================================================================
   Share screen
   ========================================================================== */

.share-content { text-align: center; padding-top: 40px; }

.share-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 480px;
  margin: 0 auto 24px;
}

.share-card h3 {
  font-family: 'Newsreader', serif;
  font-size: 1.2rem;
  color: var(--text-heading);
  margin-bottom: 16px;
  text-transform: none;
  letter-spacing: normal;
}

.share-scores-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.share-score-item {
  text-align: center;
}

.share-score-item .share-dim {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.share-score-item .share-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.1rem;
}

.share-cta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 12px;
}

.share-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.retake-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  margin-top: 24px;
  display: inline-block;
}

.retake-link:hover { text-decoration: underline; }

/* ==========================================================================
   Loading spinner
   ========================================================================== */

.loading {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 640px) {
  .screen { padding: 24px 16px 60px; }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }

  .dimension-grid { grid-template-columns: 1fr; }

  .entity-card { padding: 20px 16px; }
  .entity-name { font-size: 1.15rem; }

  .slider-label { flex-direction: column; align-items: flex-start; gap: 4px; }

  .slider-track input[type="range"] { height: 6px; }
  .slider-track input[type="range"]::-webkit-slider-thumb { width: 32px; height: 32px; }
  .slider-track input[type="range"]::-moz-range-thumb { width: 32px; height: 32px; }

  .predicted-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .predicted-card { padding: 12px 8px; }
  .predicted-card .pred-score { width: 40px; height: 40px; font-size: 1.1rem; }

  .share-scores-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Prevent scroll-while-drag on sliders */
.slider-track { touch-action: none; }
