* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #1a1a2e;
  --bg2: #16213e;
  --bg3: #0f3460;
  --accent: #e94560;
  --accent2: #00d2ff;
  --text: #eee;
  --text2: #b8b8b8;
  --green: #00c853;
  --yellow: #ffd600;
  --orange: #ff9800;
  --radius: 12px;
  --radius-sm: 8px;
  color-scheme: dark;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg2);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  z-index: 50;
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-btn {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  min-height: 44px;
  min-width: 44px;
}

/* Navigation */
.nav {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg2);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  z-index: 50;
}

.nav-btn {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.nav-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Screens */
.screen {
  display: none;
  padding: 20px;
  padding-bottom: 0;
  margin-top: 100px;
  height: calc(100vh - 100px);
  height: calc(100dvh - 100px);
  flex-direction: column;
}

.screen.active {
  display: flex;
}

.scrollable {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 70px;
  -webkit-overflow-scrolling: touch;
}

#screen-run {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Live Stats */
.live-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
}

.speed-display {
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.speed-unit {
  font-size: 16px;
  color: var(--text2);
  margin-top: 4px;
}

.stats-row {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-top: 24px;
}

.stat-card {
  flex: 1;
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
}

.stat-unit {
  font-size: 11px;
  font-weight: 400;
  color: var(--text2);
}

.stat-label {
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Segment progress */
.segment-progress {
  width: 100%;
  margin-top: 24px;
}

.segment-bar-container {
  width: 100%;
  height: 8px;
  background: var(--bg2);
  border-radius: 4px;
  overflow: hidden;
}

.segment-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 4px;
  transition: width 0.3s;
  width: 0%;
}

.segment-label {
  font-size: 12px;
  color: var(--text2);
  margin-top: 6px;
  text-align: center;
}

/* Controls */
.controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
}

.btn {
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: transform 0.15s, opacity 0.15s;
}

.btn:active {
  transform: scale(0.95);
}

