/**
 * Explore World - Interfaz de juego.
 *
 * @author    Ecom Experts <ecomyseo@gmail.com>
 * @copyright 2026 Ecom Experts
 * @license   AFL-3.0
 */

:root {
  --bg: #070d14;
  --panel: rgba(11, 22, 34, 0.82);
  --panel-solid: #0e1b28;
  --border: rgba(120, 168, 210, 0.22);
  --text: #eaf2fa;
  --muted: #9db3c8;
  --accent: #35c1ff;
  --accent-2: #ffb547;
  --ok: #39d98a;
  --danger: #ff6b6b;
  --radius: 14px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

#cesiumContainer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cesium-widget-credits,
.cesium-viewer-bottom { display: none !important; }

.cesium-widget canvas { outline: none; }

/* ---------- Pantalla de carga ---------- */

.loading {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 620px at 50% 8%, rgba(53, 193, 255, 0.16), transparent 62%),
    linear-gradient(180deg, #050a10 0%, #0a1520 55%, #060c13 100%);
  transition: opacity 0.6s ease, visibility 0.6s;
}

.loading.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loading__inner { width: min(720px, 100%); text-align: center; }

.loading__title {
  margin: 0 0 6px;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 300;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.loading__title span { font-weight: 700; color: var(--accent); }

.loading__claim { margin: 0 0 28px; color: var(--muted); font-size: 1.05rem; }

.loading__bar {
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.loading__fill {
  height: 100%;
  width: 4%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #7ee0ff);
  transition: width 0.45s ease;
}

.loading__status { margin: 12px 0 0; color: var(--muted); font-size: 0.9rem; min-height: 1.2em; }

.start { margin-top: 28px; text-align: left; }

.start__presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 20px; }

.chip {
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.83rem;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.16s;
}

.chip:hover { background: rgba(53, 193, 255, 0.16); border-color: var(--accent); transform: translateY(-1px); }

.start__results { margin-top: 8px; }

.start__hint { margin: 16px 0 0; color: var(--muted); font-size: 0.82rem; text-align: center; }

/* ---------- Controles base ---------- */

.field { display: block; margin-bottom: 14px; }

.field__label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.82rem; }

.field__input,
.select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(6, 14, 22, 0.85);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.field__input:focus,
.select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(53, 193, 255, 0.18); }

.btn {
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.12s;
}

.btn:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }

.btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #2a8fd6);
  color: #04121c;
}

.btn--primary:hover { filter: brightness(1.08); }

.btn--big { width: 100%; padding: 15px; font-size: 1.05rem; }

.btn--ghost { background: transparent; }

.switch { display: flex; align-items: center; gap: 9px; margin: 9px 0; color: var(--muted); font-size: 0.86rem; cursor: pointer; }

.switch input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

kbd {
  display: inline-block;
  min-width: 22px;
  margin: 0 2px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  font-family: inherit;
  font-size: 0.76rem;
  text-align: center;
}

/* ---------- HUD ---------- */

.hud { position: absolute; inset: 0; z-index: 20; pointer-events: none; }

.hud > * { pointer-events: none; }

.hud__topleft { position: absolute; top: 16px; left: 16px; display: flex; flex-direction: column; gap: 8px; }

.hud__topright { position: absolute; top: 16px; right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }

.hud__bottomleft { position: absolute; bottom: 16px; left: 16px; }

.hud__bottomright { position: absolute; bottom: 16px; right: 16px; max-width: 300px; }

.hud__bottom { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); width: min(680px, calc(100vw - 420px)); }

