:root {
  --bg: #f5ead7;
  --paper: rgba(255, 250, 242, 0.82);
  --paper-strong: #fff9f1;
  --ink: #191410;
  --muted: #6f6254;
  --line: rgba(25, 20, 16, 0.12);
  --accent: #b44e32;
  --accent-dark: #7d2e1b;
  --accent-soft: rgba(180, 78, 50, 0.12);
  --olive: #4d593f;
  --shadow: 0 24px 60px rgba(65, 35, 17, 0.14);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "IBM Plex Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(180, 78, 50, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(77, 89, 63, 0.14), transparent 22%),
    linear-gradient(180deg, #f9efe1 0%, var(--bg) 54%, #efe1c8 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(25, 20, 16, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 20, 16, 0.02) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 90%);
}

.page-shell {
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto;
  padding: 36px 0 80px;
}

.hero {
  padding: 18px 8px 28px;
}

.hero-kicker {
  margin: 0 0 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(42px, 8vw, 84px);
  line-height: 0.96;
  font-weight: 900;
}

.hero-subtitle {
  width: min(100%, 620px);
  margin: 18px 0 0;
  font-size: clamp(17px, 2.4vw, 22px);
  line-height: 1.7;
  color: var(--muted);
}

.app-frame {
  position: relative;
  min-height: 70vh;
  border: 1px solid rgba(25, 20, 16, 0.08);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.95), rgba(250, 241, 229, 0.86));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.app-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(125deg, rgba(180, 78, 50, 0.1), transparent 28%),
    linear-gradient(310deg, rgba(77, 89, 63, 0.08), transparent 25%);
  pointer-events: none;
}

.panel {
  position: relative;
  z-index: 1;
  padding: 28px;
}

.welcome-grid,
.quiz-grid,
.result-grid,
.types-grid {
  display: grid;
  gap: 24px;
}

.welcome-grid {
  grid-template-columns: 1.15fr 0.85fr;
  min-height: 70vh;
  align-items: stretch;
}

.paper-card,
.side-card,
.result-card,
.result-side,
.progress-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--paper);
}

.paper-card,
.result-card {
  padding: 28px;
}

.side-card,
.result-side,
.progress-card {
  padding: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
}

.welcome-title,
.question-text,
.result-name {
  margin: 16px 0 0;
  font-family: "Noto Serif SC", serif;
  line-height: 1.22;
}

.welcome-title {
  font-size: clamp(30px, 4vw, 46px);
}

.lead {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.pill {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(25, 20, 16, 0.09);
  background: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  color: var(--ink);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
  font-family: inherit;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary,
.btn-secondary,
.answer-button {
  border-radius: 18px;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.5;
}

.btn-primary {
  background: var(--accent);
  color: #fff9f2;
  box-shadow: 0 14px 30px rgba(180, 78, 50, 0.24);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
  border: 1px solid var(--line);
}

.stat-list {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.stat-item {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid var(--line);
}

.stat-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.stat-item span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.quiz-grid {
  grid-template-columns: minmax(0, 0.98fr) minmax(260px, 0.42fr);
  align-items: start;
}

.question-card {
  padding: 30px 28px 26px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--paper);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  color: var(--muted);
  font-size: 14px;
}

.question-text {
  font-size: clamp(28px, 4vw, 38px);
}

.answer-list {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

.answer-button {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(25, 20, 16, 0.12);
  color: var(--ink);
}

.answer-button:hover {
  border-color: rgba(180, 78, 50, 0.38);
  box-shadow: 0 10px 24px rgba(65, 35, 17, 0.08);
}

.answer-button.selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(180, 78, 50, 0.16), rgba(255, 255, 255, 0.78));
}

.answer-key {
  display: inline-flex;
  min-width: 28px;
  margin-right: 10px;
  color: var(--accent-dark);
  font-weight: 700;
}

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

.progress-bar {
  height: 14px;
  border-radius: 999px;
  background: rgba(25, 20, 16, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #d39254 68%, #f3d79c);
}

.progress-caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.micro-copy {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--ink);
  line-height: 1.7;
  font-size: 14px;
}

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

.types-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.type-preview-title {
  margin: 16px 0 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.2;
}

.type-preview-image,
.result-image {
  display: block;
  width: min(100%, 420px);
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  margin: 22px auto 6px;
  border-radius: 24px;
  border: 1px solid rgba(25, 20, 16, 0.08);
  box-shadow: 0 18px 36px rgba(65, 35, 17, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.result-image {
  width: min(100%, 440px);
  margin-top: 24px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(180, 78, 50, 0.12);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-name {
  font-size: clamp(38px, 5vw, 56px);
}

.result-short {
  margin: 14px 0 0;
  font-size: 20px;
  line-height: 1.7;
  color: var(--olive);
}

.section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid rgba(25, 20, 16, 0.09);
}

.section h3,
.result-side h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
}

.section p,
.result-side p {
  margin: 0;
  line-height: 1.9;
  color: var(--muted);
}

.callout {
  margin-top: 22px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.68);
  border: 1px dashed rgba(180, 78, 50, 0.3);
}

.callout strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-dark);
}

.share-box {
  margin-top: 20px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(77, 89, 63, 0.08);
  border: 1px solid rgba(77, 89, 63, 0.18);
}

.share-box p {
  margin: 0;
  color: var(--ink);
}

.stack {
  display: grid;
  gap: 18px;
}

.toast {
  margin-top: 12px;
  color: var(--olive);
  font-size: 14px;
}

.loading {
  display: grid;
  place-items: center;
  min-height: 50vh;
  color: var(--muted);
  font-size: 16px;
}

@media (max-width: 920px) {
  .welcome-grid,
  .quiz-grid,
  .result-grid,
  .types-grid {
    grid-template-columns: 1fr;
  }

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

  .panel,
  .question-card,
  .paper-card,
  .side-card,
  .progress-card,
  .result-card,
  .result-side {
    padding: 20px;
  }
}
