:root {
  color-scheme: light;
  --paper: #f5efd8;
  --paper-strong: #fff9e8;
  --ink: #1d1e1b;
  --muted: #68665e;
  --line: #24251f;
  --teal: #2f8f83;
  --red: #e94b5f;
  --yellow: #f2b84b;
  --blue: #4556a4;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(29, 30, 27, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(29, 30, 27, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  position: relative;
  overflow-x: hidden;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(245, 239, 216, 0.82), rgba(245, 239, 216, 0.7)),
    url("../assets/haeseong-hero.webp") center / cover;
  filter: saturate(0.82);
}

button {
  font: inherit;
}

.app {
  min-height: 100vh;
}

.shell,
.result-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  align-items: center;
  gap: 18px;
}

.shell {
  grid-template-columns: 0.82fr 1.18fr;
}

.result-shell {
  grid-template-columns: 0.92fr 1.08fr;
}

.quiz-shell {
  width: min(980px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 132px;
}

.quiz-brief,
.question-card,
.briefing,
.question-panel,
.result-card,
.result-details,
.mission-stage {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 249, 232, 0.92);
  box-shadow: 8px 8px 0 var(--line);
}

.briefing {
  padding: 28px;
  min-height: 580px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.quiz-brief {
  min-height: 440px;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.92fr);
  align-items: center;
  gap: 24px;
}

.quiz-brief .scene-frame {
  grid-column: 2;
  grid-row: 1 / span 5;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
}

.stamp,
.question-topline,
.card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stamp {
  color: var(--red);
}

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

.briefing h1 {
  margin: 18px 0 12px;
  font-size: clamp(2.45rem, 7vw, 5.1rem);
  line-height: 0.98;
}

.quiz-brief h1 {
  margin: 18px 0 12px;
  font-size: clamp(2.45rem, 7vw, 4.8rem);
  line-height: 0.98;
}

.lead {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.scene-frame {
  margin: 8px 0 0;
  aspect-ratio: 16 / 9;
  border: 2px solid var(--line);
  background: var(--ink);
  overflow: hidden;
}

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

.meter {
  height: 14px;
  margin: 18px 0 24px;
  border: 2px solid var(--line);
  background: var(--paper);
}

.meter span {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--teal),
    var(--teal) 12px,
    var(--yellow) 12px,
    var(--yellow) 24px
  );
  transition: width 180ms ease;
}

.quiz-secret-note {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  border: 2px solid var(--line);
  border-left: 10px solid var(--red);
  padding: 12px;
  background: #efe6c6;
}

.quiz-secret-note strong {
  font-size: 1.75rem;
}

.quiz-secret-note span {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}

.question-panel {
  padding: 30px;
}

.question-list {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.question-card {
  scroll-margin-top: 18px;
  padding: 28px;
  transition:
    outline-color 160ms ease,
    background 160ms ease;
}

.question-card.current {
  outline: 3px solid rgba(233, 75, 95, 0.34);
  outline-offset: 3px;
}

.question-panel h2 {
  min-height: 104px;
  margin: 24px 0 10px;
  font-size: clamp(1.55rem, 4vw, 2.6rem);
  line-height: 1.22;
}

.question-card h2 {
  margin: 24px 0 10px;
  font-size: clamp(1.55rem, 4vw, 2.35rem);
  line-height: 1.22;
}

.principle {
  margin-bottom: 20px;
  color: var(--muted);
  line-height: 1.65;
}

.answers {
  display: grid;
  gap: 12px;
}

.answer {
  width: 100%;
  min-height: 78px;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fffdf4;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.answer:hover,
.answer:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--line);
  outline: none;
}

.answer.selected {
  background: #f9d66f;
  box-shadow: 4px 4px 0 var(--line);
}

