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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

#game {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  cursor: none;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.panel {
  background: rgba(15, 15, 25, 0.92);
  border: 1px solid rgba(255, 140, 60, 0.35);
  border-radius: 8px;
  padding: 36px 44px;
  width: min(460px, 90vw);
  text-align: center;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

.title {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 4px;
  color: #FF8C3C;
  margin-bottom: 22px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

#nameInput {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #fff;
  outline: none;
  margin-bottom: 18px;
  font-family: inherit;
}

#nameInput:focus {
  border-color: #FF8C3C;
}

.rangeSelector {
  margin-bottom: 16px;
  text-align: left;
}

.rangeLabel {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 6px;
  text-transform: uppercase;
  text-align: center;
}

.rangeButtons {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.rangeBtn {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.rangeBtn:hover {
  border-color: rgba(255, 140, 60, 0.5);
}

.rangeBtn.selected {
  border-color: #FF8C3C;
  background: rgba(255, 107, 26, 0.18);
  color: #fff;
}

.rangeIcon {
  display: inline-block;
  width: 22px;
  height: 14px;
  position: relative;
}

.rangeIcon[data-icon="hills"]::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 100%, #FF8C3C 0 6px, transparent 7px),
              radial-gradient(ellipse at 70% 100%, #FF8C3C 0 5px, transparent 6px);
  background-repeat: no-repeat;
}

.rangeIcon[data-icon="city"]::before {
  content: '';
  position: absolute;
  left: 2px;
  bottom: 0;
  width: 4px;
  height: 9px;
  background: #FF8C3C;
  box-shadow: 6px -3px 0 0 #FF8C3C, 12px -1px 0 0 #FF8C3C;
}

.instructions {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 22px;
}

.instructions p {
  margin: 2px 0;
}

.modes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modeBtn {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.modeBtn:hover:not(:disabled),
.modeBtn:focus-visible:not(:disabled) {
  border-color: #FF6B1A;
  background: rgba(255, 107, 26, 0.15);
  outline: none;
}

.modeBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.modeIcon {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 56px;
  flex-shrink: 0;
  margin-right: 12px;
  height: 18px;
}

.modeIcon::before {
  content: '';
  display: block;
}

.modeIcon[data-icon="quickshoot"] {
  background-image: radial-gradient(circle at 8px 9px, #FF6B1A 0 7px, transparent 8px);
  background-repeat: no-repeat;
}

.modeIcon[data-icon="tournament"] {
  background-image:
    radial-gradient(circle at 5px 9px, #FF6B1A 0 4px, transparent 5px),
    radial-gradient(circle at 15px 9px, #FF6B1A 0 4px, transparent 5px),
    radial-gradient(circle at 25px 9px, #FF6B1A 0 4px, transparent 5px),
    radial-gradient(circle at 35px 9px, #FF6B1A 0 4px, transparent 5px),
    radial-gradient(circle at 45px 9px, #FF6B1A 0 4px, transparent 5px);
  background-repeat: no-repeat;
}

.modeIcon[data-icon="challenge"] {
  background-image:
    radial-gradient(circle at 8px 9px, #FF6B1A 0 6px, transparent 7px),
    radial-gradient(circle at 24px 9px, #FF6B1A 0 6px, transparent 7px);
  background-repeat: no-repeat;
}

.modeText {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
}

.modeName {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
}

.modeSub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
  font-weight: 400;
}

.modeBtn:hover:not(:disabled) .modeSub {
  color: rgba(255, 200, 160, 0.85);
}

.goRating {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 3px;
  margin: 4px 0 14px 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.goLine {
  font-size: 16px;
  margin: 6px 0;
  color: rgba(255, 255, 255, 0.85);
}

.breakdown {
  margin: 14px 0 4px 0;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.breakdown.hidden {
  display: none;
}

.breakdown .roundCell {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12px;
}

.breakdown .roundCell .roundLabel {
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  letter-spacing: 1px;
}

.breakdown .roundCell .roundValue {
  color: #FF8C3C;
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}

#playAgainBtn,
#mainMenuBtn,
#nextRoundBtn,
#resumeBtn,
#quitBtn {
  margin-top: 12px;
  align-items: center;
  text-align: center;
  justify-content: center;
}

#playAgainBtn .modeName,
#mainMenuBtn .modeName,
#nextRoundBtn .modeName,
#resumeBtn .modeName,
#quitBtn .modeName {
  width: 100%;
  text-align: center;
}

#nextRoundBtn.hidden,
#goBreakdown.hidden {
  display: none;
}

.rotate {
  position: absolute;
  inset: 0;
  background: #000;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  font-size: 18px;
}

.rotate:not(.hidden) {
  display: flex;
}

@media (orientation: portrait) and (max-width: 900px) {
  .rotate.hidden {
    display: none;
  }
}
