: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: auto;
  min-width: 0;
  flex: 1 1 auto;
}

.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;
}

.simulation-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  min-width: 0;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  max-width: none;
  flex: 0 0 auto;
  -webkit-appearance: none;
  appearance: none;
}

.simulation-button > span:last-child {
  min-width: auto;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.1;
}

.simulation-icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #c9d1dc;
  background: #ffffff;
}

.simulation-icon-svg {
  width: 14px;
  height: 14px;
  display: block;
}

.simulation-icon-play {
  fill: #6b7280;
}

.simulation-icon-pause-a,
.simulation-icon-pause-b {
  fill: #dc2626;
  opacity: 0;
}

.simulation-button.active .simulation-icon {
  border-color: #ef4444;
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #fff6f6 45%, #fee2e2 75%, #fecaca 100%);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.18), 0 0 12px rgba(239, 68, 68, 0.35);
}

.simulation-button.active .simulation-icon-play {
  opacity: 0;
}

.simulation-button.active .simulation-icon-pause-a,
.simulation-button.active .simulation-icon-pause-b {
  opacity: 1;
}

.simulation-button.active {
  border-color: #ef4444 !important;
  color: #991b1b !important;
  font-weight: 700;
  background: radial-gradient(circle at 45% 50%, #fffefe 0%, #ffe8e8 46%, #fecaca 80%, #fca5a5 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 0 14px rgba(239, 68, 68, 0.24);
}

.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;
}

.simulation-toast {
  position: fixed;
  left: 50%;
  bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(10px);
  z-index: 1300;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #f2b8b8;
  background: rgba(255, 246, 246, 0.96);
  color: #8f1d1d;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: auto;
  transition: opacity 280ms ease, transform 280ms ease;
}

.simulation-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.background-toast-action {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.background-toast-action:hover {
  color: #6f1515;
}

.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;
}

.weather-card {
  width: min(720px, 96vw);
  padding: 0;
  overflow: hidden;
}

.weather-card .about-header {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.weather-modal-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.weather-body {
  max-height: calc(84vh - 64px);
  overflow: auto;
  padding: 10px 12px 12px;
}

.weather-current {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0 12px;
  border-bottom: 1px solid rgba(205, 215, 211, 0.9);
}

.weather-current-icon {
  width: 98px;
  height: 98px;
  border-radius: 20px;
  background: linear-gradient(180deg, #f4f8f7, #edf4f1);
  display: grid;
  place-items: center;
}

.weather-current-icon span {
  display: block;
  line-height: 0;
}

.weather-current-icon span svg {
  width: 38px;
  height: 38px;
  display: block;
}

.weather-current-icon strong {
  margin-top: -6px;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.06em;
}

.weather-current-summary h3 {
  margin: 2px 0 4px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.weather-current-summary p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.weather-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.weather-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.weather-chip b {
  color: var(--text);
}

.weather-timeline-panel {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 0 0 10px;
  min-width: 0;
}

.weather-timeline-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.weather-timeline-title {
  display: grid;
  gap: 2px;
}

.weather-timeline-title strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.weather-timeline-title span {
  color: var(--muted);
  font-size: 12px;
}

.weather-timeline-sun {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 10px;
  min-width: 0;
  max-width: 100%;
  padding-top: 1px;
}

.weather-sun-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  white-space: nowrap;
}

.weather-sun-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.weather-sun-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.weather-sun-text {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  line-height: 1;
}

.weather-sun-text b {
  color: var(--text);
  font-size: 12px;
}

.weather-sun-item--sunrise {
  color: #b57a17;
}

.weather-sun-item--sunset {
  color: #b45b2a;
}

.weather-sun-item--daylight {
  color: #2f7f67;
}

.weather-timeline-track {
  position: relative;
  padding-top: 0;
  min-width: 0;
}

.weather-timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
  width: 100%;
  scrollbar-width: thin;
}

.weather-timeline-strip {
  position: relative;
  width: max-content;
  min-width: 100%;
  padding-top: 38px;
}

.weather-timeline-markers {
  position: absolute;
  inset: 0 0 auto 0;
  height: 34px;
  pointer-events: none;
}

.weather-timeline-marker {
  position: absolute;
  top: 0;
  transform: translateX(var(--marker-shift, -50%));
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
}

.weather-timeline-marker::after {
  content: "";
  width: 1px;
  height: 12px;
  background: #cdd7d3;
}

.weather-timeline-marker span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(16, 24, 20, 0.04);
}

.weather-timeline-marker[data-align="start"] {
  --marker-shift: 0%;
  justify-items: start;
}

.weather-timeline-marker[data-align="end"] {
  --marker-shift: -100%;
  justify-items: end;
}

.weather-timeline-marker--day.active span {
  border-color: var(--accent);
  background: #e9f5f1;
  color: var(--accent);
  font-weight: 700;
}

.weather-timeline-marker--sunrise span {
  border-color: #f0c86f;
  background: #fff8e9;
  color: #b57a17;
}

.weather-timeline-marker--sunset span {
  border-color: #f2b08a;
  background: #fff4ef;
  color: #b45b2a;
}

.weather-hour-timeline {
  display: flex;
  gap: 8px;
  margin-top: 0;
  padding: 4px 2px 10px;
  scroll-snap-type: x proximity;
  height: 120px;
  width: max-content;
  min-width: 100%;
  box-sizing: border-box;
}

.weather-hour-timeline--compact {
  margin-top: 10px;
  padding-bottom: 8px;
  height: 114px;
}

.weather-hour {
  flex: 0 0 74px;
  min-width: 74px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 7px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  scroll-snap-align: center;
}

