* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
html {
  margin: 0;
  height: 100%;
}
body {
  margin: 0;
  height: 100vh;
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo",
    sans-serif;
  background: #f2f2f2;
  display: flex;
  justify-content: center;
  align-items: center;
}
.container {
  margin: 0 auto;
  border: 2px solid #333;
  width: 100%;
  max-width: 1196px;
  height: 540px;
  display: flex;
  flex-direction: column;
}
.game-main {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
}
#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(#7ec8ff 0%, #b9e4ff 55%, #d9f4ff 56%);
}
.sun {
  position: absolute;
  top: -40px;
  right: -30px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff6b0, #ffd23f 60%, #ffb200);
  box-shadow: 0 0 40px 10px #ffd23f99;
}
.cloud {
  position: absolute;
  background: #fff;
  border-radius: 50px;
  opacity: 0.9;
}
.cloud:before,
.cloud:after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}
.cloud1 {
  width: 90px;
  height: 32px;
  top: 36px;
  left: 5%;
  animation: drift 26s linear infinite;
}
.cloud1:before {
  width: 46px;
  height: 46px;
  top: -22px;
  left: 10px;
}
.cloud1:after {
  width: 36px;
  height: 36px;
  top: -16px;
  left: 44px;
}
.cloud2 {
  width: 70px;
  height: 26px;
  top: 80px;
  left: 38%;
  animation: drift 32s linear infinite;
}
.cloud2:before {
  width: 36px;
  height: 36px;
  top: -16px;
  left: 8px;
}
.cloud2:after {
  width: 28px;
  height: 28px;
  top: -12px;
  left: 34px;
}
.cloud3 {
  width: 80px;
  height: 28px;
  top: 18px;
  left: 72%;
  animation: drift 22s linear infinite;
}
.cloud3:before {
  width: 40px;
  height: 40px;
  top: -18px;
  left: 8px;
}
.cloud3:after {
  width: 30px;
  height: 30px;
  top: -12px;
  left: 38px;
}
@keyframes drift {
  50% {
    transform: translateX(30px);
  }
}
.hill {
  position: absolute;
  bottom: -60px;
  border-radius: 50%;
}
.hill1 {
  width: 500px;
  height: 200px;
  left: -120px;
  background: #7bd08a;
}
.hill2 {
  width: 600px;
  height: 220px;
  right: -150px;
  background: #9be0a2;
}
.screen {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.hidden {
  display: none !important;
}
#start-screen,
#result-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.title {
  display: flex;
  font-size: 58px;
  font-weight: 900;
  letter-spacing: 4px;
  text-shadow: 3px 3px #ffffff99;
}
.title span {
  animation: bob 1.6s ease-in-out infinite;
}
.title span:nth-child(1) {
  color: #ff5b6a;
}
.title span:nth-child(2) {
  color: #ff9f43;
  animation-delay: 0.1s;
}
.title span:nth-child(3) {
  color: #ffd23f;
  animation-delay: 0.2s;
}
.title span:nth-child(4) {
  color: #4dd07a;
  animation-delay: 0.3s;
}
.title span:nth-child(5) {
  color: #3fb0ff;
  animation-delay: 0.4s;
}
.title span:nth-child(6) {
  color: #a06bff;
  animation-delay: 0.5s;
}
.title span:nth-child(7) {
  color: #ff5b9f;
  animation-delay: 0.6s;
}
.title span:nth-child(8) {
  color: #ff8a3f;
  animation-delay: 0.7s;
}
@keyframes bob {
  50% {
    transform: translateY(-10px);
  }
}
.sub-instruction {
  font-size: 19px;
  color: #3a5a40;
  font-weight: 700;
  background: #ffffffbf;
  padding: 9px 24px;
  border-radius: 20px;
  text-align: center;
}
.big-btn,
.btn-primary,
.btn-secondary {
  color: #fff;
  border: 0;
  border-radius: 60px;
  font-weight: 900;
  cursor: pointer;
}
.big-btn {
  font-size: 32px;
  padding: 17px 62px;
  background: linear-gradient(#ff8b5c, #ff6a3d);
  box-shadow: 0 8px #d94f22;
}
.big-btn:active,
.btn-primary:active,
.btn-secondary:active {
  transform: translateY(5px);
  box-shadow: none;
}
.play-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: transparent;
  z-index: 70;
}
.header-status {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 8px;
}
.timer-badge,
.question-badge {
  background: #ffffffe6;
  border: 3px solid #f2b321;
  border-radius: 24px;
  font-size: 18px;
  font-weight: 900;
  color: #6b4300;
  white-space: nowrap;
}
.question-badge {
  padding: 6px 18px;
}
.timer-badge {
  padding: 6px 14px;
  border-color: #4dabf7;
  color: #15588f;
  font-variant-numeric: tabular-nums;
}
.play-title {
  grid-column: 2;
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #4a3f00;
  white-space: nowrap;
}
.header-actions {
  justify-self: end;
  display: flex;
  gap: 8px;
}
.quit-btn,
.sound-btn {
  border: 3px solid #ddd;
  border-radius: 24px;
  padding: 7px 16px;
  background: #fff;
  color: #777;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}
.sound-btn {
  min-width: 94px;
  background: #fff0ad;
  border-color: #f2b321;
  color: #694100;
  box-shadow: 0 3px #d89500;
}
.sound-btn.sound-off {
  background: #e9edf1;
  border-color: #aeb7c0;
  color: #66717b;
  box-shadow: 0 3px #929ba4;
}
.start-sound {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 80;
}
.progress-wrap {
  position: absolute;
  top: 51px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  z-index: 60;
}
.progress-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e2e2e2;
  border: 2px solid #0000001f;
}
.progress-dot.done {
  background: #4dd07a;
}
.progress-dot.current {
  background: #ffd23f;
  border-color: #d89500;
}
.instruction-line {
  position: absolute;
  top: 72px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #3a5a40;
  z-index: 55;
}
#play-area {
  position: absolute;
  top: 94px;
  left: 0;
  right: 0;
  bottom: 0;
}
.track {
  position: absolute;
  left: 0;
  right: 0;
  height: 14px;
  background: repeating-linear-gradient(
    90deg,
    #8a5a34 0 24px,
    #a9713f 24px 48px
  );
}
.top-track {
  top: 136px;
}
.bottom-track {
  bottom: 42px;
}
.train {
  width: 170px;
  height: 96px;
  border-radius: 20px 20px 10px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  text-shadow: 1px 1px 3px #0004;
  box-shadow:
    0 6px #0003,
    0 10px 16px #0002;
}
.train:before {
  content: "";
  position: absolute;
  top: -20px;
  left: 16px;
  width: 22px;
  height: 26px;
  background: inherit;
  border-radius: 6px 6px 0 0;
}
.train.car:not(.engine):before {
  content: none;
}
.title-train {
  position: relative;
  width: 190px;
  height: 100px;
  background: #ff6b6b;
}
.wheel {
  position: absolute;
  bottom: -14px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #3b3b3b;
  border: 4px solid #d9d9d9;
}
.w1 {
  left: 20px;
}
.w2 {
  right: 20px;
}
.key {
  color: #fff700;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.choices-row {
  position: absolute;
  bottom: 46px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-evenly;
  align-items: flex-end;
  padding: 0 16px;
}
.choice-train {
  position: relative;
  cursor: grab;
  touch-action: none;
}
.wrong-flash {
  animation: shake 0.4s;
}
@keyframes shake {
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}
.feedback-msg {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  font-size: 38px;
  font-weight: 900;
  color: #fff;
  padding: 12px 32px;
  border-radius: 30px;
  z-index: 80;
  opacity: 0;
  pointer-events: none;
}
.feedback-msg.show {
  animation: pop 0.9s forwards;
}
.feedback-msg.good {
  background: #147d64f2;
}
.feedback-msg.bad {
  background: #6b2737f2;
}
@keyframes pop {
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
  }
  30%,
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}
.first-choice-guide {
  position: absolute;
  left: 50%;
  bottom: 154px;
  z-index: 65;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translate(-50%, 8px) scale(0.9);
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.25s;
}
.first-choice-guide.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}
.guide-text {
  padding: 6px 18px;
  border: 3px solid #f2b321;
  border-radius: 22px;
  background: #fffffff2;
  color: #6b4300;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 4px 8px #0002;
  white-space: nowrap;
}
.guide-finger {
  font-size: 42px;
  line-height: 1;
  filter: drop-shadow(0 3px 2px #0003);
  animation: point-choice 0.85s ease-in-out infinite;
}
@keyframes point-choice {
  0%,
  100% {
    transform: translateY(-3px);
  }
  50% {
    transform: translateY(10px);
  }
}
.result-title {
  font-size: 44px;
  font-weight: 900;
  color: #ff7b3d;
  text-shadow: 2px 2px #fff;
}
.result-time {
  background: #ffffffd9;
  border: 3px solid #4dabf7;
  border-radius: 24px;
  padding: 7px 22px;
  color: #15588f;
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.big-stars {
  display: flex;
  gap: 10px;
}
.big-star {
  width: 52px;
  height: 52px;
  clip-path: polygon(
    50% 0,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
  background: #e0e0e0;
}
.big-star.filled {
  background: #ffd23f;
}
.result-btns {
  display: flex;
  gap: 22px;
}
.btn-primary,
.btn-secondary {
  font-size: 22px;
  padding: 15px 36px;
}
.btn-primary {
  background: linear-gradient(#ff8b5c, #ff6a3d);
  box-shadow: 0 6px #d94f22;
}
.btn-secondary {
  background: linear-gradient(#4dabf7, #2f8ce0);
  box-shadow: 0 6px #1f6bb0;
}
.confetti {
  position: absolute;
  inset: 0;
  z-index: 75;
  overflow: hidden;
  pointer-events: none;
}
.confetti i {
  position: absolute;
  top: -18px;
  left: var(--x);
  width: 10px;
  height: 16px;
  border-radius: 2px;
  background: var(--color);
  animation: confetti-fall var(--duration) ease-in var(--delay) forwards;
}
@keyframes confetti-fall {
  0% {
    transform: translate3d(0, -20px, 0) rotate(0);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--dx), 105vh, 0) rotate(var(--spin));
    opacity: 0.9;
  }
}
@media (max-width: 760px) {
  .title {
    font-size: 40px;
    letter-spacing: 1px;
  }
  .play-title {
    font-size: 18px;
    letter-spacing: 0;
  }
  .header-status {
    gap: 4px;
  }
  .timer-badge,
  .question-badge,
  .quit-btn,
  .sound-btn {
    padding: 6px 7px;
    font-size: 13px;
  }
  .sound-btn {
    min-width: 76px;
  }
  .train {
    width: 130px !important;
    height: 82px !important;
    font-size: 23px;
  }
  .choices-row {
    padding: 0 4px;
  }
}
