:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #d9dfe5;
  --line-strong: #bac4ce;
  --text: #151a20;
  --muted: #5d6875;
  --accent: #087d74;
  --accent-dark: #05625c;
  --live: #15803d;
  --table-zoom: 1;
  --table-min-width: 760px;
  --table-font-size: 13px;
  --table-pad-y: 7px;
  --table-pad-x: 9px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button, select, input { font: inherit; }

.canonical-notice {
  padding: 8px 24px;
  background: #e7f3f1;
  border-bottom: 1px solid #b7d7d2;
  color: #134e4a;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.canonical-notice a {
  color: #065f5b;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px max(24px, calc((100vw - 1500px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand h1 {
  margin: 2px 0 0;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0;
}

.event-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--live);
  font-size: 14px;
  font-weight: 700;
}

.live-status.stale { color: #9a6700; }
.live-status.offline { color: #b42318; }

.live-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

main {
  max-width: 1548px;
  margin: 0 auto;
  padding: 18px 24px 40px;
}

.view-bar {
  display: flex;
  align-items: end;
  gap: 18px;
  margin-bottom: 16px;
}

.view-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #e9edf1;
}

.view-tab {
  min-width: 76px;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.view-tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(20, 30, 40, 0.14);
}

.result-filters {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) minmax(110px, 0.6fr) minmax(150px, 0.8fr) minmax(105px, 0.5fr);
  gap: 10px;
  width: min(850px, 100%);
}

.result-filters.replay-filters {
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.8fr) minmax(105px, 0.5fr);
  width: min(720px, 100%);
}

.result-filters label[hidden] { display: none; }

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

select, input, textarea {
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}

textarea {
  min-height: 120px;
  padding: 9px 10px;
  line-height: 1.45;
  resize: vertical;
}

button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover { background: var(--accent-dark); }

.secondary-button {
  border-color: var(--line-strong);
  background: var(--panel);
  color: var(--text);
}

button:disabled { cursor: not-allowed; opacity: 0.45; }

