/* ── RESET & BASE ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0d0d0d;
  --surface:    #161616;
  --surface-2:  #1f1f1f;
  --border:     #2c2c2c;
  --accent:     #f0a500;
  --accent-dim: rgba(240,165,0,.15);
  --green:      #22c55e;
  --green-dim:  rgba(34,197,94,.15);
  --red:        #ef4444;
  --red-dim:    rgba(239,68,68,.15);
  --yellow:     #eab308;
  --text:       #f1f1f1;
  --text-muted: #888;
  --text-dim:   #555;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 4px 24px rgba(0,0,0,.5);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --ring-c: 326.73; /* 2πr where r=52 */
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; border: none; }

/* ── SCREENS ─────────────────────────────────────────────── */
.screen {
  display: none;
  min-height: 100vh;
  animation: fadeIn .3s ease;
}
.screen.active           { display: block; }
#screen-landing.active   { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── LANDING ─────────────────────────────────────────────── */
#screen-landing {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(240,165,0,.12) 0%, transparent 70%),
    var(--bg);
}

.landing-inner {
  max-width: 560px;
  width: 100%;
  text-align: center;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  font-size: 2rem;
  font-weight: 900;
  color: var(--bg);
  background: var(--accent);
  border-radius: 16px;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 40px rgba(240,165,0,.3);
  letter-spacing: -2px;
}

.site-title {
  font-size: clamp(2.4rem, 8vw, 4rem);
  font-weight: 900;
  letter-spacing: -2px;
  color: var(--text);
  line-height: 1;
  margin-bottom: .5rem;
}

.site-subtitle {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.site-description {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

.landing-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: .25rem;
}

.disclaimer {
  margin-top: 1rem;
  font-size: .8rem;
  color: var(--text-dim);
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #000;
  font-weight: 800;
  font-size: 1rem;
  padding: .9rem 2rem;
  border-radius: var(--radius);
  border: none;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 0 20px rgba(240,165,0,.25);
  letter-spacing: .02em;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 30px rgba(240,165,0,.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-back {
  background: transparent;
  color: var(--text-muted);
  font-size: .9rem;
  padding: .4rem .8rem;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
}
.btn-back:hover { background: var(--surface); color: var(--text); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
}

/* ── QUIZ HEADER ─────────────────────────────────────────── */
.quiz-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(13,13,13,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.5rem;
}

.progress-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .4s ease;
  width: 0%;
}

.step-label {
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── QUIZ INNER ───────────────────────────────────────────  */
.quiz-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.quiz-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  margin-bottom: .5rem;
  letter-spacing: -.5px;
}

.quiz-sub {
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 520px;
}

/* ── VALUE SLIDERS ─────────────────────────────────────────── */
.sliders-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.slider-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  transition: border-color .2s;
}
.slider-card:focus-within { border-color: var(--accent); }

.slider-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}

.slider-label {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1rem;
}

.slider-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.slider-value-badge {
  font-size: .85rem;
  font-weight: 700;
  background: var(--accent-dim);
  color: var(--accent);
  padding: .2rem .6rem;
  border-radius: 20px;
  min-width: 80px;
  text-align: center;
  transition: all .2s;
}

.slider-desc {
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: .85rem;
  line-height: 1.5;
}

.slider-input {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(240,165,0,.4);
  transition: transform .15s, box-shadow .15s;
}
.slider-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 14px rgba(240,165,0,.6);
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: .4rem;
}
.slider-ticks span {
  font-size: .72rem;
  color: var(--text-dim);
}

/* ── BRAND GRID ──────────────────────────────────────────── */
.brands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .75rem;
  margin-bottom: 2.5rem;
}

.brand-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem .75rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.brand-card:hover { background: var(--surface-2); transform: translateY(-2px); }
.brand-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.brand-card.selected::after {
  content: '✓';
  position: absolute;
  top: 6px; right: 8px;
  font-size: .75rem;
  font-weight: 800;
  color: var(--accent);
}

.brand-emoji { font-size: 2rem; display: block; margin-bottom: .4rem; }
.brand-name { font-size: .82rem; font-weight: 700; line-height: 1.3; color: var(--text); }
.brand-cat { font-size: .7rem; color: var(--text-dim); margin-top: .2rem; }

/* ── RESULTS HEADER ──────────────────────────────────────── */
.results-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(13,13,13,.92);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.results-title {
  font-size: 1.1rem;
  font-weight: 800;
}

/* ── RESULTS INNER ───────────────────────────────────────── */
.results-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* ── SCORE CARD ──────────────────────────────────────────── */
.score-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.score-ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.score-ring {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 10;
}

.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: var(--ring-c);
  stroke-dashoffset: var(--ring-c);
  transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1), stroke .4s;
}

.score-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-pct {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
}
.score-label { font-size: .72rem; color: var(--text-muted); }

.score-details { flex: 1; min-width: 220px; }
.score-details h3 { font-size: 1.3rem; font-weight: 800; margin-bottom: .35rem; }
.score-details p  { color: var(--text-muted); font-size: .9rem; margin-bottom: 1rem; }

.debt-badge {
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius-sm);
  padding: .9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.debt-label  { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--red); font-weight: 700; }
