:root {
  color-scheme: light;
  --ink: #18314f;
  --muted: #617381;
  --paper: #fffaf0;
  --line: rgba(24, 49, 79, 0.12);
  --green: #50d7aa;
  --blue: #58b9ec;
  --pink: #ff8db5;
  --yellow: #ffd86b;
  --red: #ff6b7a;
  --shadow: 0 18px 44px rgba(27, 72, 88, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 216, 107, 0.42), transparent 22%),
    radial-gradient(circle at 88% 8%, rgba(255, 141, 181, 0.34), transparent 22%),
    linear-gradient(145deg, #dffaf2, #eaf8ff 52%, #fff5d8);
}

button {
  font: inherit;
  cursor: pointer;
}

.game-app {
  width: min(1120px, calc(100% - 28px));
  min-height: 100svh;
  margin: 0 auto;
  padding: 20px 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
}

.game-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.kicker {
  margin: 0 0 4px;
  color: #34708a;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.9rem, 4vw, 3.7rem);
  line-height: 1;
}

.reset-button,
.next-button,
.choice-button {
  border: 0;
  border-radius: 12px;
  font-weight: 900;
}

.reset-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(180deg, var(--blue), #347ab8);
  box-shadow: 0 8px 18px rgba(52, 122, 184, 0.18);
}

.world-stage {
  position: relative;
  min-height: 138px;
  overflow: hidden;
  border: 1px solid rgba(42, 127, 137, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.26)),
    linear-gradient(155deg, #72d4db, #6da8eb 58%, #9d8bea);
  box-shadow: var(--shadow);
}

.world-stage::before {
  content: "";
  position: absolute;
  left: 5%;
  right: 5%;
  top: 72px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.78);
  box-shadow: inset 0 0 0 2px rgba(24, 49, 79, 0.08);
}

.world-sky span {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 18px rgba(23, 50, 78, 0.12);
}

.world-sky span:nth-child(1) {
  left: 8%;
  top: 18px;
  width: 90px;
  height: 34px;
}

.world-sky span:nth-child(2) {
  right: 12%;
  top: 24px;
  width: 130px;
  height: 42px;
}

.world-sky span:nth-child(3) {
  left: 46%;
  bottom: 18px;
  width: 82px;
  height: 28px;
}

.progress-rail {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  align-items: end;
  gap: 5px;
  padding: 74px 18px 16px;
}

.stage-node {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 0;
}

.node-icon {
  display: grid;
  width: 36px;
  aspect-ratio: 1;
  place-items: center;
  border: 3px solid #17324e;
  border-radius: 12px;
  color: #17324e;
  background: #fffaf0;
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 6px 0 rgba(23, 50, 78, 0.14);
}

.stage-node.is-current .node-icon {
  background: linear-gradient(145deg, var(--yellow), var(--pink));
}

.stage-node.is-cleared .node-icon {
  background: linear-gradient(145deg, #e6fff5, var(--green));
}

.node-title,
.node-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.map-runner {
  --runner-x: 8%;
  position: absolute;
  z-index: 4;
  left: var(--runner-x);
  top: 43px;
  width: 54px;
  height: 66px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: left 720ms cubic-bezier(0.22, 1, 0.22, 1);
}

.map-runner.is-moving {
  animation: runnerHop 720ms ease-out;
}

.runner-head {
  position: absolute;
  left: 50%;
  top: 1px;
  width: 40px;
  height: 40px;
  border: 4px solid #17324e;
  border-radius: 17px;
  background: linear-gradient(145deg, #fff, var(--yellow));
  transform: translateX(-50%);
}

.runner-head::before,
.runner-head::after {
  content: "";
  position: absolute;
  top: 14px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #17324e;
}

.runner-head::before {
  left: 10px;
}

.runner-head::after {
  right: 10px;
}

.runner-body {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 32px;
  height: 32px;
  border: 4px solid #17324e;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--pink), var(--blue));
  transform: translateX(-50%);
}

.runner-body::before,
.runner-body::after {
  content: "";
  position: absolute;
  bottom: -11px;
  width: 8px;
  height: 16px;
  border-radius: 999px;
  background: #17324e;
  animation: runnerFeet 560ms ease-in-out infinite;
}

.runner-body::before {
  left: 4px;
}

.runner-body::after {
  right: 4px;
  animation-delay: 280ms;
}

.challenge-card {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
  padding: 18px;
  border: 1px solid rgba(42, 127, 137, 0.16);
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.93);
  box-shadow: var(--shadow);
}

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

.challenge-meta p {
  margin: 0;
  color: #34708a;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-pill {
  min-width: 92px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #14364f;
  background: rgba(255, 216, 107, 0.72);
  text-align: center;
  font-weight: 900;
}

.scenario-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 96px;
  padding: 12px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 14% 20%, rgba(255, 255, 255, 0.72), transparent 18%),
    linear-gradient(145deg, rgba(88, 185, 236, 0.22), rgba(80, 215, 170, 0.18));
}

