/* =========================
   전체 초기화
========================= */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;

  background:
    radial-gradient(
      circle at center top,
      rgba(255, 255, 255, 0.35),
      transparent 45%
    ),
    linear-gradient(
      to bottom,
      #88e1ff 0%,
      #c8efff 60%,
      #f7fdff 100%
    );

  font-family:
    Arial,
    "Apple SD Gothic Neo",
    "Noto Sans KR",
    sans-serif;
}

/* 모든 버튼 기본 스타일 제거 */
button {
  margin: 0;
  padding: 0;

  border: 0;
  background: transparent;

  color: inherit;
  font: inherit;

  cursor: pointer;
}

/* =========================
   게임 전체 영역
========================= */

#game {
  position: relative;

  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));

  overflow: hidden;

  background-color: #88e1ff;

  box-shadow:
    0 0 28px rgba(0, 0, 0, 0.12);
}

/* =========================
   화면 전환
========================= */

.screen {
  position: absolute;
  inset: 0;

  display: none;

  width: 100%;
  height: 100%;
}

.screen.active {
  display: block;
}

/* =========================
   메인 화면
========================= */

#main-screen {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;
}

/* 메인 배경 */
.main-background {
  position: absolute;
  inset: 0;

  display: block;

  width: 100%;
  height: 100%;

  /*
    배경을 피그마 프레임과 같은 비율인
    1080 × 1920으로 내보냈다면 정확히 맞음
  */
  object-fit: cover;
  object-position: center;

  pointer-events: none;
  user-select: none;
}

/* 이미지 버튼 공통 */
.image-button {
  position: absolute;
  z-index: 5;

  display: block;

  border: none;
  background: transparent;
}

.image-button img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;

  pointer-events: none;
  user-select: none;
}

/* =========================
   모드 선택 화면
========================= */

#mode-select-screen {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;
}


/* 배경 */

.mode-select-background {
  position: absolute;
  inset: 0;

  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  pointer-events: none;
  user-select: none;
}


/* =========================
   안내 문구
========================= */

/*
  피그마:
  X 191
  Y 425
  W 700
  H 193
*/

.mode-select-title {
  position: absolute;

  left: 17.6852%;
  top: 22.1354%;

  width: 64.8148%;
  height: 10.0521%;

  margin: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  font-family:
    "Pretendard Variable",
    "Pretendard",
    "Apple SD Gothic Neo",
    sans-serif;

  font-size: min(5.9259vw, 3.3333vh);
  font-weight: 700;
  line-height: 1.40625;

  letter-spacing: 0.03em;

  color: #202123;

  text-align: center;

  z-index: 2;
}


/*
  서브 문구
  피그마:
  X 약 184
  Y 645
  W 713
  H 97
*/

.mode-select-description {
  position: absolute;

  left: 16.9907%;
  top: 33.5938%;

  width: 66.0185%;

  margin: 0;

  font-family:
    "Pretendard Variable",
    "Pretendard",
    "Apple SD Gothic Neo",
    sans-serif;

  font-size: min(3.3333vw, 1.875vh);
  font-weight: 500;
  line-height: 1.2;

  color: rgba(32, 33, 35, 0.7);

  text-align: center;

  z-index: 2;
}


/* =========================
   모드 버튼 공통
========================= */

.mode-select-button {
  position: absolute;

  display: block;

  width: 36.7593%;
  height: 24.8438%;

  background: transparent;

  z-index: 3;

  transition:
    transform 0.08s ease,
    filter 0.08s ease;
}

.mode-select-button img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;

  pointer-events: none;
  user-select: none;
}


/* 스토리 모드
   X 109
   Y 809
   W 397
   H 477
*/

.story-mode-button {
  left: 10.0926%;
  top: 42.1354%;
}


/* 게임 모드
   X 573
   Y 809
   W 397
   H 477
*/

.game-mode-button {
  left: 53.0556%;
  top: 42.1354%;
}


/* 버튼 누르는 효과 */

.mode-select-button:active {
  transform: translateY(3px) scale(0.98);
  filter: brightness(0.95);
}


