:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --surface: #14171c;
  --surface-raised: #1b1f25;
  --text: #f7f7f5;
  --muted: #a6abb4;
  --line: #2c3139;
  --orange: #ff7a1a;
  --cyan: #20b9d5;
  --green: #43c77a;
  --radius: 22px;
  --max: 1180px;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -10%, rgb(32 185 213 / 12%), transparent 34rem),
    radial-gradient(circle at 90% 20%, rgb(255 122 26 / 9%), transparent 30rem),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

button, input { font: inherit; }
button { color: inherit; }

button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 1rem;
  top: -5rem;
  padding: .75rem 1rem;
  background: var(--text);
  color: var(--bg);
  border-radius: .5rem;
}

.skip-link:focus { top: 1rem; }

.site-header, footer {
  width: min(calc(100% - 40px), var(--max));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 24px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.02em;
  text-decoration: none;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 5px 10px 5px 10px;
  background: linear-gradient(135deg, var(--cyan), var(--green) 52%, var(--orange));
  transform: rotate(-8deg);
}

.text-button {
  border: 0;
  padding: .45rem 0;
  background: none;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgb(255 255 255 / 35%);
  text-underline-offset: 5px;
}

.text-button:hover { text-decoration-color: var(--orange); }
.text-button.muted { color: var(--muted); }

main {
  width: min(calc(100% - 40px), var(--max));
  min-height: calc(100vh - 184px);
  margin-inline: auto;
}

.screen { animation: reveal .35s ease both; }
.screen[hidden] { display: none; }

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

.home-screen {
  max-width: 990px;
  padding: clamp(70px, 11vw, 142px) 0 84px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgb(67 199 122 / 12%);
}

h1, h2, p { margin-top: 0; }

h1 {
  max-width: 900px;
  margin-bottom: 24px;
  font-size: clamp(3.15rem, 8.7vw, 7.4rem);
  line-height: .94;
  letter-spacing: -.065em;
}

.lead {
  max-width: 760px;
  margin-bottom: 36px;
  color: #d2d5d9;
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  line-height: 1.55;
}

.home-actions, .result-actions, .quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  min-height: 54px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, opacity .16s ease;
}

.download-link { white-space: nowrap; }