.controls-running {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.btn-start {
  width: 80px;
  height: 80px;
  background: var(--green);
  color: #fff;
  font-size: 14px;
}

/* Controles deslizables: evitan disparar acciones por un toque accidental */

.slide-controls {
  position: relative;
  width: 100%;
  max-width: 300px;
  /* Todos los hijos son absolute: sin min-width el ancho intrínseco es 0 y las
     etiquetas left/right colapsan encimadas en el centro. */
  min-width: 240px;
  height: 168px;
  margin: 0 auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.slide-controls.dragging {
  cursor: grabbing;
}

.slide-zone {
  position: absolute;
  z-index: 2; /* siempre legible: el handle pasa por debajo al arrastrar hacia la zona */
  min-width: 74px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--text2);
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  opacity: 0.5;
  transition: opacity 0.15s, transform 0.15s, background-color 0.15s, border-color 0.15s, color 0.15s;
  pointer-events: none;
}

/* Mientras se arrastra queda legible solo el lado elegido, con su color */
.slide-controls.dragging .slide-zone {
  opacity: 0.15;
}

.slide-zone.armed {
  opacity: 1;
  transform: scale(1.18);
}

.slide-controls.dragging .slide-zone.armed {
  opacity: 1;
}

.slide-zone-pause {
  left: 0;
  top: 35px;
}

.slide-zone-pause.armed {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #333;
}

.slide-zone-pause.resume.armed {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.slide-zone-stop {
  right: 0;
  top: 35px;
}

.slide-zone-stop.armed {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.slide-zone-skip {
  left: 0;
  right: 0;
  bottom: 8px;
  width: fit-content;
  margin: 0 auto; /* centrado real: no depende del ancho del texto */
}

.slide-zone-skip.armed {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #00252e;
}

.slide-handle {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 12px;
  width: 80px;
  height: 80px;
  margin-left: -40px;
  border-radius: 50%;
  background: var(--bg2);
  border: 2px dashed var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  cursor: grab;
  touch-action: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.slide-handle.dragging {
  cursor: grabbing;
  border-style: solid;
}

.slide-handle.returning {
  transition: transform 0.2s ease-out, background-color 0.15s, border-color 0.15s, color 0.15s;
}

/* El handle se pinta del color de la acción que se va a ejecutar al soltar */
.slide-handle.armed-pause {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #333;
}

.slide-handle.armed-resume {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.slide-handle.armed-stop {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.slide-handle.armed-skip {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #00252e;
}

.slide-handle-hint {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* GPS Status */
.gps-status {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text2);
}

.gps-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--text2);
}

.gps-dot.active {
  background: var(--green);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Segments Table */
.segments-container {
  margin-top: 24px;
}

.segments-container h3 {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.segments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.segments-table th {
  color: var(--text2);
  font-weight: 600;
  text-align: center;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 11px;
  text-transform: uppercase;
}

.segments-table td {
  text-align: center;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.segments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.segments-header h3 {
  font-size: 14px;
  color: var(--text2);
}

.btn-chart-toggle {
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--accent2);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

#chartCanvas {
  width: 100%;
  border-radius: 8px;
}

/* Step results */
.step-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step-result-card {
  background: var(--bg2);
  border-radius: 8px;
  padding: 12px;
}

.sr-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.sr-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sr-label {
  font-weight: 700;
  font-size: 14px;
}

.sr-round {
  font-size: 11px;
  color: var(--text2);
  margin-left: auto;
}

.sr-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 13px;
  color: var(--text2);
}

.speed-max { color: var(--accent); font-weight: 600; }
.speed-min { color: var(--accent2); font-weight: 600; }
.speed-avg { color: var(--yellow); font-weight: 600; }

/* Activity selector */
.activity-selector {
  display: flex;
  gap: 0;
  width: 100%;
  margin-top: 20px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}

.activity-btn {
  flex: 1;
  padding: 10px;
  background: var(--bg2);
  border: none;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.activity-btn.active {
  background: var(--accent2);
  color: #fff;
}

/* Mode selector */
.mode-selector {
  display: flex;
  gap: 0;
  width: 100%;
  margin-top: 20px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}

.mode-btn {
  flex: 1;
  padding: 10px;
  background: var(--bg2);
  border: none;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
}

.race-name-group {
  margin-top: 12px;
}

.race-name-group input,
.race-name-group select {
  width: 100%;
  padding: 12px;
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
}

/* History filters */
.history-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

/* History */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.history-card:active {
  background: var(--bg3);
}

.history-date {
  font-size: 13px;
  color: var(--text2);
}

.history-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

.history-stat {
  text-align: center;
}

.history-stat-value {
  font-size: 18px;
  font-weight: 700;
}

.history-stat-label {
  font-size: 10px;
  color: var(--text2);
  text-transform: uppercase;
}

.history-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.race-card {
  border-left: 3px solid var(--accent);
}

.race-name {
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.race-tag-label {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  color: #fff;
  text-transform: uppercase;
}

.comparison {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 4px;
}

.comparison.better {
  color: var(--green);
  background: rgba(0, 200, 83, 0.1);
}

.comparison.worse {
  color: var(--accent);
  background: rgba(233, 69, 96, 0.1);
}

.evolution-card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

#evolutionChart {
  width: 100%;
  border-radius: 8px;
}

/* Intervals */
.interval-form-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--bg2);
  border: none;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 0;
}

.interval-form-toggle .toggle-arrow {
  font-size: 12px;
  transition: transform 0.2s;
}

.interval-form-toggle.open .toggle-arrow {
  transform: rotate(180deg);
}

.interval-form-toggle.open {
  border-radius: var(--radius) var(--radius) 0 0;
}

.interval-form {
  background: var(--bg2);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px;
  flex-shrink: 0;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 12px;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.btn-rect {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn-rect:active {
  opacity: 0.8;
}

.btn-secondary {
  background: var(--bg3);
}

.interval-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.interval-card {
  background: var(--bg2);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.interval-info {
  font-size: 14px;
}

.interval-info small {
  color: var(--text2);
  font-size: 12px;
}

.interval-delete {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 18px;
  cursor: pointer;
  padding: 8px 12px;
  min-height: 44px;
}

/* Session Detail Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 100;
  overflow-y: auto;
}

.modal-overlay.active {
  display: block;
}

.modal {
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 28px;
  cursor: pointer;
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.modal-stat {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text2);
}

.empty-state p {
  margin-top: 8px;
  font-size: 14px;
}

/* Interval selector on run screen */
.interval-selector {
  width: 100%;
  margin-top: 20px;
  text-align: center;
}

.interval-selector label {
  display: block;
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.interval-selector select {
  width: 100%;
  padding: 12px;
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23aaa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* Weight config */
.weight-config {
  margin-top: 24px;
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.weight-config label {
  display: block;
  font-size: 12px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.weight-config input {
  width: 100%;
  padding: 12px;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
}

/* Calories stat */
.calories-stat {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(233,69,96,0.15), rgba(0,210,255,0.15));
}

/* Steps builder */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
}

.step-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.step-info {
  flex: 1;
  font-size: 13px;
}

.step-actions {
  display: flex;
  gap: 4px;
}

.step-btn {
  background: var(--bg2);
  border: none;
  color: var(--text2);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-btn-del {
  color: var(--accent);
}

.add-step-form {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px;
}

/* Next step button */
.btn-next-step {
  margin-top: 12px;
  background: var(--yellow);
  color: #333;
  font-size: 18px;
  font-weight: 800;
  padding: 16px;
  animation: pulseBtn 1.5s infinite;
}

@keyframes pulseBtn {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@media (prefers-reduced-motion: reduce) {
  .gps-dot.active { animation: none; }
  .btn-next-step { animation: none; }
}

/* Interval active display */
.interval-active {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  text-align: center;
  display: none;
}

.interval-active.visible {
  display: block;
}

.interval-phase {
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
}

.interval-phase.work {
  color: var(--accent);
}

.interval-phase.rest {
  color: var(--green);
}

.interval-phase.jog {
  color: var(--orange);
}

.interval-phase.exercise {
  color: var(--yellow);
}

.interval-remaining {
  font-size: 32px;
  font-weight: 800;
  margin-top: 4px;
}

.interval-rep {
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px;
}

/* Header auth */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-btn {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

/* Competitions */
.comp-filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  flex-shrink: 0;
}

.comp-sort-btn {
  flex-shrink: 0;
  width: auto;
  font-size: 12px;
  padding: 6px 12px;
}

.comp-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.comp-actions {
  flex-shrink: 0;
}

.filter-btn {
  background: var(--bg2);
  border: none;
  color: var(--text2);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, background-color 0.2s;
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
}

.comp-form {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.comp-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.comp-card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px;
}

.shared-event-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 12px 0 6px;
}

.comp-card-shared {
  border: 1px solid var(--accent2);
  margin-bottom: 16px;
}

.comp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.comp-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comp-info-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent2);
  text-decoration: none;
}

.comp-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.comp-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.comp-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--text2);
}

.comp-desc {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.4;
}

.comp-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.comp-author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
}

.btn-attend {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  transition: all 0.2s;
}

.btn-attend.attending {
  background: rgba(233, 69, 96, 0.2);
  border-color: var(--accent);
  color: var(--text);
}

.attend-count-only {
  font-size: 13px;
  color: var(--text2);
}

/* Weight header button */
.header-weight {
  font-size: 18px;
  display: none;
}

.header-weight:active {
  transform: scale(0.92);
}

.weight-popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.weight-popup-content {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 20px;
  width: 280px;
}

.weight-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-weight: 700;
}

/* Credit FAB */
.fab-credit {
  position: fixed;
  bottom: 16px;
  left: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  z-index: 50;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.fab-credit:active {
  opacity: 1;
}

.comp-author-pic {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.char-count {
  display: block;
  text-align: right;
  font-size: 11px;
  color: var(--text2);
  margin-top: 4px;
}

.comp-map {
  width: 100%;
  height: 200px;
  border-radius: 8px;
  margin-top: 8px;
  z-index: 0;
}

.map-hint {
  font-size: 11px;
  color: var(--text2);
  margin-top: 4px;
}


.fab-map {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.fab-map:active {
  transform: scale(0.92);
}

.fab-manual {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.fab-manual:active {
  transform: scale(0.92);
}

/* Map fullscreen */
.map-fullscreen {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
}

.map-fullscreen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg2);
  flex-shrink: 0;
}

.map-fullscreen-header h3 {
  font-size: 16px;
}

.map-filters-bar {
  flex-shrink: 0;
  background: var(--bg2);
}

.map-date-filter {
  display: flex;
  gap: 8px;
  padding: 10px 20px 6px;
  align-items: flex-end;
}

.map-tag-filter {
  padding: 0 20px 10px;
}

.map-tag-filter select {
  width: 100%;
  padding: 10px;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23aaa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.map-date-group {
  flex: 1;
}

.map-date-group label {
  display: block;
  font-size: 10px;
  color: var(--text2);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.map-date-group input {
  width: 100%;
  padding: 8px;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
}

.map-date-filter .filter-btn {
  padding: 8px 16px;
  height: fit-content;
}

.comp-map-full {
  flex: 1;
  z-index: 0;
}

/* Map markers */
.map-avatar-marker {
  background: none;
  border: none;
}

.marker-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.marker-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--bg3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.map-popup {
  min-width: 180px;
}

/* ---- Resumen (pantalla de inicio) ---- */

.summary {
  /* width + align-self en vez de margin auto: .screen es flex column y un
     margin auto dejaba el bloque en shrink-to-fit en vez de los 880px. */
  display: block;
  width: 100%;
  max-width: 880px;
  align-self: center;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 24px;
}

.summary-chart {
  width: 100%;
}

.summary-periods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.summary-card {
  background: var(--bg2);
  border-radius: 12px;
  padding: 16px;
}

.summary-card h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text2);
  margin-bottom: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.summary-stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.summary-stat-label {
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
}

.summary-block {
  background: var(--bg2);
  border-radius: 12px;
  padding: 16px;
  margin-top: 14px;
}

.summary-event {
  display: flex;
  align-items: center;
  gap: 12px;
}

.summary-event-date {
  background: var(--bg3);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: center;
  min-width: 58px;
}

.summary-event-day {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.summary-event-month {
  font-size: 10px;
  color: var(--text2);
  text-transform: uppercase;
}

.summary-hint {
  text-align: center;
  color: var(--text2);
  font-size: 12px;
  margin-top: 14px;
  line-height: 1.6;
}

.summary-empty {
  color: var(--text2);
  font-size: 13px;
  text-align: center;
  padding: 18px 0;
}
