:root {
  color-scheme: light;
  --bg: #f7efe3;
  --bg-strong: #f3e2c3;
  --ink: #1f2933;
  --muted: #5c6975;
  --panel: rgba(255, 250, 242, 0.78);
  --panel-border: rgba(31, 41, 51, 0.08);
  --accent: #cb5c39;
  --accent-deep: #8d3116;
  --accent-soft: #f2b38d;
  --teal: #195d66;
  --gold: #d5a43a;
  --shadow: 0 24px 60px rgba(77, 54, 35, 0.14);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-sm: 12px;
  --content-width: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(242, 179, 141, 0.5), transparent 28%),
    radial-gradient(circle at 85% 15%, rgba(25, 93, 102, 0.24), transparent 20%),
    linear-gradient(135deg, #f9f2e8 0%, #f6e9d6 46%, #f8f3ee 100%);
}

button,
a {
  font: inherit;
}

.page-shell {
  position: relative;
  width: min(calc(100% - 32px), var(--content-width));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.panel {
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(10px);
  opacity: 0.8;
  animation: drift 16s ease-in-out infinite;
}

.ambient-a {
  top: 7%;
  right: 8%;
  width: 220px;
  height: 220px;
  background: rgba(203, 92, 57, 0.16);
}

.ambient-b {
  top: 45%;
  left: 4%;
  width: 180px;
  height: 180px;
  background: rgba(25, 93, 102, 0.15);
  animation-delay: -4s;
}

.ambient-c {
  bottom: 8%;
  right: 16%;
  width: 240px;
  height: 240px;
  background: rgba(213, 164, 58, 0.12);
  animation-delay: -9s;
}

.hero,
.quiz-shell,
.result-shell {
  padding: 34px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -35% auto;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(203, 92, 57, 0.14), transparent 62%);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.hero h1 {
  margin: 0;
  font-family: "Instrument Serif", "Georgia", serif;
  font-size: clamp(4rem, 12vw, 7.4rem);
  font-weight: 400;
  line-height: 0.9;
}

.subtitle {
  margin: 8px 0 12px;
  font-size: 1.12rem;
  color: var(--teal);
}

.description {
  max-width: 660px;
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.75;
  color: var(--muted);
}

.hero-actions,
.quiz-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-actions {
  margin-top: 28px;
}

.hero-actions-secondary {
  margin-top: 16px;
  justify-content: flex-end;
}

.primary-button,
.ghost-button,
.answer-button {
  border: 0;
  border-radius: 999px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.primary-button,
.ghost-button {
  min-height: 52px;
  padding: 0 22px;
  cursor: pointer;
  text-decoration: none;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, #a63f21 100%);
  color: #fff9f0;
  box-shadow: 0 18px 30px rgba(166, 63, 33, 0.18);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.45);
  color: var(--ink);
  border: 1px solid rgba(31, 41, 51, 0.12);
}

.primary-button:hover,
.ghost-button:hover,
.answer-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.hero-stats div,
.dimension-card,
.question-card,
.result-card {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(31, 41, 51, 0.06);
  border-radius: var(--radius-lg);
}

.hero-stats div {
  padding: 18px 20px;
}

.hero-stats span {
  display: block;
  font-size: 1.8rem;
  color: var(--teal);
}

.hero-stats p,
.dimension-card p,
.result-card p,
.footnote {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.dimension-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.dimension-sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.dimension-sheet-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(31, 41, 51, 0.26);
  cursor: pointer;
}

.dimension-sheet-panel {
  position: absolute;
  right: 24px;
  bottom: 24px;
  left: 24px;
  max-width: 980px;
  max-height: min(72vh, 760px);
  margin: 0 auto;
  padding: 24px;
  overflow: auto;
  border: 1px solid rgba(31, 41, 51, 0.08);
  border-radius: 28px;
  background: rgba(255, 248, 239, 0.96);
  box-shadow: 0 28px 80px rgba(44, 34, 25, 0.22);
  backdrop-filter: blur(24px);
}

.dimension-sheet-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
}

.dimension-sheet-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
}

.dimension-sheet .dimension-grid {
  margin-top: 20px;
}

.dimension-close-button {
  min-width: 96px;
}

.dimension-card {
  padding: 20px;
}

.dimension-card h2 {
  margin: 8px 0 12px;
  font-size: 1.2rem;
}

.dimension-card span {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(25, 93, 102, 0.08);
  color: var(--teal);
}

.quiz-shell,
.result-shell {
  margin-top: 24px;
}

.quiz-topline,
.result-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.quiz-topline h2,
.result-code-wrap h2 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.progress-meta {
  min-width: min(100%, 340px);
}

