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

body {
  overflow: hidden;
  background-color: #050814;
  color: #f1f5f9;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  align-items: stretch;
  pointer-events: none;
}

#hud-body {
  background: rgba(10, 15, 30, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-right: none;
  border-radius: 12px 0 0 12px;
  padding: 14px 18px;
  max-width: 410px;
}

#hud.collapsed #hud-body {
  display: none;
}

#hud-toggle-btn {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0 10px 10px 0;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

#hud.collapsed #hud-toggle-btn {
  border-radius: 10px;
  padding: 8px 12px;
}

#hud-toggle-btn:hover {
  background: #2563eb;
  color: #ffffff;
}

#hud h1 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  background: #2563eb;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 999px;
}

#status {
  font-size: 13px;
  color: #38bdf8;
  margin-bottom: 4px;
}

#coords {
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.help {
  font-size: 12px;
  line-height: 1.45;
  color: #94a3b8;
}

#game-banner {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid #38bdf8;
  border-radius: 14px;
  padding: 14px 18px;
  width: 310px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#game-banner-title {
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#game-banner-prompt {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

#game-banner-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: #4ade80;
}

#game-banner-timer {
  color: #fbbf24;
}

#game-banner-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

#error-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  background: rgba(153, 27, 27, 0.95);
  border: 1px solid #f87171;
  border-radius: 12px;
  padding: 18px 22px;
  max-width: 440px;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.hidden {
  display: none !important;
}

#attribution {
  position: fixed;
  bottom: 12px;
  left: 16px;
  z-index: 10;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(0, 0, 0, 0.55);
  padding: 4px 10px;
  border-radius: 6px;
  max-width: 60vw;
  pointer-events: none;
}

#desktop-minimap {
  position: fixed;
  bottom: 44px;
  left: 16px;
  z-index: 15;
  background: rgba(10, 15, 30, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 10px;
  width: 242px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#minimap-canvas {
  width: 220px;
  height: 220px;
  border-radius: 8px;
  background: #0f172a;
  display: block;
  cursor: pointer;
}

#sv-status-text {
  font-size: 11px;
  color: #cbd5e1;
  text-align: center;
}

.sv-btn {
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sv-btn.disabled,
.sv-btn:disabled {
  background: #334155;
  color: #94a3b8;
  cursor: not-allowed;
}

.sv-btn.ready {
  background: #16a34a;
}
.sv-btn.ready:hover:not(:disabled) {
  background: #22c55e;
}

.sv-btn.exit {
  background: #b91c1c;
}
.sv-btn.exit:hover {
  background: #dc2626;
}

.search-open-btn,
.fly-btn {
  background: #2563eb;
}
.search-open-btn:hover,
.fly-btn:hover:not(:disabled) {
  background: #3b82f6;
}

/* 6-Tab Main Menu Modal */
#search-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(5, 8, 20, 0.74);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-card {
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 16px;
  padding: 18px;
  width: 95%;
  max-width: 780px;
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.menu-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.menu-tab-btn {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.menu-tab-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #93c5fd;
}

.close-x {
  background: #991b1b;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.expanded-map-wrap {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #334155;
}

#expanded-map-canvas {
  width: 100%;
  height: auto;
  display: block;
  cursor: grab;
  background: #0f172a;
}

#expanded-map-canvas:active {
  cursor: grabbing;
}

.map-overlay-btns {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-mini-btn {
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  border: 1px solid #64748b;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.map-mini-btn.wide {
  width: auto;
  padding: 0 10px;
  font-size: 12px;
}

.map-mini-btn:hover {
  background: #2563eb;
}

.round-result,
.game-summary,
.challenge-notice {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid #38bdf8;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #f8fafc;
  margin-top: 8px;
}

.challenge-notice {
  border-color: #fbbf24;
  color: #fde68a;
  margin-top: 0;
  margin-bottom: 8px;
}

#search-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #ffffff;
  font-size: 15px;
  outline: none;
  margin-bottom: 10px;
}

