:root {
  --accent: #e11d2a;
  --bg-panel: rgba(255, 255, 255, 0.96);
  --text: #14181f;
  --text-soft: #5a6472;
  --border: #e2e6ec;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
}

/* Mapa a pantalla completa */
#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ---------- Panel flotante ---------- */
.panel {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1000;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.panel__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel__toggle {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-soft);
  line-height: 1;
  padding: 4px 6px;
  border-radius: 8px;
  transition: transform 0.2s, background 0.2s;
}
.panel__toggle:hover { background: rgba(0, 0, 0, 0.06); }
.panel.is-collapsed .panel__toggle { transform: rotate(-90deg); }

.panel__body {
  padding: 14px 16px 16px;
  overflow-y: auto;
}
.panel.is-collapsed .panel__body { display: none; }

.panel__subtitle {
  margin: 0 0 14px;
  font-size: 0.82rem;
  color: var(--text-soft);
}

/* ---------- Campos ---------- */
.field {
  display: block;
  margin-bottom: 12px;
}
.field__label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.field select,
.field input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.field select:focus,
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(225, 29, 42, 0.12);
}

/* ---------- Resultados ---------- */
.results-count {
  margin: 6px 0 8px;
  font-size: 0.78rem;
  color: var(--text-soft);
}
.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.results-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s;
}
.results-list__item:hover { background: rgba(225, 29, 42, 0.08); }
.results-list__crest {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex: none;
}
.results-list__text { min-width: 0; }
.results-list__team {
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.results-list__stadium {
  font-size: 0.76rem;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.results-list__empty {
  padding: 10px 8px;
  font-size: 0.84rem;
  color: var(--text-soft);
}
.results-list__error {
  padding: 10px 8px;
  font-size: 0.84rem;
  color: var(--accent);
}

/* ---------- Marcador con escudo ---------- */
.crest-marker {
  background: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.35);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.crest-marker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 22, 0.55);
  backdrop-filter: blur(2px);
}
.modal__dialog {
  position: relative;
  z-index: 1;
  width: 480px;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: modal-in 0.18s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.modal__close:hover { background: rgba(0, 0, 0, 0.65); }
.modal__photo {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  background: #eef1f5;
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal__content { padding: 18px 20px 22px; }
.modal__heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.modal__crest {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: none;
}
.modal__stadium { margin: 0; font-size: 1.3rem; }
.modal__team { margin: 2px 0 0; color: var(--text-soft); font-size: 0.9rem; }
.modal__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin: 0 0 16px;
  padding: 14px;
  background: #f6f8fa;
  border-radius: 10px;
}
.modal__facts dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}
.modal__facts dd { margin: 2px 0 0; font-weight: 600; font-size: 0.95rem; }
.modal__description { margin: 0; line-height: 1.55; color: #2a3340; }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .panel { width: calc(100vw - 24px); left: 12px; top: 12px; }
  .modal__photo { height: 170px; }
  .modal__dialog { width: 100%; }
}
