:root {
  --ivory: #fffff0;
  --antique-gold: #c8a951;
  --brass: #b5a642;
  --deep-brass: #75601f;
  --dark: #332b1d;
  --muted: #6b604c;
  --panel: #f8f0db;
  --pale-gold: #e8d9a7;
  --white-gold: #fffdf3;
  --line: #d7c48b;
  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --symbol: "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: var(--ivory);
  color: var(--dark);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; }
button { color: inherit; }

.app-shell {
  width: min(980px, 100%);
  height: 100dvh;
  min-height: 650px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--ivory);
}

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--ivory);
}

.header-wrap { flex: 0 0 auto; }
.app-header {
  min-height: 64px;
  margin: 0 36px;
  padding: 21px 0 8px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.app-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 36px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.progress-label {
  padding-bottom: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
  white-space: nowrap;
}
.gold-rule {
  height: 2px;
  margin: 0 36px;
  background: var(--antique-gold);
}

.progress-track {
  flex: 0 0 auto;
  height: 16px;
  margin: 8px 36px 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(to bottom, var(--brass), #a99338);
  border-right: 1px solid var(--deep-brass);
  transition: width 180ms ease-out;
}

.intro-card,
.language-card,
.question-card {
  border: 1px solid var(--line);
  background: var(--panel);
}
.intro-card,
.language-card {
  flex: 1 1 auto;
  min-height: 0;
  margin: 42px 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}
.language-card { justify-content: center; padding: 42px 55px; }

.planet-glyph-line {
  margin-top: 51px;
  color: var(--deep-brass);
  font-family: var(--symbol);
  font-size: 37px;
  line-height: 1;
  letter-spacing: 6px;
  white-space: nowrap;
}
.planet-name-line {
  margin: 20px 30px 0;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.35;
  font-weight: 700;
}
.intro-meta {
  margin: 21px 24px 0;
  color: var(--deep-brass);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
}
.intro-copy {
  max-width: 650px;
  margin: 11px 55px 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.52;
}
.intro-disclaimer {
  margin: 20px 22px 29px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.language-heading {
  margin: 0;
  font-family: var(--serif);
  font-size: 31px;
  line-height: 1.18;
  font-weight: 700;
}
.language-subheading {
  margin: 10px 0 29px;
  color: var(--deep-brass);
  font-size: 15px;
  font-weight: 700;
}
.language-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 17px;
}
.language-button {
  min-width: 205px;
  padding: 16px 27px;
  border: 1px solid var(--deep-brass);
  background: var(--antique-gold);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.32);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.language-button:hover { background: var(--brass); }
.language-button:focus-visible,
.button:focus-visible,
.option-row:focus-within { outline: 3px solid rgba(117, 96, 31, .3); outline-offset: 2px; }

.button {
  min-height: 43px;
  padding: 9px 18px;
  border: 1px solid #9a8131;
  background: var(--antique-gold);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.32);
  font-size: 15px;
  line-height: 1.2;
  font-weight: 700;
  cursor: pointer;
}
.button:hover:not(:disabled) { background: var(--brass); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled {
  border-color: var(--line);
  background: var(--line);
  color: var(--muted);
  cursor: default;
}
.button-soft {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
  font-size: 14px;
  font-weight: 400;
}
.button-soft:hover:not(:disabled) { background: var(--pale-gold); }
.intro-start { margin-top: 26px; }

.question-card {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 52px 28px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.question-prompt {
  flex: 0 0 auto;
  margin: 0;
  padding: 31px 38px 23px;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.32;
  font-weight: 700;
  text-align: left;
}
.options-wrap {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 34px 10px;
  overflow-y: auto;
  scrollbar-color: var(--line) var(--panel);
}
.option-row {
  position: relative;
  min-height: 48px;
  margin: 10px 0;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  transition: background 90ms ease;
}
.option-row:hover { background: var(--white-gold); }
.option-row.selected { background: var(--white-gold); border-color: var(--antique-gold); }
.option-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.option-label {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px 11px 48px;
  display: flex;
  align-items: center;
  color: var(--dark);
  font-size: 15px;
  line-height: 1.42;
  text-align: left;
  cursor: pointer;
}
.option-label::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 50%;
  width: 14px;
  height: 14px;
  border: 1px solid #85732f;
  border-radius: 50%;
  background: var(--white-gold);
  transform: translateY(-50%);
}
.option-input:checked + .option-label::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--deep-brass);
  transform: translateY(-50%);
}
.question-actions {
  flex: 0 0 auto;
  padding: 8px 38px 29px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.results-scroll {
  flex: 1 1 auto;
  min-height: 0;
  margin: 10px 28px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-color: var(--line) var(--ivory);
}
.results-content { padding: 0 0 1px; }
.results-heading {
  margin: 15px 24px 0;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.25;
  font-weight: 700;
}
.core-blend {
  margin: 5px 24px 21px;
  color: var(--deep-brass);
  font-size: 17px;
  line-height: 1.4;
  font-weight: 700;
}
.bars-card {
  margin: 0 24px 22px;
  padding: 9px 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.bar-row {
  min-height: 34px;
  display: grid;
  grid-template-columns: 154px minmax(90px, 1fr) 62px;
  align-items: center;
  gap: 12px;
}
.bar-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--symbol);
  font-size: 15px;
  font-weight: 700;
}
.symbol { font-family: var(--symbol); line-height: 1; }
.bar-track {
  height: 16px;
  border: 1px solid var(--line);
  background: var(--white-gold);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-right: 1px solid var(--deep-brass);
  background: var(--brass);
}
.bar-value { text-align: right; font-size: 15px; font-weight: 700; }
.clarity {
  margin: 0 24px 20px;
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}
.planet-result-card {
  margin: 16px 24px 0;
  padding: 17px 20px 17px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.result-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 7px;
}
.result-planet {
  color: var(--deep-brass);
  font-family: var(--symbol);
  font-size: 21px;
  line-height: 1.25;
  font-weight: 700;
}
.result-percent { font-size: 19px; font-weight: 700; }
.result-profile {
  margin: 0 0 7px;
  font-size: 15px;
  line-height: 1.48;
}
.result-facets {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  font-style: italic;
}
.results-actions {
  margin: 22px 24px 36px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(51,43,29,.36);
}
.modal {
  width: min(440px, 100%);
  padding: 25px;
  border: 1px solid var(--deep-brass);
  background: var(--ivory);
  box-shadow: 0 14px 42px rgba(51,43,29,.28);
}
.modal h2 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 23px;
}
.modal p { margin: 0 0 23px; color: var(--muted); line-height: 1.5; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

@media (max-width: 800px) {
  body { overflow: auto; }
  .app-shell { min-height: 100dvh; height: 100dvh; }
  .app-header { margin: 0 20px; padding-top: 18px; }
  .gold-rule { margin: 0 20px; }
  .app-title { font-size: 29px; }
  .progress-track { margin-left: 20px; margin-right: 20px; }
  .intro-card, .language-card { margin: 28px 20px; }
  .question-card { margin: 0 20px 20px; }
  .question-prompt { padding: 26px 24px 20px; font-size: 21px; }
  .options-wrap { padding: 0 20px 8px; }
  .question-actions { padding: 8px 24px 24px; }
  .results-scroll { margin-left: 8px; margin-right: 8px; }
  .bar-row { grid-template-columns: 125px minmax(60px, 1fr) 52px; gap: 8px; }
}

@media (max-width: 520px) {
  .app-shell { min-height: 560px; }
  .app-header { align-items: flex-start; gap: 10px; }
  .app-title { font-size: 25px; }
  .progress-label { padding-top: 5px; font-size: 11px; }
  .intro-card { justify-content: center; }
  .planet-glyph-line { margin-top: 22px; font-size: 29px; letter-spacing: 2px; }
  .planet-name-line { font-size: 17px; }
  .intro-copy { margin-left: 24px; margin-right: 24px; font-size: 14px; }
  .question-prompt { font-size: 19px; }
  .option-label { font-size: 14px; padding-left: 43px; }
  .question-actions { gap: 10px; }
  .button { padding-left: 13px; padding-right: 13px; }
  .bars-card { padding-left: 12px; padding-right: 12px; }
  .bar-row { grid-template-columns: 1fr 58px; gap: 8px; padding: 5px 0; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .bar-value { grid-column: 2; grid-row: 1; }
  .results-actions { align-items: stretch; flex-direction: column; }
  .results-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
