:root {
  --bg: #0f1115;
  --panel: rgba(20, 24, 31, 0.92);
  --border: #2a313c;
  --text: #e7ecf3;
  --muted: #9aa6b6;
  --accent: #4f9dff;
  --profile-h: 190px;
}

* { box-sizing: border-box; }

/* El atributo [hidden] debe ganar siempre a los selectores de ID/clase
   (#dropzone, .stats, #profile-empty), que si no anulan el ocultado. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

#map { position: relative; flex: 1 1 auto; min-height: 0; }

/* ---- Panel de controles ---- */
.panel {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  width: 280px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.panel .row { display: block; margin-bottom: 12px; }
.panel .row:last-child { margin-bottom: 0; }

.title { font-size: 18px; letter-spacing: 0.5px; color: var(--text); }
.title strong { color: var(--accent); }

.ctrl-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ctrl-label em { color: var(--accent); font-style: normal; float: right; }

input[type="file"] { width: 100%; font-size: 12px; color: var(--muted); }

input[type="range"] { width: 100%; accent-color: var(--accent); }

select {
  width: 100%;
  padding: 6px 8px;
  background: #161b22;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.panel .stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.stats strong { color: var(--text); }

.share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  margin-top: 4px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.share:hover { background: #3b86e8; }
.share:disabled { opacity: 0.45; cursor: not-allowed; }
.share svg { flex: 0 0 auto; }

/* ---- Botón de recorrido (flythrough) ---- */
.play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  margin-top: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #2faa5a;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.play:hover { background: #27914c; }
.play:disabled { opacity: 0.45; cursor: not-allowed; }
.play.playing { background: #d9534f; }
.play.playing:hover { background: #c44340; }
.play svg { flex: 0 0 auto; }

/* ---- Toast ---- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--profile-h) + 18px);
  transform: translateX(-50%);
  z-index: 100;
  padding: 10px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}

/* ---- Dropzone ---- */
#dropzone {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 17, 21, 0.78);
  border: 3px dashed var(--accent);
  backdrop-filter: blur(2px);
}
.drop-hint { font-size: 26px; color: var(--text); }
.drop-hint strong { color: var(--accent); }

/* ---- Perfil ---- */
#profile-panel {
  position: relative;
  flex: 0 0 var(--profile-h);
  height: var(--profile-h);
  background: #0c0e12;
  border-top: 1px solid var(--border);
}
#profile { display: block; width: 100%; height: 100%; cursor: crosshair; }

#profile-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

#profile-tooltip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
  transform: translate(-50%, -120%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
#profile-tooltip .t-ele { color: var(--accent); font-weight: 600; }

/* ---- Enlace al listado desde el visor ---- */
.title .list-nav {
  float: right;
  font-size: 12px;
  font-weight: 400;
  color: var(--accent);
  text-decoration: none;
}
.title .list-nav:hover { text-decoration: underline; }

/* ---- Página de listado (/lista) ---- */
body.list-page { overflow: auto; }

.list-wrap { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; }

.list-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.list-header h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: 0.5px; }
.list-header h1 strong { color: var(--accent); }

.back-link { color: var(--accent); text-decoration: none; font-size: 13px; }
.back-link:hover { text-decoration: underline; }

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

.track-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.track-card .info { flex: 1 1 auto; min-width: 0; }
.track-card .name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.track-card .meta { margin-top: 4px; font-size: 12px; color: var(--muted); }
.track-card .meta strong { color: var(--text); font-weight: 600; }

.track-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.btn-view {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}
.btn-view:hover { background: #3b86e8; }
.btn-del {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.btn-del:hover { color: #ff5a3c; border-color: #ff5a3c; }

.list-empty, .list-error { text-align: center; padding: 48px 0; font-size: 14px; color: var(--muted); }
.list-error { color: #ff7a63; }