.answer b {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  background: var(--ink);
  color: var(--paper-strong);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.primary,
.ghost {
  min-height: 46px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.primary {
  background: var(--red);
  color: #fff9e8;
}

.ghost {
  background: var(--paper-strong);
}

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

.quiz-dock {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 10;
  width: min(760px, calc(100vw - 32px));
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 249, 232, 0.96);
  box-shadow: 5px 5px 0 var(--line);
  transform: translateX(-50%);
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  gap: 4px;
}

.progress-step {
  min-width: 0;
  height: 18px;
  border: 2px solid var(--line);
  border-radius: 4px;
  padding: 0;
  background: #fffdf4;
  color: transparent;
  cursor: pointer;
}

.progress-step.answered {
  background: var(--teal);
}

.progress-step.current {
  background: var(--yellow);
  box-shadow: 0 0 0 2px rgba(29, 30, 27, 0.18);
}

.progress-step:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.progress-step span {
  font-size: 0;
}

.dock-actions {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  align-items: center;
  gap: 10px;
}

.dock-actions > span {
  min-width: 64px;
  text-align: center;
  font-weight: 1000;
}

.quiz-dock .primary,
.quiz-dock .ghost {
  min-height: 42px;
  padding: 0 12px;
}

.result-card {
  position: relative;
  min-height: 760px;
  padding: 24px;
  background: #fff9e8;
}

.card-header {
  margin-bottom: 16px;
}

.ability-code {
  display: inline-block;
  margin: 4px 0 6px;
  padding: 2px 8px;
  background: var(--ink);
  color: var(--paper-strong);
  font-size: clamp(3.6rem, 10vw, 6.4rem);
  font-weight: 1000;
  line-height: 1;
}

.match-badge {
  position: absolute;
  top: 44px;
  right: 22px;
  z-index: 1;
  width: clamp(146px, 30%, 188px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 6px solid #18d5d7;
  border-radius: 50%;
  background: rgba(255, 249, 232, 0.68);
  color: var(--ink);
  transform: rotate(-3deg);
}

.match-badge::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(29, 30, 27, 0.18);
  border-radius: 50%;
}

.match-badge span,
.match-badge small {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 1000;
  line-height: 1;
  text-transform: uppercase;
}

.match-badge strong {
  position: relative;
  z-index: 1;
  font-size: clamp(2.65rem, 5.7vw, 4.15rem);
  font-weight: 1000;
  line-height: 0.88;
}

.result-card > .ability-code,
.result-card > h1,
.result-card > .quote {
  max-width: calc(100% - 190px);
}

.result-card h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.quote {
  color: var(--muted);
  font-weight: 800;
}

.hero-placeholder {
  aspect-ratio: 1 / 1;
  margin: 18px 0;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  background:
    linear-gradient(180deg, rgba(29, 30, 27, 0.02), rgba(29, 30, 27, 0.34)),
    url("../assets/ability-portraits-sheet.webp");
  background-size: auto, 400% auto;
  background-position: center, var(--art-x) var(--art-y);
  overflow: hidden;
  position: relative;
}

.hero-placeholder span {
  position: absolute;
  left: 18px;
  bottom: 18px;
  padding: 8px 14px;
  border: 2px solid var(--line);
  background: rgba(255, 249, 232, 0.9);
  font-size: 3.2rem;
  font-weight: 1000;
}

.profile {
  display: grid;
  gap: 12px;
  margin: 0;
}

.profile div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding-top: 12px;
  border-top: 2px solid var(--line);
}

.profile dt {
  color: var(--muted);
  font-weight: 900;
}

.profile dd {
  margin: 0;
  line-height: 1.58;
}