/* =========================
   첫 화면으로 버튼
========================= */

/*
  피그마:
  X 370
  Y 1638
  W 340
  H 126
*/

.first-page-button {
  position: absolute;

  left: 34.2593%;
  top: 85.3125%;

  width: 31.4815%;
  height: 6.5625%;

  z-index: 3;

  transition:
    transform 0.08s ease,
    filter 0.08s ease;
}

.first-page-button img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;

  pointer-events: none;
  user-select: none;
}

.first-page-button:active {
  transform: translateY(3px) scale(0.98);
  filter: brightness(0.95);
}

/* =========================
   피그마 기준 버튼 위치
   기준 프레임: 1080 × 1920
========================= */

/*
  게임 시작
  피그마:
  X 316
  Y 1381
  W 447
  H 188
*/
#start-button {
  left: 30.6481%;
  top: 70.2083%;

  width: 38.6111%;
  height: 9.6875%;
}

#guide-button {
  left: 30.6481%;
  top: 80.9375%;

  width: 38.6111%;
  height: 9.6875%;
}

/*
  소리 버튼
  피그마:
  X 45
  Y 45
  W 150
  H 150
*/
#volume-button {
  left: 4.1667%;
  top: 2.3438%;

  width: 13.8889%;
  height: 7.8125%;

  z-index: 10;
}

/* 버튼 누르는 효과 */
.main-screen-button,
.volume-button {
  transition:
    transform 0.08s ease,
    filter 0.08s ease;
}

.main-screen-button:active {
  transform: translateY(3px) scale(0.98);
  filter: brightness(0.94);
}

.volume-button:active {
  transform: scale(0.92);
  filter: brightness(0.94);
}

/* 키보드로 선택했을 때 */
button:focus-visible {
  outline: 4px solid rgba(255, 255, 255, 0.95);
  outline-offset: 4px;
}

/* =========================
   팝업 공통
========================= */

.modal {
  position: absolute;
  inset: 0;
  z-index: 100;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 100%;
}

.modal.hidden {
  display: none;
}

/* 팝업 뒤 어두운 영역 */
.modal-overlay {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  background-color: rgba(0, 0, 0, 0.45);
}

/* 팝업 본체 */
.modal-content {
  position: relative;
  z-index: 1;

  width: 84%;
  max-height: 82%;

  padding:
    clamp(45px, 7vh, 65px)
    clamp(18px, 5vw, 30px)
    clamp(24px, 4vh, 35px);

  overflow-y: auto;

  border: clamp(3px, 0.8vw, 5px) solid #fff;
  border-radius: clamp(18px, 5vw, 30px);

  background-color: #e9faff;

  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.25);

  color: #247ca1;
  text-align: center;
}

/* 팝업 제목 */
.modal-content h2 {
  margin: 0 0 clamp(18px, 4vh, 28px);

  font-size: clamp(20px, 5vw, 30px);
}

/* 닫기 버튼 */
.modal-close-button {
  position: absolute;
  top: 10px;
  right: 14px;

  width: 38px;
  height: 38px;

  color: #247ca1;

  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

/* =========================
   게임 방법 팝업
========================= */

.guide-modal {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 100%;

  z-index: 100;
}

/* 팝업 바깥 영역 */
.guide-overlay {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  background: rgba(255, 255, 255, 0.7);

  z-index: 0;
}

/* SVG + 텍스트 전체 묶음 */
.guide-content {
  position: absolute;

  left: 8.9815%;
  top: 13.9063%;

  width: 82.037%;
  height: 72.2396%;

  z-index: 1;
}

/* 게임 방법 SVG */
.guide-image {
  position: absolute;
  inset: 0;

  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;

  pointer-events: none;
  user-select: none;
}

/* 설명 텍스트 공통 */
.guide-description {
  position: absolute;

  width: 60.5%;
  margin: 0;

  left: 50%;
  transform: translateX(-50%);

  font-family:
    "Pretendard Variable",
    "Pretendard",
    "Apple SD Gothic Neo",
    sans-serif;

  font-size: min(2.22vw, 1.25vh);
  font-weight: 500;
  line-height: 1.21;

  color: #ff268b;
  text-align: center;

  z-index: 2;
}

/* 스토리 모드 설명 */
.story-description {
  top: 49.1%;
}

/* 게임 모드 설명 */
.game-description {
  top: 76.6%;
}
/* =========================
   임시 스토리·게임 화면
========================= */

.temporary-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 24px;

  width: 100%;
  height: 100%;

  background:
    linear-gradient(
      to bottom,
      #88e1ff,
      #fff
    );

  color: #247ca1;

  font-size: clamp(22px, 6vw, 34px);
  font-weight: 700;
  text-align: center;
}

