html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #021019;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

* {
  box-sizing: border-box;
}

#game {
  display: block;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  touch-action: none;
}

/* ---------- Settings overlay ---------- */

#settings-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 10, 18, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10;
  padding: 24px;
}

#settings-overlay.hidden {
  display: none;
}

.settings-panel {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  background: linear-gradient(160deg, rgba(20, 46, 66, 0.97), rgba(10, 26, 40, 0.97));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 24px 24px 20px;
  color: #eaf6ff;
  font-family: "Hiragino Sans", "Yu Gothic", "Segoe UI", sans-serif;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.settings-panel h1 {
  margin: 0 0 18px;
  font-size: 1.4rem;
  letter-spacing: 0.05em;
  text-align: center;
  color: #bdeeff;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.setting-label {
  flex: 0 0 6em;
  font-size: 0.95rem;
  color: #cdeeff;
}

.setting-row input[type="range"] {
  flex: 1;
  height: 28px;
  accent-color: #5fd7e0;
}

.setting-row output {
  flex: 0 0 5.5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: #aee8f5;
}

.setting-row input[type="checkbox"] {
  width: 26px;
  height: 26px;
  accent-color: #5fd7e0;
}

.theme-row {
  align-items: flex-start;
}

.theme-select {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-select button {
  flex: 1 1 calc(50% - 8px);
  min-width: 96px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #eaf6ff;
  font-size: 0.9rem;
  padding: 8px 6px;
}

.theme-select button.active {
  background: rgba(95, 215, 224, 0.35);
  border-color: #5fd7e0;
  box-shadow: 0 0 0 2px rgba(95, 215, 224, 0.4) inset;
}

#settings-close {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, #5fd7e0, #2f9bb8);
  color: #04222b;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.settings-hint {
  margin: 16px 0 0;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(205, 238, 255, 0.65);
}
