* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

#game {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  z-index: 1;
}

#top-ui {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  z-index: 10;

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

  pointer-events: none;
}

#score {
  padding: 10px 16px;
  border-radius: 999px;
  color: white;
  font-weight: 700;
  font-size: 16px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}
#open-wish-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 999px;

  color: white;
  font-weight: 700;
  font-size: 15px;

  background: rgba(92, 81, 69, 0.86);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);

  cursor: pointer;
  pointer-events: auto;
}

#open-wish-btn:hover {
  background: rgba(70, 61, 52, 0.95);
}

#open-wish-btn.hidden {
  display: none;
}

#guide-text {
  position: absolute;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  z-index: 10;

  padding: 10px 18px;
  border-radius: 999px;
  color: white;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  white-space: nowrap;
  pointer-events: none;
}

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

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

  pointer-events: auto;
}

.modal.hidden {
  display: none;
}

.modal-box {
  width: 320px;
  padding: 22px;
  border-radius: 22px;

  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);

  text-align: center;
}

.modal-box h2 {
  margin: 0 0 14px;
  font-size: 20px;
  color: #2d261f;
}

#wish-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid #cfc3b4;
  outline: none;
  font-size: 15px;
}

#wish-submit-btn {
  width: 100%;
  height: 42px;
  margin-top: 12px;

  border: none;
  border-radius: 12px;
  cursor: pointer;

  font-size: 15px;
  font-weight: 700;
  color: white;
  background: #5c5145;
}

#wish-submit-btn:hover {
  background: #463d34;
}

#message {
  position: absolute;
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%);
  z-index: 20;

  padding: 12px 20px;
  border-radius: 999px;

  color: white;
  font-size: 15px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);

  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

#message.show {
  opacity: 1;
}

@media (max-width: 640px) {
  #guide-text {
    top: 76px;
    max-width: calc(100vw - 32px);
    white-space: normal;
    text-align: center;
    line-height: 1.35;
  }

  .modal-box {
    width: calc(100vw - 40px);
  }
}
.wish-tooltip {
  position: fixed;
  z-index: 40;

  padding: 7px 11px;
  border-radius: 999px;

  color: white;
  font-size: 13px;
  font-weight: 700;

  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(8px);

  pointer-events: none;
  transform: translate(12px, 12px);
}

.wish-tooltip.hidden {
  display: none;
}

.wish-viewer {
  position: absolute;
  inset: 0;
  z-index: 50;

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

  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(3px);
}

.wish-viewer.hidden {
  display: none;
}

.wish-viewer-box {
  width: min(360px, calc(100vw - 40px));
  padding: 24px;
  border-radius: 24px;

  text-align: center;

  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.28);
}

.wish-viewer-box h2 {
  margin: 0 0 14px;
  color: #2d261f;
  font-size: 20px;
}

#wish-viewer-text {
  margin: 0 0 18px;
  color: #3a3028;
  font-size: 16px;
  line-height: 1.55;
  word-break: keep-all;
}

#wish-viewer-close {
  height: 40px;
  padding: 0 18px;

  border: none;
  border-radius: 999px;

  color: white;
  font-weight: 700;
  background: #5c5145;

  cursor: pointer;
}
@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
  }

  #game {
    width: 100vw;
    height: 100dvh;
    background-size: cover;
    background-position: center center;
  }

  #game-canvas {
    width: 100%;
    height: 100%;
  }

  #top-ui {
    top: max(12px, env(safe-area-inset-top));
    left: 12px;
    right: 12px;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  #score {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 999px;
  }

  #open-wish-btn {
    padding: 8px 13px;
    font-size: 13px;
    white-space: nowrap;
  }

   #guide-text {
    top: auto !important;
    bottom: max(30px, env(safe-area-inset-bottom)) !important;

    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;

    width: calc(100vw - 36px) !important;
    max-width: 360px !important;
    box-sizing: border-box;

    margin: 0 !important;
    padding: 12px 16px;

    font-size: 15px;
    line-height: 1.45;
    text-align: center;
    white-space: normal;

    border-radius: 26px;
  }

  .modal-box {
    width: calc(100vw - 32px);
    max-width: 360px;
    padding: 22px 18px;
    border-radius: 22px;
  }

  .modal-box h1 {
    font-size: 21px;
  }

  .modal-box p {
    font-size: 14px;
  }

  #wish-input {
    height: 44px;
    font-size: 15px;
  }

  #wish-submit-btn {
    height: 44px;
    font-size: 15px;
  }

  #message {
    display: none !important;
  }

  .wish-tooltip {
    font-size: 12px;
    padding: 6px 10px;
    transform: translate(10px, 10px);
  }

  .wish-viewer-box {
    width: calc(100vw - 36px);
    padding: 22px 18px;
    border-radius: 22px;
  }

  .wish-viewer-box h2 {
    font-size: 19px;
  }

  #wish-viewer-text {
    font-size: 15px;
  }
}