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

:root {
  --bg: #0f172a;
  --panel: rgba(15, 23, 42, 0.94);
  --card: #1e293b;
  --border: rgba(148, 163, 184, 0.2);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --ok: #22c55e;
  --warn: #f59e0b;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  min-width: 0;
}

#route-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.badge-live {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.badge-connecting {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.topbar-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

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

#map {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: var(--panel);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  max-height: 44vh;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
}

.sheet.collapsed .runner-list {
  display: none;
}

.sheet-handle {
  padding: 8px 16px 10px;
  cursor: pointer;
  user-select: none;
}

.handle-bar {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.45);
  margin: 0 auto 8px;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.runner-list {
  overflow-y: auto;
  padding: 0 12px 14px;
  display: grid;
  gap: 8px;
}

.runner-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}

.runner-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.runner-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
}

.runner-main {
  min-width: 0;
}

.runner-name {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.runner-bib {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.runner-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.runner-stats {
  text-align: right;
  font-size: 13px;
}

.runner-km {
  font-weight: 700;
  font-size: 15px;
}

.runner-pace {
  font-size: 12px;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 18px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.runner-marker-pin {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  color: #0f172a;
  border: 2px solid #ffffff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.km-marker {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #38bdf8;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  text-align: center;
}