.back-button {
  padding: 14px 24px;

  border: 3px solid #fff;
  border-radius: 18px;

  background-color: #4dc7f3;

  box-shadow:
    0 4px 0 #168fc2;

  color: #fff;

  font-size: clamp(15px, 4vw, 21px);
  font-weight: 700;
}

.back-button:active {
  transform: translateY(3px);

  box-shadow:
    0 1px 0 #168fc2;
}

/* 공통 숨김 클래스 */
.hidden {
  display: none !important;
}

/* =========================
   게임 선택 화면
========================= */

#game-mode-screen {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;
}

/* =========================
   게임 모드 타이틀
   Figma:
   X 152
   Y 223
   W 786
========================= */

.game-mode-title {
  position: absolute;

  left: 14.0741%;
  top: 11.6146%;

  width: 72.7778%;
  height: auto;

  display: block;

  object-fit: contain;

  z-index: 2;

  pointer-events: none;
  user-select: none;
}


/* =========================
   게임 모드 설명
   Figma:
   X 184 정도
   Y 434
   W 713
   H 174
========================= */

.game-mode-description {
  position: absolute;

  left: 50%;
  top: 24.5%;

  width: 66.0185%;

  margin: 0;

  transform: translateX(-50%);

  font-family:
    "Pretendard Variable",
    "Pretendard",
    "Apple SD Gothic Neo",
    sans-serif;

  font-size: min(3.3333vw, 1.875vh);
  font-weight: 500;
  line-height: 1.2;

  color: rgba(32, 33, 35, 0.7);

  text-align: center;

  z-index: 2;
}

/* 배경 */

.game-mode-background {
  position: absolute;
  inset: 0;

  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  pointer-events: none;
  user-select: none;
}


/* =========================
   미니게임 선택 버튼 공통
========================= */

.minigame-select-button {
  position: absolute;

  display: block;

  padding: 0;
  border: 0;
  background: transparent;

  z-index: 3;

  transition:
    transform 0.08s ease,
    filter 0.08s ease;
}

.minigame-select-button img {
  display: block;

  width: 100%;
  height: auto;

  pointer-events: none;
  user-select: none;
}

.minigame-select-button:active {
  transform: translateY(3px) scale(0.985);
  filter: brightness(0.95);
}


/* =========================
   달려라 만두
   Figma:
   X 172
   Y 729
   W 715
========================= */

.running-mandu-button {
  left: 16.8519%;
  top: 36.7188%;
  width: 66.2037%;
}


/* =========================
   민재의 공을 막아라
   Figma:
   X 172
   Y 960
   W 737 정도
========================= */

.goalkeeper-button {
  left: 16.8519%;
  top: 49.2188%;
  width: 68.2407%;
}


/* =========================
   선물 사수 대작전
   Figma:
   X 171
   Y 1191
========================= */

.catching-gift-button {
  left: 16.8519%;
  top: 60.7292%;
  width: 66.2037%;
}


/* =========================
   랭킹 확인 버튼
   Figma:
   X 180
   Y 1588
   W 715
   H 120
========================= */

.show-rank-button {
  position: absolute;

  left: 16.6667%;
  top: 82.1875%;

  width: 66.2037%;

  padding: 0;
  border: 0;
  background: transparent;

  z-index: 3;

  transition:
    transform 0.08s ease,
    filter 0.08s ease;
}