.ability-dossier {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.dossier-item {
  min-height: 108px;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  border: 2px solid var(--line);
  padding: 12px;
  background: #fffdf4;
  overflow: hidden;
}

.dossier-skill {
  background: linear-gradient(90deg, rgba(47, 143, 131, 0.2), #fffdf4 54%);
}

.dossier-flaw {
  background: linear-gradient(90deg, rgba(233, 75, 95, 0.18), #fffdf4 52%);
}

.dossier-cover {
  background: linear-gradient(90deg, rgba(242, 184, 75, 0.24), #fffdf4 56%);
}

.dossier-role {
  background: linear-gradient(90deg, rgba(69, 86, 164, 0.18), #fffdf4 58%);
}

.dossier-command,
.warning-tag,
.id-card-face,
.route-map {
  min-width: 0;
}

.dossier-command {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  border: 2px solid var(--line);
  background: var(--ink);
  color: var(--paper-strong);
  padding: 10px;
}

.dossier-command span {
  align-self: start;
  width: max-content;
  padding: 4px 7px;
  background: var(--teal);
  color: var(--paper-strong);
  font-weight: 1000;
}

.dossier-command strong {
  font-size: 1.15rem;
  line-height: 1.18;
}

.warning-tag {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 2px solid var(--line);
  background: #f7d8d2;
  padding: 10px;
}

.warning-tag b {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  background: var(--red);
  color: var(--paper-strong);
  font-weight: 1000;
}

.warning-tag span {
  text-align: center;
}

.warning-tag span,
.id-card-face span,
.dossier-copy span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0;
}

.id-card-face {
  display: grid;
  align-content: space-between;
  border: 2px solid var(--line);
  background: var(--yellow);
  padding: 10px;
}

.id-card-face span {
  color: var(--ink);
}

.id-card-face b {
  font-size: 2.5rem;
  line-height: 1;
}

.route-map {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 8px 4px;
}

.route-map::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  border-top: 3px solid var(--blue);
}

.route-map i {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--blue);
  color: var(--paper-strong);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 1000;
}

.dossier-copy {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 6px;
}

.dossier-copy strong {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.16;
}

.dossier-copy p {
  margin: 0;
  font-weight: 900;
  line-height: 1.42;
}

.dossier-copy small {
  width: fit-content;
  margin-top: 2px;
  padding: 3px 7px;
  border: 2px solid var(--line);
  background: #efe6c6;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.2;
}

.result-details {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 26px;
}

.result-side {
  display: grid;
  align-content: start;
  gap: 18px;
}

.result-analysis {
  display: grid;
  gap: 12px;
}

.section-head,
.mission-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}

.section-head span,
.mission-stage-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 1000;
}

.section-head strong,
.mission-stage-head strong {
  font-size: 1.05rem;
}

.mission-stage {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-width: 3px;
  background:
    linear-gradient(90deg, rgba(47, 143, 131, 0.16), rgba(242, 184, 75, 0.16)),
    #eff5ef;
  box-shadow: inset 0 0 0 5px rgba(255, 249, 232, 0.72);
}

.mission-stage-head {
  border-bottom-width: 3px;
}

.mission-stage-head span {
  color: var(--teal);
}

.mission-stage .mission-panel {
  border: 0;
  padding: 0;
  background: transparent;
}

.bars {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.trait-insights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.trait-insights article {
  display: grid;
  align-content: start;
  gap: 6px;
  border: 2px solid var(--line);
  padding: 10px;
  background: #fffdf4;
}

.trait-insights b {
  width: fit-content;
  border: 2px solid var(--line);
  padding: 3px 8px;
  background: var(--ink);
  color: var(--paper-strong);
  font-size: 0.74rem;
  line-height: 1;
}

.trait-insights strong {
  font-size: 1.1rem;
  line-height: 1.2;
}

.trait-insights span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.35;
}

.trait-insights .strongest-trait {
  background: linear-gradient(90deg, rgba(47, 143, 131, 0.16), #fffdf4);
}

.trait-insights .weakest-trait {
  background: linear-gradient(90deg, rgba(233, 75, 95, 0.14), #fffdf4);
}

.trait-row {
  display: grid;
  grid-template-columns: minmax(116px, 0.62fr) minmax(130px, 1fr) 58px 26px;
  align-items: center;
  gap: 10px;
  border: 2px solid transparent;
  padding: 3px;
}

.trait-row.strongest-trait {
  border-color: var(--teal);
  background: rgba(47, 143, 131, 0.08);
}

.trait-row.weakest-trait {
  border-color: var(--red);
  background: rgba(233, 75, 95, 0.07);
}

.trait-label {
  min-width: 0;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-weight: 900;
}

.trait-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trait-code {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  background: var(--trait-color);
  color: var(--paper-strong);
  font-style: normal;
  font-weight: 1000;
}

.trait-scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.trait-cell {
  height: 22px;
  border: 2px solid var(--line);
  background: #fffdf4;
}

.trait-cell.filled {
  background: var(--trait-color);
}

.trait-level-tag {
  display: grid;
  place-items: center;
  min-height: 30px;
  border: 2px solid var(--line);
  background: #efe6c6;
  font-size: 0.78rem;
  line-height: 1;
}

.trait-score {
  display: block;
  text-align: right;
  white-space: nowrap;
  font-weight: 1000;
}

.status {
  margin: 0;
  line-height: 1.6;
}

.mission-panel {
  display: grid;
  gap: 14px;
  margin-top: 0;
  border: 2px solid var(--line);
  padding: 18px;
  background: rgba(255, 249, 232, 0.94);
}

.mission-panel h2,
.mission-panel h3,
.mission-panel p {
  margin: 0;
}

.mission-panel h2 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.25;
}

.mission-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}

