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

:root {
  --bg-dark: #0a1220;
  --bg-medium: #0e1728;
  --bg-light: #152238;
  --accent: #2ecc71;
  --accent-hover: #27ae60;
  --hint-blue: #5ba4cf;
  --text: #eee;
  --text-dim: #aaa;
  --green: #2ecc71;
  --yellow: #f39c12;
  --orange: #e67e22;
  --red: #e74c3c;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text);
}

.btn-secondary:hover {
  background: #1a4a8a;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  background: var(--bg-light);
  color: var(--text);
  border: none;
  cursor: pointer;
}

.btn-small:hover {
  background: #1a4a8a;
}

/* START SCREEN */
#start-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  background-color: #080c14;
  position: relative;
  overflow: hidden;
}

#start-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.start-header {
  text-align: center;
  padding: 30px 20px 10px;
  position: relative;
  z-index: 1;
}

.start-header h1 {
  font-size: 2.8rem;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 3px;
  font-weight: 300;
  text-shadow: 0 0 40px rgba(255, 200, 80, 0.15);
}

.subtitle {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.95rem;
  font-weight: 300;
  letter-spacing: 1px;
}

.start-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 20px 24px;
  position: relative;
  z-index: 1;
  margin-top: auto;
  background: linear-gradient(to top, rgba(8, 12, 20, 0.85) 0%, transparent 100%);
}

.start-footer label {
  font-size: 1.4rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 300;
}

#start-btn {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-weight: 400;
  letter-spacing: 1px;
}

#start-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.city-count-stepper {
  display: flex;
  align-items: center;
  gap: 0;
}

.stepper-btn {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  line-height: 1;
  padding-top: 2px;
}

.stepper-btn:hover {
  background: var(--bg-light);
}

.stepper-btn.stepper-minus {
  border-radius: 8px 0 0 8px;
  border-right: none;
}

.stepper-btn.stepper-plus {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.stepper-value {
  width: 50px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.85);
  user-select: none;
  box-sizing: border-box;
}

/* GAME SCREEN */
#game-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-medium);
  border-bottom: 1px solid var(--bg-light);
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  gap: 8px;
}

#round-info {
  color: var(--text-dim);
}

#points-display {
  color: var(--green);
}

#total-points-display {
  color: var(--text-dim);
  font-size: 12px;
}

#timer-display {
  color: var(--yellow);
}

/* MAP */
#map-container {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

#map-tabs {
  display: flex;
  flex-shrink: 0;
  z-index: 500;
}

.map-tab {
  flex: 1;
  padding: 6px 0;
  border: none;
  background: var(--bg-dark);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.map-tab:hover {
  color: var(--text);
}

.map-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.map-view {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.map-view.hidden {
  display: none !important;
}

/* Hide Leaflet attribution (BSD-2-Clause license does not require on-map credit) */
.leaflet-control-attribution {
  display: none !important;
}

/* GUESS AREA */
#guess-area {
  padding: 10px 16px;
  background: var(--bg-medium);
  border-top: 1px solid var(--bg-light);
  flex-shrink: 0;
  max-height: 200px;
  overflow-y: auto;
}

#guess-row {
  display: flex;
  gap: 8px;
}

#guess-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 16px;
  border-radius: 8px;
  border: 2px solid var(--bg-light);
  background: var(--bg-dark);
  color: var(--text);
  outline: none;
}

#guess-input:focus {
  border-color: var(--accent);
}

#guess-counter {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

#feedback-list {
  margin-top: 4px;
}

.guess-entry {
  font-size: 13px;
  color: var(--orange);
  padding: 2px 0;
}

#feedback {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.4;
}

#feedback.wrong {
  color: var(--orange);
}

#feedback.correct {
  color: var(--green);
}

#feedback.info {
  color: var(--text-dim);
}

#suggestions {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-dim);
}

.suggestion-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  margin-right: 8px;
}

.suggestion-link:hover {
  color: var(--accent-hover);
}

/* AUTOCOMPLETE DROPDOWN */
#autocomplete-dropdown {
  position: fixed;
  background: var(--bg-medium);
  border: 1px solid var(--bg-light);
  border-radius: 8px;
  z-index: 2000;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  min-width: 220px;
}

.autocomplete-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--bg-light);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: var(--bg-light);
}

.autocomplete-city {
  font-weight: 600;
}

.autocomplete-country {
  color: var(--text-dim);
  font-size: 12px;
  margin-left: 6px;
}

/* HINTS */
#hints-section {
  background: rgba(91, 164, 207, 0.1);
  border-top: 1px solid rgba(91, 164, 207, 0.2);
  flex-shrink: 0;
}

#clues-toggle {
  width: 100%;
  text-align: center;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--hint-blue);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, color 0.2s;
}