.progress-meta span {
  display: block;
  margin-bottom: 10px;
  text-align: right;
  color: var(--muted);
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(31, 41, 51, 0.08);
  overflow: hidden;
}

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

.question-card {
  margin-top: 24px;
  padding: 28px;
}

.question-card-active {
  display: flex;
  flex-direction: column;
}

.question-category {
  margin: 0 0 10px;
  color: var(--accent-deep);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.84rem;
}

.question-card h3 {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2.2rem);
  line-height: 1.3;
}

.question-helper {
  margin: 10px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.65;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.answer-button {
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-height: 112px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(31, 41, 51, 0.08);
  cursor: pointer;
  text-align: left;
}

.answer-button span {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.answer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  background: rgba(25, 93, 102, 0.1);
  color: var(--teal);
  font-size: 0.92rem;
}

.answer-button.is-selected {
  background: rgba(203, 92, 57, 0.08);
  border-color: rgba(203, 92, 57, 0.3);
  box-shadow: 0 20px 34px rgba(203, 92, 57, 0.08);
}

.text-answer-wrap {
  margin-top: 24px;
}

.text-answer-label {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
}

.text-answer-input {
  width: 100%;
  padding: 18px 20px;
  border: 1px solid rgba(31, 41, 51, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  resize: vertical;
  min-height: 150px;
  font: inherit;
  line-height: 1.7;
}

.text-answer-input:focus {
  outline: 2px solid rgba(203, 92, 57, 0.22);
  border-color: rgba(203, 92, 57, 0.28);
}

.text-answer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.text-answer-meta strong {
  color: var(--teal);
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 22px;
}

.result-code-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.result-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  min-height: 64px;
  padding: 0 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(25, 93, 102, 0.12), rgba(203, 92, 57, 0.16));
  color: var(--teal);
  font-size: 1.7rem;
  letter-spacing: 0.08em;
}

.result-summary {
  max-width: 720px;
  margin: 0;
  font-size: 1.06rem;
}

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

.result-card {
  padding: 22px;
}

.result-card-primary {
  background: linear-gradient(135deg, rgba(255, 244, 236, 0.92), rgba(246, 236, 225, 0.86));
}

.result-card h3 {
  margin: 0 0 14px;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.trait-tags,
.dimension-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trait-tag,
.dimension-pill {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(25, 93, 102, 0.08);
  color: var(--teal);
  font-size: 0.95rem;
}

.dimension-pill strong {
  color: var(--ink);
}

.result-quote {
  margin: 0;
  padding: 16px 18px;
  border-left: 3px solid rgba(203, 92, 57, 0.36);
  border-radius: 0 16px 16px 0;
  background: rgba(255, 255, 255, 0.45);
  color: var(--ink);
  line-height: 1.8;
}

.analysis-kicker {
  margin-bottom: 10px;
  color: var(--accent-deep);
  font-weight: 700;
}

.result-actions {
  margin-top: 24px;
}

.footnote {
  margin-top: 16px;
  font-size: 0.95rem;
}

.hidden {
  display: none;
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -16px, 0);
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(calc(100% - 20px), var(--content-width));
    padding-top: 20px;
  }

  .hero,
  .quiz-shell,
  .result-shell {
    padding: 22px;
  }

  .hero-stats,
  .dimension-grid,
  .answers,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .quiz-shell {
    min-height: calc(100svh - 20px);
  }

  .dimension-sheet-panel {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-height: min(68vh, 640px);
    padding: 18px;
    border-radius: 24px;
  }

  .quiz-topline {
    gap: 12px;
    align-items: start;
  }

  .question-card-active {
    min-height: calc(100svh - 220px);
    justify-content: flex-start;
  }

  .question-card {
    padding: 20px;
  }

  .question-card h3 {
    font-size: clamp(1.2rem, 6vw, 1.6rem);
    line-height: 1.25;
  }

  .question-helper {
    margin-top: 8px;
    font-size: 0.94rem;
    line-height: 1.5;
  }

  .answers {
    gap: 10px;
    margin-top: 16px;
  }

  .answer-button {
    min-height: 0;
    padding: 14px 16px;
  }

  .answer-button span {
    gap: 10px;
  }

  .answer-badge {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    font-size: 0.82rem;
  }

  .quiz-actions {
    position: sticky;
    bottom: 8px;
    padding: 12px 0 0;
    background: linear-gradient(180deg, rgba(247, 239, 227, 0), rgba(247, 239, 227, 0.9) 24%, rgba(247, 239, 227, 0.98) 100%);
  }

  .result-actions button,
  .hero-actions button,
  .hero-actions a {
    width: 100%;
  }

  .quiz-actions button {
    flex: 1 1 calc(50% - 7px);
    width: auto;
  }

  .progress-meta span {
    text-align: left;
  }
}
