:root {
  --ink: #2b202d;
  --muted: #77677a;
  --paper: #fffaf2;
  --white: #ffffff;
  --pink: #ff69a9;
  --pink-soft: #ffe0ed;
  --yellow: #ffd84f;
  --yellow-soft: #fff0b9;
  --cyan: #60d6e8;
  --cyan-soft: #dff8ff;
  --lav: #b99bff;
  --lav-soft: #eee5ff;
  --line: #2d2330;
  --shadow: 0 18px 45px rgba(68, 44, 74, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Yu Gothic", YuGothic, Meiryo, system-ui, sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(90deg, rgba(43, 32, 45, 0.05) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(180deg, rgba(43, 32, 45, 0.04) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--paper);
}

button {
  color: inherit;
  font: inherit;
}

.stage-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.stage-decor::before,
.stage-decor::after {
  position: absolute;
  content: "";
  width: 44vw;
  max-width: 420px;
  aspect-ratio: 1;
  border: 3px solid rgba(43, 32, 45, 0.08);
  border-radius: 46% 54% 52% 48% / 58% 42% 52% 48%;
  background: var(--pink-soft);
  transform: rotate(-12deg);
}

.stage-decor::before {
  top: 5%;
  left: -16%;
}

.stage-decor::after {
  right: -18%;
  bottom: 4%;
  background: var(--cyan-soft);
  transform: rotate(16deg);
}

.spark,
.bolt,
.scribble {
  position: absolute;
  display: block;
}

.spark {
  width: 18px;
  height: 18px;
  border: 3px solid var(--line);
  background: var(--yellow);
  transform: rotate(45deg);
}

.spark-a {
  top: 17%;
  right: 18%;
  animation: wiggle 4.8s ease-in-out infinite;
}

.spark-b {
  bottom: 19%;
  left: 11%;
  background: var(--pink);
  animation: wiggle 5.3s ease-in-out infinite reverse;
}

.bolt {
  width: 26px;
  height: 44px;
  background: var(--yellow);
  clip-path: polygon(48% 0, 100% 0, 63% 43%, 96% 43%, 28% 100%, 44% 58%, 0 58%);
  filter: drop-shadow(0 2px 0 var(--line));
}

.bolt-a {
  top: 42%;
  left: 4%;
  transform: rotate(-16deg);
}

.bolt-b {
  right: 6%;
  bottom: 28%;
  transform: rotate(14deg);
}

.scribble {
  width: 84px;
  height: 22px;
  border-top: 6px solid var(--lav);
  border-radius: 50%;
}

.scribble-a {
  top: 10%;
  left: 18%;
  transform: rotate(-10deg);
}

.scribble-b {
  right: 17%;
  bottom: 11%;
  transform: rotate(10deg);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px 28px;
}

.screen {
  display: none;
  min-height: calc(100vh - 46px);
  position: relative;
  overflow: hidden;
  border: 4px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 224, 237, 0.86), transparent 32%),
    linear-gradient(35deg, transparent 46%, rgba(255, 240, 185, 0.82) 47%, rgba(255, 240, 185, 0.82) 68%, transparent 69%),
    var(--white);
  box-shadow: var(--shadow);
}

.screen::before {
  position: absolute;
  z-index: 0;
  inset: 20px auto auto -30px;
  width: 170px;
  height: 120px;
  content: "";
  border: 3px dashed rgba(43, 32, 45, 0.1);
  border-radius: 56% 44% 48% 52%;
  background: rgba(223, 248, 255, 0.92);
  transform: rotate(-15deg);
}

.screen::after {
  position: absolute;
  z-index: 0;
  right: -26px;
  bottom: 84px;
  width: 145px;
  height: 118px;
  content: "";
  border-radius: 51% 49% 45% 55%;
  background: rgba(238, 229, 255, 0.92);
  transform: rotate(18deg);
}

