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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a12;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
}

#game, #hud {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#game {
  z-index: 1;
}

#hud {
  z-index: 2;
  cursor: crosshair;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(20, 0, 0, 0.75);
  color: #f2e6e6;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlayTitle {
  font-size: 64px;
  font-weight: bold;
  letter-spacing: 4px;
  text-shadow: 0 0 20px #700;
}

.overlaySub {
  margin-top: 10px;
  font-size: 20px;
  opacity: 0.8;
}

.pauseOverlay {
  background: rgba(10, 10, 14, 0.75);
  color: #eae0c8;
}

.pauseOverlay .overlayTitle {
  text-shadow: 0 0 20px rgba(0,0,0,0.7);
}

.hint {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(0,0,0,0.55);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  white-space: nowrap;
}

.hint.show {
  opacity: 1;
}

.startScreen {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(10, 14, 8, 0.82);
  color: #eae0c8;
  text-align: center;
  transition: opacity 0.4s ease;
}

.startScreen.hidden {
  opacity: 0;
  pointer-events: none;
}

.startTitle {
  font-size: 56px;
  letter-spacing: 6px;
  text-shadow: 0 0 20px rgba(0,0,0,0.7);
  margin-bottom: 2px;
}

.startTagline {
  color: #c9c0a8;
  font-size: 15px;
  margin-bottom: 18px;
}

.metaRow {
  display: flex;
  gap: 24px;
  font-size: 16px;
  margin-bottom: 22px;
}

#ssCoins {
  color: #e8c94a;
  font-weight: bold;
}

#ssAch {
  color: #a8c8a0;
}

.nameLabel {
  font-size: 12px;
  color: #a89878;
  max-width: 320px;
}

.nameInput {
  margin-top: 6px;
  margin-bottom: 20px;
  width: 260px;
  padding: 9px 12px;
  font-size: 15px;
  font-family: inherit;
  background: rgba(20, 16, 12, 0.85);
  border: 1.5px solid #8a6a3a;
  border-radius: 4px;
  color: #f2ead6;
  text-align: center;
}

.nameInput:focus {
  outline: none;
  border-color: #e8c94a;
}

.diffLabel {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #c9c0a8;
  margin-bottom: 8px;
}

.diffRow {
  display: flex;
  gap: 14px;
  margin-bottom: 26px;
}

.diffBtn {
  width: 100px;
  height: 42px;
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #c9c0a8;
  background: rgba(20, 16, 12, 0.8);
  border: 1.5px solid #8a6a3a;
  border-radius: 4px;
  cursor: pointer;
}

.diffBtn:hover {
  border-color: #e8c94a;
}

.diffBtn.selected {
  background: rgba(138, 106, 58, 0.85);
  border: 2.5px solid #e8c94a;
  color: #fff;
}

.startBtn {
  width: 220px;
  height: 54px;
  font-family: inherit;
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 2px;
  color: #fff;
  background: rgba(74, 138, 58, 0.9);
  border: 2px solid #e8c94a;
  border-radius: 6px;
  cursor: pointer;
}

.startBtn:hover {
  background: rgba(94, 158, 74, 0.95);
}

.startControlsHint {
  margin-top: 22px;
  font-size: 12px;
  color: #8a8a70;
}

.rulebookCallout {
  position: absolute;
  top: 22px;
  right: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.rulebookBtn {
  width: 72px;
  height: 72px;
  font-size: 34px;
  background: rgba(20, 16, 12, 0.8);
  border: 2px solid #8a6a3a;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}

.rulebookBtn:hover {
  border-color: #e8c94a;
  background: rgba(138, 106, 58, 0.5);
}

.rulebookCalloutText {
  margin: 0;
  font-size: 12px;
  font-weight: bold;
  line-height: 1.35;
  text-align: center;
  color: #e8c94a;
  text-shadow: 0 0 6px rgba(0,0,0,0.8);
}

.customizeCallout {
  position: absolute;
  top: 22px;
  left: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.customizeCoins {
  color: #e8c94a;
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 16px;
}

.customizeSlot {
  margin-bottom: 18px;
}

.customizeSlotLabel {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.5px;
  color: #a8c8a0;
  margin-bottom: 8px;
  text-align: left;
}

.customizeSwatchRow {
  display: flex;
  gap: 10px;
}

.swatchBtn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2.5px solid #6a5a3a;
  cursor: pointer;
  padding: 0;
}

.swatchBtn:hover {
  border-color: #e8c94a;
}

.swatchBtn.selected {
  border-color: #e8c94a;
  box-shadow: 0 0 0 2px rgba(232, 201, 74, 0.5);
}

.swatchBtn.locked::after {
  content: '\1F512';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 50%;
}

.swatchCost {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: #e8c94a;
  white-space: nowrap;
}

.rulebookModal {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  transition: opacity 0.25s ease;
}

.rulebookModal.hidden {
  opacity: 0;
  pointer-events: none;
}

.rulebookCard {
  position: relative;
  width: min(560px, 88vw);
  max-height: 78vh;
  overflow-y: auto;
  background: rgba(20, 16, 12, 0.97);
  border: 2px solid #8a6a3a;
  border-radius: 8px;
  padding: 28px 30px;
  color: #eae0c8;
}

.rulebookCard h2 {
  margin: 0 0 14px;
  color: #e8c94a;
  letter-spacing: 1px;
}

.rulebookCard h3 {
  margin: 16px 0 4px;
  color: #a8c8a0;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.rulebookCard p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #d8cfb8;
}

.rulebookCloseBtn {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 30px;
  height: 30px;
  font-size: 18px;
  background: transparent;
  border: none;
  color: #c9c0a8;
  cursor: pointer;
}

.rulebookCloseBtn:hover {
  color: #e8c94a;
}