.button:hover:not(:disabled) { transform: translateY(-2px); }
.button:disabled { cursor: not-allowed; opacity: .35; }
.button-primary { background: var(--text); color: var(--bg); }
.button-primary:hover:not(:disabled) { background: #fff; }
.button-secondary { background: transparent; border-color: var(--line); }
.button-secondary:hover { border-color: #555c67; background: rgb(255 255 255 / 3%); }
.button-ghost { background: transparent; color: var(--muted); padding-inline: 8px; }

.saved-result {
  display: flex;
  width: min(100%, 610px);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 16px 20px;
  border: 1px solid rgb(67 199 122 / 35%);
  border-radius: 14px;
  background: rgb(67 199 122 / 8%);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.saved-result[hidden] { display: none; }
.saved-result span { color: var(--muted); }
.saved-result strong { white-space: nowrap; }

.intro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 760px;
  margin-top: 76px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.intro-grid div { padding: 22px 20px 22px 0; }
.intro-grid div + div { padding-left: 22px; border-left: 1px solid var(--line); }
.intro-grid strong, .intro-grid span { display: block; }
.intro-grid strong { font-size: 1.45rem; }
.intro-grid span { color: var(--muted); font-size: .88rem; }

.privacy-note, .disclaimer {
  max-width: 720px;
  margin-top: 22px;
  color: var(--muted);
  font-size: .82rem;
}

.privacy-page {
  max-width: 820px;
  padding: clamp(58px, 8vw, 96px) 0 90px;
}

.privacy-page h1 { font-size: clamp(2.8rem, 7vw, 5.8rem); }
.privacy-page section { margin-top: 42px; padding-top: 28px; border-top: 1px solid var(--line); }
.privacy-page h2 { margin-bottom: 12px; font-size: clamp(1.4rem, 3vw, 2rem); }
.privacy-page p { max-width: 740px; color: #d2d5d9; }
.privacy-page .button { margin-top: 22px; color: var(--bg); }

.quiz-screen {
  width: min(100%, 840px);
  margin-inline: auto;
  padding: clamp(58px, 8vw, 96px) 0 90px;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.progress-track { height: 4px; overflow: hidden; border-radius: 4px; background: var(--line); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--green), var(--orange)); transition: width .25s ease; }

.question-card { margin-top: 48px; }
.question-card fieldset { margin: 0; padding: 0; border: 0; }
.question-card legend { max-width: 780px; margin-bottom: 34px; font-size: clamp(1.7rem, 4.5vw, 3.3rem); font-weight: 800; line-height: 1.12; letter-spacing: -.035em; }

.answer-list { display: grid; gap: 10px; }
.answer-option {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgb(255 255 255 / 1.5%);
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, transform .14s ease;
}

.answer-option:hover { transform: translateX(3px); border-color: #515862; }
.answer-option:has(input:checked) { border-color: var(--green); background: rgb(67 199 122 / 9%); }
.answer-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.answer-option:has(input:focus-visible) { outline: 3px solid var(--cyan); outline-offset: 3px; }
.radio-marker { display: grid; width: 22px; height: 22px; place-items: center; border: 2px solid #69717c; border-radius: 50%; }
.radio-marker::after { width: 10px; height: 10px; border-radius: 50%; background: var(--green); content: ""; opacity: 0; transform: scale(.4); transition: .15s ease; }
.answer-option:has(input:checked) .radio-marker { border-color: var(--green); }
.answer-option:has(input:checked) .radio-marker::after { opacity: 1; transform: scale(1); }

.quiz-actions { justify-content: space-between; margin-top: 34px; }

.result-screen { padding: clamp(58px, 8vw, 96px) 0 90px; }
.result-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 48px; }
.result-heading h1 { margin: 0 0 8px; font-size: clamp(3rem, 8vw, 6.8rem); }
.result-score { margin: 0; color: var(--muted); font-size: 1.2rem; }
.result-badge { display: grid; width: 124px; height: 124px; flex: 0 0 auto; place-items: center; border: 2px solid var(--orange); border-radius: 50%; color: var(--orange); font-size: 2.4rem; font-weight: 800; }

.time-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.time-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.time-card.accent { border-color: rgb(255 122 26 / 50%); background: linear-gradient(140deg, rgb(255 122 26 / 12%), var(--surface) 55%); }
.time-card span, .time-card small, .time-card strong { display: block; }
.time-card span { margin-bottom: 26px; color: var(--muted); font-size: .77rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.time-card strong { margin-bottom: 7px; font-size: clamp(2.2rem, 5vw, 4rem); letter-spacing: -.05em; }
.time-card small { color: var(--muted); }

.curve-card { padding: clamp(22px, 4vw, 42px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.curve-copy { display: grid; grid-template-columns: 1.15fr .85fr; align-items: end; gap: 40px; }
.curve-copy h2 { max-width: 650px; margin-bottom: 0; font-size: clamp(1.65rem, 3.7vw, 3rem); line-height: 1.08; letter-spacing: -.035em; }
.curve-copy > p { margin-bottom: 4px; color: var(--muted); }
.energy-curve { display: block; width: 100%; height: auto; margin-top: 30px; overflow: visible; }
.chart-grid { stroke: #2c3139; stroke-width: 1; stroke-dasharray: 4 8; }
.curve-shadow { fill: none; stroke: rgb(32 185 213 / 20%); stroke-width: 16; stroke-linejoin: round; filter: blur(4px); }
.curve-line { fill: none; stroke: url(#curveGradient); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.chart-label, .chart-marker-label { fill: #a6abb4; font-family: Arial, sans-serif; }
.chart-label { font-size: 17px; }
.chart-marker-label { fill: #f7f7f5; font-size: 16px; font-weight: 700; }
.chart-marker-line { stroke: rgb(255 255 255 / 22%); stroke-width: 1.5; stroke-dasharray: 5 7; }
.chart-marker-dot { fill: #f7f7f5; }

.result-actions { margin-top: 24px; }
.save-instruction { max-width: 760px; margin: 20px 0 8px; color: var(--muted); }
.save-instruction strong { color: var(--text); }
.submit-status { min-height: 1.5rem; margin-bottom: 8px; color: var(--green); font-size: .86rem; }
.disclaimer { padding-top: 18px; border-top: 1px solid var(--line); }

.stats-dialog {
  width: min(calc(100% - 28px), 720px);
  max-height: min(88vh, 760px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #111419;
  color: var(--text);
  box-shadow: 0 30px 100px rgb(0 0 0 / 55%);
}

.stats-dialog::backdrop { background: rgb(2 4 7 / 76%); backdrop-filter: blur(6px); }
.dialog-heading { position: sticky; z-index: 2; top: 0; display: flex; align-items: start; justify-content: space-between; padding: 28px 30px 20px; background: rgb(17 20 25 / 94%); backdrop-filter: blur(10px); }
.dialog-heading h2 { margin: 0; font-size: clamp(1.7rem, 5vw, 2.6rem); letter-spacing: -.04em; }
.icon-button { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 1.7rem; cursor: pointer; }
.stats-loading, .stats-empty { padding: 60px 30px 70px; color: var(--muted); text-align: center; }
.stats-empty strong { display: block; margin-bottom: 8px; color: var(--text); font-size: 1.15rem; }
.stats-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 30px 34px; border: 1px solid var(--line); border-radius: 16px; }
.stats-summary div { padding: 18px; }
.stats-summary div + div { border-left: 1px solid var(--line); }
.stats-summary strong, .stats-summary span { display: block; }
.stats-summary strong { font-size: 1.8rem; }
.stats-summary span { color: var(--muted); font-size: .75rem; }
.stats-bars { display: grid; gap: 17px; padding-inline: 30px; }
.stats-bar-label { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: .9rem; }
.stats-bar-label span { color: #d2d5d9; }
.stats-bar-track { height: 10px; overflow: hidden; border-radius: 999px; background: var(--line); }
.stats-bar-track span { display: block; height: 100%; min-width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--green), var(--orange)); }
.stats-privacy { margin: 30px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px 0 34px; border-top: 1px solid rgb(255 255 255 / 8%); color: var(--muted); font-size: .78rem; }
footer a { color: inherit; text-underline-offset: 3px; }

@media (max-width: 760px) {
  .site-header .text-button { font-size: .8rem; }
  .home-screen { padding-top: 68px; }
  h1 { font-size: clamp(3rem, 15vw, 5rem); }
  .intro-grid { grid-template-columns: 1fr; margin-top: 58px; }
  .intro-grid div + div { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .saved-result { align-items: start; flex-direction: column; }
  .time-cards { grid-template-columns: 1fr; }
  .curve-copy { grid-template-columns: 1fr; gap: 16px; }
  .result-heading { align-items: start; }
  .result-badge { width: 86px; height: 86px; font-size: 1.8rem; }
  .stats-summary { grid-template-columns: 1fr; }
  .stats-summary div + div { border-top: 1px solid var(--line); border-left: 0; }
  footer { flex-direction: column; }
}

@media (max-width: 480px) {
  .site-header, footer, main { width: min(calc(100% - 28px), var(--max)); }
  .site-header { padding-block: 18px; }
  .brand { font-size: 1rem; }
  .home-actions, .result-actions { flex-direction: column; }
  .home-actions .button, .result-actions .button { width: 100%; }
  .quiz-actions .button-primary { flex: 1; }
  .answer-option { min-height: 60px; }
  .result-heading { display: block; }
  .result-badge { margin-top: 22px; }
  .time-card { padding: 20px; }
  .chart-marker-label { font-size: 13px; }
  .dialog-heading, .stats-loading, .stats-empty { padding-inline: 20px; }
  .stats-summary, .stats-privacy { margin-inline: 20px; }
  .stats-bars { padding-inline: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
