:root {
  color-scheme: light;
  --header-height: 170px;
  --bg: #eef2f6;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-soft: #f8fafc;
  --text: #142033;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.11);
  --line-strong: rgba(15, 23, 42, 0.2);
  --accent: #d97706;
  --accent-strong: #b45309;
  --accent-soft: rgba(245, 158, 11, 0.14);
  --green: #0f9f52;
  --green-soft: rgba(15, 159, 82, 0.15);
  --red: #e11d48;
  --red-soft: rgba(225, 29, 72, 0.15);
  --gray-pill: #526174;
  --blue: #2563eb;
  --purple: #7c3aed;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07101f;
  --surface: rgba(15, 23, 42, 0.9);
  --surface-solid: #111c2e;
  --surface-soft: #162337;
  --text: #edf3fb;
  --muted: #9fb0c6;
  --line: rgba(226, 232, 240, 0.12);
  --line-strong: rgba(226, 232, 240, 0.22);
  --accent: #f59e0b;
  --accent-strong: #fbbf24;
  --accent-soft: rgba(245, 158, 11, 0.17);
  --green: #24c76f;
  --green-soft: rgba(36, 199, 111, 0.17);
  --red: #fb4f72;
  --red-soft: rgba(251, 79, 114, 0.17);
  --gray-pill: #8190a4;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --shadow: 0 22px 55px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.26);
}



* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 5%, rgba(245, 158, 11, 0.16), transparent 31rem),
    radial-gradient(circle at 90% 18%, rgba(37, 99, 235, 0.1), transparent 34rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.page-watermark {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("custom_logo.png") center 59% / min(52vw, 580px) auto no-repeat;
  opacity: 0.045;
  filter: saturate(0.85);
}

html[data-theme="dark"] .page-watermark {
  opacity: 0.035;
}



.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: calc(10px + var(--safe-top)) calc(12px + var(--safe-right)) 10px calc(12px + var(--safe-left));
  pointer-events: none;
}

.header-inner {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  pointer-events: auto;
}

.event-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.event-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(15, 23, 42, 0.13));
}

.event-copy {
  min-width: 0;
}

.live-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: 4px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.live-badge.is-stale {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border-color: color-mix(in srgb, var(--red) 36%, transparent);
}

.live-badge.is-stale .live-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 15%, transparent);
}

.live-dot,
.pulse-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 15%, transparent);
}

