/* ============================================================
   Mundo Tierra Firme — Estilos de interfaz
   El espacio domina; la marca acompaña (clay #F58634, Zilla Slab).
   ============================================================ */

:root {
  --mtf-bg: #06070c;
  --mtf-panel: rgba(16, 18, 26, 0.82);
  --mtf-panel-solid: #12141c;
  --mtf-line: rgba(255, 255, 255, 0.1);
  --mtf-text: #ece7de;
  --mtf-text-dim: #a9a49a;
  --mtf-clay: #f58634;
  --mtf-clay-deep: #dc6f22;
  --mtf-ochre: #c99a3f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--mtf-bg);
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  color: var(--mtf-text);
}

#globe-container { position: fixed; inset: 0; }
#globe-container canvas { display: block; }

/* ---------- carga ---------- */
#loader {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--mtf-bg);
}
#loader.hidden { opacity: 0; pointer-events: none; visibility: hidden; }
#loader img { width: 130px; opacity: 0.95; }
#loader .dot-pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--mtf-clay); animation: mtfPulse 1.1s ease-in-out infinite; }
#loader p { font-size: 14px; color: var(--mtf-text-dim); margin: 0; }
@keyframes mtfPulse { 0%, 100% { transform: scale(0.7); opacity: 0.5; } 50% { transform: scale(1.25); opacity: 1; } }

/* ---------- barra superior ---------- */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  background: linear-gradient(to bottom, rgba(6, 7, 12, 0.85), rgba(6, 7, 12, 0));
}
.brand { display: flex; align-items: center; gap: 48px; }
.brand > div { text-align: center; }
.brand img { height: 44px; }
.brand .title {
  font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 27px; line-height: 1.1;
  color: var(--mtf-text); letter-spacing: 0.012em;
}
.brand .subtitle { font-size: 11px; color: var(--mtf-text-dim); letter-spacing: 0.08em; text-transform: uppercase; }

.spacer { flex: 1; }

.seg {
  display: flex; gap: 2px; padding: 3px;
  background: var(--mtf-panel); border: 1px solid var(--mtf-line); border-radius: 10px;
  backdrop-filter: blur(10px);
}
.seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; min-height: 34px; padding: 0 10px;
  background: transparent; color: var(--mtf-text-dim);
  border: 0; border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600;
}
.seg button:hover { color: var(--mtf-text); }
.seg button.active { background: var(--mtf-clay); color: #1a120a; }
.seg button svg { width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px;
  border-radius: 10px; border: 1px solid transparent;
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--mtf-clay); color: #1a120a; }
.btn-primary:hover { background: var(--mtf-clay-deep); }
.btn-ghost { background: var(--mtf-panel); color: var(--mtf-text); border-color: var(--mtf-line); backdrop-filter: blur(10px); }
.btn-ghost:hover { border-color: rgba(255, 255, 255, 0.25); }
.btn svg { width: 17px; height: 17px; }

.user-chip {
  display: none; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px 0 6px;
  background: var(--mtf-panel); border: 1px solid var(--mtf-line); border-radius: 999px;
  font-size: 13px; font-weight: 600; backdrop-filter: blur(10px);
}
.user-chip .ava {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--mtf-clay); color: #1a120a;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}
.user-chip button { background: none; border: 0; color: var(--mtf-text-dim); cursor: pointer; display: flex; padding: 2px; }
.user-chip button:hover { color: var(--mtf-text); }
.user-chip button svg { width: 15px; height: 15px; }

/* ---------- banner demo ---------- */
.demo-banner {
  position: fixed; bottom: 26px; left: 20px; z-index: 15;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 16px;
  background: rgba(245, 134, 52, 0.12); border: 1px solid rgba(245, 134, 52, 0.4);
  border-radius: 14px; backdrop-filter: blur(10px);
  font-size: 13px; color: #ffc189;
  max-width: 230px; line-height: 1.45;
}
.demo-banner svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }

/* ---------- pistas y chips flotantes ---------- */
.hint-chip {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 15;
  padding: 8px 16px;
  background: var(--mtf-panel); border: 1px solid var(--mtf-line); border-radius: 999px;
  backdrop-filter: blur(10px);
  font-size: 13px; color: var(--mtf-text-dim);
  opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 8px;
}
.hint-chip.show { opacity: 1; }
.hint-chip svg { width: 15px; height: 15px; color: var(--mtf-clay); }