.debt-amount { font-size: 2rem; font-weight: 900; color: var(--red); line-height: 1; }
.debt-explain { font-size: .78rem; color: var(--text-muted); }

/* ── RESULTS SECTIONS ────────────────────────────────────── */
.results-section {}
.results-section-title { font-size: 1.1rem; font-weight: 800; margin-bottom: .35rem; }
.results-section-sub   { font-size: .85rem; color: var(--text-muted); margin-bottom: 1rem; }

/* ── COMPANY CARDS ───────────────────────────────────────── */
.company-cards {
  display: grid;
  gap: .75rem;
}

.company-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.company-card:hover { border-color: var(--accent); background: var(--surface-2); }

.company-card-emoji { font-size: 1.8rem; flex-shrink: 0; }

.company-card-info { flex: 1; min-width: 0; }
.company-card-name { font-weight: 700; font-size: .97rem; }
.company-card-sub  { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.company-card-score {
  font-size: 1.4rem;
  font-weight: 900;
  flex-shrink: 0;
  min-width: 48px;
  text-align: right;
}

.score-good   { color: var(--green); }
.score-ok     { color: var(--yellow); }
.score-bad    { color: var(--red); }

/* ── BREAKDOWN TABLE ─────────────────────────────────────── */
.breakdown-table {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.breakdown-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .85rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  cursor: pointer;
  transition: border-color .2s;
}
.breakdown-row:hover { border-color: var(--accent); }

.breakdown-emoji { font-size: 1.4rem; flex-shrink: 0; }
.breakdown-name  { flex: 1; font-weight: 700; font-size: .9rem; }
.breakdown-bar   { width: 90px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.breakdown-bar-fill { height: 100%; border-radius: 3px; background: var(--green); transition: width .8s ease; }
.breakdown-pct { font-size: .85rem; font-weight: 700; min-width: 36px; text-align: right; flex-shrink: 0; }

/* ── DIMENSION BARS ──────────────────────────────────────── */
.dimension-bars {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.dim-row {
  display: flex;
  align-items: center;
  gap: .85rem;
}

.dim-icon { font-size: 1.2rem; width: 26px; flex-shrink: 0; }
.dim-label { font-size: .85rem; font-weight: 600; width: 140px; flex-shrink: 0; }
.dim-track { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.dim-fill { height: 100%; border-radius: 4px; transition: width .9s ease; }
.dim-pct  { font-size: .8rem; font-weight: 700; min-width: 36px; text-align: right; flex-shrink: 0; }

/* ── SHARE SECTION ───────────────────────────────────────── */
.share-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  text-align: center;
}
.share-section h3 { margin-bottom: .4rem; font-size: 1.1rem; }
.share-section p  { color: var(--text-muted); margin-bottom: 1.25rem; font-size: .9rem; }

.share-buttons {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

.btn-share {
  padding: .7rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .9rem;
  transition: opacity .2s, transform .15s;
}
.btn-share:hover { opacity: .85; transform: translateY(-1px); }

.btn-twitter { background: #1d9bf0; color: #fff; }
.btn-copy    { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }

.share-privacy { font-size: .75rem; color: var(--text-dim); margin-bottom: 0 !important; }

/* ── SOURCES SECTION ─────────────────────────────────────── */
.sources-section {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}
.sources-section h3 { font-size: 1rem; margin-bottom: .85rem; }

.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .4rem .75rem;
  margin-bottom: 1rem;
}
.sources-grid a {
  font-size: .8rem;
  color: var(--text-muted);
  transition: color .2s;
}
.sources-grid a:hover { color: var(--accent); text-decoration: none; }
.sources-grid a::before { content: '↗ '; }

.sources-note {
  font-size: .78rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}

@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  position: relative;
  animation: slideUp .2s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: var(--surface-2);
  color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.modal-close:hover { background: var(--border); color: var(--text); }

.modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.modal-emoji { font-size: 2.5rem; flex-shrink: 0; }
.modal-header h3 { font-size: 1.2rem; font-weight: 800; }
.modal-category { font-size: .78rem; color: var(--text-muted); }

.modal-overall-score {
  margin-left: auto;
  text-align: right;
  flex-shrink: 0;
}
.modal-overall-score span:first-child { font-size: 2rem; font-weight: 900; }
.modal-overall-score span:last-child  { font-size: .8rem; color: var(--text-muted); }

.modal-dimension-scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  margin-bottom: 1.25rem;
}

.mdim {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: .6rem .8rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.mdim-icon  { font-size: 1rem; }
.mdim-info  { flex: 1; }
.mdim-label { font-size: .7rem; color: var(--text-muted); display: block; }
.mdim-score { font-size: .9rem; font-weight: 800; }

.modal-notes {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.note-row {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: .75rem .9rem;
  border-left: 3px solid var(--border);
}
.note-row.highlighted { border-left-color: var(--red); }
.note-row.good        { border-left-color: var(--green); }

.note-title { font-weight: 700; font-size: .82rem; margin-bottom: .2rem; display: flex; align-items: center; gap: .4rem; }
.note-text  { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }

/* ── UTILITY ─────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .score-card { flex-direction: column; align-items: flex-start; }
  .dim-label  { width: 100px; font-size: .77rem; }
  .brands-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .modal-dimension-scores { grid-template-columns: 1fr; }
}