#search-input:focus {
  border-color: #38bdf8;
}

#search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 160px;
}

.search-result-item {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-result-item:hover {
  background: #1d4ed8;
  border-color: #60a5fa;
}

.search-result-item strong {
  font-size: 14px;
  color: #ffffff;
}

.search-result-item span {
  font-size: 12px;
  color: #cbd5e1;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.setting-row strong {
  display: block;
  font-size: 14px;
  color: #ffffff;
}

.setting-row span {
  font-size: 12px;
  color: #94a3b8;
}

.toggle-group {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.toggle-btn {
  background: #0f172a;
  color: #cbd5e1;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.toggle-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #93c5fd;
}

.controls-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.controls-list li {
  background: #1e293b;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #e2e8f0;
}

.controls-list strong {
  color: #38bdf8;
}

#search-selected {
  font-size: 12px;
  color: #4ade80;
  text-align: center;
}

.search-actions {
  display: flex;
  gap: 10px;
}


/* v1.4 — Bookmarks, Featured Places, Personal Bests, 8-Tab Polish */
.menu-tabs {
  flex-wrap: wrap;
  gap: 5px;
}

.menu-tab-btn {
  padding: 6px 10px;
  font-size: 0.78rem;
}

.map-mini-btn.accent {
  background: rgba(217, 119, 6, 0.92);
  border-color: #fcd34d;
}

.map-mini-btn.lucky {
  background: rgba(124, 58, 237, 0.92);
  border-color: #c4b5fd;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-hint {
  font-size: 0.82rem;
  color: #94a3b8;
}

.compact-btn {
  width: auto;
  padding: 7px 14px;
  font-size: 0.78rem;
}

.places-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 350px;
  overflow-y: auto;
  padding-right: 4px;
}

.place-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
}

.place-card-info {
  min-width: 0;
  flex: 1;
}

.place-card-info strong {
  display: block;
  font-size: 0.9rem;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-card-info span {
  display: block;
  font-size: 0.76rem;
  color: #94a3b8;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.place-card-actions button {
  padding: 6px 10px;
  font-size: 0.75rem;
  border-radius: 7px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
}

.place-card-actions .btn-3d { background: #2563eb; }
.place-card-actions .btn-sv { background: #16a34a; }
.place-card-actions .btn-del { background: #991b1b; }

.best-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(74, 222, 128, 0.45);
  color: #86efac;
  font-size: 0.8rem;
  font-weight: 700;
}


/* v1.4.4 — Optional Custom Google Maps API Key */
.custom-key-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 8px;
}

.custom-key-box summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  color: #ffffff;
}

.custom-key-box summary::-webkit-details-marker {
  display: none;
}

.key-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}

.key-pill.custom {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(74, 222, 128, 0.45);
  color: #86efac;
}

.custom-key-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #334155;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.custom-key-desc {
  font-size: 12px;
  line-height: 1.45;
  color: #cbd5e1;
}

.custom-key-warn {
  font-size: 11.5px;
  line-height: 1.45;
  color: #fde68a;
  background: rgba(120, 53, 15, 0.42);
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 8px;
  padding: 8px 10px;
}

.custom-key-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

#custom-key-input {
  flex: 1;
  min-width: 180px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #0f172a;
  color: #ffffff;
  font-size: 12px;
  outline: none;
}

#custom-key-input:focus {
  border-color: #38bdf8;
}

.custom-key-feedback {
  font-size: 12px;
  color: #fde68a;
  margin-top: 2px;
}

/* v1.6.3 — 5 API Key Save Slots */
.key-slots-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.key-slot-btn {
  flex: 1;
  min-width: 68px;
  text-align: center;
}
.key-slot-btn.has-key {
  border-color: #4ade80;
  color: #bbf7d0;
}
.key-slot-btn.active-key {
  background: #16a34a;
  border-color: #86efac;
  color: #ffffff;
}
.key-slot-btn.editing {
  box-shadow: 0 0 0 2px #38bdf8;
}
