:root {
  --background: #f6f4ef;
  --surface: #ffffff;
  --surface-soft: #f1eee7;
  --surface-cool: #eef5f3;
  --ink: #18212f;
  --muted: #65707f;
  --primary: #256f68;
  --primary-hover: #1e5d57;
  --accent: #d65f3d;
  --gold: #c9962e;
  --border: #ded8cc;
  --shadow: 0 18px 50px rgba(24, 33, 47, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family:
    Inter, "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 980px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 22px 52px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  margin-bottom: 22px;
}

.brand,
.topbar-meta,
.meta,
.eyebrow,
.section-label,
.progress-count,
.question-kicker,
.audio-title,
.audio-note,
.score-pill {
  margin: 0;
}

.brand {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.topbar-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.screen {
  display: none;
  min-height: calc(100vh - 140px);
  animation: fade-up 180ms ease both;
}

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

.screen-start {
  flex-direction: column;
  justify-content: center;
  gap: 34px;
}

.start-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(360px, 1.12fr);
  gap: 34px;
  align-items: center;
}

.start-copy {
  max-width: 720px;
}

.eyebrow,
.section-label,
.question-kicker {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.start-copy h1 {
  margin: 10px 0 0;
  font-size: clamp(34px, 7vw, 64px);
  line-height: 1.08;
  white-space: nowrap;
}

.hero-copy {
  max-width: 780px;
  margin: 22px 0 0;
  font-size: clamp(24px, 4.2vw, 38px);
  font-weight: 800;
  line-height: 1.35;
}

.lead {
  max-width: 680px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.8;
}

.guide-callout {
  max-width: 480px;
  margin-top: 24px;
  padding: 16px 18px;
  border-left: 5px solid var(--accent);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 7px 7px 0 rgba(24, 33, 47, 0.08);
}

.guide-callout p {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.65;
}

.guide-callout .guide-name {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.start-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 32px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.button {
  min-height: 52px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    transform 120ms ease;
}

.button:focus-visible,
.text-button:focus-visible {
  outline: 3px solid rgba(37, 111, 104, 0.24);
  outline-offset: 2px;
}

.button-primary {
  min-width: 220px;
  padding: 0 22px;
  color: #ffffff;
  background: var(--primary);
  font-weight: 800;
}

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

.button-secondary {
  min-width: 180px;
  padding: 0 20px;
  color: var(--ink);
  background: transparent;
  border-color: var(--border);
  font-weight: 800;
}

.button-secondary:hover {
  border-color: var(--primary);
  background: var(--surface-cool);
}

.button:active {
  transform: translateY(1px);
}

.hero-art {
  position: relative;
  min-height: 360px;
  margin: 0;
  overflow: hidden;
  border: 2px solid rgba(24, 33, 47, 0.9);
  border-radius: 8px;
  background: var(--ink);
  box-shadow:
    10px 10px 0 rgba(37, 111, 104, 0.2),
    var(--shadow);
}

.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  pointer-events: none;
}

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

.celebration-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  left: var(--start-x);
  top: var(--start-y);
  width: var(--piece-width);
  height: var(--piece-height);
  border: 2px solid rgba(24, 33, 47, 0.72);
  border-radius: 2px;
  background: var(--piece-color);
  box-shadow: 2px 2px 0 rgba(24, 33, 47, 0.16);
  transform: translate(-50%, -50%) rotate(var(--start-rotate));
  animation: confetti-burst var(--duration) cubic-bezier(0.18, 0.84, 0.3, 1) forwards;
}

.confetti-piece.is-streamer {
  width: 22px;
  height: 8px;
  border-radius: 999px;
}

.confetti-piece.is-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.map-preview {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  padding: 28px 0 0;
}

.map-line {
  position: absolute;
  top: 48px;
  left: 7%;
  right: 7%;
  height: 3px;
  background: var(--border);
}

.map-stop {
  position: relative;
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
}

.map-stop span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid var(--background);
  border-radius: 50%;
  color: #ffffff;
  background: var(--ink);
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 0 0 1px var(--border);
}

