/* worldquest.css — World Quest Game Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: Arial, sans-serif;
  background: #080c18;
  color: #fff;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ── Globe ── */
#globe-container {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ── Header ── */
.wq-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: rgba(10, 22, 40, 0.92);
  border-bottom: 1px solid rgba(94, 190, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.wq-header .logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #5ebeff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wq-header .logo span { color: #fff; font-size: 11px; opacity: 0.6; }

.header-balance {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  color: #ffd700;
}

.back-btn {
  background: rgba(94, 190, 255, 0.1);
  border: 1px solid rgba(94, 190, 255, 0.3);
  color: #5ebeff;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.back-btn:hover { background: rgba(94, 190, 255, 0.2); }

/* ── Menu / Setup Screens ── */
#main-menu, #setup-screen, #create-screen, #join-screen, #lobby-screen {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.92);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.menu-card, .setup-card {
  background: rgba(10, 22, 40, 0.98);
  border: 2px solid rgba(94, 190, 255, 0.25);
  border-radius: 16px;
  padding: 36px;
  max-width: 460px;
  width: 90%;
  text-align: center;
}

.menu-card h1, .setup-card h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 26px;
  color: #5ebeff;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 22px;
}

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

.menu-btn {
  width: 100%;
  padding: 14px;
  background: rgba(94, 190, 255, 0.08);
  border: 2px solid rgba(94, 190, 255, 0.25);
  border-radius: 10px;
  color: #5ebeff;
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.menu-btn:hover {
  background: rgba(94, 190, 255, 0.18);
  border-color: #5ebeff;
}
.menu-btn.primary {
  background: rgba(94, 190, 255, 0.2);
  border-color: #5ebeff;
  font-size: 16px;
}
.menu-btn.primary:hover {
  background: rgba(94, 190, 255, 0.35);
  box-shadow: 0 0 20px rgba(94, 190, 255, 0.2);
}

.setup-field { text-align: left; margin-bottom: 12px; }
.setup-field label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 4px;
}
.setup-field input, .setup-field select {
  width: 100%;
  padding: 9px 11px;
  background: rgba(94, 190, 255, 0.06);
  border: 1px solid rgba(94, 190, 255, 0.2);
  border-radius: 7px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.setup-field input:focus, .setup-field select:focus { border-color: #5ebeff; }
.setup-field select option { background: #0a1628; }

.setup-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.start-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, rgba(94, 190, 255, 0.18), rgba(94, 190, 255, 0.32));
  border: 2px solid #5ebeff;
  border-radius: 10px;
  color: #5ebeff;
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.start-btn:hover {
  background: linear-gradient(135deg, rgba(94, 190, 255, 0.28), rgba(94, 190, 255, 0.45));
  box-shadow: 0 0 20px rgba(94, 190, 255, 0.25);
}

.back-link {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  cursor: pointer;
  margin-top: 12px;
  padding: 6px;
}
.back-link:hover { color: #5ebeff; }

/* ── Lobby ── */
.lobby-code {
  font-family: 'Orbitron', sans-serif;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 8px;
  color: #5ebeff;
  background: rgba(94, 190, 255, 0.08);
  border: 2px solid rgba(94, 190, 255, 0.3);
  border-radius: 10px;
  padding: 14px 20px;
  margin: 12px 0 4px;
  user-select: all;
  cursor: pointer;
}

.lobby-players {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0;
}

.lobby-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(94, 190, 255, 0.05);
  border: 1px solid rgba(94, 190, 255, 0.12);
  border-radius: 8px;
}

.lobby-player-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
}

.lobby-player-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}

.lobby-player-ready {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

/* ── Pick Location ── */
#pick-location-banner {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 22, 40, 0.95);
  border: 2px solid #5ebeff;
  border-radius: 12px;
  padding: 14px 28px;
  z-index: 300;
  display: none;
  align-items: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  color: #5ebeff;
  animation: pulse-border 2s infinite;
  text-align: center;
  white-space: nowrap;
}
@keyframes pulse-border {
  0%, 100% { border-color: #5ebeff; box-shadow: 0 0 10px rgba(94,190,255,0.2); }
  50% { border-color: #8dd4ff; box-shadow: 0 0 25px rgba(94,190,255,0.4); }
}

/* ── HUD ── */
#hud {
  position: fixed;
  top: 56px; left: 10px;
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 50;
  max-width: 250px;
  pointer-events: auto;
}

.hud-card {
  background: rgba(10, 22, 40, 0.93);
  border: 1px solid rgba(94, 190, 255, 0.18);
  border-radius: 10px;
  padding: 10px 12px;
  backdrop-filter: blur(8px);
}

.hud-card h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  color: #5ebeff;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nation-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}

#nation-color-indicator {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
}

