:root {
  color-scheme: light;
  --ink: #211f1b;
  --muted: #6d665c;
  --paper: #fff9ef;
  --surface: #ffffff;
  --sun: #f7c948;
  --coral: #ef6f61;
  --teal: #1f9a8a;
  --blue: #4077c8;
  --line: #2a2520;
  --shadow: 0 22px 70px rgba(64, 42, 20, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(247, 201, 72, 0.16), transparent 34%),
    linear-gradient(225deg, rgba(31, 154, 138, 0.16), transparent 36%),
    #f6efe5;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
  display: grid;
  align-items: center;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.intro-screen,
.quiz-screen,
.result-screen {
  width: 100%;
}

.topbar,
.quiz-head,
.result-card-head,
.intro-strip,
.score-panel,
.share-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark,
.pill,
.question-tag,
.rarity {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--line);
}

.brand-mark {
  padding: 8px 13px;
  font-size: 14px;
  font-weight: 900;
}

.pill {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--teal);
}

.dark-pill {
  background: var(--ink);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(340px, 1.05fr);
  gap: clamp(22px, 5vw, 64px);
  align-items: center;
}

.hero-copy {
  padding: 20px 0;
}

.kicker {
  margin: 0 0 14px;
  font-size: clamp(15px, 2vw, 18px);
  font-weight: 900;
  color: var(--coral);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 620px;
  margin-bottom: 18px;
  font-size: clamp(42px, 8vw, 86px);
  line-height: 0.96;
  letter-spacing: 0;
}

.lede {
  max-width: 560px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.8;
}

.hero-actions,
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 160px));
  gap: 12px;
  margin: 0 0 24px;
}

.metric-strip div,
.mini-metrics span {
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 4px 4px 0 var(--line);
}

.metric-strip div {
  min-height: 82px;
  padding: 12px 14px;
  border-radius: 16px;
}

.metric-strip span,
.mini-metrics span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.metric-strip strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(26px, 5vw, 36px);
  line-height: 1;
}

.primary-button,
.ghost-button,
.text-button,
.icon-button,
.option-button {
  border: 2px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button,
.ghost-button {
  min-height: 52px;
  padding: 0 22px;
  border-radius: 12px;
  font-weight: 950;
  box-shadow: 5px 5px 0 var(--line);
}

.primary-button {
  background: var(--sun);
}

.ghost-button {
  background: var(--surface);
}

.compact {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--line);
}

.primary-button:hover,
.ghost-button:hover,
.option-button:hover,
.icon-button:hover,
.text-button:hover {
  transform: translate(-2px, -2px);
}

.primary-button:hover,
.ghost-button:hover {
  box-shadow: 7px 7px 0 var(--line);
}

.hero-art {
  position: relative;
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow), 8px 8px 0 var(--line);
  aspect-ratio: 4 / 3;
}

.hero-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.intro-strip {
  width: fit-content;
  max-width: 100%;
  margin-top: 30px;
  gap: 10px;
  flex-wrap: wrap;
}

.intro-strip span {
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-weight: 850;
}

.quiz-screen {
  max-width: 780px;
  margin: 0 auto;
}

.quiz-head {
  gap: 14px;
  margin-bottom: 18px;
}

.icon-button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--line);
  font-size: 32px;
  line-height: 1;
}

.progress-wrap {
  flex: 1;
  min-width: 0;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.progress-track {
  height: 14px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-right: 2px solid var(--line);
  background: linear-gradient(90deg, var(--teal), var(--sun), var(--coral));
  transition: width 220ms ease;
}

.question-card,
.result-card,
.share-panel {
  border: 3px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow), 7px 7px 0 var(--line);
}

.question-card {
  padding: clamp(20px, 5vw, 42px);
}

.question-tag {
  margin-bottom: 18px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  background: var(--blue);
}

.question-card h2 {
  margin-bottom: 22px;
  font-size: clamp(25px, 5vw, 42px);
  line-height: 1.18;
  letter-spacing: 0;
}

