:root {
  --paper: #fbf6ed;
  --paper-strong: #fffaf2;
  --ink: #25221f;
  --muted: #70685f;
  --line: #e1d5c6;
  --rose: #d9908a;
  --iris: #6f78a8;
  --pond: #5a8a87;
  --leaf: #6c8f5a;
  --sun: #e0a14a;
  --shadow: 0 24px 70px rgba(65, 54, 42, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(135deg, rgba(217, 144, 138, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(90, 138, 135, 0.14), transparent 42%),
    var(--paper);
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 18px;
}

.brand,
.creator-link,
.source-link {
  color: inherit;
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
  font-size: clamp(0.96rem, 2.2vw, 1.08rem);
}

.brand-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 60% 42%, var(--sun) 0 16%, transparent 17%),
    linear-gradient(145deg, var(--pond), var(--iris) 55%, var(--rose));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.creator-link {
  flex: 0 0 auto;
  border: 1px solid rgba(37, 34, 31, 0.12);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 250, 242, 0.72);
  color: #443e37;
  font-weight: 750;
  font-size: 0.86rem;
}

.quiz-view {
  display: grid;
  gap: 18px;
  align-items: start;
}

.quiz-copy {
  padding: 8px 2px 2px;
}

.kicker,
.question-eyebrow {
  margin: 0 0 10px;
  color: #79584b;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.quiz-copy h1,
.result-content h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  line-height: 0.98;
}

.quiz-copy h1 {
  max-width: 760px;
  font-size: clamp(2.5rem, 13vw, 6.4rem);
}

.intro {
  max-width: 620px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  line-height: 1.56;
}

.question-panel {
  width: 100%;
  border: 1px solid rgba(37, 34, 31, 0.12);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 250, 242, 0.86);
  box-shadow: var(--shadow);
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.progress-track {
  width: 100%;
  height: 8px;
  margin: 10px 0 22px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfd1;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pond), var(--sun), var(--rose));
  transition: width 220ms ease;
}

.question-title {
  min-height: 3.5em;
  margin: 0 0 18px;
  font-size: clamp(1.35rem, 5.5vw, 2.55rem);
  line-height: 1.12;
}

.options {
  display: grid;
  gap: 10px;
}

.option-button {
  width: 100%;
  min-height: 64px;
  border: 1px solid rgba(37, 34, 31, 0.13);
  border-radius: var(--radius);
  padding: 14px 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.option-button:hover,
.option-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(90, 138, 135, 0.56);
  background: #fff;
  outline: none;
  box-shadow: 0 10px 24px rgba(65, 54, 42, 0.08);
}

.option-button[aria-pressed="true"] {
  border-color: rgba(90, 138, 135, 0.88);
  background: linear-gradient(135deg, rgba(90, 138, 135, 0.18), rgba(224, 161, 74, 0.13));
}

.option-title {
  display: block;
  font-weight: 850;
  line-height: 1.25;
}

.option-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.36;
}

.nav-row,
.action-buttons {
  display: flex;
  gap: 10px;
}

.nav-row {
  margin-top: 16px;
  justify-content: space-between;
}

.primary-button,
.dark-button,
.ghost-button {
  min-height: 46px;
  border-radius: var(--radius);
  padding: 12px 15px;
  border: 1px solid transparent;
  font-weight: 850;
  line-height: 1;
}

.primary-button {
  background: var(--ink);
  color: #fffaf2;
}

.dark-button {
  background: #111;
  color: #fff;
}

.ghost-button {
  background: rgba(255, 250, 242, 0.7);
  border-color: rgba(37, 34, 31, 0.16);
  color: var(--ink);
}

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

.result-view {
  padding: 2px 0 28px;
}

.result-grid {
  display: grid;
  gap: 16px;
}

.result-card {
  overflow: hidden;
  border: 1px solid rgba(37, 34, 31, 0.12);
  border-radius: var(--radius);
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.painting-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #d8cbbc;
}

.painting-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 260ms ease;
}

.painting-frame img.is-loaded {
  opacity: 1;
}

.image-fallback {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(130deg, rgba(111, 120, 168, 0.78), transparent 42%),
    linear-gradient(305deg, rgba(224, 161, 74, 0.82), transparent 45%),
    linear-gradient(20deg, rgba(90, 138, 135, 0.9), rgba(217, 144, 138, 0.62));
}

.result-content {
  padding: 18px;
}

.result-content h1 {
  font-size: clamp(2.15rem, 10vw, 5.2rem);
}

.result-meta {
  margin: 12px 0 0;
  color: #6b6158;
  font-weight: 800;
}

.result-description {
  margin: 14px 0 0;
  color: #47413b;
  font-size: 1.06rem;
  line-height: 1.68;
}

.result-actions {
  border: 1px solid rgba(37, 34, 31, 0.12);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 250, 242, 0.86);
}

.result-one-liner {
  margin: 0 0 16px;
  color: #4e473f;
  line-height: 1.48;
}

.action-buttons {
  display: grid;
}

.source-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}

[hidden] {
  display: none !important;
}

@media (min-width: 760px) {
  .app-shell {
    padding: 24px;
  }

  .topbar {
    padding-bottom: 28px;
  }

  .quiz-view {
    grid-template-columns: minmax(0, 0.95fr) minmax(360px, 0.82fr);
    gap: 32px;
  }

  .quiz-copy {
    position: sticky;
    top: 22px;
    padding-top: 18px;
  }

  .question-panel {
    padding: 20px;
  }

  .result-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }

  .result-actions {
    position: sticky;
    top: 24px;
  }
}

@media (min-width: 980px) {
  .app-shell {
    width: min(1280px, 100%);
    padding-inline: 32px;
  }

  .result-view {
    padding-top: 8px;
  }

  .result-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    max-width: 940px;
    margin: 0 auto;
  }

  .result-card {
    display: grid;
    grid-template-columns: minmax(340px, 0.92fr) minmax(430px, 1fr);
    align-items: stretch;
  }

  .painting-frame {
    height: clamp(500px, 58vh, 620px);
    min-height: 0;
    aspect-ratio: auto;
  }

  .result-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 32px 36px;
  }

  .result-content h1 {
    max-width: 100%;
    font-size: clamp(3rem, 4vw, 4.35rem);
    line-height: 0.94;
    overflow-wrap: normal;
  }

  .result-meta {
    margin-top: 16px;
    font-size: 0.96rem;
    line-height: 1.24;
  }

  .result-description {
    margin-top: 18px;
    font-size: 0.98rem;
    line-height: 1.58;
  }

  .result-actions {
    position: static;
    padding: 18px;
  }
}

@media (min-width: 1180px) {
  .result-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
    max-width: none;
    margin: 0;
  }

  .result-actions {
    position: sticky;
    top: 24px;
  }
}
