* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #ffecd2 0%, #fcb69f 100%);
  font-family: Arial, sans-serif;
  touch-action: none;
  height: 100dvh;
}
#game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: rgba(255,255,255,0.6);
}
#game-header h1 { font-size: 18px; color: #776e65; }
#score-display { font-size: 18px; color: #f59563; font-weight: bold; }
#game-canvas {
  display: block;
  margin: 0 auto;
  background: rgba(255,255,255,0.3);
  border-left: 3px solid #e0c8a8;
  border-right: 3px solid #e0c8a8;
}
#bottom-bar {
  height: 30px;
  max-width: 420px;
  margin: 0 auto;
  background: #e0c8a8;
  border-radius: 0 0 8px 8px;
}
#next-preview {
  position: absolute;
  top: 52px;
  right: 16px;
  width: 50px; height: 50px;
  background: rgba(255,255,255,0.5);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#next-preview img {
  max-width: 40px; max-height: 40px;
  border-radius: 50%;
}
#game-over-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  justify-content: center;
  align-items: center;
}
#game-over-box {
  background: white;
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
#game-over-box h2 { color: #776e65; margin-bottom: 10px; }
#game-over-box p { color: #f59563; font-size: 22px; margin-bottom: 20px; }
#game-over-box button {
  padding: 10px 30px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  background: #f59563;
  color: white;
  cursor: pointer;
}
#level-bar {
  display: flex;
  justify-content: center;
  gap: 3px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.4);
  flex-wrap: wrap;
}
#level-bar img {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid #e0c8a8;
  opacity: 0.5;
  transition: opacity 0.3s;
}
#level-bar img.unlocked { opacity: 1; border-color: #f59563; }
#rank-btn {
  width: 36px; height: 36px;
  border: none;
  border-radius: 8px;
  background: #f59563;
  color: white;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
#home-btn {
  width: 36px; height: 36px;
  border: none;
  border-radius: 8px;
  background: #8f7a66;
  color: white;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
#more-games-btn {
  width: 36px; height: 36px;
  border: none;
  border-radius: 8px;
  background: #d4894a;
  color: white;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
#submit-area {
  margin-bottom: 15px;
}
#submit-area input {
  padding: 8px 12px;
  font-size: 14px;
  border: 2px solid #e0c8a8;
  border-radius: 6px;
  width: 140px;
  margin-right: 6px;
}
#submit-area button {
  padding: 8px 16px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  background: #8cc152;
  color: white;
  cursor: pointer;
}
#leaderboard-panel {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
}
#leaderboard-box {
  background: white;
  border-radius: 16px;
  padding: 20px 30px;
  max-height: 70vh;
  min-width: 260px;
  overflow-y: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  text-align: center;
  display: flex;
  flex-direction: column;
}
#leaderboard-box h3 { color: #776e65; margin-bottom: 12px; }
#leaderboard-list {
  list-style: none;
  padding: 0;
  text-align: left;
  margin-bottom: 15px;
  max-height: 300px;
  overflow-y: auto;
  flex: 1;
}
#leaderboard-list li {
  padding: 6px 0;
  border-bottom: 1px solid #f0e6d6;
  color: #555;
  font-size: 14px;
  word-break: break-word;
}
#leaderboard-list li:nth-child(-n+3) {
  color: #f59563;
  font-weight: bold;
}
#leaderboard-list li a:hover {
  text-decoration: underline;
}
#leaderboard-box button {
  padding: 8px 24px;
  font-size: 14px;
  border: none;
  border-radius: 8px;
  background: #f59563;
  color: white;
  cursor: pointer;
  margin-top: 6px;
  flex-shrink: 0;
}
#mode-select-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.92);
  z-index: 300;
  display: flex;
  justify-content: center;
  align-items: center;
}
#mode-select-box {
  background: white;
  border-radius: 16px;
  padding: 30px 24px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  min-width: 260px;
}
#mode-select-box h2 {
  color: #776e65;
  margin-bottom: 4px;
  font-size: 24px;
}
.mode-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: white;
  background: #8f7a66;
  transition: transform 0.1s;
}
.mode-btn:active { transform: scale(0.97); }
.mode-btn span {
  display: block;
  font-size: 12px;
  font-weight: normal;
  opacity: 0.85;
  margin-top: 2px;
}
.mode-frenzy { background: #e74c3c; }
.mode-bounce { background: #3498db; }
#dash-line {
  width: 100%;
  height: 2px;
  position: relative;
}
#dash-line::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  border-top: 2px dashed rgba(255,0,0,0.4);
}
