:root {
  --ink: #241915;
  --muted: #5f6660;
  --paper: #f6f7f5;
  --panel: #ffffff;
  --panel-soft: #eef4ef;
  --line: #c9d3ca;
  --accent: #9d2f25;
  --accent-dark: #6f1f19;
  --gold: #c58b35;
  --green: #2f6f55;
  --focus: #1d6f8f;
  --shadow: 0 16px 42px rgba(36, 25, 21, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #f6f7f5 0%, #e8eee8 100%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
}

.view {
  display: none;
  min-height: 100vh;
  padding: 40px 20px;
}

.view.is-active {
  display: grid;
  align-items: center;
}

.section-inner {
  width: min(880px, 100%);
  margin: 0 auto;
}

.intro-layout,
.quiz-layout,
.center-layout {
  padding: 32px 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 760px;
  margin: 0 0 16px;
  font-size: 42px;
  line-height: 1.16;
}

h2 {
  margin: 0 0 16px;
  font-size: 30px;
  line-height: 1.25;
}

h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.intro-text,
.question-text,
.result-block p {
  color: var(--muted);
  line-height: 1.75;
}

.intro-text {
  max-width: 680px;
  margin: 0 0 24px;
}

.progress-row {
  margin-bottom: 22px;
}

.progress-text {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 8px;
  background: #dce5dd;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--accent), var(--green));
}

.question-text {
  margin: 0 0 24px;
  font-size: 21px;
  line-height: 1.65;
}

.options-list {
  display: grid;
  gap: 14px;
}

.option-button,
.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
}

.option-button {
  width: 100%;
  padding: 16px 18px;
  border: 2px solid var(--line);
  color: var(--ink);
  background: var(--panel);
  text-align: left;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.option-button:hover,
.option-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(157, 47, 37, 0.12);
}

.option-button.is-selected {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.answer-hint {
  min-height: 28px;
  margin: 16px 0 0;
  color: var(--accent);
  font-weight: 700;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.primary-button,
.secondary-button {
  padding: 13px 18px;
  border: 1px solid transparent;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-dark);
}

.secondary-button {
  color: var(--green);
  border-color: currentColor;
  background: transparent;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  color: #fff;
  background: var(--green);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-button:disabled:hover,
.secondary-button:disabled:focus-visible {
  color: var(--green);
  background: transparent;
}

.center-layout {
  text-align: center;
}

.result-layout {
  display: grid;
  gap: 0;
  padding: 28px 0;
}

.result-block {
  padding: 24px 0;
  border-top: 1px solid var(--line);
  background: transparent;
}

#primaryResult {
  padding-top: 0;
  border-top: 0;
}

.result-subtitle {
  margin: 0 0 16px;
  font-size: 18px;
  color: var(--ink);
  font-weight: 700;
}

.meta-row,
.tag-list,
.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-row span,
.tag-list span,
.related-list span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  line-height: 1.4;
}

.description-list p {
  margin: 0 0 14px;
}

.result-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin: 18px 0;
}

.result-columns h4 {
  margin: 0 0 8px;
}

.result-columns ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.75;
}

.score-list,
.match-list {
  display: grid;
  gap: 14px;
}

.score-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.score-track {
  height: 10px;
  overflow: hidden;
  border-radius: 8px;
  background: #dce5dd;
}

.score-fill {
  height: 100%;
  border-radius: 8px;
  background: var(--green);
}

.match-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.match-item span {
  justify-self: start;
  color: var(--accent);
  font-weight: 700;
}

.match-item p {
  margin: 0;
}

.copy-status {
  min-height: 28px;
  margin: 0;
  color: var(--green);
  font-weight: 700;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .view {
    padding: 22px 14px;
  }

  .intro-layout,
  .quiz-layout,
  .center-layout,
  .result-layout {
    padding: 18px 0;
  }

  h1 {
    font-size: 32px;
    line-height: 1.18;
  }

  h2 {
    font-size: 24px;
  }

  .question-text {
    font-size: 19px;
  }

  .button-row {
    flex-direction: column;
    gap: 10px;
  }

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

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