.option-list {
  display: grid;
  gap: 12px;
}

.option-button {
  width: 100%;
  min-height: 64px;
  padding: 16px 18px;
  border-radius: 14px;
  background: #fffefb;
  box-shadow: 4px 4px 0 var(--line);
  text-align: left;
  font-size: clamp(15px, 2.2vw, 18px);
  font-weight: 850;
  line-height: 1.45;
}

.option-button:nth-child(2n) {
  background: #f8fbff;
}

.option-button:nth-child(3n) {
  background: #fff7f2;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(280px, 0.46fr);
  gap: 22px;
  align-items: start;
}

.result-card,
.share-panel {
  padding: clamp(18px, 3vw, 26px);
}

.result-card-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.result-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.text-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--surface);
  font-weight: 900;
  box-shadow: 3px 3px 0 var(--line);
}

.result-visual {
  width: min(440px, 100%);
  margin: 0 auto 20px;
  aspect-ratio: 1 / 1;
  border: 3px solid var(--line);
  border-radius: 24px;
  background-image: url("./assets/worker-archetypes-v2.png");
  background-repeat: no-repeat;
  background-size: 400% 300%;
  background-color: var(--paper);
  box-shadow: 6px 6px 0 var(--line);
}

.result-main {
  text-align: center;
}

.rarity {
  margin: 0 auto 12px;
  padding: 7px 12px;
  color: #fff;
  background: var(--coral);
  font-size: 13px;
  font-weight: 950;
}

.result-main h2 {
  margin-bottom: 12px;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

.result-desc {
  max-width: 620px;
  margin: 0 auto 18px;
  color: var(--muted);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.7;
}

.score-panel {
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fffdf8;
}

.score-panel div {
  flex: 1;
  min-width: 0;
}

.score-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.score-panel strong {
  display: block;
  font-size: clamp(28px, 6vw, 48px);
  line-height: 1;
}

.trait-bars {
  display: grid;
  gap: 12px;
}

.trait-row {
  display: grid;
  grid-template-columns: 88px 1fr 44px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  font-weight: 850;
}

.trait-track {
  height: 12px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.trait-fill {
  width: var(--value);
  height: 100%;
  background: var(--fill);
}

.share-panel {
  position: sticky;
  top: 22px;
}

.share-panel h3 {
  margin-bottom: 10px;
  font-size: 22px;
}

.share-panel p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.mini-metrics {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.mini-metrics span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
}

.mini-metrics strong {
  color: var(--ink);
  font-size: 16px;
}

.hint {
  margin: 14px 0 0;
}

.share-canvas {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(33, 31, 27, 0.46);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 3px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 8px 8px 0 var(--line);
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-head h3 {
  margin: 0;
}

.copy-box {
  width: 100%;
  min-height: 180px;
  margin: 8px 0 14px;
  padding: 14px;
  resize: vertical;
  border: 2px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fffefb;
  font: inherit;
  line-height: 1.6;
}

.image-panel {
  width: min(620px, 100%);
}

.card-preview {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  margin: 10px 0 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 16px;
    align-items: start;
  }

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

  .hero-copy {
    padding-top: 6px;
  }

  .hero-art {
    order: -1;
    width: min(100%, 520px);
    margin: 0 auto;
    border-radius: 22px;
  }

  .intro-strip {
    width: 100%;
  }

  .intro-strip span {
    flex: 1;
    text-align: center;
  }

  .share-panel {
    position: static;
  }
}

@media (max-width: 480px) {
  .topbar {
    align-items: flex-start;
  }

  .brand-mark,
  .pill {
    font-size: 12px;
  }

  .hero-actions,
  .share-actions {
    flex-direction: column;
  }

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

  .metric-strip {
    grid-template-columns: 1fr;
  }

  .progress-meta {
    font-size: 12px;
  }

  .score-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .trait-row {
    grid-template-columns: 76px 1fr 38px;
  }
}
