:root {
  --night: #201a38;
  --ink: #2b1f24;
  --paper: #faf5e6;
  --gold: #ffd647;
  --orange: #ff8c33;
  --purple: #8c59c7;
  --font: "Apple SD Gothic Neo", "Hiragino Sans", "PingFang SC", "Noto Sans KR", "Noto Sans JP", "Noto Sans SC", "Malgun Gothic", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #120e22;
  color: #fff;
  font-family: var(--font);
  font-weight: 800;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  position: relative;
  background: var(--night);
  overflow: hidden;
  touch-action: manipulation;
}

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

.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.screen[hidden] { display: none; }
.dim-35 { background: rgba(0, 0, 0, 0.35); }
.dim-45 { background: rgba(0, 0, 0, 0.45); justify-content: center; }

/* 타이틀 */
#title { justify-content: space-between; padding: 70px 0 50px; }
.title-top, .title-bottom { display: flex; flex-direction: column; align-items: center; width: 100%; }
.faces { display: flex; gap: 6px; }
.faces img { width: 56px; height: 56px; object-fit: contain; }
.bob { animation: bob 1.4s ease-in-out infinite; }
.bob.late { animation-delay: -0.7s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

h1 {
  margin: 14px 20px 0;
  font-size: 52px;
  line-height: 1.15;
  color: var(--orange);
  text-shadow: 3px 3px 0 var(--ink);
  white-space: nowrap;
  text-align: center;
}
.sub { margin: 14px 0 0; font-size: 17px; text-shadow: 2px 2px 0 var(--ink); text-align: center; padding: 0 16px; }
.best { margin: 0 0 14px; font-size: 15px; color: var(--gold); }
.title-bottom .btn { width: calc(100% - 80px); }

.btn {
  display: block;
  min-height: 48px;
  padding: 8px 10px 14px;
  border: 0;
  border-radius: 0;
  color: #fff;
  font: inherit;
  font-size: 17px;
  cursor: pointer;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.25);
}
.btn:active { transform: translateY(2px); }
.btn.orange { background: var(--orange); }
.btn.purple { background: var(--purple); }

.link {
  margin-top: 18px;
  background: none;
  border: 0;
  color: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.links { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; }
.links a { color: rgba(255, 255, 255, 0.55); text-decoration: none; }

/* 게임 오버 */
.panel {
  width: calc(100% - 40px);
  background: var(--paper);
  border: 4px solid var(--ink);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  text-align: center;
}
.panel .house { width: 96px; height: 96px; object-fit: contain; }
.panel h2 { margin: 0; font-size: 21px; color: var(--purple); }
.panel p { margin: 0; font-size: 17px; }
.panel .btn { width: 100%; }
.rank-link { font-size: 14px; color: #777; text-decoration: none; }

/* 소리 버튼: 게임 중엔 해골 왼쪽(main.js placeSound), 타이틀에선 오른쪽 위 */
.sound {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 56px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 5;
}
.sound img { width: 44px; height: 32px; display: block; margin: 0 auto; }
.sound:active img { transform: translateY(2px); }

/* 튜토리얼 중 "설명 건너뛰기" */
.skip {
  position: absolute;
  left: 12px;
  padding: 6px 10px;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  z-index: 5;
}

/* PC 양옆 광고 (300×600). 게임 버튼과 떨어뜨려 둔다 */
.rail { display: none; }
@media (min-width: 1180px) and (min-height: 640px) {
  body { gap: 40px; }
  .rail {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 300px;
    width: 300px;
    height: 600px;
  }
  .rail .adsbygoogle { display: block; width: 300px; height: 600px; }
}
.promo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 300px;
  padding: 36px 20px;
  border: 4px solid var(--ink);
  background: var(--night);
  color: var(--gold);
  text-align: center;
  text-decoration: none;
  font-size: 18px;
  line-height: 1.4;
}
.promo img { width: 96px; height: 96px; object-fit: contain; }
.promo:hover { background: #2c2450; }