#clues-toggle:hover {
  background: rgba(91, 164, 207, 0.18);
  color: #7ec0e0;
}

#hints-section.collapsed #hints-collapsible {
  display: none;
}

#hints-section.collapsed #clues-toggle {
  border-bottom: none;
}

#hints-panel-label {
  display: none;
}

#hints-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 16px 10px;
}

.hint-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  color: white;
  transition: opacity 0.2s, transform 0.1s;
  white-space: nowrap;
}

.hint-btn:active {
  transform: scale(0.97);
}

.hint-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hint-btn .cost {
  font-size: 10px;
  opacity: 0.8;
}

.hint-btn {
  background: var(--hint-blue);
}

.hint-btn:hover:not(:disabled) {
  background: #4a93be;
}

#hints-display {
  padding: 0 16px;
  font-size: 13px;
}

#hints-display:empty {
  padding: 0;
}

.hint-revealed {
  display: inline-block;
  background: var(--bg-dark);
  padding: 4px 10px;
  border-radius: 4px;
  margin: 0 6px 6px 0;
  font-size: 12px;
  color: var(--text);
}

/* WORLD MAP LABELS */
.world-country-label {
  position: absolute;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.75);
  font-size: 9px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-shadow: 0 0 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.7);
  pointer-events: none;
}

.world-city-label {
  position: absolute;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.75);
  font-size: 9px;
  white-space: nowrap;
  text-shadow: 0 0 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.7);
  pointer-events: auto;
  cursor: pointer;
}

.world-city-label:hover {
  color: rgba(255, 255, 255, 1);
}

/* ROUND RESULT OVERLAY */
#round-result {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.round-result-content {
  background: var(--bg-medium);
  padding: 32px;
  border-radius: 16px;
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.round-result-content h2 {
  margin-bottom: 12px;
  font-size: 1.5rem;
}

.round-result-content p {
  color: var(--text-dim);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* SUMMARY SCREEN */
#summary-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  overflow-y: auto;
}

.summary-content {
  padding: 30px;
  text-align: center;
  width: 100%;
  max-width: 600px;
}

.summary-content h1 {
  color: var(--accent);
  margin-bottom: 20px;
}

#results-list {
  text-align: left;
  margin-bottom: 24px;
}

.result-item {
  background: var(--bg-medium);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.result-item .city-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.result-item .result-detail {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

.result-item.correct .city-name {
  color: var(--green);
}

.result-item.incorrect .city-name {
  color: var(--red);
}

#final-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 24px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.summary-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* HAMBURGER MENU */
#hamburger-btn {
  position: relative;
  font-size: 18px;
  padding: 4px 8px;
  line-height: 1;
}

#hamburger-menu {
  position: fixed;
  background: var(--bg-medium);
  border: 1px solid var(--bg-light);
  border-radius: 8px;
  z-index: 3000;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.hamburger-item {
  display: block;
  width: 100%;
  padding: 10px 20px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.hamburger-item:hover {
  background: var(--bg-light);
}

/* QUESTION MODAL */
#question-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
}

#question-modal.hidden {
  display: none;
}

.question-content {
  background: var(--bg-medium);
  padding: 24px;
  border-radius: 16px;
  max-width: 400px;
  width: 90%;
}

.question-content h3 {
  margin-bottom: 14px;
  font-size: 1rem;
  color: var(--text);
  font-weight: 500;
}

.question-btn {
  display: block;
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 6px;
  border: 1px solid var(--bg-light);
  border-radius: 8px;
  background: var(--bg-dark);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.question-btn:hover {
  background: var(--bg-light);
}

.question-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#question-skip-btn {
  margin-top: 10px;
  width: 100%;
}

/* TOAST */
#toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-light);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 2000;
  animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  85% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* RESPONSIVE */
@media (max-width: 600px) {
  .start-header h1 {
    font-size: 2rem;
  }

  #hud {
    font-size: 12px;
    padding: 6px 10px;
  }

  .btn-small {
    padding: 4px 8px;
    font-size: 11px;
  }

  #guess-area {
    padding: 8px 10px;
  }

  #guess-input {
    font-size: 14px;
    padding: 8px 10px;
  }

  .btn {
    padding: 8px 14px;
    font-size: 14px;
  }

  .hint-btn {
    font-size: 11px;
    padding: 5px 8px;
  }

  #final-stats {
    gap: 16px;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .round-result-content {
    padding: 24px;
  }
}

@media (min-width: 900px) {
  #game-screen {
    flex-direction: column;
  }

  #hints-panel.open {
    justify-content: center;
  }

  .hint-btn {
    font-size: 13px;
    padding: 8px 14px;
  }
}