.screen.is-active {
  display: block;
  animation: screenIn 0.45s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.top-logo-wrap,
.hero-copy,
.badge-row,
.mascot-stage,
.start-button,
.ghost-link,
.quiz-header,
.progress-wrap,
.question-card,
.answer-list,
.quiz-nav,
.result-ribbon,
.result-title,
.result-visual,
.result-card,
.trait-board,
.result-actions,
.detail-back,
.detail-chip-row {
  position: relative;
  z-index: 1;
}

.screen-start {
  padding: 24px 20px 24px;
}

.top-logo-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

.title-logo {
  width: min(116%, 386px);
  height: auto;
  max-width: none;
  filter: drop-shadow(0 6px 0 rgba(43, 32, 45, 0.09));
}

.hero-copy {
  padding-top: 2px;
  text-align: center;
}

.hero-label {
  display: inline-flex;
  position: relative;
  margin: 0;
  padding: 8px 16px;
  transform: rotate(-2deg);
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  color: var(--white);
  font-size: 14px;
  font-weight: 950;
  line-height: 1.15;
  box-shadow: 0 4px 0 rgba(43, 32, 45, 0.16);
}

.hero-label::after {
  position: absolute;
  left: 30px;
  bottom: -13px;
  width: 18px;
  height: 14px;
  content: "";
  background: var(--line);
  clip-path: polygon(0 0, 100% 0, 28% 100%);
}

.hero-label span {
  color: var(--pink);
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(34px, 10vw, 46px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-summary {
  position: relative;
  z-index: 1;
  margin: 2px auto 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.72;
  text-align: center;
  text-wrap: balance;
}

.hero-summary span {
  color: var(--pink);
  font-size: 19px;
  font-weight: 950;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.badge-row span,
.chip,
.type-card-code,
.trait-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 12px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(43, 32, 45, 0.16);
}

.badge-row span:nth-child(2) {
  background: var(--cyan);
}

.badge-row span:nth-child(3) {
  background: var(--pink-soft);
}

.mascot-stage {
  width: min(100%, 344px);
  margin: 12px auto 0;
  padding-top: 23px;
  transform: rotate(-1deg);
}

.mascot-stage > img:not(.mascot-bubble-image) {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  animation: floaty 4.6s ease-in-out infinite;
}

.mascot-bubble-image {
  position: absolute;
  z-index: 2;
  height: auto;
  animation: bubbleFloat 5.2s ease-in-out infinite;
}

.mascot-bubble-left {
  top: 4px;
  left: -7px;
  width: 134px;
  transform: rotate(-8deg);
}

.mascot-bubble-right {
  top: -4px;
  right: -5px;
  width: 118px;
  transform: rotate(6deg);
  animation-delay: -1.1s;
}

.primary-button,
.secondary-button,
.answer-button,
.ghost-link,
.icon-button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 56px;
  border: 3px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 5px 0 var(--line);
  font-size: 18px;
  font-weight: 900;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

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

.primary-button span {
  display: inline-block;
  margin-left: 8px;
}

.secondary-button {
  background: var(--white);
}

.primary-button:hover,
.secondary-button:hover,
.answer-button:hover,
.ghost-link:hover,
.icon-button:hover {
  filter: brightness(1.02);
}

.primary-button:active,
.secondary-button:active,
.answer-button:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--line);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.2);
}

.start-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  margin-top: -2px;
  border-radius: 999px;
  font-size: 22px;
}

.start-button span {
  display: inline-grid;
  width: 34px;
  height: 34px;
  margin-left: 12px;
  place-items: center;
  border-radius: 50%;
  background: var(--line);
  color: var(--white);
  line-height: 1;
}

.ghost-link {
  display: block;
  width: 100%;
  margin-top: 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.quiz-header {
  display: grid;
  grid-template-columns: 44px 1fr 78px;
  align-items: center;
  gap: 8px;
  padding: 18px 18px 10px;
}

.quiz-header img {
  display: block;
  width: 190px;
  max-width: 100%;
  margin: 0 auto;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 0 rgba(43, 32, 45, 0.18);
}

.quiz-count {
  justify-self: end;
  padding: 8px 9px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--pink);
  font-size: 13px;
  font-weight: 900;
}

.progress-wrap {
  padding: 4px 24px 0;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--white);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink), var(--yellow));
  transition: width 0.35s ease;
}

.progress-dots {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
  margin-top: 8px;
}

.progress-dots span {
  height: 7px;
  border-radius: 999px;
  background: rgba(43, 32, 45, 0.16);
}

.progress-dots span.is-done {
  background: var(--pink);
}

.question-card {
  min-height: 164px;
  margin: 18px 20px 12px;
  padding: 21px 18px 20px;
  border: 4px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 0 rgba(43, 32, 45, 0.1);
}

.question-mark {
  display: inline-grid;
  width: 48px;
  height: 48px;
  margin-bottom: 13px;
  place-items: center;
  border: 4px solid var(--line);
  border-radius: 50%;
  background: var(--yellow);
  font-size: 25px;
  font-weight: 950;
  transform: rotate(-7deg);
}

