:root {
  --bg: #f4f7f6;
  --panel: #ffffff;
  --text: #18211f;
  --muted: #63706d;
  --line: #d7dfdc;
  --accent: #147d64;
  --accent-2: #d64b36;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  height: calc(var(--app-vh, 1dvh) * 100);
  min-height: calc(var(--app-vh, 1dvh) * 100);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

body.embed-mode .brand {
  display: none;
}

body.embed-mode .toolbar {
  padding: 8px 10px;
}

body.embed-mode .status {
  display: none;
}

body.embed-mode .workspace {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.toolbar,
.timeline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 800;
  font-size: 18px;
}

.brand-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: 8px;
}

.brand-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 6px;
}

.brand-menu-button .brand {
  line-height: 1;
}

.brand-menu-caret {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.brand-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 1400;
  min-width: 220px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}

.brand-menu[hidden] {
  display: none;
}

.brand-menu a,
.brand-menu span,
.brand-menu button {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  background: transparent;
  text-decoration: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
}

.brand-menu a:hover,
.brand-menu button:hover {
  background: #f2f6f5;
}

.brand-menu .disabled {
  color: var(--muted);
  cursor: default;
}

.brand-menu-divider {
  height: 1px;
  margin: 4px 2px;
  background: var(--line);
}

.brand-menu .brand-menu-mobile-only {
  display: none;
}

.mini-title {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.network-badge {
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  color: var(--muted);
  background: #f7faf9;
  cursor: pointer;
}

.network-badge.online {
  color: #116149;
  border-color: #b9d8ce;
  background: #edf8f3;
}

.network-badge.offline {
  color: #8f2f23;
  border-color: #e1bbb5;
  background: #fff1ef;
}

.network-badge.degraded {
  color: #7d5a10;
  border-color: #e5d4a8;
  background: #fff8e8;
}

.mobile-actions {
  display: none;
}

.about-open-desktop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  min-width: 92px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.about-open {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  padding: 0;
  font-weight: 700;
}

.startup-panel {
  display: contents;
}

.startup-panel-header {
  display: none;
}

.mobile-start-open {
  display: none;
}

label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

select,
input,
button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

select {
  min-width: 220px;
  padding: 0 8px;
}

input[type="search"] {
  width: 100%;
  padding: 0 10px;
}

button {
  padding: 0 10px;
  cursor: pointer;
}

button.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.status {
  display: none;
}

.sw-update-banner {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 52px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #101418;
  color: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  font-size: 12px;
}

.sw-update-banner[hidden] {
  display: none !important;
}

.sw-update-banner button {
  height: 24px;
  border-radius: 999px;
  border: 1px solid #5d6c7a;
  background: #1b2430;
  color: #fff;
  padding: 0 10px;
  font-size: 12px;
}

.sw-update-banner button:hover {
  background: #263346;
}

.mobile-list-open { display: none; }
.mobile-refresh-open { display: none; }
.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
}

.pushall-status {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
  margin-top: 6px;
}

.pushall-surname-wrap {
  display: none;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: stretch;
  width: 100%;
  margin-top: 6px;
}

.pushall-surname-wrap button {
  width: 100%;
  min-width: 0;
  border-radius: 8px;
  height: 32px;
  font-size: 12px;
}

.surname-selected-box {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: #fafcfb;
}

.surname-selected-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.surname-selected-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin: 4px 0;
}

.panel-mobile-header {
  display: none;
}

.about-modal {
  position: fixed;
  inset: 0;
  background: rgba(9, 17, 23, 0.45);
  display: none;
  z-index: 1400;
  padding: 16px;
}

.about-modal.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.about-card {
  width: min(560px, 92vw);
  max-height: 84vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}

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

.offline-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.about-close {
  width: 32px;
  height: 32px;
  padding: 0;
}

.about-card p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
}

.participant-card {
  width: min(860px, 96vw);
}