.file-update-state,
.connection-state {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-update-state.is-stale {
  color: var(--red);
}

/* Kitsal ekraanil kerivad pikad päisetekstid ainult siis, kui need ei mahu. */
.header-marquee {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.header-marquee-text {
  display: inline-block;
  min-width: max-content;
  white-space: nowrap;
  transform: translateX(0);
  will-change: transform;
}

.connection-state.is-error {
  color: var(--red);
}

.file-update-state {
  flex: 1 1 auto;
}

.event-copy h1 {
  margin: 0;
  overflow: hidden;
  font-size: clamp(1.1rem, 2.2vw, 1.55rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-copy p {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-meta-row {
  min-width: 0;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.event-meta-row > #eventMeta {
  flex: 0 0 auto;
  margin: 0;
}

.latest-finishers {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  color: var(--muted);
}

.latest-finishers[hidden] {
  display: none;
}

.latest-finishers-label {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 850;
}

.latest-finishers-viewport {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
}

.latest-finishers-track {
  width: max-content;
  display: flex;
  align-items: center;
  transform: translateX(0);
  will-change: transform;
}

.latest-finishers-track.is-moving {
  animation: latest-finishers-scroll var(--ticker-duration, 28s) linear infinite;
}

.latest-finishers:hover .latest-finishers-track,
.latest-finishers:focus-within .latest-finishers-track {
  animation-play-state: paused;
}

.latest-finishers-track:not(.is-moving) .latest-finishers-group[aria-hidden="true"] {
  display: none;
}

.latest-finishers-group {
  flex: 0 0 auto;
  padding-right: 24px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.latest-finisher-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  white-space: nowrap;
}

.latest-finisher-item::after {
  content: "•";
  margin-left: 6px;
  color: color-mix(in srgb, var(--muted) 55%, transparent);
}

.latest-finisher-name {
  color: var(--muted);
  font-weight: 750;
}

.latest-finisher-class,
.route-class-link {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  color: var(--accent-strong);
  background: var(--accent-soft);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.latest-finisher-class {
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 0.62rem;
}

.latest-finisher-class:hover,
.latest-finisher-class:focus-visible,
.route-class-link:hover,
.route-class-link:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 66%, var(--line));
  background: color-mix(in srgb, var(--accent) 20%, var(--surface-solid));
  outline: none;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.latest-finisher-class.is-static {
  cursor: default;
}

.latest-finisher-result {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.class-picker {
  width: 150px;
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.class-picker select {
  width: 100%;
  min-height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background-color: var(--surface-solid);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  appearance: none;
  -webkit-appearance: none;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.class-picker select:disabled {
  opacity: 0.65;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.icon-button {
  position: relative;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.icon-button:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.icon-button:active {
  transform: translateY(0);
}

.icon-button:disabled,
.icon-button[aria-disabled="true"] {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.icon-button:disabled:hover,
.icon-button[aria-disabled="true"]:hover {
  border-color: var(--line);
  background: var(--surface-solid);
  transform: none;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button.is-spinning svg {
  animation: spin 0.75s linear infinite;
}

.text-button {
  width: auto;
  padding: 0 11px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.text-button[aria-pressed="true"] {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: var(--accent-soft);
}

.button-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--purple);
  border: 2px solid var(--surface-solid);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 900;
}

.main-content {
  width: min(1180px, calc(100% - 24px - var(--safe-left) - var(--safe-right)));
  margin: 8px auto 0;
}

.status-strip {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: 1fr 0.55fr 1.35fr;
  gap: 10px;
}

.status-item {
  min-width: 0;
  padding: 11px 13px;
  display: grid;
  gap: 4px;
  background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.status-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.status-item strong {
  overflow: hidden;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-panel {
  scroll-margin-top: calc(var(--header-height) + 8px);
  overflow: clip;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.panel-heading {
  padding: 16px 18px 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.panel-heading h2,
.dialog-header h2 {
  margin: 0;
  font-size: clamp(1.08rem, 2vw, 1.4rem);
  letter-spacing: -0.02em;
}

.runner-dialog-meta {
  min-width: 0;
  max-width: min(520px, calc(100vw - 120px));
  margin: 5px 0 0;
  display: grid;
  gap: 2px;
  overflow: visible;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
}

.runner-meta-line {
  min-width: 0;
  display: block;
  overflow-wrap: anywhere;
}

.runner-meta-ids {
  font-variant-numeric: tabular-nums;
}

.runner-meta-club {
  color: var(--muted);
}

.auto-refresh-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  animation: pulse 2s ease-out infinite;
}

.results-container {
  min-height: 190px;
}

.results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.results-table col.position-col {
  width: 64px;
}

.results-table col.result-col {
  width: 130px;
}

/* Punktiarvestusega klassides on tulemus pikem (nt 24 p · 3:26:24).
   Eraldi veerulaius hoiab tulemuse ja nime selgelt lahus. */
.results-table.score-results-table col.result-col {
  width: 142px;
}

.results-table col.name-col {
  width: 42%;
}

.results-table thead th {
  position: sticky;
  top: calc(var(--header-height) - 1px);
  z-index: 20;
  padding: 11px 13px;
  color: #3d2b0b;
  background: linear-gradient(90deg, #f9c55a, #f4ad37);
  border-bottom: 1px solid rgba(120, 73, 0, 0.2);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.results-table thead th:first-child,
.results-table thead th:nth-child(2) {
  text-align: right;
}

.results-table tbody tr {
  background: color-mix(in srgb, var(--surface-solid) 70%, transparent);
  transition: background 0.15s ease;
}

.results-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
}

.results-table tbody tr:hover {
  background: var(--accent-soft);
}

.results-table td {
  padding: 8px 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.results-table tbody tr:last-child td {
  border-bottom: 0;
}

.position-cell {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: right;
}

.result-cell {
  text-align: right;
}

.result-pill {
  min-width: 78px;
  min-height: 34px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  white-space: nowrap;
}

.result-pill:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: var(--accent-soft);
}

.result-pill.is-selected {
  color: var(--purple);
  border-color: color-mix(in srgb, var(--purple) 55%, transparent);
  background: color-mix(in srgb, var(--purple) 14%, var(--surface-solid));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 12%, transparent);
}

.result-pill.status-ok {
  color: var(--green);
}

.result-pill.status-mp,
.result-pill.status-dq,
.result-pill.status-dnf,
.result-pill.status-dns,
.result-pill.status-oob {
  color: #fff;
  border-color: transparent;
  background: var(--red);
}

.result-pill.status-unknown {
  color: #fff;
  border-color: transparent;
  background: var(--gray-pill);
}

/* VALIK-/punktitulemuse pill on tavalisest ajatulemusest pikem. */
.score-results-table .result-pill {
  min-width: 0;
  padding-inline: 8px;
  font-size: 0.86rem;
  letter-spacing: -0.012em;
}

.runner-button {
  max-width: 100%;
  padding: 0;
  display: block;
  overflow: hidden;
  border: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-weight: 850;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runner-button:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.club-cell {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-ranking-cell {
  overflow: hidden;
}

.route-ranking-content {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-class-name,
.route-class-link {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 7px;
  font-size: 0.68rem;
  line-height: 1.2;
  font-weight: 900;
}

.route-class-name {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}

.route-club-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.mobile-club {
  display: none;
}

.empty-state,
.loading-state,
.error-state {
  min-height: 230px;
  padding: 36px 20px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong,
.error-state strong {
  color: var(--text);
  font-size: 1.05rem;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.app-footer {
  width: min(1180px, calc(100% - 24px - var(--safe-left) - var(--safe-right)));
  margin: 12px auto calc(12px + var(--safe-bottom));
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-solid) 74%, transparent);
  border: 1px solid var(--line);
  border-radius: 13px;
  font-size: 0.69rem;
  font-weight: 650;
}

.app-dialog {
  width: min(760px, calc(100vw - 28px - var(--safe-left) - var(--safe-right)));
  max-height: min(86vh, 820px);
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.4);
}

.runner-dialog {
  width: min(640px, calc(100vw - 28px - var(--safe-left) - var(--safe-right)));
}

.compare-dialog {
  width: min(var(--compare-dialog-width, 520px), calc(100vw - 28px - var(--safe-left) - var(--safe-right)));
}

.search-dialog {
  width: min(560px, calc(100vw - 28px - var(--safe-left) - var(--safe-right)));
}

.info-dialog {
  width: min(580px, calc(100vw - 28px - var(--safe-left) - var(--safe-right)));
}

.app-dialog::backdrop {
  background: rgba(3, 8, 18, 0.62);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.dialog-shell {
  max-height: min(86vh, 820px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.dialog-header {
  padding: 15px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface-solid);
  border-bottom: 1px solid var(--line);
}

.dialog-header > div {
  min-width: 0;
}

.dialog-close {
  flex: 0 0 auto;
  box-shadow: none;
}

.dialog-body {
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
}

.runner-dialog .dialog-shell {
  height: min(86dvh, 820px);
  max-height: min(86dvh, 820px);
}

.runner-dialog .dialog-body {
  min-width: 0;
  min-height: 0;
  padding: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  overflow: hidden;
}

.runner-fixed-content {
  min-width: 0;
}

.runner-splits-region {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
}

.runner-splits-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.runner-splits-heading strong {
  font-size: 0.82rem;
}

.runner-splits-heading span {
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 650;
  text-align: right;
}

.runner-splits-scroll {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}

.runner-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.summary-card {
  min-width: 0;
  padding: 6px 7px;
  display: grid;
  gap: 3px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.summary-card span {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.summary-card strong {
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-line {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 650;
}

.table-scroll {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  -webkit-overflow-scrolling: touch;
}

.detail-table,
.compare-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.79rem;
}

.compare-table .compare-sequence-col { width: 40px; }
.compare-table .compare-control-col { width: 50px; }
.compare-table .compare-runner-col { width: 118px; }

.runner-splits-scroll .detail-table {
  min-width: 560px;
  table-layout: fixed;
}

.detail-table .split-sequence-col { width: 38px; }
.detail-table .split-clock-col { width: 78px; }
.detail-table .split-control-col { width: 50px; }
.detail-table .split-elapsed-col { width: 66px; }
.detail-table .split-leg-col { width: 86px; }
.detail-table .split-loss-col { width: 72px; }
.detail-table .split-pace-col { width: 80px; }

.runner-splits-scroll .detail-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 0 var(--line);
}

.detail-table th,
.compare-table th {
  padding: 6px 6px;
  color: var(--muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.detail-table td,
.compare-table td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.detail-table tr:last-child td,
.compare-table tr:last-child td {
  border-bottom: 0;
}

.detail-table td.numeric,
.detail-table th.numeric,
.compare-table td.numeric,
.compare-table th.numeric {
  text-align: right;
}

.control-pill {
  min-width: 38px;
  padding: 4px 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--green);
  border-radius: 8px;
  font-weight: 900;
}

.control-pill.is-missing {
  background: var(--red);
}

.control-pill.is-neutral {
  background: var(--gray-pill);
}

.best-cell {
  color: var(--green);
  font-weight: 900;
}

.loss-cell {
  color: var(--red);
}

.split-time {
  font-weight: 800;
}

.split-place {
  min-width: 25px;
  margin-left: 6px;
  padding: 2px 5px;
  display: inline-flex;
  justify-content: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.1;
}

.pace-cell {
  color: var(--muted);
  font-weight: 750;
}

.search-field {
  height: 46px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.search-field svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.9;
  stroke-linecap: round;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search-results {
  margin-top: 12px;
  display: grid;
  gap: 7px;
}

.search-result {
  width: 100%;
  padding: 10px 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-solid);
  cursor: pointer;
  text-align: left;
}

.search-result:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: var(--accent-soft);
}

.search-result strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result span {
  color: var(--muted);
  font-size: 0.76rem;
}

.search-result .search-time {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  color: var(--text);
  font-weight: 900;
}

.compare-dialog .dialog-shell {
  height: min(86dvh, 760px);
  max-height: min(86dvh, 760px);
}

.compare-dialog .dialog-body {
  min-width: 0;
  min-height: 0;
  padding: 10px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 7px;
  overflow: hidden;
}

.compare-dialog .table-scroll {
  min-width: 0;
  min-height: 0;
  max-height: none;
  height: 100%;
  padding-bottom: 8px;
  overflow: auto;
  scroll-padding-bottom: 12px;
  overscroll-behavior: contain;
}

.compare-dialog .compare-table th,
.compare-dialog .compare-table td {
  padding: 5px 6px;
}

.compare-dialog .compare-table tbody tr:last-child td {
  padding-bottom: 12px;
}

.compare-toolbar {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.compare-names {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.compare-chip {
  padding: 4px 7px;
  color: var(--purple);
  background: color-mix(in srgb, var(--purple) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--purple) 30%, transparent);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
}

.small-button:hover {
  background: var(--red-soft);
  border-color: color-mix(in srgb, var(--red) 35%, var(--line));
}

.info-content {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 20px;
  align-items: center;
  color: var(--muted);
  line-height: 1.55;
}

.info-content img {
  width: 110px;
  height: 110px;
  object-fit: contain;
}

.info-content p {
  margin: 0 0 12px;
}

.info-content p:last-child {
  margin-bottom: 0;
}

.info-section {
  margin: 15px 0;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.info-section h3 {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 0.88rem;
  letter-spacing: -0.01em;
}

.toast-region {
  position: fixed;
  right: calc(14px + var(--safe-right));
  bottom: calc(14px + var(--safe-bottom));
  z-index: 500;
  width: min(390px, calc(100vw - 28px - var(--safe-left) - var(--safe-right)));
  display: grid;
  gap: 9px;
  pointer-events: none;
}

.toast {
  padding: 11px 13px;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--green);
  border-radius: 13px;
  box-shadow: var(--shadow);
  font-size: 0.81rem;
  font-weight: 750;
  animation: toast-in 0.22s ease-out;
  pointer-events: auto;
}

.toast.is-error {
  border-left-color: var(--red);
}

@media (max-width: 900px) {
  .header-inner {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .toolbar {
    width: 100%;
    justify-content: space-between;
  }

  .class-picker {
    width: min(220px, 42vw);
  }

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

  .status-item-wide {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  :root {
    --header-height: 190px;
  }

  body {
    background:
      radial-gradient(circle at 15% 3%, rgba(245, 158, 11, 0.14), transparent 24rem),
      var(--bg);
  }

  .app-header {
    padding: calc(6px + var(--safe-top)) calc(7px + var(--safe-right)) 6px calc(7px + var(--safe-left));
  }

  .header-inner {
    padding: 10px;
    gap: 9px;
    border-radius: 18px;
  }

  .event-brand {
    gap: 9px;
  }

  .event-logo {
    width: 44px;
    height: 44px;
  }

  .live-line {
    margin-bottom: 2px;
  }

  .connection-state {
    font-size: 0.7rem;
  }

  .event-copy h1 {
    font-size: 1.05rem;
  }

  .event-copy p {
    font-size: 0.72rem;
  }

  .event-meta-row {
    gap: 7px;
  }

  .latest-finishers {
    gap: 4px;
  }

  .latest-finishers-label {
    font-size: 0.63rem;
  }

  .latest-finisher-item {
    gap: 4px;
    font-size: 0.64rem;
  }

  .latest-finisher-class {
    padding: 1px 4px;
    font-size: 0.58rem;
  }

  .header-marquee.is-scrolling .header-marquee-text {
    animation: header-marquee var(--marquee-duration, 9s) ease-in-out infinite alternate;
  }

  .header-marquee.is-scrolling {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
  }

  .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 7px;
  }

  .class-picker {
    width: 100%;
  }

  .class-picker span {
    display: none;
  }

  .class-picker select {
    min-height: 40px;
  }

  .toolbar-actions {
    gap: 5px;
  }

  .icon-button {
    min-width: 40px;
    min-height: 40px;
    border-radius: 11px;
  }

  .text-button {
    width: 40px;
    padding: 0;
  }

  .text-button span {
    display: none;
  }

  .main-content {
    width: calc(100% - 14px - var(--safe-left) - var(--safe-right));
    margin-top: 2px;
  }

  .status-strip {
    margin-bottom: 8px;
    grid-template-columns: 1fr 0.55fr;
    gap: 6px;
  }

  .status-item {
    padding: 8px 9px;
    border-radius: 11px;
  }

  .status-item-wide {
    display: none;
  }

  .results-panel {
    border-radius: 18px;
  }

  .panel-heading {
    padding: 11px 12px 10px;
    align-items: center;
  }

  .panel-heading h2 {
    font-size: 1rem;
  }

  .eyebrow {
    font-size: 0.6rem;
  }

  .auto-refresh-note {
    font-size: 0.64rem;
  }

  .results-table {
    display: block;
    table-layout: auto;
  }

  .results-table colgroup,
  .results-table thead {
    display: none;
  }

  .results-table tbody {
    display: grid;
    gap: 7px;
    padding: 7px;
  }

  .results-table tbody tr,
  .results-table tbody tr:nth-child(even) {
    min-width: 0;
    padding: 7px 8px;
    display: grid;
    grid-template-columns: 33px 78px minmax(0, 1fr);
    grid-template-areas:
      "position result name"
      "position result club";
    gap: 1px 8px;
    align-items: center;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    border-radius: 13px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  }

  .results-table tbody tr:hover {
    background: var(--surface-solid);
  }

  /* Punktiarvestuse pikk tulemus saab mobiilis oma piisava laiusega veeru.
     Nimeveeru sisu jääb selle kõrvale ega saa pilli peale nihkuda. */
  .score-results-table tbody tr,
  .score-results-table tbody tr:nth-child(even) {
    grid-template-columns: 33px 116px minmax(0, 1fr);
  }

  .results-table td {
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .position-cell {
    grid-area: position;
    align-self: stretch;
    display: grid;
    place-items: center;
    color: var(--muted);
    border-right: 1px solid var(--line) !important;
    font-size: 0.78rem;
    text-align: center;
  }

  .result-cell {
    grid-area: result;
    text-align: left;
  }

  .result-pill {
    min-width: 72px;
    min-height: 31px;
    padding: 4px 8px;
    font-size: 0.78rem;
  }

  .score-results-table .result-pill {
    width: 100%;
    max-width: 116px;
    min-width: 0;
    padding: 4px 5px;
    overflow: hidden;
    font-size: 0.71rem;
    letter-spacing: -0.018em;
    text-overflow: clip;
  }

  .name-cell {
    grid-area: name;
    overflow: hidden;
  }

  .runner-button {
    font-size: 0.87rem;
  }

  .club-cell {
    grid-area: club;
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-footer {
    display: none;
  }

  .runner-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .runner-dialog {
    width: calc(100vw - 10px - var(--safe-left) - var(--safe-right));
    max-height: calc(100dvh - 10px - var(--safe-top) - var(--safe-bottom));
    border-radius: 17px;
  }

  .runner-dialog .dialog-shell {
    height: calc(100dvh - 10px - var(--safe-top) - var(--safe-bottom));
    max-height: calc(100dvh - 10px - var(--safe-top) - var(--safe-bottom));
  }

  .runner-dialog .dialog-header {
    padding: 11px 12px;
  }

  .runner-dialog .dialog-header > div {
    flex: 1 1 auto;
    min-width: 0;
  }

  .runner-dialog-meta {
    max-width: none;
    font-size: 0.68rem;
    line-height: 1.3;
  }

  .runner-dialog .dialog-body {
    min-width: 0;
    padding: 8px;
    gap: 7px;
  }

  .runner-splits-heading {
    align-items: flex-start;
  }

  .runner-splits-heading span {
    max-width: 58%;
    font-size: 0.62rem;
  }

  .summary-card {
    padding: 7px 8px;
  }

  .summary-card span {
    font-size: 0.6rem;
  }

  .summary-card strong {
    font-size: 0.82rem;
  }

  .runner-splits-scroll .detail-table {
    min-width: 540px;
    font-size: 0.72rem;
  }

  .runner-splits-scroll .detail-table th,
  .runner-splits-scroll .detail-table td {
    padding: 6px 5px;
  }

  .compare-dialog {
    width: calc(100vw - 10px - var(--safe-left) - var(--safe-right));
    max-height: calc(100dvh - 10px - var(--safe-top) - var(--safe-bottom));
    border-radius: 17px;
  }

  .compare-dialog .dialog-shell {
    height: calc(100dvh - 10px - var(--safe-top) - var(--safe-bottom));
    max-height: calc(100dvh - 10px - var(--safe-top) - var(--safe-bottom));
  }

  .compare-dialog .dialog-body {
    padding: 8px;
  }

  .dialog-body {
    padding: 12px;
  }

  .info-content {
    grid-template-columns: 72px 1fr;
    gap: 12px;
    font-size: 0.84rem;
  }

  .info-content img {
    width: 72px;
    height: 72px;
  }

  .toast-region {
    right: calc(8px + var(--safe-right));
    bottom: calc(8px + var(--safe-bottom));
    width: calc(100vw - 16px - var(--safe-left) - var(--safe-right));
  }
}

@media (max-width: 390px) {
  .toolbar-actions .icon-button:nth-last-child(1) {
    display: none;
  }

  .auto-refresh-note {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .header-marquee.is-scrolling .header-marquee-text,
  .latest-finishers-track.is-moving {
    animation: none !important;
  }

  .latest-finishers-viewport {
    overflow: hidden;
    -webkit-mask-image: none;
    mask-image: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .app-header,
  .status-strip,
  .app-footer,
  .toast-region,
  .page-watermark,
  .auto-refresh-note {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .main-content {
    width: 100%;
    margin: 0;
  }

  .results-panel {
    border: 0;
    box-shadow: none;
  }

  .results-table thead th {
    position: static;
  }
}

@keyframes latest-finishers-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-1 * var(--ticker-distance, 0px))); }
}

@keyframes header-marquee {
  0%, 14% {
    transform: translateX(0);
  }
  86%, 100% {
    transform: translateX(calc(-1 * var(--marquee-distance, 0px)));
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 34%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}


/* Päises kuvatakse tulemuste faili tegelik muutmisaeg. */
.file-update-state:empty,
.connection-state:empty {
  display: none;
}

/* ============================================================
   V15: viimased lõpetajad eraldi täislaiuses automaatsel ribal
   ============================================================ */
.latest-finishers-panel {
  min-width: 0;
  width: 100%;
  margin: 0 0 12px;
  padding: 9px 13px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  overflow: hidden;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-solid) 86%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.latest-finishers-panel[hidden] {
  display: none !important;
}

.latest-finishers-heading {
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.latest-finishers-heading .pulse-dot {
  width: 7px;
  height: 7px;
}

.latest-finishers-panel .latest-finishers-viewport {
  min-width: 0;
  width: 100%;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}

.latest-finishers-panel .latest-finishers-track {
  width: max-content;
  min-width: max-content;
  display: flex;
  align-items: center;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.latest-finishers-panel .latest-finishers-track.is-moving {
  animation: latest-finishers-scroll var(--ticker-duration, 28s) linear infinite;
}

/* Hiire kohal olemine ei peata enam liikumist juhuslikult. */
.latest-finishers-panel:hover .latest-finishers-track {
  animation-play-state: running;
}

.latest-finishers-panel:focus-within .latest-finishers-track {
  animation-play-state: paused;
}

.latest-finishers-panel .latest-finishers-group {
  padding-right: 34px;
  gap: 18px;
}

.latest-finishers-panel .latest-finisher-item {
  gap: 7px;
  font-size: 0.76rem;
}

.latest-finishers-panel .latest-finisher-item::after {
  margin-left: 10px;
}

.latest-finishers-panel .latest-finisher-name {
  color: var(--text);
  font-weight: 800;
}

.latest-finishers-panel .latest-finisher-class {
  padding: 2px 6px;
  font-size: 0.64rem;
}

.latest-finishers-panel .latest-finisher-result {
  color: var(--green);
  font-weight: 900;
}

@media (max-width: 720px) {
  .latest-finishers-panel {
    margin-bottom: 10px;
    padding: 9px 10px;
    grid-template-columns: 1fr;
    gap: 6px;
    border-radius: 16px;
  }

  .latest-finishers-heading {
    font-size: 0.65rem;
  }

  .latest-finishers-panel .latest-finishers-group {
    padding-right: 26px;
    gap: 14px;
  }

  .latest-finishers-panel .latest-finisher-item {
    gap: 5px;
    font-size: 0.69rem;
  }

  .latest-finishers-panel .latest-finisher-class {
    padding: 1px 5px;
    font-size: 0.6rem;
  }
}

/* Riba peab kasutaja soovil liikuma ka siis, kui süsteemis on Reduce Motion sees. */
@media (prefers-reduced-motion: reduce) {
  .latest-finishers-panel .latest-finishers-track.is-moving {
    animation: latest-finishers-scroll var(--ticker-duration, 28s) linear infinite !important;
  }
}

@media print {
  .latest-finishers-panel {
    display: none !important;
  }
}

/* v1.2.0: keelevalik ja etapipikkus */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.language-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.language-picker select {
  min-width: 68px;
  min-height: 42px;
  padding: 0 27px 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background-color: var(--surface-solid);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.detail-table .split-length-col { width: 72px; }
.detail-table .split-length-cell { white-space: nowrap; }
.runner-splits-scroll .detail-table { min-width: 635px; }

@media (max-width: 760px) {
  .language-picker select {
    min-width: 62px;
    min-height: 40px;
    padding-left: 8px;
    padding-right: 24px;
    border-radius: 11px;
  }
}


/* v1.2.3 — kompaktsem osaleja detailaken ja mobiilis kaardivaade */
.runner-dialog {
  width: min(590px, calc(100vw - 28px - var(--safe-left) - var(--safe-right)));
}

.runner-dialog .dialog-header {
  padding: 13px 14px;
}

.runner-dialog .dialog-body {
  padding: 10px;
}

.runner-splits-scroll .detail-table {
  min-width: 545px;
}

.detail-table .split-sequence-col { width: 34px; }
.detail-table .split-clock-col { width: 70px; }
.detail-table .split-control-col { width: 46px; }
.detail-table .split-elapsed-col { width: 58px; }
.detail-table .split-leg-col { width: 76px; }
.detail-table .split-length-col { width: 58px; }
.detail-table .split-loss-col { width: 62px; }
.detail-table .split-pace-col { width: 68px; }

@media (max-width: 600px) {
  .runner-dialog {
    width: calc(100vw - 8px - var(--safe-left) - var(--safe-right));
    max-width: none;
    max-height: calc(100dvh - 8px - var(--safe-top) - var(--safe-bottom));
    border-radius: 15px;
  }

  .runner-dialog .dialog-shell {
    height: calc(100dvh - 8px - var(--safe-top) - var(--safe-bottom));
    max-height: calc(100dvh - 8px - var(--safe-top) - var(--safe-bottom));
  }

  .runner-dialog .dialog-header {
    padding: 9px 10px;
    gap: 8px;
  }

  .runner-dialog .dialog-header h2 {
    font-size: 1.12rem;
  }

  .runner-dialog .dialog-body {
    padding: 6px;
    gap: 6px;
  }

  .runner-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .summary-card {
    padding: 5px 5px;
    border-radius: 10px;
  }

  .summary-card span {
    font-size: 0.52rem;
    letter-spacing: 0.015em;
  }

  .summary-card strong {
    font-size: 0.72rem;
  }

  .runner-splits-heading {
    gap: 6px;
  }

  .runner-splits-heading strong {
    font-size: 0.74rem;
  }

  .runner-splits-heading span {
    max-width: 54%;
    font-size: 0.56rem;
    line-height: 1.2;
  }

  .runner-splits-scroll {
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
  }

  .runner-splits-scroll .detail-table {
    display: block;
    width: 100%;
    min-width: 0;
    table-layout: auto;
    font-size: 0.7rem;
    border-collapse: separate;
  }

  .runner-splits-scroll .detail-table colgroup,
  .runner-splits-scroll .detail-table thead {
    display: none;
  }

  .runner-splits-scroll .detail-table tbody {
    display: grid;
    gap: 6px;
  }

  .runner-splits-scroll .detail-table tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 11px;
    gap: 1px;
  }

  .runner-splits-scroll .detail-table td {
    min-width: 0;
    min-height: 42px;
    padding: 4px 5px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    overflow: hidden;
    color: var(--text);
    background: var(--surface-solid);
    border: 0;
    text-align: left !important;
    white-space: nowrap;
  }

  .runner-splits-scroll .detail-table td::before {
    content: attr(data-label);
    max-width: 100%;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.49rem;
    font-weight: 850;
    letter-spacing: 0.025em;
    line-height: 1;
    text-overflow: ellipsis;
    text-transform: uppercase;
  }

  .runner-splits-scroll .detail-table td > * {
    max-width: 100%;
  }

  .runner-splits-scroll .detail-table .control-pill {
    min-width: 32px;
    padding: 3px 5px;
    border-radius: 7px;
    font-size: 0.7rem;
  }

  .runner-splits-scroll .detail-table .split-time {
    font-size: 0.74rem;
  }

  .runner-splits-scroll .detail-table .split-place {
    margin-left: 3px;
    font-size: 0.58rem;
  }

  .runner-splits-scroll .detail-table .best-cell,
  .runner-splits-scroll .detail-table .loss-cell,
  .runner-splits-scroll .detail-table .pace-cell {
    justify-content: center;
  }
}

@media (max-width: 390px) {
  .runner-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .runner-splits-scroll .detail-table tr {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .runner-splits-scroll .detail-table td {
    min-height: 40px;
    padding: 4px;
    font-size: 0.66rem;
  }
}


/* v1.2.4 — mobiilis klass/rada alati täislaiuses, keel ja tööriistad eraldi real */
@media (max-width: 620px) {
  .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 7px;
  }
  .class-picker { width: 100%; min-width: 0; }
  .class-picker select {
    width: 100%; min-width: 0; min-height: 42px;
    font-size: 0.9rem; padding-left: 12px;
  }
  .toolbar-actions {
    width: 100%; min-width: 0; display: flex; align-items: center;
    justify-content: flex-start; gap: 5px; overflow-x: auto; overflow-y: hidden;
    padding-bottom: 1px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .toolbar-actions::-webkit-scrollbar { display: none; }
  .language-picker { flex: 0 0 auto; }
  .language-picker select { min-width: 62px; max-width: 68px; }
  .toolbar-actions .icon-button { flex: 0 0 40px; }
}
@media (max-width: 380px) {
  .class-picker select { font-size: 0.86rem; }
  .language-picker select { min-width: 58px; max-width: 58px; padding-left: 7px; padding-right: 21px; }
}


/* v1.2.5 — lisamärge (Additional): ainult KP ja märke kellaaeg */
.detail-table tr.is-additional td,
.compare-table tr.compare-additional-row td {
  color: var(--muted);
}
.detail-table tr.is-additional .control-pill,
.compare-table tr.compare-additional-row .control-pill {
  opacity: .82;
}
.compare-table .additional-cell {
  font-weight: 700;
  color: var(--muted);
}

@media (max-width: 600px) {
  .runner-splits-scroll .detail-table tr.is-additional {
    grid-template-columns: .7fr 1.35fr .95fr;
  }
  .runner-splits-scroll .detail-table tr.is-additional td:nth-child(n+4) {
    display: none;
  }
}


/* v1.4.7: SIME viimased lõpetajad parempoolses otsetulemuste paneelis. */
:root { --sime-live-sidebar-w: 270px; }
body { transition: padding-right .22s ease; }
body.sime-live-sidebar-active { padding-right: var(--sime-live-sidebar-w); }
.sime-live-sidebar.latest-finishers-panel {
  position: fixed; z-index: 120; inset: 0 0 0 auto; width: var(--sime-live-sidebar-w); height: 100vh;
  margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; overflow: hidden;
  color: var(--text); background: linear-gradient(180deg,color-mix(in srgb,var(--accent) 19%,var(--surface-solid)) 0%,color-mix(in srgb,var(--accent) 7%,var(--surface-solid)) 36%,var(--surface-solid) 100%);
  border: 0; border-left: 1px solid color-mix(in srgb,var(--accent) 28%,var(--line)); border-radius: 0;
  box-shadow: -18px 0 48px rgba(0,0,0,.28); transform: translateX(0); transition: transform .22s ease;
}
.sime-live-sidebar.latest-finishers-panel.is-closed { display: none !important; }
.sime-live-sidebar .latest-finishers-heading {
  min-height: 53px; width: 100%; padding: 6px 7px 6px 10px; display: grid;
  grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 7px;
  background: linear-gradient(105deg,color-mix(in srgb,var(--accent) 27%,var(--surface-strong)),color-mix(in srgb,var(--accent) 9%,var(--surface-strong)));
  border-bottom: 1px solid color-mix(in srgb,var(--accent) 25%,var(--line)); text-transform: none;
}
.sime-live-title { min-width: 0; }
.sime-live-title strong { display: block; font-size: .86rem; letter-spacing: 0; }
.sime-live-title span { display: block; margin-top: 1px; color: var(--muted); font-size: .58rem; font-weight: 700; letter-spacing: 0; }
.sime-live-updated { color: var(--muted); font-size: .62rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sime-live-close { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-strong); color: var(--text); font-size: 1.35rem; line-height: 1; cursor: pointer; }
.sime-live-sidebar .latest-finishers-viewport { min-height: 0; width: 100%; flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; mask-image: none; -webkit-mask-image: none; scrollbar-width: thin; }
.sime-live-sidebar .latest-finishers-track { width: 100%; min-width: 0; display: block; transform: none !important; animation: none !important; will-change: auto; }
.sime-live-sidebar .latest-finishers-group { width: 100%; padding: 0; display: flex; flex-direction: column; gap: 0; }
.sime-live-sidebar .latest-finisher-item { width: 100%; padding: 7px 8px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 6px; border-bottom: 1px solid var(--line); background: linear-gradient(100deg,color-mix(in srgb,var(--accent) 7%,var(--surface-solid)),color-mix(in srgb,var(--accent) 2%,var(--surface-solid))); font-size: .72rem; white-space: normal; }
.sime-live-sidebar .latest-finisher-item:hover { background: color-mix(in srgb,var(--accent) 11%,var(--surface-solid)); }
.sime-live-sidebar .latest-finisher-item::after { display: none; }
.sime-live-person { min-width: 0; display: flex; align-items: center; gap: 4px; }
.sime-live-flag { flex: 0 0 auto; font-size: .72rem; line-height: 1; }
.sime-live-sidebar .latest-finisher-name { min-width: 0; padding: 0; overflow: hidden; border: 0; color: var(--text); background: transparent; cursor: pointer; font: inherit; font-size: .79rem; font-weight: 850; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.sime-live-name-text { display: inline-block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sime-live-sidebar .latest-finisher-name:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }
.sime-live-bib { display: inline-flex; padding: 1px 4px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-strong); font-size: .55rem; font-weight: 850; }
.sime-live-sidebar .latest-finisher-result { align-self: center; grid-row: 1; grid-column: 2; color: var(--text); font-size: .78rem; }
.event-meta-row > #eventMeta { white-space: pre-line; line-height: 1.15; }
.sime-live-meta { min-width: 0; grid-row: 2; grid-column: 1 / -1; display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: .57rem; }
.sime-live-meta-left { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sime-live-event { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.sime-live-finish { color: var(--red); font-weight: 900; }
.sime-live-sidebar .latest-finisher-class { padding: 1px 4px; font-size: .56rem; }
.sime-live-open { position: fixed; right: 13px; bottom: 16px; z-index: 115; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-strong); color: var(--text); box-shadow: var(--shadow); font-weight: 850; cursor: pointer; }
.sime-live-open:not([hidden]) { display: inline-flex; }
.sime-live-sidebar.is-stale .pulse-dot,.sime-live-open.is-stale .pulse-dot { background: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb,var(--red) 15%,transparent); }
@media (max-width: 1280px) { body.sime-live-sidebar-active { padding-right: 0; } }
@media (max-width: 720px) { .sime-live-sidebar.latest-finishers-panel { width: min(var(--sime-live-sidebar-w),calc(100vw - 18px)); } }
@media print { .sime-live-sidebar,.sime-live-open { display: none !important; } body.sime-live-sidebar-active { padding-right: 0; } }


/* v1.5.6: universaalvaatega identsed värvimuutujad ja mobiilipäis. */
:root{--bg:#f4f7fb;--surface:rgba(255,255,255,.96);--surface-solid:#fff;--surface-soft:#f5f7fa;--text:#132a46;--muted:#63758a;--line:rgba(30,62,98,.15);--line-strong:rgba(30,62,98,.25);--accent:#d98200;--accent-strong:#a85f00;--accent-soft:rgba(217,130,0,.14);--green:#0b8f5d;--green-soft:rgba(11,143,93,.15);--red:#cc3658;--red-soft:rgba(204,54,88,.15);--gray-pill:#63758a;--blue:#2f78b7;--purple:#6f5ab8;--shadow:0 20px 50px rgba(29,66,105,.14);--shadow-soft:0 8px 24px rgba(29,66,105,.09)}
html[data-theme="dark"]{--bg:#081a2d;--surface:rgba(16,42,70,.96);--surface-solid:#102a46;--surface-soft:#183a5d;--text:#f4f7fb;--muted:#a9bfd8;--line:rgba(218,235,252,.18);--line-strong:rgba(218,235,252,.28);--accent:#f2aa24;--accent-strong:#ffc85c;--accent-soft:rgba(242,170,36,.17);--green:#3ccf91;--green-soft:rgba(60,207,145,.17);--red:#ff6682;--red-soft:rgba(255,102,130,.17);--gray-pill:#a9bfd8;--blue:#76baff;--purple:#c0b2ff;--shadow:0 22px 55px rgba(0,0,0,.34);--shadow-soft:0 10px 28px rgba(0,0,0,.26)}
body{font-family:"Segoe UI Variable Text",Aptos,"Segoe UI",Arial,sans-serif;font-weight:400;background:radial-gradient(circle at 10% 4%,color-mix(in srgb,var(--accent) 18%,transparent),transparent 30rem),radial-gradient(circle at 90% 15%,color-mix(in srgb,var(--blue) 17%,transparent),transparent 35rem),linear-gradient(145deg,var(--bg),color-mix(in srgb,var(--blue) 6%,var(--bg)))}
.app-header{padding:6px 8px;background:linear-gradient(112deg,color-mix(in srgb,var(--accent) 18%,var(--surface-solid)),color-mix(in srgb,var(--blue) 9%,var(--surface-solid)) 72%,var(--surface-solid))}.header-inner{padding:8px 10px;gap:10px;border-radius:14px}.event-logo{width:52px;height:52px}.sime-now-clock{color:var(--text);font-size:.76rem;font-weight:750;font-variant-numeric:tabular-nums}.file-update-state{display:none!important}.toolbar{gap:6px}.class-picker select{min-height:36px}.icon-button{min-width:36px;min-height:36px;border-radius:9px}.language-picker select{height:36px}
.panel-heading .eyebrow{display:none}.results-title,.runner-button,.result-pill{font-weight:700}.class-picker select{min-width:150px}.eol-col{width:86px}.eol-cell{font-variant-numeric:tabular-nums;color:var(--muted);white-space:nowrap}
.results-table.score-results-table col.result-col{width:calc(var(--score-result-width,16ch) + 16px)!important}
.score-results-table .result-cell{max-width:calc(16ch + 16px)}
.header-inner,.panel-heading{background:linear-gradient(112deg,color-mix(in srgb,var(--accent) 18%,var(--surface-solid)),color-mix(in srgb,var(--blue) 9%,var(--surface-solid)) 72%,var(--surface-solid))}
.results-panel{background:color-mix(in srgb,var(--surface-solid) 96%,var(--blue))}.results-table thead th{color:var(--text);background:linear-gradient(105deg,color-mix(in srgb,var(--accent) 19%,var(--surface-soft)),color-mix(in srgb,var(--blue) 8%,var(--surface-soft)));border-bottom-color:color-mix(in srgb,var(--accent) 24%,var(--line))}
.sime-live-title span{display:none}.sime-live-sidebar .latest-finishers-viewport{overflow:hidden}.sime-live-sidebar .latest-finishers-track.sime-live-update{animation:sime-live-update .24s ease-out!important}@keyframes sime-live-update{from{transform:translateY(-48px)!important;opacity:.72}to{transform:translateY(0)!important;opacity:1}}
.pulse-dot{animation:none!important;opacity:1;box-shadow:0 0 0 3px color-mix(in srgb,var(--green) 13%,transparent)}
.sime-live-open{width:44px;height:44px;justify-content:center;padding:0;font-size:1.25rem}.sime-live-open .pulse-dot{position:absolute;right:2px;top:2px}.app-footer{font-weight:500}
@media(max-width:720px){
  .app-header{position:sticky;top:0;z-index:100;padding:3px 4px}.header-inner{display:grid;grid-template-columns:minmax(0,1fr);width:100%;min-width:0;gap:4px;padding:5px 6px;border-radius:10px}.event-brand,.event-copy,.toolbar,.class-picker,.toolbar-actions{min-width:0}.event-brand{gap:7px}.event-logo{width:48px;height:48px;flex:0 0 48px}.event-copy h1{font-size:.9rem;line-height:1.02;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.event-copy p,.connection-state,.file-update-state{font-size:.56rem}.live-line{margin:0;font-size:.57rem}.toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;width:100%;align-items:center;justify-content:stretch;gap:4px}.class-picker{width:100%;min-width:0}.class-picker span{display:none}.class-picker select{display:block;width:100%;max-width:100%;min-width:0;min-height:30px;padding:3px 20px 3px 6px;font-size:.69rem}.toolbar-actions{display:grid;grid-auto-flow:column;grid-auto-columns:auto;width:auto;min-width:0;gap:3px;overflow:visible;justify-content:end}.language-picker{width:42px}.language-picker select{width:42px;height:30px;min-width:42px;padding:3px 15px 3px 4px;font-size:.62rem}.icon-button{width:30px;height:30px;min-width:30px;min-height:30px;border-radius:8px}.toolbar-actions .icon-button{width:30px;min-width:30px}#themeButton{display:inline-grid!important}#compareButton[hidden]{display:none!important}.status-strip{display:none}.main-content{margin-top:3px;padding:0 3px 6px}.results-panel{border-radius:9px}.panel-heading{padding:5px 6px}.results-title{font-size:.84rem}
  .results-container{overflow-x:auto;-webkit-overflow-scrolling:touch}.results-panel{overflow:hidden}
  .results-table,.score-results-table{display:table!important;width:100%!important;min-width:650px!important;table-layout:fixed!important;border-collapse:separate!important}.results-table colgroup{display:table-column-group!important}.results-table thead{display:table-header-group!important}.results-table tbody{display:table-row-group!important;padding:0!important}.results-table tbody tr,.results-table tbody tr:nth-child(even),.score-results-table tbody tr,.score-results-table tbody tr:nth-child(even){display:table-row!important;min-width:0!important;padding:0!important;background:color-mix(in srgb,var(--surface-solid) 72%,transparent)!important;border:0!important;border-radius:0!important;box-shadow:none!important}.results-table td{display:table-cell!important;min-width:0;padding:6px 8px!important;border-bottom:1px solid var(--line)!important;vertical-align:middle!important}.results-table thead th{display:table-cell!important;position:static!important;padding:6px 8px!important}.results-table col.position-col{width:48px!important}.results-table col.result-col{width:112px!important}.results-table.score-results-table col.result-col{width:calc(var(--score-result-width,16ch) + 16px)!important}.results-table col.name-col{width:210px!important}.results-table col.eol-col{width:82px!important}.position-cell,.result-cell,.name-cell,.eol-cell,.club-cell{display:table-cell!important;white-space:nowrap!important;overflow:visible!important;text-overflow:clip!important}.runner-button{display:inline-block;width:auto;max-width:none;overflow:visible;text-overflow:clip;white-space:nowrap;text-align:left}.runner-button,.result-pill{font-size:.72rem}.result-pill,.score-results-table .result-pill{width:auto;min-width:0;max-width:16ch;min-height:27px;padding:3px 7px}.eol-cell,.club-cell{font-size:.68rem}
  .runner-splits-scroll{overflow:auto!important;-webkit-overflow-scrolling:touch}.runner-splits-scroll .detail-table{display:table!important;width:max-content!important;min-width:545px!important;table-layout:fixed!important;border-collapse:collapse!important}.runner-splits-scroll .detail-table colgroup{display:table-column-group!important}.runner-splits-scroll .detail-table thead{display:table-header-group!important}.runner-splits-scroll .detail-table tbody{display:table-row-group!important}.runner-splits-scroll .detail-table tr,.runner-splits-scroll .detail-table tr.is-additional{display:table-row!important;background:transparent!important;border:0!important}.runner-splits-scroll .detail-table td{display:table-cell!important;min-height:0!important;padding:6px 5px!important;overflow:visible!important;background:transparent!important;border-bottom:1px solid var(--line)!important;white-space:nowrap!important;text-align:left!important}.runner-splits-scroll .detail-table td.numeric{text-align:right!important}.runner-splits-scroll .detail-table td::before{display:none!important}.runner-splits-scroll .detail-table tr.is-additional td:nth-child(n+4){display:table-cell!important}
  .header-inner,.results-panel,.sime-live-sidebar.latest-finishers-panel{backdrop-filter:none!important;-webkit-backdrop-filter:none!important}.header-marquee.is-scrolling .header-marquee-text,.sime-live-sidebar .latest-finishers-track.sime-live-update{animation:none!important;transform:none!important;opacity:1!important}.results-table tbody tr,.app-header,.header-inner,.results-panel,.sime-live-sidebar.latest-finishers-panel{transition:none!important}
  .sime-live-sidebar.latest-finishers-panel{width:min(242px,calc(100vw - 8px))}.sime-live-sidebar .latest-finisher-item{padding:5px 6px}.sime-live-open{right:5px;bottom:6px;width:38px;height:38px}}
@media(max-width:340px){.event-logo{width:44px;height:44px;flex-basis:44px}.toolbar-actions{grid-auto-columns:auto;gap:2px}.icon-button,.toolbar-actions .icon-button{width:28px;min-width:28px;height:28px;min-height:28px}.language-picker{width:39px}.language-picker select{width:39px;min-width:39px;height:28px}.class-picker select{min-height:28px}}
@media(prefers-reduced-motion:reduce){.pulse-dot,.sime-live-sidebar .latest-finishers-track{animation:none!important}}