.avatar {
  position: relative;
  width: 72px;
  aspect-ratio: 1;
  border: 4px solid #17324e;
  border-radius: 26px;
  background: linear-gradient(145deg, #fff, var(--yellow));
  transform: rotate(-5deg);
  animation: avatarIdle 2.2s ease-in-out infinite;
}

.avatar-face::before,
.avatar-face::after {
  content: "";
  position: absolute;
  top: 28px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #17324e;
}

.avatar-face::before {
  left: 22px;
}

.avatar-face::after {
  right: 22px;
}

.game-app.is-answer-correct .avatar {
  animation: avatarCelebrate 680ms ease-out;
}

.game-app.is-answer-wrong .avatar {
  animation: avatarOops 360ms linear;
}

.scene-bubble {
  min-height: 72px;
  padding: 12px 14px;
  border: 3px solid #17324e;
  border-radius: 16px;
  background: #fff;
  font-weight: 900;
  line-height: 1.55;
}

.question-area h2 {
  margin-bottom: 6px;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.2;
}

.stage-question {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 900;
  line-height: 1.65;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.choice-button {
  min-height: 74px;
  padding: 12px 14px;
  border: 3px solid #17324e;
  color: var(--ink);
  background: #fff;
  text-align: left;
  line-height: 1.45;
  box-shadow: 0 5px 0 rgba(23, 50, 78, 0.18);
}

.choice-button:disabled {
  cursor: default;
}

.choice-button.is-correct {
  border-color: #16875f;
  background: #d8fff0;
}

.choice-button.is-wrong {
  border-color: #b7354b;
  background: #ffe0e6;
}

.result-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: rgba(84, 214, 170, 0.18);
}

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

.result-title {
  margin-bottom: 4px;
  font-size: 1.05rem;
  font-weight: 900;
}

.result-panel p:last-of-type {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.55;
}

.next-button {
  min-height: 50px;
  padding: 0 18px;
  color: #fff;
  background: linear-gradient(180deg, var(--green), #2aa686);
}

.game-app.is-complete .challenge-card {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 216, 107, 0.38), transparent 28%),
    rgba(255, 250, 240, 0.94);
}

@keyframes runnerHop {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  38% {
    transform: translate(-50%, calc(-50% - 20px)) scale(1.05) rotate(-4deg);
  }
  72% {
    transform: translate(-50%, calc(-50% - 5px)) scale(0.98) rotate(3deg);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes runnerFeet {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-5px) rotate(12deg);
  }
}

@keyframes avatarIdle {
  0%,
  100% {
    transform: translateY(0) rotate(-5deg);
  }
  50% {
    transform: translateY(-7px) rotate(3deg);
  }
}

@keyframes avatarCelebrate {
  0%,
  100% {
    transform: translateY(0) rotate(-5deg) scale(1);
  }
  34% {
    transform: translateY(-20px) rotate(8deg) scale(1.08);
  }
  68% {
    transform: translateY(-7px) rotate(-8deg) scale(1.02);
  }
}

@keyframes avatarOops {
  0%,
  100% {
    transform: translateX(0) rotate(-5deg);
  }
  25% {
    transform: translateX(-8px) rotate(-9deg);
  }
  75% {
    transform: translateX(8px) rotate(4deg);
  }
}

@media (max-width: 760px) {
  .game-app {
    width: min(100% - 20px, 1120px);
    padding: 14px 0;
    gap: 10px;
  }

  .game-header {
    align-items: start;
  }

  .world-stage {
    min-height: 108px;
  }

  .world-stage::before {
    top: 55px;
  }

  .progress-rail {
    padding: 56px 10px 10px;
    gap: 2px;
  }

  .node-icon {
    width: 28px;
    border-width: 2px;
    border-radius: 9px;
    font-size: 0.78rem;
  }

  .map-runner {
    top: 34px;
    width: 44px;
    height: 54px;
  }

  .runner-head {
    width: 34px;
    height: 34px;
    border-width: 3px;
  }

  .runner-body {
    width: 27px;
    height: 27px;
    border-width: 3px;
  }

  .challenge-card {
    padding: 12px;
    gap: 10px;
  }

  .scenario-row {
    grid-template-columns: 58px minmax(0, 1fr);
    min-height: 76px;
    padding: 10px;
  }

  .avatar {
    width: 54px;
    border-width: 3px;
    border-radius: 20px;
  }

  .avatar-face::before,
  .avatar-face::after {
    top: 21px;
  }

  .avatar-face::before {
    left: 16px;
  }

  .avatar-face::after {
    right: 16px;
  }

  .scene-bubble {
    min-height: 58px;
    padding: 10px 11px;
    border-width: 2px;
    font-size: 0.88rem;
  }

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

  .choice-button {
    min-height: 52px;
    padding: 10px 12px;
    border-width: 2px;
  }

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