#nation-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 700;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  padding: 5px 7px;
  background: rgba(94, 190, 255, 0.04);
  border-radius: 5px;
  border: 1px solid rgba(94, 190, 255, 0.08);
}

.stat-label {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.4);
}

.stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.stat-item.land .stat-value { color: #2ecc71; }
.stat-item.pop .stat-value { color: #3498db; }
.stat-item.troops .stat-value { color: #e74c3c; }
.stat-item.coins .stat-value { color: #f1c40f; }

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(94, 190, 255, 0.08);
}
.score-label { font-size: 9px; color: rgba(255,255,255,0.4); text-transform: uppercase; }
#score-value { font-family: 'Orbitron', sans-serif; font-size: 13px; color: #5ebeff; }

/* ── Panel Tabs ── */
.panel-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 3px;
}

.panel-tab {
  padding: 7px 2px;
  border: 1px solid rgba(94, 190, 255, 0.2);
  background: rgba(10, 22, 40, 0.7);
  color: rgba(255,255,255,0.55);
  font-size: 10px;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.panel-tab:hover { background: rgba(94, 190, 255, 0.1); color: #fff; }
.panel-tab.active {
  background: rgba(94, 190, 255, 0.2);
  border-color: #5ebeff;
  color: #5ebeff;
  box-shadow: 0 0 8px rgba(94, 190, 255, 0.15);
}

.panel-hint {
  font-size: 9px;
  color: rgba(255,255,255,0.3);
  text-align: center;
  margin-top: 4px;
}

/* ── Control Panels ── */
.control-panel {
  display: none;
}

.slider-group { margin-top: 4px; }
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  margin-bottom: 3px;
}
.slider-header .label { color: rgba(255,255,255,0.55); }
.slider-header .value { font-family: 'Orbitron', sans-serif; font-weight: 600; color: #5ebeff; font-size: 12px; }
.slider-sub { font-size: 9px; color: rgba(255,255,255,0.35); margin-top: 2px; }

.dim { color: rgba(255,255,255,0.35) !important; }

input[type="range"] {
  width: 100%; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: rgba(94, 190, 255, 0.18);
  border-radius: 2px; outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: #5ebeff; border: 2px solid #0a1628; cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #5ebeff; border: 2px solid #0a1628; cursor: pointer;
}

.panel-note {
  font-size: 9px;
  color: rgba(255,255,255,0.25);
  margin-top: 6px;
  line-height: 1.4;
}

/* Military panel */
.mil-stats { display: flex; flex-direction: column; gap: 3px; }
.mil-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 3px 0;
}
.mil-row span:first-child { color: rgba(255,255,255,0.5); }
.mil-row span:last-child { font-family: 'Orbitron', sans-serif; font-weight: 600; color: #e74c3c; font-size: 12px; }
.mil-row.dim span:last-child { color: rgba(255,255,255,0.35); font-size: 10px; }

/* Building panel */
.build-select {
  width: 100%;
  padding: 8px 10px;
  background: rgba(10, 22, 40, 0.9);
  border: 1px solid rgba(94, 190, 255, 0.25);
  color: #fff;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}
.build-select option { background: #0a1628; }

.upgrade-info {
  margin-top: 6px;
  font-size: 9px;
  color: rgba(255,255,255,0.25);
  line-height: 1.6;
}

/* ── Right Panels ── */
.right-panels {
  position: fixed;
  top: 56px; right: 10px;
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 50;
  max-width: 280px;
  pointer-events: auto;
}

.panel-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.panel-toggle::after { content: '▼'; font-size: 8px; opacity: 0.4; transition: transform 0.2s; }
.collapsed .panel-toggle::after { transform: rotate(-90deg); }
.panel-body { margin-top: 6px; overflow: hidden; max-height: 300px; transition: max-height 0.3s; }
.collapsed .panel-body { max-height: 0; margin-top: 0; }

.lb-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.lb-table th { font-size: 8px; text-transform: uppercase; color: rgba(255,255,255,0.35); padding: 3px 5px; text-align: left; border-bottom: 1px solid rgba(94,190,255,0.08); }
.lb-table td { padding: 3px 5px; border-bottom: 1px solid rgba(94,190,255,0.04); }
.lb-table .player-row { background: rgba(94,190,255,0.06); }
.lb-table .player-row td { color: #5ebeff; font-weight: 600; }
.lb-color { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

.no-alliances { font-size: 10px; color: rgba(255,255,255,0.25); text-align: center; padding: 8px; }

/* ── Tooltip ── */
#tooltip {
  position: fixed;
  bottom: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(10, 22, 40, 0.95);
  border: 1px solid rgba(94, 190, 255, 0.25);
  border-radius: 8px;
  padding: 7px 12px;
  z-index: 60;
  display: none;
  font-size: 11px;
  min-width: 140px;
  backdrop-filter: blur(8px);
}

/* ── Notifications ── */
#notification-area {
  position: fixed;
  top: 56px; left: 50%; transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.wq-notification {
  background: rgba(10, 22, 40, 0.95);
  border: 1px solid rgba(94, 190, 255, 0.35);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 12px;
  animation: notifSlide 0.3s ease-out;
  backdrop-filter: blur(8px);
  text-align: center;
  max-width: 420px;
}
.wq-notification.fade-out { opacity: 0; transform: translateY(-10px); transition: all 0.5s; }
@keyframes notifSlide { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

/* ── Minimap ── */
.minimap-container { position: fixed; bottom: 10px; left: 10px; z-index: 50; }
#minimap-canvas { border: 1px solid rgba(94,190,255,0.25); border-radius: 6px; background: #0a1628; }

/* ── Game Over ── */
#game-over-screen {
  position: fixed; inset: 0;
  background: rgba(5,10,20,0.95);
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.game-over-card {
  background: rgba(10,22,40,0.98);
  border: 2px solid rgba(94,190,255,0.35);
  border-radius: 16px;
  padding: 36px;
  max-width: 380px;
  width: 90%;
  text-align: center;
}
#game-over-title { font-family: 'Orbitron', sans-serif; font-size: 22px; margin-bottom: 18px; }
.go-stat { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(94,190,255,0.08); font-size: 13px; }
.go-stat span:first-child { color: rgba(255,255,255,0.5); }
.go-stat span:last-child { font-family: 'Orbitron', sans-serif; font-weight: 600; color: #5ebeff; }

#play-again-btn {
  margin-top: 18px;
  padding: 11px 28px;
  background: linear-gradient(135deg, rgba(94,190,255,0.18), rgba(94,190,255,0.32));
  border: 2px solid #5ebeff;
  border-radius: 8px;
  color: #5ebeff;
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
#play-again-btn:hover { background: linear-gradient(135deg, rgba(94,190,255,0.28), rgba(94,190,255,0.45)); }

/* ── Responsive ── */
@media (max-width: 768px) {
  #hud { max-width: 195px; left: 6px; }
  .right-panels { max-width: 200px; right: 6px; }
  .setup-card, .menu-card { padding: 22px; }
  .menu-card h1, .setup-card h1 { font-size: 20px; }
  .stat-value { font-size: 12px; }
  #minimap-canvas { width: 120px; height: 60px; }
  .panel-tab { font-size: 9px; padding: 6px 1px; }
  .lobby-code { font-size: 28px; letter-spacing: 6px; }
}

@media (max-width: 480px) {
  #hud { max-width: 155px; top: 52px; left: 4px; }
  .hud-card { padding: 7px 9px; }
  .right-panels { max-width: 165px; top: 52px; right: 4px; }
  .wq-header { height: 42px; padding: 0 8px; }
  .wq-header .logo { font-size: 12px; }
  .minimap-container { bottom: 6px; left: 4px; }
  #minimap-canvas { width: 90px; height: 45px; }
  .panel-tab { font-size: 8px; }
}
