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

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0a0a0a;
  overflow: hidden;
}

#cesium-container {
  width: 100%;
  height: 100%;
}

/* Hide Cesium default UI chrome */
.cesium-viewer-toolbar,
.cesium-viewer-bottom,
.cesium-viewer-fullscreenContainer,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-infoBoxContainer,
.cesium-viewer-selectionIndicatorContainer,
.cesium-viewer-geocoderContainer {
  display: none !important;
}

/* HUD bar */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
  font-size: 14px;
}

#hud-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

#tries-label {
  color: #888;
}

#tries-count {
  font-weight: 700;
  font-size: 18px;
  color: #4ecdc4;
  font-variant-numeric: tabular-nums;
}

#tries-count.low {
  color: #ff6b6b;
}

#hud-center {
  color: #aaa;
  font-size: 13px;
}

#game-status.found {
  color: #4ecdc4;
  font-weight: 600;
}

#region-select {
  background: rgba(255, 255, 255, 0.08);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  margin-left: 8px;
}

#region-select:hover {
  background: rgba(255, 255, 255, 0.14);
}

#region-select option {
  background: #1a1a1a;
  color: #ccc;
}

#hud-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

#new-game-btn, #help-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

#help-btn {
  padding: 6px 10px;
  font-weight: 700;
}

#new-game-btn:hover, #help-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

/* Distance toast */
#distance-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 12px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
}

#distance-toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
}

#distance-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Win/Lose overlay */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  animation: overlayIn 0.3s ease-out;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#overlay.hidden {
  display: none;
}

#overlay-box {
  background: linear-gradient(145deg, #181818, #111);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 36px 44px 32px;
  text-align: center;
  max-width: 440px;
  width: 90%;
  animation: boxIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes boxIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

#overlay-box.win {
  border-color: rgba(78, 205, 196, 0.3);
  box-shadow: 0 0 60px rgba(78, 205, 196, 0.08);
}

#overlay-box.lose {
  border-color: rgba(255, 107, 107, 0.2);
}

#overlay-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
}

#overlay-box.win #overlay-icon {
  background: linear-gradient(135deg, #4ecdc4, #2ab7ad);
  color: #fff;
  box-shadow: 0 0 30px rgba(78, 205, 196, 0.3), 0 0 60px rgba(78, 205, 196, 0.1);
}

#overlay-box.lose #overlay-icon {
  background: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
  border: 2px solid rgba(255, 107, 107, 0.3);
}

#overlay-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #fff;
}

#overlay-box.win #overlay-title {
  color: #4ecdc4;
}

#overlay-box.lose #overlay-title {
  color: #ff6b6b;
}

#overlay-subtitle {
  color: #777;
  font-size: 13px;
  margin-bottom: 20px;
}

/* Stats grid */
#stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.stat-card.highlight .stat-value {
  color: #4ecdc4;
}

.stat-label {
  font-size: 11px;
  color: #666;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#overlay-btn {
  background: #4ecdc4;
  color: #0a0a0a;
  border: none;
  padding: 12px 36px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

#overlay-btn:hover {
  background: #3dbdb5;
  transform: translateY(-1px);
}

#overlay-box.lose #overlay-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #ccc;
}

#overlay-box.lose #overlay-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* Help panel */
#help-panel {
  position: fixed;
  top: 50px;
  right: 12px;
  z-index: 1000;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 14px 18px;
  color: #ccc;
  font-size: 13px;
  min-width: 180px;
}

#help-panel.hidden {
  display: none;
}

.help-title {
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  font-size: 14px;
}

.help-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 6px;
}

.help-row kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 12px;
  color: #ddd;
}

.help-row span {
  color: #888;
}