.mission-head span,
.mission-source,
.mission-error {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 1000;
}

.mission-head strong {
  text-align: right;
}

.mission-start {
  width: fit-content;
}

.mission-weirdness {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 2px solid var(--line);
  padding: 8px;
  background: #fffdf4;
  font-weight: 800;
  line-height: 1.45;
}

.mission-brief {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.48;
}

.mission-brief b,
.mission-weirdness b {
  display: grid;
  place-items: center;
  min-height: 34px;
  border: 2px solid var(--line);
  background: var(--ink);
  color: var(--paper-strong);
  font-size: 0.8rem;
}

.mission-weirdness b {
  background: var(--yellow);
  color: var(--ink);
}

.mission-brief span,
.mission-weirdness span {
  min-width: 0;
}

.mission-outcome-brief {
  border: 2px solid var(--line);
  padding: 8px;
  background: rgba(255, 253, 244, 0.72);
}

.skill-order {
  display: grid;
  gap: 10px;
}

.order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.order-head strong {
  font-size: 1.05rem;
}

.order-head span {
  min-width: 46px;
  border: 2px solid var(--line);
  padding: 3px 8px;
  background: var(--ink);
  color: var(--paper-strong);
  text-align: center;
  font-weight: 1000;
}

.skill-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.skill-card {
  position: relative;
  min-width: 0;
  min-height: 128px;
  display: grid;
  align-content: start;
  gap: 7px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #fffdf4;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  animation: cardDeal 420ms ease both;
  animation-delay: calc(var(--choice-index, 0) * 70ms);
}

.skill-order-badge {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--red);
  color: var(--paper-strong);
  font-style: normal;
  font-weight: 1000;
  line-height: 1;
  box-shadow: 2px 2px 0 var(--line);
}

.skill-card:hover,
.skill-card:focus-visible {
  outline: none;
  background: #f9d66f;
  box-shadow: 4px 4px 0 var(--line);
  transform: translate(-2px, -2px);
}

.skill-card.selected,
.skill-card:disabled {
  cursor: not-allowed;
  background: #efe6c6;
  opacity: 0.72;
}

.skill-card b {
  width: max-content;
  padding: 4px 8px;
  background: var(--ink);
  color: var(--paper-strong);
  font-weight: 1000;
}

.skill-card span {
  font-weight: 1000;
  line-height: 1.2;
}

.skill-card small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.35;
}

.order-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.order-slot {
  min-height: 50px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 2px dashed var(--line);
  padding: 8px;
  background: rgba(255, 253, 244, 0.7);
}

.order-slot.filled {
  border-style: solid;
  background: #f9d66f;
}

.order-slot span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper-strong);
  font-weight: 1000;
}

.order-slot strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mission-error {
  color: var(--red);
}