.show-rank-button img {
  display: block;

  width: 100%;
  height: auto;

  pointer-events: none;
  user-select: none;
}

.show-rank-button:active {
  transform: translateY(3px) scale(0.985);
  filter: brightness(0.95);
}


/* =========================
   랭킹 안내 문구
========================= */

.ranking-notice {
  position: absolute;

  left: 50%;
  top: 90.1042%;

  width: 57.4074%;

  margin: 0;

  transform: translateX(-50%);

  font-family:
    "Pretendard Variable",
    "Pretendard",
    "Apple SD Gothic Neo",
    sans-serif;

  font-size: min(1.8519vw, 1.0417vh);
  font-weight: 500;
  line-height: 1.2;

  text-align: center;

  color: rgba(32, 33, 35, 0.7);

  z-index: 2;
}

/* =========================
   닉네임 설정 화면
========================= */

#nickname-screen {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;
}


/* 배경 */

.nickname-background {
  position: absolute;
  inset: 0;

  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  pointer-events: none;
  user-select: none;
}


/* =========================
   이름 설정 패널

   Figma
   X 172
   Y 653
   W 737
   H 590
========================= */

.nickname-panel {
  position: absolute;

  left: 15.9259%;
  top: 34.0104%;

  width: 68.2407%;
  height: 30.7292%;

  object-fit: fill;

  z-index: 2;

  pointer-events: none;
  user-select: none;
}


/* =========================
   닉네임 입력창

   Figma
   W 529
   H 92
   Y 894
========================= */

.nickname-input {
  position: absolute;

  left: 50%;
  top: 46.5625%;

  width: 48.9815%;
  height: 4.7917%;

  transform: translateX(-50%);

  box-sizing: border-box;

  padding: 0 4%;

  border: 0;
  outline: none;

  background: #ffffff;

  box-shadow:
    inset 0 -4px 0 #1c69bd;

  border-radius: 12px;

  font-family:
    "Pretendard Variable",
    "Pretendard",
    "Apple SD Gothic Neo",
    sans-serif;

  font-size: min(3.3333vw, 1.875vh);
  font-weight: 600;

  color: #202123;
  text-align: center;

  z-index: 3;
}


/* 입력창 선택됐을 때
   브라우저 기본 외곽선 방지 */

.nickname-input:focus {
  outline: none;
}


/* =========================
   닉네임 안내 문구

   시작 Y 1005
========================= */

.nickname-notice {
  position: absolute;

  left: 50%;
  top: 52.3438%;

  width: 60%;

  margin: 0;

  transform: translateX(-50%);

  font-family:
    "Pretendard Variable",
    "Pretendard",
    "Apple SD Gothic Neo",
    sans-serif;

  font-size: min(1.8519vw, 1.0417vh);
  font-weight: 500;
  line-height: 1.35;

  text-align: center;

  color: rgba(32, 33, 35, 0.7);

  z-index: 3;
}

.nickname-duplicate-notice {
  position: absolute;

  left: 50%;
  top: 66%;

  width: 60%;

  margin: 0;

  transform: translateX(-50%);

  font-family:
    "Pretendard Variable",
    "Pretendard",
    "Apple SD Gothic Neo",
    sans-serif;

font-size: min(2.6vw, 1.46vh);
  font-weight: 600;
  line-height: 1.35;

  text-align: center;

color: #0E4CB0;

  z-index: 3;
}

/* =========================
   확인 버튼

   Figma
   W 169
   H 93
   Y 1076
========================= */

.nickname-ok-button {
  position: absolute;

  left: 50%;
  top: 56.0417%;

  width: 15.6481%;
  height: 4.8438%;

  transform: translateX(-50%);

  padding: 0;
  border: 0;

  background: transparent;

  z-index: 3;

  transition:
    transform 0.08s ease,
    filter 0.08s ease;
}

.nickname-ok-button img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;

  pointer-events: none;
  user-select: none;
}


/* 버튼 누르는 효과 */

.nickname-ok-button:active {
  transform:
    translateX(-50%)
    translateY(3px)
    scale(0.98);

  filter: brightness(0.95);
}