* {
  box-sizing: border-box;
}

html,
body,
#game-container {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #202726;
  color: #f8f4e9;
  font-family: "Pretendard", "Noto Sans KR", "Segoe UI", system-ui, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
}

button {
  font: inherit;
}

#game-container {
  position: relative;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #707977;
  outline: none;
  cursor: pointer;
  touch-action: none;
}

.pause-button {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 4;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(248, 244, 233, 0.28);
  border-radius: 999px;
  background: rgba(32, 39, 38, 0.72);
  color: #f8f4e9;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.pause-button[hidden] {
  display: none;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 5vw, 48px);
  background: linear-gradient(rgba(24, 30, 29, 0.42), rgba(24, 30, 29, 0.84));
  backdrop-filter: blur(5px);
  transition: opacity 300ms ease, visibility 300ms ease;
}

.overlay.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.intro-card,
.game-dialog {
  color: #f8f4e9;
  background: rgba(43, 51, 49, 0.96);
  border: 1px solid rgba(255, 249, 226, 0.28);
  border-radius: 26px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

.intro-card {
  width: min(92vw, 560px);
  padding: clamp(28px, 6vw, 48px);
  text-align: center;
}

.eyebrow,
.dialog-eyebrow {
  color: #dfc66e;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.intro-card h1 {
  margin: 10px 0 14px;
  font-size: clamp(2rem, 7vw, 3.6rem);
  letter-spacing: -0.05em;
}

.intro-card p,
.game-dialog p {
  color: rgba(248, 244, 233, 0.76);
  line-height: 1.7;
}

.intro-card small {
  display: block;
  margin-top: 17px;
  color: rgba(248, 244, 233, 0.58);
  line-height: 1.6;
}

#startButton,
.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 999px;
  padding: 12px 24px;
  font-weight: 800;
  cursor: pointer;
}

#startButton,
.primary-button {
  border: 0;
  color: #26302e;
  background: linear-gradient(135deg, #f2db8c, #72c4b8);
}

.secondary-button {
  border: 1px solid rgba(248, 244, 233, 0.25);
  color: #f8f4e9;
  background: transparent;
}

.game-dialog {
  width: min(90vw, 500px);
  max-height: 88vh;
  padding: clamp(24px, 5vw, 38px);
  text-align: center;
}

.game-dialog::backdrop {
  background: rgba(19, 24, 23, 0.72);
  backdrop-filter: blur(5px);
}

.game-dialog h2 {
  margin: 8px 0 12px;
  font-size: clamp(1.45rem, 5vw, 2rem);
}

.game-dialog .primary-button,
.game-dialog .secondary-button {
  display: block;
  width: 100%;
  margin-top: 12px;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 15px;
  width: 38px;
  height: 38px;
  border: 0;
  color: #f8f4e9;
  background: transparent;
  font-size: 1.8rem;
  cursor: pointer;
}

.clue-preview {
  display: block;
  width: min(100%, 340px);
  max-height: 34vh;
  margin: 0 auto 18px;
  border-radius: 18px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
}

.clue-preview:not([src]),
.clue-preview[src=""] {
  display: none;
}

.guide-box {
  margin: 20px 0;
  padding: 18px;
  border-radius: 18px;
  background: rgba(248, 244, 233, 0.07);
  text-align: left;
}

.guide-box p {
  margin: 8px 0 0;
}

@media (max-height: 560px) {
  .intro-card {
    padding: 22px;
  }

  .intro-card h1 {
    font-size: 2rem;
  }

  .clue-preview {
    max-height: 24vh;
  }
}