/* Mapa de setas — estilos. Móvil primero: el mapa ocupa todo. */

:root {
  --bg: #ffffff;
  --ink: #222;
  --muted: #777;
  --accent: #1c6b2f;
  --shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}

#map { position: absolute; inset: 0; }

/* --- barra superior: título + selector de día --- */

#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 8px 10px;
  pointer-events: none; /* el mapa sigue siendo arrastrable alrededor */
}

#topbar h1 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  text-shadow: 0 0 4px #fff, 0 0 8px #fff;
}

#days {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  pointer-events: auto;
  padding-bottom: 4px;
}

#days button {
  flex: 0 0 auto;
  border: none;
  border-radius: 14px;
  padding: 5px 11px;
  font-size: 13px;
  background: var(--bg);
  box-shadow: var(--shadow);
  cursor: pointer;
}

#days button.active {
  background: var(--accent);
  color: #fff;
}

/* --- leyenda --- */

#legend {
  position: absolute;
  bottom: 26px;
  left: 10px;
  width: 130px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  padding: 6px 8px;
  box-shadow: var(--shadow);
  font-size: 11px;
}

.legend-bar {
  height: 8px;
  border-radius: 4px;
  /* misma escala que colorExpression() en app.js */
  background: linear-gradient(to right, #cdcdcd, #e4de8d 20%, #b5c94e 50%, #56a344 75%, #1c6b2f);
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

/* --- panel de desglose --- */

#panel {
  position: absolute;
  background: var(--bg);
  box-shadow: var(--shadow);
  overflow-y: auto;
  /* móvil: hoja inferior */
  left: 0; right: 0; bottom: 0;
  max-height: 55%;
  border-radius: 14px 14px 0 0;
  padding: 14px 16px;
}

#panel-close {
  position: absolute;
  top: 8px; right: 10px;
  border: none;
  background: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
}

.cell-id { margin: 0; color: var(--muted); font-size: 12px; }

.big-score {
  margin: 2px 0 0;
  font-size: 40px;
  font-weight: 700;
  color: var(--accent);
}
.big-score span { font-size: 16px; font-weight: 400; color: var(--muted); }

.score-date { margin: 0 0 12px; font-size: 13px; color: var(--muted); }

.factor {
  display: grid;
  grid-template-columns: 11em 1fr 4em;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 7px;
}

.factor.inactive { opacity: 0.45; }

.factor-bar {
  height: 9px;
  background: #eee;
  border-radius: 5px;
  overflow: hidden;
}

.factor-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 5px;
}

.factor-bar i.penalty { background: #c0392b; }

.factor-value { text-align: right; color: var(--muted); }

.panel-note {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
}

/* --- escritorio: panel lateral --- */

@media (min-width: 720px) {
  #topbar { padding: 12px 14px; }
  #topbar h1 { font-size: 18px; }

  #panel {
    left: auto;
    top: 70px; right: 10px; bottom: auto;
    width: 340px;
    max-height: calc(100% - 110px);
    border-radius: 10px;
  }
}
