﻿:root {
  --ink: #1b1f2a;
  --peach: #ffb77d;
  --sun: #ffd56a;
  --mist: rgba(255, 255, 255, 0.25);
  --shadow: rgba(22, 26, 38, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Bitcount Single", "Gamja Flower", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 20%, #fff0d6 0%, #f7caa2 40%, #c97f5f 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}


.page {
  position: relative;
  z-index: 1;
  width: min(92vw, 420px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.credit {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 0.85rem;
  color: rgba(27, 31, 42, 0.7);
  pointer-events: none;
  z-index: 3;
}

.titlebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  box-shadow: 0 12px 24px var(--shadow);
}

.brand {
  font-size: 1.3rem;
  letter-spacing: 0.04em;
}

.subtitle {
  font-size: 0.9rem;
  opacity: 0.8;
}

.ko {
  font-family: "Gamja Flower", "Bitcount Single", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 1.05rem;
}

.intro {
  font-size: 1.2rem;
  line-height: 1.2;
  margin-bottom: 12px;
}

.game-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 18px 40px var(--shadow);
  user-select: none;
  -webkit-user-select: none;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  text-align: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.2));
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.screen.start,
.screen.result {
  background: url("/image/setground.png") center / cover no-repeat;
}

.screen.result {
  padding-top: 70px;
}

.result-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  align-items: center;
}

.result-header {
  position: relative;
  width: 100%;
  min-height: 90px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin-top: -62px;
}

.result-visual {
  position: relative;
  width: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen.start::before,
.screen.result::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.screen.active {
  display: flex;
}

.success-message {
  display: none;
  position: absolute;
  top: -48px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0;
  background: transparent;
  border-radius: 0;
  font-weight: 700;
  font-size: 3.2rem;
  letter-spacing: 0.08em;
  color: #f7c1d9;
  pointer-events: none;
  z-index: 3;
}

.screen.result:not(.game-over).success-ready .success-message {
  display: block;
}


.result-success {
  display: none;
  width: 160px;
  height: 160px;
  position: relative;
}

.screen.result:not(.game-over) .result-success {
  display: block;
}

.result-success img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#successRei {
  display: none;
  transform: scale(2);
  position: relative;
  top: 20px;
}

.blink-twice {
  animation: blinkTwice 2s ease-in-out 1;
}

@keyframes blinkTwice {
  0% {
    opacity: 1;
  }
  15% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  45% {
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}

.panel {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: 0 12px 24px var(--shadow);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.panel h1,
.panel h2 {
  margin-top: 0;
  margin-bottom: 10px;
}

.panel p {
  margin-top: 0;
  margin-bottom: 18px;
  line-height: 1.5;
}

.result-cry {
  position: relative;
  width: 110px;
  height: 110px;
  display: none;
}

.result-cry img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.screen.result.game-over .result-cry {
  display: block;
}

.result-cry .tear {
  position: absolute;
  width: 12px;
  height: 20px;
  background: rgba(95, 185, 255, 0.85);
  border-radius: 0 0 10px 10px;
  clip-path: polygon(50% 0%, 70% 18%, 82% 40%, 50% 78%, 18% 40%, 30% 18%);
  top: 48px;
  transform: rotate(8deg);
  animation: drip 1.4s ease-in-out infinite;
}

.result-cry .tear::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  background: rgba(247, 193, 217, 0.9);
  border-radius: 50%;
  left: -3px;
  bottom: -10px;
}

.result-cry .tear.right {
  right: 30px;
  animation-delay: 0.35s;
}

@keyframes drip {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0.9;
  }
  60% {
    transform: translateY(14px) scale(0.95);
    opacity: 0.8;
  }
  100% {
    transform: translateY(22px) scale(0.85);
    opacity: 0;
  }
}

.action {
  border: none;
  border-radius: 999px;
  background: #f7c1d9;
  padding: 12px 28px;
  font-size: 1rem;
  font-family: "Bitcount Single", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(194, 116, 71, 0.35);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#screen-play {
  padding: 0;
  background: transparent;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.95rem;
  z-index: 2;
}

.hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(27, 31, 42, 0.65);
  color: white;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

@media (max-width: 420px) {
  .titlebar {
    padding: 10px 12px;
  }

  .panel {
    padding: 18px 16px;
  }
}
#screen-result .panel {
  margin-top: 34px;
}