.replay-panel {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.replay-panel[hidden] { display: none; }

.replay-primary-time {
  display: block;
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.replay-wall-clock {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}
.replay-wall-clock strong {
  display: block;
  margin-top: 1px;
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.timeline-control input { width: 100%; padding: 0; }
.replay-actions { display: flex; gap: 8px; }
.replay-actions button { white-space: nowrap; }
.replay-fine-controls {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(360px, auto) 140px 92px;
  align-items: end;
  gap: 10px;
}
.replay-stepper {
  display: flex;
  gap: 6px;
}
.replay-stepper button {
  min-height: 32px;
  padding: 6px 10px;
}

.youtube-sync {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

summary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.youtube-fields {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(190px, 1fr) auto auto minmax(100px, 0.5fr) minmax(180px, 1fr);
  align-items: end;
  gap: 10px;
  padding-top: 12px;
}

.result-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin: 14px 2px 10px;
}

.result-heading h2 {
  margin: 3px 0 0;
  font-size: 22px;
  letter-spacing: 0;
}

.updated-time { text-align: right; }
.label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.tables { display: grid; gap: 18px; }

.attempt-changes {
  margin: 14px 0 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.attempt-changes:empty { display: none; }

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

.attempt-changes-heading h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.attempt-changes-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.attempt-changes-heading > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.attempt-changes ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.attempt-changes li {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.attempt-changes li:last-child { border-bottom: 0; }

.attempt-changes time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.attempt-change-main {
  display: flex;
  min-width: 0;
  gap: 8px;
}

.attempt-change-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attempt-change-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.attempt-changes-empty {
  margin: 0;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  -webkit-overflow-scrolling: touch;
}

.table-title {
  display: flex;
  position: sticky;
  left: 0;
  z-index: 2;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

table {
  width: 100%;
  min-width: var(--table-min-width);
  border-collapse: collapse;
  font-size: var(--table-font-size);
  zoom: var(--table-zoom);
}

td, th {
  padding: var(--table-pad-y) var(--table-pad-x);
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

@supports not (zoom: 1) {
  table {
    min-width: calc(var(--table-min-width) * var(--table-zoom));
    font-size: calc(var(--table-font-size) * var(--table-zoom));
  }
  td, th {
    padding: calc(var(--table-pad-y) * var(--table-zoom)) calc(var(--table-pad-x) * var(--table-zoom));
  }
}

tr:first-child td, tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f4;
  font-weight: 700;
}

tr:nth-child(even) td { background: #fafbfc; }
td.G_ { background: #d9f2df !important; color: #155724; font-weight: 700; }
td.R_, td.N_ { background: #f8d7da !important; color: #842029; font-weight: 700; }
td.X_ { background: #fff3cd !important; color: #664d03; }
th.squat, th.bench, th.dead { background: #e7edf3; }

.opl-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.opl-link:hover {
  color: var(--accent);
}

td.ipfbody-title {
  background: #e2e8ee !important;
  color: var(--text);
  font-weight: 700;
  text-align: center;
}

td.calculated-place,
td.current-place-value {
  font-weight: 400;
  text-align: center;
}

tr.current-lifter td {
  box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent);
}

tr.current-lifter td:first-child {
  border-left: 4px solid var(--accent);
}

tr.current-lifter td:not(.G_):not(.R_):not(.N_):not(.X_) {
  background: #dff5f2;
}

.mobile-label { display: none; }
.estimate { color: #8a4b00; }

.empty {
  padding: 32px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
}

.technical-info {
  margin-top: 18px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(220px, 1fr);
  gap: 14px;
  padding-top: 14px;
}

.status-grid strong {
  display: block;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.disclaimer {
  max-width: 980px;
  margin: 12px auto 0;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.disclaimer strong { color: var(--text); }
.disclaimer a { color: var(--accent-dark); }

.text-button {
  display: block;
  min-height: auto;
  margin: 8px auto 0;
  padding: 3px;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 12px;
  text-decoration: underline;
}

.contact-dialog {
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.contact-dialog::backdrop { background: rgba(20, 28, 38, 0.58); }

.contact-form {
  display: grid;
  gap: 15px;
  padding: 20px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-heading h2 { margin: 3px 0 0; font-size: 22px; }

.close-button {
  width: 36px;
  min-width: 36px;
  padding: 0;
  border-color: var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 25px;
  line-height: 1;
}

.form-intro {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.contact-person {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.contact-person label span { font-weight: 500; text-transform: none; }
.honeypot { position: absolute; left: -10000px; }

.report-context {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

.report-context p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.privacy-note {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.turnstile-container:empty { display: none; }

.contact-status {
  min-height: 18px;
  margin: -4px 0;
  color: var(--muted);
  font-size: 12px;
}

.contact-status.error { color: #b42318; }
.contact-status.success { color: var(--live); }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

@media (max-width: 900px) {
  .view-bar { align-items: stretch; flex-direction: column; gap: 10px; }
  .result-filters { width: 100%; }
  .replay-panel { grid-template-columns: auto minmax(220px, 1fr) auto; }
  .replay-fine-controls {
    grid-row: 2;
    grid-template-columns: 1fr 1fr;
  }
  .replay-stepper { grid-column: 1 / -1; }
  .youtube-sync { grid-row: 3; }
  .youtube-fields { grid-template-columns: 1fr 1fr; }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .topbar {
    align-items: flex-start;
    padding: 13px 10px;
  }

  .brand h1 { font-size: 20px; }
  .event-label { font-size: 9px; }
  .live-status { padding-top: 2px; font-size: 11px; white-space: nowrap; }

  main { padding: 10px 6px 28px; }
  .view-bar { margin-bottom: 10px; }
  .view-tabs { width: 100%; }
  .view-tab { flex: 1; }

  .result-filters {
    grid-template-columns: minmax(0, 1.1fr) minmax(88px, 0.85fr) minmax(128px, 1.35fr);
    gap: 6px;
  }

  .result-filters.replay-filters {
    grid-template-columns: minmax(0, 1.4fr) minmax(128px, 1fr);
  }

  .zoom-control { grid-column: 1 / -1; display: none; }
  label { font-size: 9px; }
  select, input, textarea, button { min-height: 34px; font-size: 12px; }

  .replay-panel {
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px;
  }

  .replay-clock { grid-column: 1; }
  .replay-primary-time { font-size: 25px; }
  .replay-wall-clock strong { font-size: 11px; }
  .timeline-control { grid-column: 1 / -1; grid-row: 2; }
  .replay-fine-controls {
    grid-column: 1 / -1;
    grid-row: 3;
    grid-template-columns: 1fr 1fr;
  }
  .replay-stepper { grid-column: 1 / -1; }
  .replay-stepper button { flex: 1; padding: 5px; }
  .replay-actions { grid-column: 1 / -1; grid-row: 4; }
  .replay-actions button { flex: 1; }
  .time-control { grid-column: 1; }
  .speed-control { grid-column: 2; }
  .youtube-sync { grid-row: 6; }
  .youtube-fields { grid-template-columns: 1fr; }

  .result-heading {
    align-items: flex-start;
    margin: 8px 2px 7px;
  }

  .result-heading h2 { font-size: 17px; line-height: 1.2; }
  .updated-time { font-size: 11px; }
  .updated-time .label { display: none; }

  .table-wrap {
    padding-bottom: 6px;
    border-radius: 5px;
  }
  .table-title { padding: 7px 8px; font-size: 10px; }

  .attempt-changes { margin: 10px 0 14px; }
  .attempt-changes-heading { padding: 10px; }
  .attempt-changes-heading h3 { font-size: 14px; }
  .attempt-changes li {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 7px;
    padding: 8px 10px;
    font-size: 12px;
  }
  .attempt-change-main {
    display: grid;
    gap: 2px;
  }
  .attempt-change-meta {
    grid-column: 2;
    font-size: 11px;
  }

  table {
    --table-min-width: 560px;
    --table-font-size: 10px;
    --table-pad-y: 3px;
    --table-pad-x: 4px;
  }

  td, th { line-height: 1.15; }

  td.current-place-heading,
  th.current-place-heading,
  td.calculated-place,
  td.current-place-value {
    width: 26px;
    min-width: 26px;
    max-width: 26px;
    padding-left: 2px;
    padding-right: 2px;
    text-align: center;
  }

  .current-place-heading .desktop-label { display: none; }
  .current-place-heading .mobile-label { display: inline; }
  .technical-info { margin-top: 12px; padding: 10px 6px; }
  .status-grid { grid-template-columns: 1fr; }
  .contact-form { padding: 16px 14px; }
  .contact-person { grid-template-columns: 1fr; }
}