#tooltip {
  position: fixed; z-index: 30; pointer-events: none;
  padding: 6px 12px;
  background: var(--mtf-panel-solid); border: 1px solid var(--mtf-line); border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--mtf-text);
  transform: translate(-50%, -150%);
  opacity: 0;
  white-space: nowrap;
}
#tooltip.show { opacity: 1; }

/* ---------- FAB ---------- */
.fab-row {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 10px;
}
.fab {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 26px;
  background: var(--mtf-clay); color: #1a120a;
  border: 0; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 8px 30px rgba(245, 134, 52, 0.35);
}
.fab:hover { background: #ff974c; }
.fab svg { width: 19px; height: 19px; }
.fab.cancel-mode { background: var(--mtf-panel-solid); color: var(--mtf-text); border: 1px solid var(--mtf-line); box-shadow: none; }
.fab-photo {
  width: 52px; padding: 0; justify-content: center;
  background: var(--mtf-panel-solid); color: var(--mtf-text);
  border: 1px solid var(--mtf-line); box-shadow: none;
}
.fab-photo:hover { background: #1c1f29; border-color: rgba(255, 255, 255, 0.25); }

/* ---------- soltar foto ---------- */
#drop-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 5, 9, 0.75); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
}
#drop-overlay.show { opacity: 1; }
.drop-box {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 46px 60px; text-align: center;
  border: 2px dashed var(--mtf-clay); border-radius: 18px;
  background: rgba(245, 134, 52, 0.06);
}
.drop-box svg { width: 38px; height: 38px; color: var(--mtf-clay); }
.drop-box strong { font-family: 'Zilla Slab', serif; font-size: 22px; }
.drop-box span { color: var(--mtf-text-dim); font-size: 14px; }

#add-photo-preview { display: none; position: relative; margin-bottom: 4px; }
#add-photo-preview.show { display: block; }
#add-photo-preview img { width: 100%; height: 150px; object-fit: cover; border-radius: 12px; display: block; }
#add-photo-preview .gps-note {
  position: absolute; bottom: 10px; left: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(10, 11, 17, 0.75); backdrop-filter: blur(6px);
  border: 1px solid rgba(245, 134, 52, 0.35);
  font-size: 12px; font-weight: 600; color: #ffb077;
}
#add-photo-preview .gps-note svg { width: 13px; height: 13px; }