.map-stop:nth-child(2) span,
.map-stop:nth-child(6) span {
  background: var(--primary);
}

.map-stop:nth-child(4) span,
.map-stop:nth-child(5) span {
  background: var(--accent);
}

.map-stop:nth-child(3) span {
  background: var(--gold);
}

.map-stop:nth-child(7) span {
  background: #5b43a4;
}

.map-stop p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

.intro-shell,
.transition-copy,
.question-shell,
.result-shell {
  width: min(100%, 720px);
  margin: auto;
}

.intro-shell h2,
.transition-copy h2 {
  margin: 10px 0 0;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.45;
}

.guidance {
  display: grid;
  gap: 8px;
  margin: 28px 0 32px;
  padding: 24px;
  border-left: 5px solid var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.guidance p {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.8;
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.text-button {
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.text-button:hover {
  color: var(--ink);
}

.progress-count {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.progress-track {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6dfd2;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 220ms ease;
}

.question-content {
  margin-top: 34px;
}

.question-text {
  min-height: 86px;
  margin: 10px 0 0;
  font-size: clamp(24px, 4.6vw, 34px);
  line-height: 1.55;
}

.audio-panel {
  display: grid;
  gap: 16px;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.audio-panel[hidden] {
  display: none;
}

.audio-title {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.audio-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}

audio {
  width: 100%;
}

.answer-group {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.button-answer {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 12px 16px;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--border);
  text-align: left;
}

.button-answer:hover {
  border-color: var(--primary);
  background: var(--surface-cool);
}

.button-answer.is-selected {
  color: #ffffff;
  border-color: var(--primary);
  background: var(--primary);
}

.option-label {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.button-answer.is-selected .option-label {
  color: var(--primary);
  background: #ffffff;
}

.option-text {
  font-size: 15px;
  font-weight: 750;
  line-height: 1.55;
}

.transition-copy {
  text-align: center;
}

.analysis-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 28px 0 32px;
}

.analysis-list span {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-shell {
  width: min(100%, 900px);
}

.result-hero {
  padding-bottom: 32px;
}

.result-hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 30px;
  align-items: center;
}

.result-copy {
  min-width: 0;
}

.result-greeting {
  max-width: 34rem;
  margin: 0 0 2px;
  color: #333333;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.8;
}

.result-character-card {
  margin: 0;
  overflow: hidden;
  border: 2px solid rgba(24, 33, 47, 0.9);
  border-radius: 8px;
  background: var(--surface);
  box-shadow:
    8px 8px 0 rgba(214, 95, 61, 0.16),
    var(--shadow);
}

.result-character-card img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  object-position: center top;
}

.result-character-card figcaption {
  padding: 16px;
  border-top: 2px solid rgba(24, 33, 47, 0.9);
  background: #fffaf0;
}

.result-character-card h3 {
  margin: 6px 0 6px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.result-character-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
}

.result-character-card .section-label {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 16px 0 14px;
  padding: 0 12px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 14px;
  font-weight: 900;
}

.result-summary-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin: 0 0 26px;
  padding: 24px;
  border: 1px solid var(--border);
  border-left: 7px solid var(--gold);
  border-radius: 8px;
  background: #fffaf0;
  box-shadow: 8px 8px 0 rgba(201, 150, 46, 0.13);
}

.summary-main h3 {
  margin: 8px 0 0;
  font-size: clamp(24px, 3.6vw, 34px);
  line-height: 1.45;
  word-break: keep-all;
}

.summary-points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-content: center;
}

.summary-points p {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.75;
}

.marker-underline {
  background-image: linear-gradient(transparent 62%, rgba(255, 213, 111, 0.7) 0);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  color: var(--ink);
  font-weight: 900;
}

.result-hero h2 {
  margin: 0;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.18;
  word-break: keep-all;
}

.result-lead {
  margin: 18px 0 0;
  font-size: 21px;
  font-weight: 850;
  line-height: 1.75;
}

.result-body,
.result-section p,
.result-cta p {
  color: var(--muted);
  line-height: 1.85;
}

.result-body {
  max-width: 46rem;
  margin: 14px 0 0;
  font-size: 16px;
}

.result-section {
  padding: 28px 0;
  border-top: 1px solid var(--border);
}

.result-message {
  display: grid;
  gap: 14px;
  padding-top: 0;
}

.result-message-card {
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-left: 6px solid var(--primary);
  border-radius: 8px;
  background: #fffaf0;
}

.result-message-card h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.45;
}

.result-message-card p {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.9;
}

.result-marker {
  padding: 0 .08em;
  color: inherit;
  background: linear-gradient(transparent 56%, rgba(255, 213, 111, .62) 0);
  font-weight: 850;
}

.result-message-card p + p {
  margin-top: 10px;
}

.result-message-note {
  border-left-color: var(--accent);
  background: var(--surface-soft);
}

.result-message-note h3 {
  color: var(--primary);
}

.result-section h3,
.result-cta h3 {
  margin: 7px 0 8px;
  font-size: 20px;
  line-height: 1.45;
}

.result-section p,
.result-cta p {
  margin: 0;
}

.result-section .result-message-card h3 {
  margin: 0 0 10px;
}

.result-section .result-message-card p {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.9;
}

.result-section .result-message-card p + p {
  margin-top: 10px;
}

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

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.score-pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 14px;
  font-weight: 900;
}

