* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #111;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; color: #fff;
  font-family: system-ui, sans-serif;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}
#game {
  image-rendering: pixelated; image-rendering: crisp-edges;
  border: 1px solid #333;
  max-width: 100vw; max-height: 100vh;
  display: none;
}
.error {
  color: #f44; background: #222;
  padding: 20px; border-radius: 8px;
  max-width: 600px; white-space: pre-wrap;
  font-family: monospace; line-height: 1.6;
}
#loading-bar {
  width: 320px; height: 8px;
  background: #333; border-radius: 4px;
  overflow: hidden;
}
#loading-fill {
  width: 0%; height: 100%;
  background: #52a234; border-radius: 4px;
  transition: width 0.2s;
}
#status {
  margin-top: 12px; font-size: 14px; color: #aaa;
}
#loading-wrap {
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
}
#pause-overlay {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 10;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 20px;
}
#pause-overlay span {
  font-size: 32px; font-weight: bold;
}
#pause-overlay button {
  padding: 10px 30px; font-size: 18px;
  border: 2px solid #fff; background: transparent;
  color: #fff; cursor: pointer; border-radius: 4px;
}
#pause-overlay button:hover { background: #fff; color: #111; }
#main-menu {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(8,10,14,0.94); z-index: 20;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 28px;
}
#main-menu h1 {
  font-size: 38px; letter-spacing: 5px;
  text-shadow: 3px 3px 0 #000;
}
.menu-screen {
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}
.menu-title { font-size: 22px; font-weight: bold; letter-spacing: 3px; }
.menu-btn {
  padding: 10px 30px; font-size: 18px;
  border: 2px solid #fff; background: transparent;
  color: #fff; cursor: pointer; border-radius: 4px;
  min-width: 220px;
}
.menu-btn:hover { background: #fff; color: #111; }
.menu-btn.small { padding: 6px 18px; font-size: 14px; min-width: 110px; }
.menu-status { color: #aaa; font-size: 14px; padding: 6px; }
#level-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 45vh; overflow-y: auto;
  min-width: 320px; padding: 4px;
}
.level-btn {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border: 1px solid #555;
  background: rgba(255,255,255,0.06); color: #fff;
  cursor: pointer; border-radius: 4px; font-size: 16px;
}
.level-btn:hover { background: rgba(255,255,255,0.18); }
.level-meta { color: #9ab; font-size: 13px; align-self: center; }
.option-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; min-width: 320px;
}
.option-row label { font-size: 16px; }
#opt-touch {
  padding: 6px 10px; font-size: 15px;
  background: #222; color: #fff;
  border: 1px solid #555; border-radius: 4px;
}
#loading-back { display: none; }
#menu-btn {
  position: fixed; top: 12px; right: 12px; z-index: 6;
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 10px; color: #fff;
  font-size: 20px; cursor: pointer;
}
#menu-btn:hover { background: rgba(255,255,255,0.3); }
#touch-controls {
  display: none;
  position: fixed; bottom: 10px; left: 10px; right: 10px;
  z-index: 5; justify-content: space-between; align-items: center;
}
.touch-btn {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 10px; color: #fff;
  font-size: 24px; display: flex;
  align-items: center; justify-content: center;
  cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.touch-btn:active { background: rgba(255,255,255,0.3); }
.touch-btn.jump { width: 72px; font-size: 18px; }