.panel {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.place { font-size: 0.98rem; font-weight: 600; margin-bottom: 5px; }

.readout { display: flex; gap: 14px; color: var(--accent); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

.readout--sub { color: var(--muted); margin-top: 3px; }

.badge {
  align-self: flex-start;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.76rem;
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.badge--warn { color: var(--accent-2); border-color: rgba(255, 181, 71, 0.4); }

.compass {
  position: relative;
  width: 62px;
  height: 62px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.compass__needle {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 3px;
  height: 25px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--danger) 0%, var(--danger) 50%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.5) 100%);
  transform-origin: 50% 100%;
}

.compass__label {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.tool {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.83rem;
  cursor: pointer;
  transition: background 0.14s;
}

.tool span { width: 18px; text-align: center; font-size: 0.98rem; }

.tool em { font-style: normal; }

.tool:hover { background: rgba(53, 193, 255, 0.16); }

.tool.is-active { background: rgba(53, 193, 255, 0.26); color: #fff; }

.tool:disabled { opacity: 0.35; cursor: not-allowed; }

.stats-mini {
  display: flex;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stats-mini span {
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}

.minimap {
  display: block;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #0a1119;
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.minimap__scale { margin-top: 5px; text-align: center; color: var(--muted); font-size: 0.7rem; }

.panel--quests { max-height: 230px; overflow-y: auto; }

.panel__title { margin: 0 0 8px; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }

.quests { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.quests li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.81rem;
  color: var(--text);
}

.quests li.is-done { color: var(--ok); text-decoration: line-through; opacity: 0.7; }

.quests li small { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.quests__empty { color: var(--muted); font-size: 0.8rem; }

/* ---------- Barra de tiempo ---------- */

.timebar {
  padding: 13px 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.timebar__row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }

.timebar__row:last-child { margin-bottom: 0; }

.timebar__row--options { flex-wrap: wrap; gap: 8px 18px; }

.timebar__label { width: 42px; color: var(--muted); font-size: 0.79rem; }

.timebar__slider { flex: 1; accent-color: var(--accent); cursor: pointer; }

.timebar__value { min-width: 62px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }

.timebar__info { color: var(--muted); font-size: 0.76rem; }

/* ---------- Street View ---------- */

.streetview {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  background: #000;
}

.streetview.is-visible { display: block; }

.streetview__bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 16px;
  background: linear-gradient(180deg, rgba(4, 10, 16, 0.94), rgba(4, 10, 16, 0));
}

.streetview__dates { display: flex; align-items: center; gap: 9px; font-size: 0.83rem; color: var(--muted); }

.streetview__dates .select { width: auto; min-width: 190px; padding: 8px 11px; }

.streetview__meta { margin-left: auto; display: flex; gap: 14px; color: var(--muted); font-size: 0.79rem; font-variant-numeric: tabular-nums; }

/* ---------- Modales ---------- */

.modal {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(3, 8, 13, 0.72);
  backdrop-filter: blur(6px);
}

.modal[hidden] { display: none; }

.modal__box {
  width: min(620px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.modal__box h2 { margin: 0 0 6px; font-size: 1.28rem; font-weight: 600; }

.modal__box h3 { margin: 22px 0 10px; font-size: 0.78rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }

.modal__hint { margin: 0 0 14px; color: var(--muted); font-size: 0.87rem; }

.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.results { display: flex; flex-direction: column; gap: 5px; max-height: 240px; overflow-y: auto; }

.result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
}

.result:hover { background: rgba(53, 193, 255, 0.14); border-color: var(--accent); }

.result small { color: var(--muted); font-size: 0.74rem; white-space: nowrap; }

.result__remove { border: 0; background: transparent; color: var(--danger); font: inherit; cursor: pointer; padding: 2px 6px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }

.stat {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
}

.stat b { display: block; font-size: 1.28rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

.stat span { color: var(--muted); font-size: 0.76rem; }

.achievements { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }

.achievement {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  opacity: 0.42;
}

.achievement.is-unlocked { opacity: 1; border-color: rgba(57, 217, 138, 0.42); background: rgba(57, 217, 138, 0.09); }

.achievement b { display: block; font-size: 0.85rem; }

.achievement small { color: var(--muted); font-size: 0.74rem; }

.usage { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.78rem; }

.usage div { display: flex; justify-content: space-between; margin-bottom: 4px; }

.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 16px; }

.help-grid div { display: flex; align-items: center; gap: 5px; font-size: 0.84rem; }

.help-grid span { color: var(--muted); margin-left: 5px; }

.help-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.86rem; line-height: 1.65; }

.help-list strong { color: var(--text); }

/* ---------- Avisos ---------- */

.toasts {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 11px 19px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  font-size: 0.87rem;
  animation: toast-in 0.32s ease;
}

.toast--ok { border-color: rgba(57, 217, 138, 0.5); color: var(--ok); }

.toast--warn { border-color: rgba(255, 181, 71, 0.5); color: var(--accent-2); }

.toast--error { border-color: rgba(255, 107, 107, 0.5); color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Mira ---------- */

.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 15;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  pointer-events: none;
}

.crosshair span,
.crosshair::before {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}

.crosshair span { top: 7px; left: 0; width: 16px; height: 2px; }

.crosshair::before { left: 7px; top: 0; width: 2px; height: 16px; }

/* ---------- Creditos ---------- */

.credits {
  position: absolute;
  left: 210px;
  bottom: 8px;
  z-index: 22;
  max-width: 46vw;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  pointer-events: auto;
}

.credits a { color: rgba(255, 255, 255, 0.88); }

.google-attr { position: absolute; left: 16px; bottom: 210px; z-index: 22; opacity: 0.92; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.9)); }

.noscript { position: absolute; inset: 0; display: grid; place-items: center; z-index: 90; background: var(--bg); }

/* ---------- Controles táctiles ---------- */

.touch { position: absolute; inset: auto 0 0 0; z-index: 25; height: 190px; pointer-events: none; }

.touch__stick {
  position: absolute;
  left: 26px;
  bottom: 26px;
  width: 118px;
  height: 118px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(11, 22, 34, 0.5);
  pointer-events: auto;
  touch-action: none;
}

.touch__knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: rgba(53, 193, 255, 0.6);
}

.touch__buttons { position: absolute; right: 26px; bottom: 26px; display: flex; flex-direction: column; gap: 10px; pointer-events: auto; }

.touch__btn {
  width: 82px;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(11, 22, 34, 0.62);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  touch-action: none;
}

/* ---------- Adaptación a pantallas pequeñas ---------- */

@media (max-width: 980px) {
  .hud__bottom { width: calc(100vw - 32px); bottom: 200px; }
  .hud__bottomright { display: none; }
  .hud__bottomleft { display: none; }
  .tool em { display: none; }
  .tool { justify-content: center; }
  .credits { left: 16px; max-width: 62vw; }
  .google-attr { bottom: 8px; left: auto; right: 16px; }
}

@media (max-width: 560px) {
  .modal__box { padding: 20px; }
  .streetview__meta { display: none; }
}