.weather-hour.active {
  border-color: var(--accent);
  background: #e9f5f1;
  color: var(--accent);
  box-shadow: 0 6px 18px rgba(20, 125, 100, 0.14);
}

.weather-hour-icon {
  display: block;
  margin: 10px 0;
  font-size: 20px;
}

.weather-hour-icon svg {
  width: 20px;
  height: 20px;
  display: block;
  margin: 0 auto;
}

.weather-hour strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

.weather-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.weather-alerts {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.weather-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid rgba(205, 215, 211, 0.9);
  border-radius: 12px;
  background: #fbfcfc;
}

.weather-alert--advisory {
  border-color: rgba(47, 127, 103, 0.22);
  background: #f4fbf8;
}

.weather-alert--danger {
  border-color: rgba(208, 90, 43, 0.24);
  background: #fff6f2;
}

.weather-alert-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.weather-alert-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.weather-alert-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.weather-alert-text strong {
  color: var(--text);
  font-size: 13px;
}

.weather-metric {
  border: 1px solid rgba(205, 215, 211, 0.9);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.weather-metric b {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 14px;
}

.weather-wind-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.weather-wind-compass {
  width: 28px;
  height: 28px;
  display: block;
  flex: 0 0 auto;
}

.weather-wind-label {
  min-width: 0;
}

.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;
}

.weather-widget {
  position: absolute;
  top: 58px;
  right: 16px;
  z-index: 42;
  width: 118px;
  min-width: 118px;
  max-width: 118px;
  aspect-ratio: 1 / 1;
  height: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto 1fr auto;
  row-gap: 1px;
  column-gap: 6px;
  align-items: start;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 26px;
  padding: 10px 10px 9px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.04);
  color: var(--text);
  box-shadow: 0 10px 26px rgba(15, 28, 24, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(26px) saturate(1.65);
  -webkit-backdrop-filter: blur(26px) saturate(1.65);
  cursor: pointer;
  overflow: hidden;
}

.weather-widget[hidden] {
  display: none;
}

.weather-widget:hover {
  border-color: rgba(20, 125, 100, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.12)),
    rgba(255, 255, 255, 0.06);
}

.weather-widget-icon {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  font-size: 22px;
  line-height: 1;
  margin-top: 1px;
}

.weather-widget-icon svg {
  width: 40px;
  height: 40px;
  display: block;
}

.weather-widget-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  text-align: center;
  padding-top: 5px;
}

.weather-widget-temp {
  font-size: 32px;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.weather-widget-summary {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.05;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
}

.weather-widget-extra {
  grid-column: 1 / 3;
  grid-row: 4;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  align-self: end;
}

.weather-widget-pill {
  min-width: 0;
  border-radius: 14px;
  padding: 5px 4px 4px;
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(200, 210, 206, 0.62);
  color: var(--muted);
  font-size: 9px;
  line-height: 1.05;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.weather-widget-pill-k {
  display: block;
  font-size: 8px;
  line-height: 1;
}

.weather-widget-pill-v {
  display: block;
  color: var(--text);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

.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;
  white-space: nowrap;
}

.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;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border-style: solid;
  border-width: 2px;
  border-color: var(--runner-stroke, #1f2937);
  background: var(--runner-fill, #6b7280);
  box-shadow: none;
  z-index: 5;
}

.runner-marker.rm-s12 { width: 12px; height: 12px; }
.runner-marker.rm-s14 { width: 14px; height: 14px; }
.runner-marker.rm-s18 { width: 18px; height: 18px; }
.runner-marker.rm-s22 { width: 22px; height: 22px; }

.runner-marker.rm-b1 { border-width: 1px; }
.runner-marker.rm-b2 { border-width: 2px; }
.runner-marker.rm-b3 { border-width: 3px; }

.runner-marker.rm-selected { z-index: 15; }
.runner-marker.rm-selected.rm-emphasized {
  z-index: 20;
  box-shadow: var(--runner-glow, none);
}

.runner-marker.runner-marker-uncertain {
  animation: runner-uncertain-blink 1.1s ease-in-out infinite;
}
body.simulation-on .runner-marker.runner-marker-uncertain {
  animation: none !important;
}

@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;
}
body.simulation-on .user-location-marker.user-location-marker-near {
  animation: none !important;
}

.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;
}
body.simulation-on .user-route-snap-marker {
  animation: none !important;
}

@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;
  }

  .weather-widget {
    top: 56px;
    right: 10px;
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    padding: 6px 6px 5px;
    border-radius: 20px;
  }

  .weather-widget-icon {
    font-size: 16px;
  }

  .weather-widget-icon svg {
  width: 20px;
  height: 20px;
}

  .weather-widget-temp {
    font-size: 19px;
  }

  .weather-widget-summary {
    font-size: 8px;
  }

  .weather-widget-pill {
    padding: 4px 3px 3px;
  }

  .weather-widget-pill-k {
    font-size: 7px;
  }

  .weather-widget-pill-v {
    font-size: 8px;
  }

  .weather-current {
    grid-template-columns: 1fr;
  }

  .weather-current-icon {
    width: 100%;
    height: 88px;
    grid-auto-flow: column;
    gap: 8px;
  }

  .weather-current-icon strong {
    margin-top: 0;
  }

  .weather-timeline-head {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .weather-timeline-sun {
    justify-content: flex-start;
    gap: 6px 10px;
  }

  .weather-sun-item {
    white-space: normal;
  }

  .weather-sun-text {
    font-size: 11px;
  }

  .weather-hour {
    flex-basis: 68px;
    min-width: 68px;
  }

  .weather-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weather-alert {
    grid-template-columns: 1fr;
    gap: 6px;
  }

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

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

  .simulation-button {
    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;
  }
}