.question-kicker {
  display: inline-flex;
  margin: 0 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.question-card h2 {
  margin: 0;
  font-size: clamp(22px, 6vw, 26px);
  line-height: 1.48;
  letter-spacing: 0;
}

.answer-list {
  padding: 0 20px;
}

.scale-card {
  padding: 13px 13px 11px;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 5px 0 rgba(43, 32, 45, 0.12);
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.answer-scale {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.answer-button {
  display: grid;
  place-items: center;
  min-width: 0;
  height: 50px;
  padding: 0;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 3px 0 rgba(43, 32, 45, 0.14);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.answer-dot {
  width: 22px;
  height: 22px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.answer-button:nth-child(1):not(.is-selected) {
  background: var(--cyan-soft);
}

.answer-button:nth-child(2):not(.is-selected) {
  background: #ebfbff;
}

.answer-button:nth-child(3):not(.is-selected) {
  background: var(--white);
}

.answer-button:nth-child(4):not(.is-selected) {
  background: var(--yellow-soft);
}

.answer-button:nth-child(5):not(.is-selected) {
  background: #ffe07d;
}

.answer-button:nth-child(6):not(.is-selected) {
  background: var(--pink-soft);
}

.answer-button.is-selected {
  background: var(--pink);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--line);
}

.answer-button.is-selected .answer-dot {
  background: var(--yellow);
  box-shadow: inset 0 0 0 5px var(--white);
  transform: scale(1.12);
}

.selected-answer {
  min-height: 22px;
  margin: 9px 0 0;
  color: var(--pink);
  font-size: 14px;
  font-weight: 950;
  text-align: center;
}

.quiz-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 18px 20px 24px;
}

.quiz-nav .secondary-button,
.quiz-nav .primary-button {
  min-height: 48px;
  font-size: 17px;
}

.screen-result,
.screen-type-detail {
  padding: 25px 22px 24px;
}

.screen-type-detail {
  min-height: calc(100vh - 46px);
}

.detail-back {
  position: absolute;
  top: 20px;
  left: 20px;
}

.detail-ribbon {
  margin-left: 52px;
}

.result-ribbon {
  display: inline-block;
  margin-top: 6px;
  padding: 8px 14px;
  transform: rotate(-1.5deg);
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  color: var(--white);
  font-size: 14px;
  font-weight: 900;
}

.result-title {
  margin-top: 18px;
  text-align: center;
}

.result-title span {
  display: block;
  margin-top: 8px;
  color: var(--pink);
  font-size: 24px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0.04em;
}

.result-title h2 {
  margin: 0;
  font-size: clamp(36px, 10vw, 48px);
  line-height: 1.1;
  letter-spacing: 0;
}

.result-visual {
  width: min(78%, 270px);
  margin: 10px auto 4px;
}

.result-visual img {
  display: block;
  width: 100%;
  height: auto;
  animation: resultPop 0.85s cubic-bezier(0.16, 0.9, 0.2, 1);
}

.detail-visual {
  margin-top: 8px;
}

.result-card {
  margin-top: 6px;
  padding: 20px 18px;
  border: 4px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 0 rgba(43, 32, 45, 0.1);
}

.result-card h3 {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.55;
}

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

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

.detail-chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.detail-actions {
  margin-top: 16px;
}

.trait-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 15px;
}

.trait-meter {
  padding: 10px 11px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.trait-meter strong {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  line-height: 1.3;
}

.trait-meter span {
  color: var(--pink);
}

.meter-track {
  height: 9px;
  margin-top: 8px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--gray);
}

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

.result-actions {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.result-actions .primary-button {
  background: var(--pink);
  color: var(--white);
}

.type-drawer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  padding: 18px;
  background: rgba(43, 32, 45, 0.52);
}

.type-drawer.is-open {
  display: block;
  animation: fadeIn 0.18s ease;
}

.type-drawer-panel {
  position: relative;
  width: min(100%, 520px);
  max-height: calc(100vh - 36px);
  margin: 0 auto;
  overflow: auto;
  padding: 24px 18px 28px;
  border: 4px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.drawer-kicker {
  margin: 0;
  color: var(--pink);
  font-size: 13px;
  font-weight: 900;
}

.type-drawer-panel h2 {
  margin: 4px 0 18px;
  font-size: 30px;
}

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

.type-card {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  color: inherit;
  font: inherit;
  width: 100%;
  min-height: 172px;
  padding: 12px 10px;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 4px 0 rgba(43, 32, 45, 0.13);
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.type-card:hover {
  background: #fff7fb;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 rgba(43, 32, 45, 0.18);
}

.type-card:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(43, 32, 45, 0.18);
}

.type-card img {
  display: block;
  width: 86px;
  height: 86px;
  object-fit: contain;
  margin: 0 auto 6px;
}

.type-card h3 {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
}

.type-card-hint {
  display: inline-flex;
  justify-content: center;
  width: 100%;
  margin-top: 6px;
  color: var(--pink);
  font-size: 11px;
  font-weight: 900;
}

.type-card-code {
  min-height: 24px;
  padding: 3px 8px;
  font-size: 11px;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-8px) rotate(1deg);
  }
}

@keyframes resultPop {
  0% {
    opacity: 0;
    transform: scale(0.74) rotate(-4deg);
  }
  70% {
    transform: scale(1.05) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes bubbleFloat {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -4px;
  }
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(45deg) translateY(0);
  }
  50% {
    transform: rotate(54deg) translateY(-8px);
  }
}

@media (min-width: 780px) {
  .app-shell {
    width: min(100%, 1060px);
    display: grid;
    min-height: 100vh;
    align-items: center;
    padding: 36px;
  }

  .screen {
    width: 430px;
    min-height: 852px;
    margin: 0 auto;
  }
}

@media (max-width: 374px) {
  .app-shell {
    padding: 8px;
  }

  .screen {
    border-radius: 22px;
  }

  .screen-start,
  .screen-result,
  .screen-type-detail {
    padding-inline: 16px;
  }

  .detail-back {
    left: 14px;
  }

  .detail-ribbon {
    margin-left: 48px;
  }

  .question-card {
    margin-inline: 14px;
  }

  .answer-list,
  .quiz-nav {
    padding-inline: 14px;
  }

  .type-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
