* {
  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%, #141021 0%, #090710 70%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f0ead9;
}

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

#game {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 2px solid #372c4e;
  background: #0b0f16;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  touch-action: none;
  cursor: pointer;
}

/* HUD overlay */
#hud {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 7px 16px;
  background: rgba(10, 7, 18, 0.65);
  border: 1px solid rgba(255, 165, 60, 0.15);
  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: #ffb347;
}

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

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

#restart {
  padding: 4px 14px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #ff8c1a;
  color: #1a0f05;
  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: #ffa03d;
}

#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, 165, 60, 0.2);
  background: rgba(10, 7, 18, 0.65);
  color: #e8dcc8;
  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(45, 32, 65, 0.85);
  transform: rotate(30deg);
}

/* Settings panel */
#settings-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 12, 0.65);
  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: #17121f;
  border: 1px solid rgba(255, 165, 60, 0.18);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.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: #a898c0;
  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: #ffb347;
  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: #ffb347;
  margin-left: 6px;
}

.row select {
  background: #0e0a16;
  color: #f0ead9;
  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: #ff8c1a;
}

.row.toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #ff8c1a;
  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: #ff8c1a;
  color: #1a0f05;
}

#settings-done:hover {
  background: #ffa03d;
}

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

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

.hidden {
  display: none !important;
}