/* ---------- tarjeta de lugar ---------- */
.place-card {
  position: fixed; z-index: 38;
  right: 20px; top: 86px; width: 340px; max-width: calc(100vw - 40px);
  background: var(--mtf-panel-solid); border: 1px solid var(--mtf-line); border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  opacity: 0; pointer-events: none;
  max-height: calc(100vh - 130px);
  display: flex; flex-direction: column;
}
.place-card.open { opacity: 1; pointer-events: auto; }
.place-card .photo-wrap { position: relative; height: 190px; flex: none; background: #0c0e15; }
.place-card .photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.place-card .photo-wrap image-slot { width: 100%; height: 100%; display: block; }
.place-card .card-close {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(10, 11, 17, 0.7); border: 1px solid var(--mtf-line);
  color: var(--mtf-text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.place-card .card-close:hover { background: rgba(30, 32, 42, 0.9); }
.place-card .card-close svg { width: 16px; height: 16px; }
.place-card .body { padding: 18px 20px 20px; overflow-y: auto; }
.place-card h2 {
  font-family: 'Zilla Slab', serif; font-size: 22px; font-weight: 700;
  margin: 0 0 6px; color: var(--mtf-text); line-height: 1.15;
}
.place-card .comment { font-size: 14.5px; line-height: 1.55; color: var(--mtf-text-dim); margin: 0 0 14px; }
.place-card .meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: rgba(245, 134, 52, 0.14); color: #ffb077;
  border: 1px solid rgba(245, 134, 52, 0.3);
}
.tag.neutral { background: rgba(255, 255, 255, 0.06); color: var(--mtf-text-dim); border-color: var(--mtf-line); }
.tag svg { width: 13px; height: 13px; }
.place-card .zoom-cta { margin-top: 14px; width: 100%; }

/* ---------- modales ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(4, 5, 9, 0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  width: 460px; max-width: 100%; max-height: calc(100vh - 60px); overflow-y: auto;
  background: var(--mtf-panel-solid); border: 1px solid var(--mtf-line); border-radius: 18px;
  padding: 28px;
  transform: none;
}

.modal.wide { width: 760px; }
.modal h2 { font-family: 'Zilla Slab', serif; font-size: 26px; font-weight: 700; margin: 0 0 6px; }
.modal .sub { color: var(--mtf-text-dim); font-size: 14px; margin: 0 0 20px; line-height: 1.5; }
.modal label { display: block; font-size: 13px; font-weight: 700; margin: 14px 0 6px; }
.modal input, .modal textarea {
  width: 100%; padding: 11px 13px;
  background: rgba(255, 255, 255, 0.05); border: 1.5px solid var(--mtf-line); border-radius: 10px;
  color: var(--mtf-text); font-family: inherit; font-size: 14.5px;
  outline: none;
}
.modal input:focus, .modal textarea:focus { border-color: var(--mtf-clay); box-shadow: 0 0 0 3px rgba(245, 134, 52, 0.25); }
.modal input::placeholder, .modal textarea::placeholder { color: rgba(236, 231, 222, 0.35); }
.modal textarea { resize: vertical; min-height: 74px; }
.modal select {
  width: 100%; padding: 11px 13px;
  background: rgba(255, 255, 255, 0.05); border: 1.5px solid var(--mtf-line); border-radius: 10px;
  color: var(--mtf-text); font-family: inherit; font-size: 14.5px;
  outline: none; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a9a49a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.modal select:focus { border-color: var(--mtf-clay); box-shadow: 0 0 0 3px rgba(245, 134, 52, 0.25); }
.modal select option { background: var(--mtf-panel-solid); color: var(--mtf-text); }
.mode-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mode-chips button {
  width: 48px; height: 42px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.05); border: 1.5px solid var(--mtf-line);
  color: var(--mtf-text-dim); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.mode-chips button:hover { color: var(--mtf-text); border-color: rgba(255, 255, 255, 0.25); }
.mode-chips button.active { background: var(--mtf-clay); border-color: var(--mtf-clay); color: #1a120a; }
.mode-chips button svg { width: 20px; height: 20px; }
.mode-chips .moto-slot { display: inline-flex; }
.modal .actions { display: flex; gap: 10px; margin-top: 22px; }
.modal .actions .btn { flex: 1; }
.modal .note { font-size: 12px; color: var(--mtf-text-dim); margin-top: 14px; text-align: center; }
.modal .switch-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--mtf-clay); font-family: inherit; font-size: 13px; font-weight: 600;
  margin-top: 14px; display: block; text-align: center; width: 100%;
}
.benefits { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.benefits li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--mtf-text); }
.benefits svg { width: 17px; height: 17px; color: var(--mtf-clay); flex: none; }

/* ---------- planes ---------- */
.plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 20px; }
.plan {
  position: relative;
  border: 1px solid var(--mtf-line); border-radius: 14px; padding: 20px 18px;
  display: flex; flex-direction: column; gap: 4px;
  background: rgba(255, 255, 255, 0.025);
}
.plan.featured { border-color: var(--mtf-clay); background: rgba(245, 134, 52, 0.07); }
.plan .pop {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  padding: 3px 12px; border-radius: 999px;
  background: var(--mtf-clay); color: #1a120a;
  font-size: 11px; font-weight: 800; white-space: nowrap;
}
.plan h3 { font-family: 'Zilla Slab', serif; font-size: 19px; margin: 0; }
.plan .price { font-size: 15px; font-weight: 800; color: var(--mtf-clay); margin-bottom: 10px; }
.plan ul { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.plan li { display: flex; align-items: flex-start; gap: 7px; font-size: 13px; color: var(--mtf-text-dim); line-height: 1.4; }
.plan li svg { width: 14px; height: 14px; color: var(--mtf-ochre); flex: none; margin-top: 2px; }
.plan .btn { width: 100%; }

/* ---------- bienvenida ---------- */
.welcome-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.welcome-logo img { width: 110px; }
.modal .center { text-align: center; }

/* ---------- mapa 2D a nivel calle ---------- */
#map2d {
  position: fixed; inset: 0; z-index: 30;
  background: var(--mtf-bg);
  display: none; flex-direction: column;
}
#map2d.show { display: flex; }
.map2d-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  background: var(--mtf-panel-solid); border-bottom: 1px solid var(--mtf-line);
  z-index: 2;
}
.map2d-title { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 18px; }
.map2d-hint { margin-left: auto; font-size: 12.5px; color: var(--mtf-text-dim); }
.fav-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 9px 16px;
  background: rgba(255, 255, 255, 0.05); border: 1.5px solid var(--mtf-line); border-radius: 999px;
  color: var(--mtf-text-dim); cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600;
}
.fav-toggle:hover { color: var(--mtf-text); border-color: rgba(255, 255, 255, 0.25); }
.fav-toggle.active { background: rgba(245, 134, 52, 0.14); border-color: var(--mtf-clay); color: #ffb077; }
.fav-toggle.active svg { fill: var(--mtf-clay); color: var(--mtf-clay); }
.fav-toggle svg { width: 16px; height: 16px; }
#map2d-canvas { flex: 1; }
#map2d-canvas .leaflet-container { background: #0a0c12; }
.pmark { background: none; border: 0; }
.pmark-ph, .pmark-dot {
  display: block; width: 46px; height: 46px; border-radius: 50%;
  border: 2.5px solid var(--mtf-clay);
  background-color: var(--mtf-panel-solid);
  background-size: cover; background-position: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
}
.pmark-dot {
  width: 20px; height: 20px; margin: 13px;
  background: var(--mtf-clay); border-color: rgba(255, 255, 255, 0.85);
}
.leaflet-control-attribution { background: rgba(10, 11, 17, 0.7) !important; color: #8d887f !important; }
.leaflet-control-attribution a { color: #b3aca1 !important; }

/* ---------- viaje a la luna ---------- */
.moon-btn {
  position: fixed; right: 16px; bottom: 40px; z-index: 20;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  background: var(--mtf-panel); border: 1px solid var(--mtf-line); border-radius: 999px;
  color: var(--mtf-text); cursor: pointer; backdrop-filter: blur(10px);
  font-family: inherit; font-size: 13px; font-weight: 600;
}
.moon-btn:hover { border-color: rgba(255, 255, 255, 0.3); }
.moon-btn svg { width: 16px; height: 16px; color: #e8d9a0; }
.moon-btn.active { border-color: rgba(245, 134, 52, 0.55); color: #ffc189; }
.moon-btn.active svg { color: #f58634; }
.const-btn { bottom: 88px; }
.sky-btn { display: none; bottom: 136px; }
body.const-on .sky-btn { display: inline-flex; }
body.moon-mode .const-btn, body.moon-mode .sky-btn { display: none; }
.stand-btn { display: none; bottom: 88px; }
body.moon-mode .stand-btn { display: inline-flex; }
body.moon-mode .fab-row, body.moon-mode .demo-banner, body.moon-mode .hint-chip { display: none; }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 60;
  padding: 11px 20px;
  background: var(--mtf-panel-solid); border: 1px solid rgba(245, 134, 52, 0.45); border-radius: 12px;
  font-size: 14px; font-weight: 600;
  opacity: 0;
  pointer-events: none;
  display: flex; align-items: center; gap: 9px;
}
#toast.show { opacity: 1; }
#toast svg { width: 16px; height: 16px; color: var(--mtf-clay); }

/* ---------- footer ---------- */
.credit {
  position: fixed; bottom: 12px; right: 16px; z-index: 10;
  font-size: 11px; color: rgba(236, 231, 222, 0.4);
  letter-spacing: 0.03em;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  header { padding: 10px 12px; gap: 8px; }
  .moon-btn { bottom: 84px; right: 12px; }
  .const-btn { bottom: 132px; }
  .sky-btn { bottom: 180px; }
  .brand img { height: 36px; }
  .brand .title { font-size: 18px; }
  .brand .subtitle { display: none; }
  .hide-mobile { display: none !important; }
  .demo-banner { bottom: 86px; left: 12px; font-size: 12px; max-width: min(230px, calc(100vw - 30px)); }
  .place-card {
    right: 0; left: 0; top: auto; bottom: 0; width: 100%; max-width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 72vh;
  }
  
  .place-card .photo-wrap { height: 150px; }
  .plans-grid { grid-template-columns: 1fr; }
  .modal { padding: 22px; }
  .credit { display: none; }
  .fab-row { bottom: 18px; }
  .hint-chip { bottom: 86px; width: max-content; max-width: calc(100vw - 30px); text-align: center; }
}