.participant-body {
  display: grid;
  gap: 10px;
}

.participant-headline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: start;
}

.participant-name {
  font-size: 20px;
  font-weight: 700;
}

.participant-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.participant-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.participant-action-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 26px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  box-sizing: border-box;
}

.participant-subscribe-btn {
  border: 1px solid #82c6b0;
  background: #e9f5f1;
  color: #125846;
  cursor: pointer;
}

.participant-cup-points {
  max-width: min(100%, 48vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.participant-action-btn-dark {
  border: 1px solid #111;
  background: #111;
  color: #fff;
}

.participant-cup-points:hover,
.participant-cup-points:focus-visible {
  background: #000;
  color: #fff;
  outline: none;
}

.participant-sub {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--muted);
}

.participant-rating-overall-banner {
  grid-column: 1 / -1;
  font-size: 11px;
  line-height: 1.3;
  color: #5e7088;
  background: #f6f9fd;
  border: 1px solid #dde6f2;
  border-radius: 8px;
  padding: 5px 8px;
}

.participant-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.participant-k {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.participant-v {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.participant-rating-mini {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  text-decoration: none;
}

.participant-rating-tile {
  display: block;
  background: #fff;
  border: 1px solid #d6deea;
  border-radius: 10px;
  padding: 7px 9px;
}

.participant-rating-mini:hover .participant-rating-tile,
.participant-rating-mini:focus-visible .participant-rating-tile {
  border-color: #8fb7e3;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.02), 0 6px 14px rgba(59, 130, 246, 0.08);
}

.participant-rating-k {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #5e7088;
  letter-spacing: 0.02em;
}

.participant-rating-v {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  color: #1f334d;
}

.participant-rating-flat .participant-rating-v { color: #126638; }
.participant-rating-up .participant-rating-v { color: #8f2323; }
.participant-rating-down .participant-rating-v { color: #1f4f9b; }

.participant-splits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.participant-splits-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.participant-splits-table th,
.participant-splits-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.participant-splits-table th {
  font-size: 11px;
  color: var(--muted);
}

.split-time-cell {
  position: relative;
}

.split-time-estimated {
  color: #f97316;
  font-weight: 700;
  white-space: nowrap;
}

.split-estimated-button {
  margin-left: 5px;
  width: 17px;
  height: 17px;
  border: 1px solid rgba(249, 115, 22, 0.55);
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.12);
  color: #c2410c;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.split-time-popover {
  display: none;
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 8px;
  min-width: 210px;
  max-width: 280px;
  padding: 8px 10px;
  border: 1px solid rgba(249, 115, 22, 0.35);
  border-radius: 10px;
  background: #fff7ed;
  box-shadow: 0 12px 28px rgba(124, 45, 18, 0.18);
  color: #7c2d12;
  font-size: 12px;
  font-weight: 600;
  white-space: normal;
}

.split-time-cell:hover .split-time-popover,
.split-time-cell:focus-within .split-time-popover,
.split-time-cell.open .split-time-popover {
  display: block;
}

.participant-empty {
  color: var(--muted);
  font-size: 13px;
}

.pushall-login-link {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.map-stack {
  height: 100%;
  min-height: 0;
  position: relative;
  border-right: 1px solid var(--line);
}

.map {
  min-height: 0;
  height: 100%;
}

.map .maplibregl-ctrl-top-left,
.map .maplibregl-ctrl-top-right,
.map .maplibregl-ctrl-bottom-left,
.map .maplibregl-ctrl-bottom-right {
  z-index: 40;
}

.map .maplibregl-ctrl-bottom-right {
  top: 8px;
  right: 8px;
  bottom: auto;
  margin: 0;
}

.map .maplibregl-ctrl-top-right {
  margin-top: 8px;
  margin-right: 52px;
}

.map .maplibregl-ctrl-top-right .maplibregl-ctrl {
  margin: 0;
}

.map .maplibregl-ctrl-bottom-right .maplibregl-ctrl {
  margin: 0;
}

.map-layers-ctrl {
  position: relative;
  display: flex;
  gap: 6px;
  align-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  z-index: 41;
}

.map-layers-main-btn,
.map-layers-top-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #c4d4ce;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
  cursor: pointer;
}

.map-layers-main-btn svg {
  width: 17px;
  height: 17px;
}

.map-layers-top-btn.active {
  border-color: #6db79f;
  background: #e9f5f1;
  color: #0f4c3c;
}

.map-layers-panel {
  display: none;
  position: absolute;
  top: 34px;
  right: 0;
  width: 180px;
  padding: 8px;
  border: 1px solid #c4d4ce;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(20, 29, 25, 0.22);
  z-index: 41;
}

.map-layers-ctrl.open .map-layers-panel {
  display: block;
}

.map-layers-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.map-layer-option {
  width: 100%;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #c4d4ce;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  display: block;
  cursor: pointer;
}

.map-layer-option.active {
  border-color: #6db79f;
  background: #e9f5f1;
  color: #0f4c3c;
}

.route-profile {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: transparent;
  border: 0;
  backdrop-filter: none;
  border-radius: 0;
  padding: 0 8px 0;
  display: block;
  pointer-events: none;
}

.route-profile-head {
  position: absolute;
  right: 8px;
  bottom: calc(clamp(88px, 9vw, 126px) + 4px);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 0;
  pointer-events: none;
  z-index: 21;
}

.route-profile-meta {
  color: var(--muted);
  font-size: clamp(11px, 0.7vw, 14px);
  background: color-mix(in srgb, #ffffff 65%, transparent);
  border: 1px solid color-mix(in srgb, #d8e5e0 70%, transparent);
  border-radius: 999px;
  padding: 2px 10px;
  box-shadow: 0 2px 10px rgba(15, 28, 24, 0.14);
  pointer-events: none;
}

.route-profile-svg {
  display: block;
  width: 100%;
  height: clamp(88px, 9vw, 126px);
  min-height: clamp(88px, 9vw, 126px);
  border: 0;
  border-radius: 0;
  background: transparent;
  pointer-events: auto;
  overflow: visible;
  touch-action: none;
}

.profile-runner {
  cursor: pointer;
}

.panel {
  min-height: 0;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--panel);
}

.panel-tools {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto));
  justify-content: start;
  gap: 8px;
  padding: 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}

.panel-search {
  position: sticky;
  top: 55px;
  padding: 8px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}

.panel-search input[type="search"] {
  width: 100%;
}

.list-stats-row {
  position: sticky;
  top: 107px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  gap: 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}

.list-stats {
  padding: 0;
  font-size: 12px;
  color: var(--muted);
}

.filters-toggle {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
}

.filters-toggle.active {
  border-color: #82c6b0;
  background: #e9f5f1;
  color: #125846;
}

.panel-filters {
  position: sticky;
  top: 138px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 2;
  overflow-x: auto;
}

.panel-filters.collapsed {
  display: none;
}

.filter-toggle {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbfa;
  color: var(--muted);
  font-size: 12px;
}

.filter-toggle.active {
  background: #e9f5f1;
  border-color: #82c6b0;
  color: #125846;
}

.filter-division-toggle {
  height: 30px;
  min-width: 180px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbfa;
  color: var(--muted);
  font-size: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  position: relative;
}

.filter-division-label {
  position: relative;
  z-index: 1;
  text-align: center;
  font-weight: 600;
}

.filter-division-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(50% - 2px);
  height: calc(100% - 4px);
  border-radius: 999px;
  background: #e9f5f1;
  border: 1px solid #82c6b0;
  transition: transform 0.18s ease;
}

.filter-division-toggle[aria-pressed="false"] .filter-division-thumb {
  transform: translateX(100%);
}

.filter-division-toggle[aria-pressed="true"] .filter-division-label-absolute,
.filter-division-toggle[aria-pressed="false"] .filter-division-label-masters {
  color: #125846;
}

.leader {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.leader input {
  width: 18px;
  height: 18px;
}

.leader-select-zone {
  width: 32px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.leader strong {
  display: block;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.leader > span,
.leader > span > span {
  color: var(--muted);
  font-size: 12px;
}

.leader-meta {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.runner-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid #1f2937;
  flex: 0 0 10px;
}

.runner-marker {
  box-sizing: border-box;
  cursor: pointer;
}

.runner-marker.runner-marker-uncertain {
  animation: runner-uncertain-blink 1.1s ease-in-out infinite;
}

@keyframes user-location-near-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(24, 124, 252, 0.18); }
  50% { box-shadow: 0 0 0 8px rgba(24, 124, 252, 0); }
}

.user-location-marker {
  width: 30px;
  height: 30px;
  padding: 8px;
  border-radius: 999px;
  background: transparent;
  border: 0;
  box-sizing: border-box;
  position: relative;
  touch-action: manipulation;
  pointer-events: auto;
  z-index: 30;
}

.user-location-marker.user-location-marker-near {
  animation: user-location-near-pulse 1.6s ease-in-out infinite;
}

.user-location-marker::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 999px;
  background: #1d4ed8;
  border: 2px solid #ffffff;
  box-sizing: border-box;
}

.user-location-marker.user-location-marker-near::before {
  background: linear-gradient(135deg, #22d3ee 0%, #2563eb 45%, #9333ea 100%);
  border-color: #f8fafc;
}

.user-route-snap-marker {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22d3ee 0%, #2563eb 45%, #9333ea 100%);
  border: 2px solid #f8fafc;
  box-sizing: border-box;
  animation: user-location-near-pulse 1.4s ease-in-out infinite;
}

@keyframes runner-uncertain-blink {
  0%, 100% { opacity: 0.98; }
  50% { opacity: 0.38; }
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  line-height: 1.2;
}

.leader .status-badge.status-finished { color: #115e3c; border-color: #8ecfb3; background: #eaf9f1; }
.leader .status-badge.status-active { color: #1f4f8a; border-color: #9ec6f1; background: #edf5ff; }
.leader .status-badge.status-prestart { color: #4b5563; border-color: #cfd4dc; background: #f4f6f8; }
.leader .status-badge.status-dnf,
.leader .status-badge.status-dsq { color: #8f1d10; border-color: #efb0a6; background: #fff3f1; }
.leader .status-badge.status-uncertain { color: #8a5a00; border-color: #e8d08f; background: #fff8e7; }

.distance {
  color: var(--accent);
  font-weight: 700;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.distance-gap {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.timeline {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  position: relative;
  z-index: 500;
  display: grid;
  grid-template-rows: auto auto;
  gap: 1px;
  padding-top: 2px;
  padding-bottom: calc(2px + env(safe-area-inset-bottom, 0px));
}

.timeline-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.timeline button,
.timeline select {
  height: 22px;
  font-size: 12px;
  padding: 0 5px;
}

#timeSlider {
  width: 100%;
}

#timeLabel {
  min-width: 120px;
  text-align: right;
  color: var(--muted);
  line-height: 1.1;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.speed-control select {
  min-width: 82px;
}

@media (max-width: 900px) {
  .toolbar {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 6px;
    padding: 6px 8px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .map-stack {
    border-right: 0;
  }

  .map {
    height: 100%;
    min-height: 0;
  }

  .mobile-actions {
    display: inline-flex;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    gap: 6px;
  }

  .about-open-desktop {
    display: none;
  }

  .mobile-list-open,
  .mobile-start-open {
    display: block;
    height: 30px;
    padding: 0 9px;
    font-size: 12px;
  }

  .about-open {
    display: none;
  }

  .brand-menu .brand-menu-mobile-only {
    display: block;
  }

  .mini-title {
    grid-column: 1 / -1;
    max-width: 100%;
    font-size: 10px;
    line-height: 1.15;
  }

  .network-badge {
    position: static;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    width: auto;
    height: 22px;
    min-width: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 20px;
    overflow: visible;
    border-width: 1px;
    z-index: auto;
    margin-right: 2px;
  }

  .about-card {
    width: min(96vw, 520px);
    max-height: 88vh;
    padding: 10px 10px;
  }

  .about-card p {
    margin: 0 0 8px;
    font-size: 13px;
  }

  .startup-panel {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: none;
    background: var(--panel);
    padding: 10px 12px;
    overflow: auto;
  }

  .startup-panel.mobile-open {
    display: block;
  }

  .startup-panel-header {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0 10px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    margin-bottom: 10px;
  }

  .startup-panel label {
    display: grid;
    gap: 4px;
    margin-bottom: 10px;
  }

  .startup-panel .refresh-button {
    display: none !important;
  }

  .startup-panel select,
  .startup-panel input[type="search"] {
    width: 100%;
    min-width: 0;
  }

  .mobile-start-close {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
  }

  .panel {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    border: 0;
    max-height: calc(var(--app-vh, 1dvh) * 100);
    width: 100vw;
  }

  .panel.mobile-open {
    display: block;
  }

  .panel-mobile-header {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
  }

  .panel-search {
    top: 55px;
    padding: 8px 12px;
  }

  .mobile-list-close {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
  }

  .timeline {
    gap: 0;
    padding: 1px 6px;
  }

  .timeline-top {
    gap: 4px;
  }

  .timeline-controls {
    gap: 4px;
  }

  .timeline button,
  .timeline select {
    height: 20px;
    font-size: 11px;
    padding: 0 4px;
  }

  .speed-control {
    font-size: 11px;
    gap: 2px;
  }

  .speed-label {
    display: none;
  }

  #timeSlider {
    width: 100%;
    margin-top: 0;
  }

  #timeLabel {
    min-width: 0;
    text-align: right;
    font-size: 10px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .participant-modal.open {
    align-items: flex-start;
    justify-content: center;
    padding-top: max(8px, env(safe-area-inset-top));
  }

  .participant-modal .participant-card {
    width: min(96vw, 860px);
    max-width: min(96vw, 860px);
    max-height: calc(var(--app-vh, 1dvh) * 100 - max(16px, env(safe-area-inset-top)) - 16px);
    border-radius: 10px;
    border: 1px solid var(--line);
    padding: 12px;
  }

  .participant-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .participant-rating-mini {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .participant-headline {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .participant-cup-points {
    justify-self: end;
    max-width: min(100%, 52vw);
  }

  .participant-splits-table {
    width: max-content;
    min-width: 100%;
    font-size: 10px;
    table-layout: auto;
  }

  .participant-splits-table th,
  .participant-splits-table td {
    padding: 3px 4px;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    line-height: 1.1;
  }

  .participant-splits-table th:nth-child(-n+3),
  .participant-splits-table td:nth-child(-n+3) {
    width: auto;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .participant-splits-table th:nth-child(1),
  .participant-splits-table td:nth-child(1) {
    min-width: min(70px, 16ch);
  }

  .participant-splits-table th:nth-child(2),
  .participant-splits-table td:nth-child(2) {
    min-width: min(44px, 12ch);
  }

  .participant-splits-table th:nth-child(3),
  .participant-splits-table td:nth-child(3) {
    min-width: min(40px, 10ch);
  }

  .participant-splits-table th:nth-child(n+4),
  .participant-splits-table td:nth-child(n+4) {
    width: auto;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
  }

  .participant-splits-table .split-main {
    display: inline;
  }

  .participant-splits-table .split-sub {
    display: block;
    margin-top: 0;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.05;
  }
}

@media (max-width: 359px) {
  .participant-grid {
    grid-template-columns: 1fr;
  }
}
