:root {
  --bg-color: #2c2c2c;
  --panel-color: #1a1a1a;
  --text-color: #ffffff;
  --accent-color: #7289da;
}

body {
  margin: 0; padding: 0; min-height: 100vh;
  background-color: var(--bg-color);
  font-family: 'DungGeunMo', sans-serif;
  color: var(--text-color);
  box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center;
}

.main-layout {
  display: flex; flex-direction: column; align-items: center;
  gap: 2rem; padding: 2rem; width: 100%; max-width: 800px;
}

.container {
  text-align: center; background-color: var(--panel-color);
  padding: 1.5rem; border: 4px solid #000;
  box-shadow: 8px 8px 0px rgba(0,0,0,0.5);
  width: 100%; max-width: 600px;
}

.title {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 1.5rem; text-shadow: 4px 4px 0px #000; color: #ffcc00;
}

/* 상단 정보 및 동그란 버튼 */
.game-info {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; font-size: clamp(1.2rem, 4vw, 1.5rem); color: #00ff00;
}
.info-box { flex: 1; white-space: nowrap; }

.pause-circle {
  width: 50px; height: 50px; border-radius: 50%;
  background-color: #ffcc00; color: #000; border: 4px solid #000;
  font-family: 'DungGeunMo', sans-serif; font-size: 1.2rem; font-weight: bold;
  cursor: pointer; display: flex; justify-content: center; align-items: center;
  box-shadow: 4px 4px 0px #000; margin: 0 0.5rem; flex-shrink: 0;
}
.pause-circle:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0px #000; }

/* 게임판 (높이 20% 축소) */
.game-area {
  position: relative; width: 100%;
  height: 0; padding-bottom: 53%; /* 66.6%에서 약 20% 축소 */
  min-height: 240px; /* 300px에서 20% 축소 */
  background-color: #222; 
  background-image: 
    linear-gradient(#333 2px, transparent 2px),
    linear-gradient(90deg, #333 2px, transparent 2px);
  background-size: 40px 40px;
  border: 4px solid #000;
  margin-bottom: 1rem; overflow: hidden; cursor: crosshair;
  -webkit-tap-highlight-color: transparent;
}

/* 메뉴 및 버튼 */
.pause-menu {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.95); border: 4px solid #fff;
  padding: 15px; width: 85%; max-width: 250px; z-index: 60;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.pause-title { color: #ffcc00; font-size: 1.5rem; margin: 0; }
.btn-menu {
  background-color: #555; color: white; border: 3px solid #000; padding: 10px;
  width: 100%; font-family: 'DungGeunMo', sans-serif; font-size: 1.2rem;
  cursor: pointer; box-shadow: 3px 3px 0px #000;
}
.btn-menu:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0px #000; }
#resumeBtn { background-color: #2ecc71; }
#restartBtn { background-color: #3498db; }
.btn-menu.quit { background-color: #e74c3c; }

/* 기타 */
.btn {
  position: absolute; top: 55%; left: 50%; transform: translate(-50%, -50%);
  background-color: var(--accent-color); color: white; border: 5px solid #000;
  padding: 10px 20px; font-size: clamp(1.2rem, 5vw, 1.8rem);
  cursor: pointer; box-shadow: 6px 6px 0px #000; z-index: 20;
  white-space: nowrap;
}
#startMsg {
  position: absolute; top: 20%; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: clamp(1.5rem, 6vw, 2.5rem);
  text-shadow: 4px 4px 0px #000;
  animation: blink 1s infinite; z-index: 10; text-align: center; pointer-events: none; width: 90%;
}
.rat {
  position: absolute; width: 50px; height: 36px; 
  background-color: #888; display: none; cursor: pointer; z-index: 2; 
  box-shadow: 4px 0 0 #000, -4px 0 0 #000, 0 -4px 0 #000, 0 4px 0 #000, 20px -6px 0 #000, 26px -10px 0 #000, 32px -6px 0 #000;
  border: 10px solid transparent; margin: -10px; background-clip: padding-box;
}
.rat::before { content: ''; position: absolute; top: -12px; left: 6px; width: 12px; height: 12px; background-color: #888; box-shadow: 20px 0 0 #888, -2px -2px 0 #000, 22px -2px 0 #000; pointer-events: none; }
.rat::after { content: ''; position: absolute; top: 18px; left: -6px; width: 6px; height: 6px; background-color: pink; pointer-events: none; }
.eyes { position: absolute; top: 10px; left: 6px; width: 6px; height: 6px; background-color: #000; box-shadow: 20px 0 0 #000; pointer-events: none; }
.rat.dead { background-color: #555; transform: scaleY(0.8) translateY(6px); border: none; margin: 0; }
.rat.dead .eyes::before, .rat.dead .eyes::after { content: 'X'; color: #000; font-family: monospace; font-weight: bold; font-size: 14px; position: absolute; top: -4px; }
.rat.dead .eyes::before { left: 0px; }
.rat.dead .eyes::after { left: 20px; }

/* 랭킹 등록창 */
.ranking-input {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 30; background-color: rgba(0, 0, 0, 0.95); padding: 15px; border: 4px solid #fff;
  text-align: center; width: 85%; max-width: 300px;
}
.input-msg { color: #ffcc00; font-size: 1.2rem; margin-bottom: 0.8rem; }
#playerName { font-family: 'DungGeunMo', sans-serif; font-size: 1.2rem; padding: 8px; width: 80%; text-align: center; margin-bottom: 0.8rem; }
.btn-small { background-color: #2ecc71; color: white; border: 4px solid #000; padding: 8px 16px; font-family: 'DungGeunMo', sans-serif; font-size: 1rem; cursor: pointer; }

/* 랭킹판 */
.ranking-board {
  background-color: var(--panel-color); 
  padding: 1.5rem; 
  border: 4px solid #000; 
  width: 100%; max-width: 500px;
  margin-top: 1rem;
}
.ranking-title { font-size: 1.5rem; color: #ffcc00; margin-bottom: 1rem; text-align: center; }
.ranking-list li { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 2px dashed #444; font-size: 1rem; }
.rank-name {
  color: #aaa; font-size: 1.1rem; margin-left: 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px;
}

/* 콘텐츠 섹션 */
.content-section {
  width: 100%; max-width: 800px;
  background-color: #eee; color: #333;
  padding: 2rem; border: 4px solid #000;
  margin-top: 2rem; font-family: sans-serif; line-height: 1.6; text-align: left;
}
.content-section h2 { font-family: 'DungGeunMo', sans-serif; margin-bottom: 1rem; color: #000; border-bottom: 2px solid #ccc; padding-bottom: 0.5rem; }
.content-section p { margin-bottom: 1rem; }
.content-section ul { margin-bottom: 1rem; padding-left: 1.5rem; }

/* 댓글 */
.comment-section {
  width: 100%; margin-top: 2rem; background-color: var(--panel-color);
  padding: 1.5rem; border: 4px solid #000; box-shadow: 8px 8px 0px rgba(0,0,0,0.5);
  box-sizing: border-box;
}

/* 푸터 */
footer {
  margin-top: 3rem; padding: 1rem; text-align: center;
  color: #888; font-size: 0.8rem; width: 100%;
}
footer a { color: #aaa; text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* 모바일 전용 */
@media (max-width: 600px) {
  .main-layout { padding: 10px; gap: 1rem; }
  .container { padding: 1rem; }
  .rat { transform: scale(0.8); transform-origin: top left; }
  /* 모바일 높이도 20% 축소 (80% -> 64%) */
  .game-area { padding-bottom: 64%; }
}