.axis-list {
  display: grid;
  gap: 16px;
}

.axis-row {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr) 48px;
  align-items: center;
  gap: 14px;
}

.axis-name {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.axis-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6dfd2;
}

.axis-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.axis-row:nth-child(2n) .axis-fill {
  background: var(--accent);
}

.axis-score {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  text-align: right;
}

.result-next {
  background: var(--surface-cool);
  border: 0;
  border-radius: 8px;
  padding: 24px;
}

.result-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 28px;
  padding: 24px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
}

.result-cta .section-label,
.result-cta p {
  color: rgba(255, 255, 255, 0.72);
}

.result-cta h3 {
  color: #ffffff;
}

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

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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

@keyframes confetti-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5) rotate(var(--start-rotate));
  }

  12% {
    opacity: 1;
  }

  72% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform:
      translate(
        calc(var(--end-x) - var(--start-x)),
        calc(var(--end-y) - var(--start-y))
      )
      scale(0.92)
      rotate(var(--end-rotate));
  }
}

@media (prefers-reduced-motion: reduce) {
  .confetti-piece {
    display: none;
    animation: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 18px 18px 36px;
  }

  .screen {
    min-height: calc(100vh - 106px);
  }

  .screen-start {
    justify-content: flex-start;
    padding-top: 18px;
  }

  .start-hero {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .hero-art {
    order: -1;
    min-height: 260px;
    box-shadow:
      7px 7px 0 rgba(37, 111, 104, 0.18),
      var(--shadow);
  }

  .hero-art img {
    object-position: center center;
  }

  .start-actions,
  .result-cta {
    display: grid;
    gap: 14px;
  }

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

  .map-preview {
    grid-template-columns: 1fr;
    gap: 10px;
    padding-top: 0;
  }

  .map-line {
    display: none;
  }

  .map-stop {
    grid-template-columns: 42px minmax(0, 1fr);
    justify-items: start;
    text-align: left;
  }

  .question-text {
    min-height: 112px;
  }

  .button-answer {
    min-height: 64px;
  }

  .result-overview {
    grid-template-columns: 1fr;
  }

  .result-summary-card {
    gap: 18px;
    padding: 22px 20px;
  }

  .summary-points {
    grid-template-columns: 1fr;
  }

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

  .result-character-card {
    width: min(100%, 320px);
    margin: 0 auto;
  }

  .result-character-card img {
    aspect-ratio: 4 / 5;
  }

  .section-heading {
    display: grid;
  }

  .score-pill {
    width: fit-content;
  }

  .axis-row {
    grid-template-columns: 1fr 44px;
    gap: 8px 12px;
  }

  .axis-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}
