* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #16222e 0%, #0c141c 70%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f5f5f5;
}

#game-container {
  position: relative;
  width: min(96vw, 800px);
}

#game {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 2px solid #2c3a48;
  background: #1a2733;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65);
  touch-action: none;
  cursor: crosshair;
}

/* HUD overlay */
#hud {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 7px 16px;
  background: rgba(8, 14, 20, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  font-size: 14px;
  white-space: nowrap;
}

.stat {
  opacity: 0.85;
}

.stat .val {
  font-weight: 700;
  opacity: 1;
  color: #ffffff;
}

.combo-val {
  color: #ffd166 !important;
}

#combo-stat.hidden {
  display: none;
}

#hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  opacity: 0.45;
  pointer-events: none;
  white-space: nowrap;
}

/* Buttons */
button {
  font-family: inherit;
}

#restart {
  padding: 4px 14px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #32cd32;
  color: #0a0f14;
  font-weight: 700;
  font-size: 13px;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}

#restart:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  background: #39e639;
}

#restart:active {
  transform: translateY(0);
  box-shadow: none;
}

#settings-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 14, 20, 0.65);
  color: #dfe8ef;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.15s ease, background 0.15s ease;
}

#settings-btn:hover {
  background: rgba(30, 45, 60, 0.85);
  transform: rotate(30deg);
}

/* Settings panel */
#settings-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 15, 0.6);
  backdrop-filter: blur(3px);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#settings-panel {
  width: min(92%, 420px);
  max-height: 92%;
  overflow-y: auto;
  background: #16222e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel-header h2 {
  font-size: 18px;
}

#settings-close {
  border: none;
  background: none;
  color: #9fb2c1;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

#settings-close:hover {
  color: #ffffff;
}

.setting-group {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.setting-group h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7fd1a0;
  margin-bottom: 8px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: 14px;
}

.row span {
  flex-shrink: 0;
}

.row output {
  font-weight: 700;
  color: #ffd166;
  margin-left: 6px;
}

.row select {
  background: #0e1822;
  color: #f5f5f5;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 13px;
}

.row input[type="range"] {
  flex: 1;
  max-width: 180px;
  accent-color: #32cd32;
}

.row.toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #32cd32;
  cursor: pointer;
}

.panel-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.panel-footer button {
  padding: 7px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}

#settings-done {
  background: #32cd32;
  color: #0a0f14;
}

#settings-done:hover {
  background: #39e639;
}

.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #dfe8ef;
}

.secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.hidden {
  display: none !important;
}