.mission-loader {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mission-loader i {
  height: 18px;
  border: 2px solid var(--line);
  background: var(--teal);
  animation: pulse 900ms infinite alternate;
}

.mission-loader i:nth-child(2) {
  background: var(--yellow);
  animation-delay: 120ms;
}

.mission-loader i:nth-child(3) {
  background: var(--red);
  animation-delay: 240ms;
}

.outcome-topline {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

.outcome-topline p {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.55;
}

.grade-stamp {
  width: 104px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 5px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  font-size: 4rem;
  font-weight: 1000;
  transform: rotate(-8deg);
}

.grade-stamp small {
  margin-top: -16px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
}

.mission-log {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.mission-log-title {
  width: fit-content;
  border: 2px solid var(--line);
  padding: 4px 9px;
  background: var(--ink);
  color: var(--paper-strong);
  font-size: 0.86rem;
  line-height: 1;
}

.mission-log article {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 2px solid var(--line);
  padding: 8px;
  background: #fffdf4;
}

.mission-log span {
  display: grid;
  place-items: center;
  min-height: 34px;
  background: var(--teal);
  color: var(--paper-strong);
  font-weight: 1000;
}

.mission-log p {
  font-weight: 800;
  line-height: 1.45;
}

.mission-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mission-meta p {
  display: grid;
  align-content: start;
  gap: 8px;
  border: 2px solid var(--line);
  padding: 10px;
  background: #efe6c6;
  font-weight: 800;
  line-height: 1.5;
}

.mission-meta b {
  width: fit-content;
  border: 2px solid var(--line);
  padding: 3px 8px;
  background: var(--ink);
  color: var(--paper-strong);
  font-size: 0.78rem;
  line-height: 1;
}

.mission-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status {
  min-height: 26px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
}

.result-export-snapshot {
  position: fixed;
  left: -10000px;
  top: 0;
  z-index: -1;
  display: grid;
  gap: 18px;
  padding: 12px 18px 12px 10px;
  background:
    linear-gradient(90deg, rgba(29, 30, 27, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(29, 30, 27, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  pointer-events: none;
}

.result-export-snapshot .result-card,
.result-export-snapshot .result-details {
  width: 100%;
  box-shadow: 5px 5px 0 var(--line);
}

.result-export-snapshot .result-card {
  overflow: visible;
  padding: 28px;
}

.result-export-snapshot .card-header {
  align-items: flex-start;
  margin-bottom: 18px;
  font-size: 0.74rem;
  line-height: 1.15;
}

.result-export-snapshot .card-header span:last-child {
  max-width: 280px;
  text-align: right;
  white-space: nowrap;
}

.result-export-snapshot .match-badge {
  position: relative;
  float: right;
  width: 156px;
  margin: -18px 2px 26px 22px;
  background: #fff9e8;
  background-color: #fff9e8;
  background-image: none;
  overflow: hidden;
}

.result-export-snapshot .match-badge::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid #d8d1bd;
  border-radius: 50%;
}

.result-export-snapshot .match-badge strong {
  font-size: 2.9rem;
  font-weight: 900;
}

.result-export-snapshot .ability-code {
  max-width: calc(100% - 160px);
  margin: 6px 0 12px;
  font-size: 4.9rem;
  font-weight: 900;
  line-height: 0.96;
}

.result-export-snapshot .result-card > h1,
.result-export-snapshot .result-card > .quote {
  max-width: calc(100% - 160px);
}

.result-export-snapshot .result-card h1 {
  margin: 0 0 10px;
  font-size: 2.55rem;
  font-weight: 900;
  line-height: 1.12;
}

.result-export-snapshot .quote {
  line-height: 1.46;
}

.result-export-snapshot .hero-placeholder {
  clear: both;
  margin-top: 18px;
}

.result-export-snapshot .hero-placeholder span {
  font-weight: 900;
}

.result-export-snapshot .dossier-copy p,
.result-export-snapshot .trait-label,
.result-export-snapshot .trait-score {
  font-weight: 800;
}

.result-export-snapshot .result-details {
  padding-bottom: 34px;
}

.result-export-snapshot .trait-row {
  min-height: 48px;
  grid-template-columns: 118px minmax(178px, 1fr) 58px 26px;
  align-items: center;
  padding: 6px;
}

.result-export-snapshot .trait-label,
.result-export-snapshot .trait-scale {
  align-items: center;
}

.result-export-snapshot .trait-code {
  display: flex;
  align-items: flex-start;
  align-self: center;
  justify-content: center;
  padding-top: 2px;
  line-height: 1;
}

.result-export-snapshot .trait-cell {
  height: 20px;
}

.result-export-snapshot .result-actions,
.result-export-snapshot .status {
  display: none;
}

@keyframes pulse {
  from {
    transform: scaleY(0.55);
  }

  to {
    transform: scaleY(1);
  }
}

@keyframes cardDeal {
  from {
    opacity: 0;
    transform: translateY(20px) rotate(2deg) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

@keyframes cardPick {
  0% {
    transform: translateY(0) scale(1);
  }

  55% {
    transform: translateY(-10px) rotate(-1deg) scale(1.03);
  }

  100% {
    transform: translateY(4px) scale(0.98);
  }
}

.mobile-shell {
  width: min(100vw - 22px, 620px);
  margin: 0 auto;
  padding: 12px 0 104px;
}

.mobile-brief,
.mobile-question-card {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 249, 232, 0.94);
  box-shadow: 5px 5px 0 var(--line);
}

.mobile-brief {
  min-height: calc(100svh - 128px);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.mobile-brief h1 {
  margin: 18px 0 12px;
  font-size: clamp(2.55rem, 15vw, 4.2rem);
  line-height: 0.98;
}

.mobile-question-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.mobile-question-card {
  min-height: calc(100svh - 126px);
  scroll-margin-top: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.mobile-question-card.current {
  outline: 3px solid rgba(233, 75, 95, 0.35);
  outline-offset: 2px;
}

.mobile-question-card h2 {
  margin: 24px 0 10px;
  font-size: clamp(1.45rem, 7.3vw, 2rem);
  line-height: 1.28;
}

.mobile-dock {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 10;
  width: min(100vw - 22px, 620px);
  display: grid;
  grid-template-columns: 1fr auto 1fr 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 249, 232, 0.96);
  box-shadow: 5px 5px 0 var(--line);
  transform: translateX(-50%);
}

.mobile-dock span {
  min-width: 52px;
  text-align: center;
  font-weight: 1000;
}

.mobile-dock .primary,
.mobile-dock .ghost {
  min-height: 42px;
  padding: 0 10px;
}

@media (max-width: 860px) {
  .shell,
  .result-shell {
    width: min(100vw - 14px, 620px);
    min-height: auto;
    padding: 12px 0 28px;
    grid-template-columns: 1fr;
  }

  .quiz-shell {
    width: min(100vw - 14px, 620px);
    padding: 12px 0 132px;
  }

  .quiz-brief {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 22px;
    gap: 16px;
  }

  .quiz-brief .scene-frame {
    grid-column: auto;
    grid-row: auto;
    min-height: auto;
    height: auto;
    margin: 0;
  }

  .briefing {
    min-height: auto;
    padding: 22px;
  }

  .quiz-brief h1,
  .briefing h1 {
    font-size: clamp(2.55rem, 15vw, 4.2rem);
  }

  .question-card,
  .question-panel {
    padding: 22px;
  }

  .question-card h2,
  .question-panel h2 {
    min-height: auto;
    font-size: clamp(1.45rem, 7.3vw, 2rem);
  }

  .quiz-brief,
  .question-card,
  .briefing,
  .question-panel,
  .result-card,
  .result-details,
  .mission-stage {
    box-shadow: 5px 5px 0 var(--line);
  }

  .quiz-dock {
    width: min(100vw - 14px, 620px);
  }

  .trait-row {
    grid-template-columns: minmax(110px, 0.62fr) minmax(120px, 1fr) 54px 24px;
  }
}

@media (max-width: 520px) {
  .dock-actions {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
  }

  .quiz-secret-note {
    grid-template-columns: 1fr;
  }

  .match-badge {
    position: absolute;
    top: 38px;
    right: 16px;
    width: 124px;
    margin: 0;
  }

  .result-card > .ability-code,
  .result-card > h1,
  .result-card > .quote {
    max-width: calc(100% - 136px);
  }

  .result-card {
    padding: 20px;
  }

  .ability-code {
    font-size: clamp(3rem, 14vw, 4.2rem);
  }

  .ability-dossier,
  .mission-meta,
  .outcome-topline,
  .trait-insights,
  .skill-cards,
  .order-slots {
    grid-template-columns: 1fr;
  }

  .dossier-item {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 12px;
    min-height: auto;
    padding: 10px;
  }

  .warning-tag b {
    width: 48px;
    height: 48px;
  }

  .dossier-flaw .warning-tag {
    justify-items: start;
    text-align: left;
  }

  .mission-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .mission-head strong {
    text-align: left;
  }

  .mission-brief,
  .mission-weirdness,
  .mission-log article {
    grid-template-columns: 1fr;
  }

  .grade-stamp {
    width: 86px;
    font-size: 3.2rem;
  }

  .trait-row {
    grid-template-columns: 76px minmax(104px, 1fr) 44px 18px;
    gap: 6px;
    padding: 4px;
  }

  .trait-scale {
    grid-column: auto;
    gap: 4px;
  }

  .trait-label {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 6px;
    font-size: 0.78rem;
  }

  .trait-code {
    width: 26px;
    height: 26px;
    font-size: 0.78rem;
  }

  .trait-cell {
    height: 16px;
  }

  .trait-level-tag {
    min-height: 26px;
    font-size: 0.68rem;
  }

  .trait-score {
    font-size: 0.9rem;
  }

  .answer {
    grid-template-columns: 34px 1fr;
  }

  .answer b {
    width: 34px;
    height: 34px;
  }

  .primary,
  .ghost {
    flex: 1 1 150px;
  }
}
