.nwc-backyard-results {
  --nwc-border: #d9e2ee;
  --nwc-text: #162033;
  --nwc-muted: #5d6b7d;
  --nwc-surface: #ffffff;
  --nwc-surface-strong: #f7fbff;
  --nwc-subtle: #eef6fb;
  --nwc-navy: #123a5a;
  --nwc-accent: #2f80c3;
  --nwc-accent-soft: #e5f3ff;
  --nwc-yellow: #f7c948;
  --nwc-warning: #b45309;
  --nwc-danger: #b42318;
  --nwc-finished: #157f5b;
  background: linear-gradient(180deg, rgba(18, 58, 90, 0.08), rgba(255, 255, 255, 0) 240px);
  border-radius: 8px;
  color: var(--nwc-text);
  font-family: inherit;
  padding: 18px;
}

.nwc-backyard-results.is-dark {
  --nwc-border: #29445d;
  --nwc-text: #edf6ff;
  --nwc-muted: #aab9c8;
  --nwc-surface: #102235;
  --nwc-surface-strong: #0b1a2a;
  --nwc-subtle: #172e45;
  --nwc-accent-soft: #173d5e;
  background: #071827;
}

.nwc-backyard-results:fullscreen,
.nwc-backyard-results.is-fullscreen {
  height: 100vh;
  height: 100svh;
  max-height: 100vh;
  max-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.nwc-backyard-results:fullscreen:not(.is-dark),
.nwc-backyard-results.is-fullscreen:not(.is-dark) {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4ff 50%, #f5f9ff 100%);
}

.nwc-backyard-results.is-fullscreen {
  inset: 0;
  position: fixed;
  z-index: 999999;
}

.nwc-backyard-toolbar {
  align-items: stretch;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto auto;
  margin-bottom: 16px;
}

.nwc-backyard-toolbar > :first-child,
.nwc-backyard-search,
.nwc-backyard-toggle,
.nwc-backyard-button {
  grid-column: 1 / -1;
}

.nwc-backyard-toolbar > :first-child {
  order: 1;
}

.nwc-backyard-search {
  order: 2;
}

.nwc-backyard-toggle {
  order: 3;
}

.nwc-backyard-button {
  order: 4;
}

.nwc-backyard-kicker {
  color: var(--nwc-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.nwc-backyard-timer {
  color: var(--nwc-navy);
  font-size: 32px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1;
}

.nwc-backyard-results.is-dark .nwc-backyard-timer {
  color: #ffffff;
}

.nwc-backyard-search,
.nwc-backyard-toggle {
  display: grid;
  gap: 6px;
}

.nwc-backyard-search span,
.nwc-backyard-toggle span {
  color: var(--nwc-muted);
  font-size: 13px;
  font-weight: 700;
}

.nwc-backyard-search input {
  background: var(--nwc-surface);
  border: 1px solid var(--nwc-border);
  border-radius: 6px;
  color: var(--nwc-text);
  min-height: 42px;
  padding: 8px 10px;
  width: 100%;
}

.nwc-backyard-toggle {
  align-items: center;
  background: var(--nwc-surface);
  border: 1px solid var(--nwc-border);
  border-radius: 6px;
  grid-auto-flow: column;
  gap: 8px;
  height: 43.5px;
  justify-content: start;
  min-height: 43.5px;
  padding: 8px 10px;
}

.nwc-backyard-toggle input {
  accent-color: var(--nwc-accent);
  height: 18px;
  width: 18px;
}

.nwc-backyard-discipline {
  align-self: end;
  background: var(--nwc-subtle);
  border: 1px solid var(--nwc-border);
  border-radius: 6px;
  display: inline-grid;
  gap: 2px;
  grid-auto-flow: column;
  grid-column: 2;
  justify-self: center;
  padding: 3px;
  order: 6;
  width: max-content;
}

.nwc-backyard-discipline button,
.nwc-backyard-button,
.nwc-backyard-icon-button,
.nwc-backyard-fav,
.nwc-backyard-modal-close {
  border: 1px solid var(--nwc-border);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}

.nwc-backyard-discipline button {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border-color: transparent;
  border-radius: 4px;
  color: var(--nwc-muted);
  display: inline-flex;
  font-size: 18px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  min-height: 34px;
  padding: 0;
  width: 36px;
}

.nwc-backyard-discipline button.is-active {
  background: #dff0ff;
  border-color: #9ed3fb;
  color: var(--nwc-navy);
  box-shadow: inset 0 0 0 1px rgba(47, 128, 195, 0.15);
}

.nwc-backyard-button {
  min-height: 42px;
  padding: 8px 14px;
}

.nwc-backyard-button {
  background: var(--nwc-accent);
  border-color: var(--nwc-accent);
  color: #fff;
}

.nwc-backyard-icon-button {
  align-items: center;
  background: var(--nwc-surface);
  color: var(--nwc-text);
  display: inline-flex;
  font-size: 18px;
  font-weight: 800;
  height: 43.5px;
  justify-content: center;
  min-height: 43.5px;
  padding: 0;
  width: 43.5px;
}

.nwc-backyard-icon-button[data-role="dark-mode"] {
  grid-column: 1;
  justify-self: end;
  order: 5;
}

.nwc-backyard-icon-button[data-role="fullscreen"] {
  grid-column: 3;
  justify-self: start;
  order: 7;
}

.nwc-backyard-status {
  color: var(--nwc-danger);
  min-height: 24px;
}

.nwc-backyard-visuals {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  margin: 24px 0 0;
}

.nwc-backyard-chart-panel,
.nwc-backyard-side-panel {
  background: var(--nwc-surface);
  border: 1px solid rgba(18, 58, 90, 0.1);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(18, 58, 90, 0.1);
}

.nwc-backyard-chart-panel {
  overflow: hidden;
}

.nwc-backyard-chart-heading {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px 18px 8px;
}

.nwc-backyard-chart-heading h2 {
  color: var(--nwc-text);
  font-size: 24px;
  line-height: 1.15;
  margin: 0;
}

.nwc-backyard-chart-stat {
  background: var(--nwc-yellow);
  border-radius: 999px;
  color: #172033;
  font-weight: 900;
  padding: 6px 12px;
  white-space: nowrap;
}

.nwc-backyard-chart-scroll {
  min-height: 330px;
  overflow-x: auto;
  padding: 8px 12px 14px;
  position: relative;
}

.nwc-backyard-empty-chart {
  align-items: center;
  color: var(--nwc-muted);
  display: flex;
  min-height: 250px;
  padding: 18px;
}

.nwc-backyard-survival-svg {
  display: block;
  min-width: 720px;
  width: 100%;
  height: 100%;
}

.nwc-backyard-chart-bg {
  fill: var(--nwc-surface-strong);
}

.nwc-backyard-grid-line {
  stroke: var(--nwc-border);
  stroke-width: 1;
}

.nwc-backyard-axis-line {
  stroke: var(--nwc-text);
  stroke-linecap: square;
  stroke-width: 2;
}

.nwc-backyard-axis-label {
  fill: var(--nwc-text);
  font-size: 12px;
  font-weight: 800;
}

.nwc-backyard-axis-title {
  fill: var(--nwc-text);
  font-size: 12px;
  font-weight: 900;
}

.nwc-backyard-current-loop {
  stroke: var(--nwc-yellow);
  stroke-dasharray: 4 5;
  stroke-linecap: round;
  stroke-width: 2;
}

.nwc-backyard-current-label {
  fill: var(--nwc-navy);
  font-size: 12px;
  font-weight: 900;
}

.nwc-backyard-results.is-dark .nwc-backyard-current-label {
  fill: #ffffff;
}

.nwc-backyard-survival-line {
  fill: none;
  stroke: var(--nwc-accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  transition: d 260ms ease;
  vector-effect: non-scaling-stroke;
}

.nwc-backyard-drop-point {
  fill: var(--nwc-surface);
  outline: none;
  stroke: var(--nwc-navy);
  stroke-width: 3;
  transition: r 160ms ease, fill 160ms ease, stroke 160ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.nwc-backyard-drop-point.is-latest {
  fill: var(--nwc-yellow);
}

.nwc-backyard-drop-point.is-favorite {
  fill: #5ab2ff;
  stroke: var(--nwc-yellow);
}

.nwc-backyard-drop-point:hover,
.nwc-backyard-drop-point:focus {
  fill: var(--nwc-yellow);
  r: 8;
}

.nwc-backyard-tooltip {
  background: #071827;
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
  color: #ffffff;
  display: grid;
  font-size: 12px;
  gap: 3px;
  max-width: min(260px, calc(100vw - 48px));
  padding: 10px 12px;
  pointer-events: none;
  position: absolute;
  z-index: 3;
}

.nwc-backyard-tooltip strong {
  color: var(--nwc-yellow);
}

.nwc-backyard-tooltip em {
  color: #dbeafe;
  font-style: normal;
}

.nwc-backyard-side-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.nwc-backyard-side-panel h3 {
  color: var(--nwc-text);
  font-size: 15px;
  margin: 0 0 10px;
}

.nwc-backyard-segmented {
  background: var(--nwc-subtle);
  border-radius: 999px;
  display: flex;
  height: 14px;
  overflow: hidden;
}

.nwc-backyard-segmented span {
  display: block;
  min-width: 2px;
  width: var(--segment-width);
}

.nwc-backyard-status-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
}

.nwc-backyard-status-list div {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.nwc-backyard-status-list dt {
  align-items: center;
  color: var(--nwc-muted);
  display: inline-flex;
  font-size: 13px;
  gap: 8px;
}

.nwc-backyard-status-list dd {
  font-weight: 900;
  margin: 0;
}

.nwc-backyard-status-list dt span {
  border-radius: 999px;
  display: inline-block;
  height: 9px;
  width: 9px;
}

.nwc-backyard-segmented .is-active,
.nwc-backyard-status-list .is-active {
  background: var(--nwc-accent);
}

.nwc-backyard-segmented .is-dnf,
.nwc-backyard-status-list .is-dnf {
  background: var(--nwc-warning);
}

.nwc-backyard-segmented .is-dns,
.nwc-backyard-status-list .is-dns {
  background: var(--nwc-danger);
}

.nwc-backyard-segmented .is-finished,
.nwc-backyard-status-list .is-finished {
  background: var(--nwc-finished);
}

.nwc-backyard-sparkline {
  display: block;
  width: 100%;
}

.nwc-backyard-sparkline text {
  fill: var(--nwc-muted);
  font-size: 11px;
  font-weight: 800;
}

.nwc-backyard-spark-axis {
  stroke: var(--nwc-text);
  stroke-linecap: square;
  stroke-width: 2;
}

.nwc-backyard-spark-grid {
  stroke: var(--nwc-border);
  stroke-width: 1;
}

.nwc-backyard-sparkline path {
  fill: none;
  stroke: var(--nwc-yellow);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}

.nwc-backyard-muted,
.nwc-backyard-side-panel p {
  color: var(--nwc-muted);
  margin: 0;
}

.nwc-backyard-table-wrap,
.nwc-backyard-modal-table-wrap {
  background: var(--nwc-surface);
  border: 1px solid var(--nwc-border);
  border-radius: 8px;
  overflow-x: auto;
}

.nwc-backyard-table,
.nwc-backyard-laps-table {
  border-collapse: collapse;
  min-width: 1020px;
  width: 100%;
}

.nwc-backyard-laps-table {
  min-width: 0;
  table-layout: fixed;
}

.nwc-backyard-table th,
.nwc-backyard-table td,
.nwc-backyard-laps-table th,
.nwc-backyard-laps-table td {
  border-bottom: 1px solid var(--nwc-border);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

.nwc-backyard-laps-table th,
.nwc-backyard-laps-table td {
  padding: 8px;
  white-space: nowrap;
}

.nwc-backyard-table th,
.nwc-backyard-laps-table th {
  background: var(--nwc-subtle);
  color: var(--nwc-muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.nwc-backyard-row {
  cursor: pointer;
}

.nwc-backyard-row:hover,
.nwc-backyard-row:focus {
  background: var(--nwc-accent-soft);
  outline: 2px solid transparent;
}

.nwc-backyard-row.is-favorite {
  background: #eaf5ff;
}

.nwc-backyard-results.is-dark .nwc-backyard-row.is-favorite {
  background: #143653;
}

.nwc-backyard-row.is-dnf,
.nwc-backyard-row.is-dns,
.nwc-backyard-row.is-finished {
  color: #687385;
}

.nwc-backyard-results.is-dark .nwc-backyard-row.is-dnf,
.nwc-backyard-results.is-dark .nwc-backyard-row.is-dns,
.nwc-backyard-results.is-dark .nwc-backyard-row.is-finished {
  color: #b9c6d3;
}

.nwc-backyard-fav {
  align-items: center;
  background: transparent;
  border-color: transparent;
  color: #a8b0bb;
  display: inline-flex;
  font-size: 23px;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 32px;
}

.nwc-backyard-fav[aria-pressed="true"] {
  background: transparent;
  border-color: transparent;
  color: #f7b500;
}

.nwc-backyard-fav:hover,
.nwc-backyard-fav:focus {
  background: #e5f3ff;
  border-color: #98cff7;
  outline: none;
}

.nwc-backyard-badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  margin-left: 8px;
  padding: 2px 8px;
}

.nwc-backyard-badge-dnf {
  background: #fff7ed;
  color: var(--nwc-warning);
}

.nwc-backyard-badge-dns {
  background: #fee2e2;
  color: var(--nwc-danger);
}

.nwc-backyard-badge-finished {
  background: #dcfce7;
  color: var(--nwc-finished);
}

.nwc-backyard-modal[hidden] {
  display: none;
}

.nwc-backyard-modal {
  align-items: center;
  background: rgba(13, 23, 38, 0.55);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 100000;
}

.nwc-backyard-modal-card {
  background: var(--nwc-surface);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
  max-height: min(760px, 90vh);
  max-width: 760px;
  overflow: auto;
  padding: 22px;
  position: relative;
  width: min(760px, 100%);
}

.nwc-backyard-modal-close {
  align-items: center;
  background: #ffffff;
  border-color: var(--nwc-border);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(18, 58, 90, 0.16);
  color: var(--nwc-navy);
  display: inline-flex;
  font-size: 24px;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 14px;
  top: 14px;
  width: 38px;
}

.nwc-backyard-modal-close:hover,
.nwc-backyard-modal-close:focus {
  background: var(--nwc-yellow);
  outline: none;
}

.nwc-backyard-modal-card h2 {
  margin: 0 48px 18px 0;
}

@media (min-width: 900px) {
  .nwc-backyard-toolbar {
    align-items: end;
    gap: 14px;
    grid-template-columns: minmax(130px, auto) auto minmax(180px, 1fr) auto auto auto auto;
  }

  .nwc-backyard-toolbar > *,
  .nwc-backyard-icon-button[data-role="dark-mode"],
  .nwc-backyard-icon-button[data-role="fullscreen"],
  .nwc-backyard-discipline {
    order: initial;
  }

  .nwc-backyard-toolbar > :first-child,
  .nwc-backyard-search,
  .nwc-backyard-toggle,
  .nwc-backyard-button {
    grid-column: auto;
  }

  .nwc-backyard-icon-button[data-role="dark-mode"],
  .nwc-backyard-icon-button[data-role="fullscreen"],
  .nwc-backyard-discipline {
    grid-column: auto;
  }

  .nwc-backyard-visuals {
    grid-template-columns: minmax(0, 1fr) 280px;
  }

  .nwc-backyard-chart-scroll {
    min-height: 440px;
  }

  .nwc-backyard-discipline {
    justify-self: start;
  }

}

@media (max-width: 780px) {
  .nwc-backyard-results {
    padding: 12px;
  }

  .nwc-backyard-toolbar {
    align-items: center;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }

  .nwc-backyard-toolbar > :first-child,
  .nwc-backyard-search,
  .nwc-backyard-button,
  .nwc-backyard-discipline,
  .nwc-backyard-toggle,
  .nwc-backyard-icon-button[data-role="dark-mode"],
  .nwc-backyard-icon-button[data-role="fullscreen"] {
    grid-column: auto;
  }

  .nwc-backyard-toolbar > :first-child {
    order: 1;
    min-width: 0;
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .nwc-backyard-toolbar > :first-child .nwc-backyard-kicker {
    margin: 0;
  }

  .nwc-backyard-search {
    order: 2;
    grid-column: 1 / -1;
  }

  .nwc-backyard-toggle {
    order: 3;
    grid-column: 1 / -1;
  }

  .nwc-backyard-button {
    order: 4;
    grid-column: 1 / -1;
  }

  .nwc-backyard-icon-button[data-role="dark-mode"] {
    order: 5;
    grid-column: 1;
    justify-self: start;
  }

  .nwc-backyard-discipline {
    order: 6;
    grid-column: 2;
    justify-self: center;
  }

  .nwc-backyard-icon-button[data-role="fullscreen"] {
    order: 7;
    grid-column: 3;
    justify-self: end;
  }

  .nwc-backyard-chart-heading {
    align-items: start;
    flex-direction: column;
  }

  .nwc-backyard-side-panel {
    grid-template-columns: 1fr;
  }

  .nwc-backyard-table {
    min-width: 960px;
  }

  .nwc-backyard-laps-table {
    font-size: 13px;
    min-width: 0;
  }

  .nwc-backyard-laps-table th,
  .nwc-backyard-laps-table td {
    padding: 6px 5px;
  }

  .nwc-backyard-modal {
    padding: 10px;
  }

  .nwc-backyard-modal-card {
    padding: 18px 12px 14px;
  }

  .nwc-backyard-tooltip {
    left: 12px !important;
    right: 12px;
    top: 12px !important;
  }
}

@media print {
  .nwc-backyard-toolbar,
  .nwc-backyard-visuals,
  .nwc-backyard-modal {
    display: none;
  }
}
