:root {
  --bg: #f4f7f2;
  --card: #ffffff;
  --ink: #121c1a;
  --muted: #5f6f68;
  --line: #d3ded8;
  --accent: #1f7a5b;
  --accent-soft: #e8f6ef;
  --warn: #fff4d8;
  --sidebar-bg: #f6fbf8;
  --shadow: 0 12px 30px rgba(18, 28, 26, 0.08);
  --auth-bg: linear-gradient(140deg, #eff7f3 0%, #f7faf9 48%, #eef3fb 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1000px 420px at 85% -10%, rgba(133, 216, 181, 0.18), transparent 50%),
    radial-gradient(900px 380px at -5% 18%, rgba(130, 169, 223, 0.12), transparent 55%),
    var(--bg);
  overflow-x: hidden;
}

body[data-theme="dark"] {
  --bg: #111716;
  --card: #17201d;
  --ink: #ecf3f1;
  --muted: #a8b9b2;
  --line: #2b3b35;
  --accent: #56bb91;
  --accent-soft: #20382f;
  --warn: #3d341f;
  --sidebar-bg: #151d1a;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", "Manrope", sans-serif;
  letter-spacing: -0.02em;
}

.app-shell {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 20px 16px 26px;
}

.sidebar {
  position: sticky;
  top: 16px;
  align-self: flex-start;
  width: 250px;
  min-height: calc(100vh - 36px);
  margin-bottom: 0;
  background: var(--sidebar-bg);
  border-color: var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: width 0.18s ease;
}

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

.sidebar-toggle {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.sidebar-toggle:hover {
  border-color: var(--accent);
}

.sidebar-icon-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  text-decoration: none;
}

.sidebar-icon-home:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--card) 30%);
}

.sidebar-icon-home img {
  width: 28px;
  height: 28px;
  display: block;
  border-radius: 8px;
}

body.sidebar-collapsed .sidebar {
  width: 58px;
  min-height: 0;
  padding: 10px 8px;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.side-nav-link {
  display: block;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--ink);
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 700;
}

.side-nav-link:hover {
  border-color: var(--line);
  background: color-mix(in srgb, var(--card) 86%, transparent);
}

.side-nav-link.active {
  background: var(--accent);
  color: #fff;
}

.side-nav-label {
  display: inline;
}

.sidebar-bottom {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.sidebar-email {
  margin-top: 0;
  margin-bottom: 10px;
  word-break: break-word;
}

.side-logout-link {
  display: inline-flex;
  text-decoration: none;
  color: #b54242;
  border: 1px solid #d59c9c;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 700;
}

body.sidebar-collapsed .sidebar-top {
  justify-content: center;
}

body.sidebar-collapsed .sidebar-icon-home,
body.sidebar-collapsed .side-nav,
body.sidebar-collapsed .sidebar-bottom {
  display: none;
}

.page {
  max-width: 1100px;
  margin: 0;
  padding: 0 16px 24px;
  overflow-x: hidden;
}

.app-main {
  flex: 1 1 auto;
  max-width: none;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.hero {
  background:
    linear-gradient(135deg, #ffffff 0%, #f8fcff 100%);
}

.hero-header-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.brand-row {
  margin-bottom: 8px;
  flex: 1 1 auto;
}

.brand-home-link {
  display: inline-flex;
  text-decoration: none;
  line-height: 1;
}

.hero-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  margin: 8px 0 6px;
}

.hero-search-row>* {
  min-width: 0;
}

.hero-search-main {
  min-width: 0;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  width: min(100%, 460px);
  border-radius: 22px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 90%, #eef7ff 10%);
  padding: 12px 14px;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(18, 28, 26, 0.08);
}

.brand-lockup-icon {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  flex: 0 0 auto;
  display: block;
}

.brand-lockup-copy {
  display: grid;
  gap: 2px;
}

.brand-lockup-title {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(30px, 2.8vw, 44px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.brand-lockup-subtitle {
  margin: 0;
  font-size: clamp(14px, 1.2vw, 18px);
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
}

.auth-brand {
  margin-inline: auto;
  width: min(100%, 500px);
}

.ad-card {
  margin-bottom: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbff 100%);
  border-color: #c8ddeb;
}

.ad-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #557299;
  margin-bottom: 8px;
}

.ad-card-body {
  min-height: 62px;
  border: 1px dashed #afc3dc;
  border-radius: 10px;
  color: #516a8f;
  font-size: 12px;
  font-weight: 600;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px 12px;
  background: repeating-linear-gradient(45deg,
      #f4f8fd,
      #f4f8fd 10px,
      #eaf2fb 10px,
      #eaf2fb 20px);
}

.ad-card-top {
  width: 100%;
  max-width: 100%;
  justify-self: end;
  min-height: 128px;
}

.ad-inline-section {
  margin-bottom: 18px;
}

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

.ad-card-middle,
.ad-card-bottom {
  width: 100%;
}

.hero-topline {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #c8ddeb;
  border-radius: 999px;
  padding: 5px 10px;
}

.hero h1 {
  margin: 10px 0 2px;
  font-size: 34px;
  line-height: 1.1;
}

.hero p {
  margin: 8px 0;
  color: var(--muted);
}

.meta {
  font-size: 13px;
}

.search-scope-note {
  margin-top: -2px;
}

.message {
  background: var(--warn);
  border: 1px solid #efdca0;
  border-radius: 8px;
  padding: 8px 10px;
}

.record-alert {
  margin: 6px 0 10px;
  background: #eaf8ef;
  border: 1px solid #b9e4c6;
  color: #155a30;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
}

.athlete-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.athlete-form label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.athlete-form input {
  min-width: 280px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
}

.athlete-form select {
  min-width: 280px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

.athlete-form button {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font-weight: 600;
  font: inherit;
  cursor: pointer;
}

.athlete-form button:hover {
  filter: brightness(1.06);
}

.fav-actions-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.fav-actions-wrap.compact {
  margin-top: 0;
}

.fav-inline-form {
  margin: 0;
}

.fav-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 9px;
  padding: 7px 11px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.fav-btn.secondary {
  background: transparent;
  color: var(--accent);
}

.fav-btn.danger {
  background: #a93939;
  border-color: #a93939;
  color: #fff;
}

.h2h-card .table-wrap table {
  min-width: 0;
}

.h2h-card .table-wrap td {
  white-space: normal;
}

.h2h-summary-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.3fr) minmax(260px, 0.9fr);
  gap: 12px;
  margin: 10px 0 12px;
}

.h2h-summary-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 90%, #eef5ff 10%);
  padding: 12px;
}

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

.h2h-kpi-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  padding: 8px;
}

.h2h-kpi-box span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.h2h-kpi-box strong {
  display: block;
  margin-top: 3px;
  font-size: 24px;
  line-height: 1;
}

.h2h-kpi-win strong {
  color: #1c8c60;
}

.h2h-kpi-loss strong {
  color: #c54545;
}

.h2h-summary-text {
  margin: 10px 0 0;
}

.h2h-pie-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.h2h-pie {
  width: 114px;
  height: 114px;
  border-radius: 50%;
  border: 1px solid var(--line);
  position: relative;
}

.h2h-pie.is-ready {
  background: conic-gradient(#1c8c60 0 var(--h2h-win), #c54545 var(--h2h-win) 100%);
}

.h2h-pie.is-empty {
  background: conic-gradient(#7b8894 0 100%);
}

.h2h-pie-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 62px;
  height: 62px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
}

.h2h-pie-legend {
  display: grid;
  gap: 6px;
}

.h2h-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.h2h-dot-win {
  background: #1c8c60;
}

.h2h-dot-loss {
  background: #c54545;
}

.h2h-table-wrap td {
  white-space: nowrap;
}

.h2h-outcome-pill {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.h2h-outcome-win {
  background: #e7f7ee;
  border-color: #b8e3cb;
  color: #1d7750;
}

.h2h-outcome-loss {
  background: #fdecec;
  border-color: #efbcbc;
  color: #a43232;
}

.h2h-outcome-unknown {
  background: #eef2f7;
  border-color: #d5dce7;
  color: #5e6f80;
}

.h2h-row-win td {
  background: color-mix(in srgb, #1c8c60 10%, transparent);
}

.h2h-row-loss td {
  background: color-mix(in srgb, #c54545 9%, transparent);
}

.default-pill {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid #9bcfb7;
  background: #dff3e9;
  color: #1b664a;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 800;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid>* {
  min-width: 0;
}

.summary-grid .card p {
  margin: 6px 0;
}

.live-focus {
  border: 1px solid #cddaf0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f2f8ff 100%);
  padding: 12px;
  margin-bottom: 10px;
}

.live-focus-label {
  font-size: 12px;
  color: #4f6483;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.live-focus-rank {
  font-size: 52px;
  line-height: 1;
  font-weight: 800;
  color: #122443;
}

.live-focus-sub {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-focus-vs {
  font-size: 13px;
  color: #4f6483;
  font-weight: 600;
}

.live-scope-panel {
  display: none;
}

.live-scope-panel.active {
  display: block;
}

.live-quick-stats {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 8px;
}

.live-stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
}

.live-stat span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.live-stat strong {
  font-size: 20px;
  line-height: 1.1;
}

.athlete-static-card {
  background: linear-gradient(135deg, #f7fbff 0%, #ffffff 100%);
}

.athlete-static-head {
  display: inline-block;
  margin-bottom: 4px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid #c8ddeb;
  background: #eef6fc;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.athlete-static-card>.meta {
  margin: 2px 0 8px;
}

.athlete-static-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.athlete-field {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
}

.athlete-field-highlight {
  border-color: #c8ddeb;
  background: #f3f9fd;
}

.athlete-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.athlete-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.athlete-category-box {
  margin-top: 12px;
  border: 1px solid #c8ddeb;
  border-radius: 12px;
  background: #f4f9ff;
  padding: 10px 12px;
}

.athlete-category-head {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.athlete-category-box .meta {
  margin: 6px 0;
}

.category-range {
  color: #4f6483;
}

.summary-grid h2,
.grid h2,
.card h2 {
  margin: 0 0 10px;
}

.rank-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}

.rank-tab {
  border: 1px solid #c8ddeb;
  background: #f1f7fb;
  color: var(--accent);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.rank-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.rank-tab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.rank-tab.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.rank-panel {
  display: none;
}

.rank-panel.active {
  display: block;
}

.scope-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

.scope-select-label {
  font-size: 12px;
  color: #4f6483;
  font-weight: 600;
}

.scope-select {
  border: 1px solid #c8ddeb;
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 5px 8px;
  font: inherit;
  font-size: 12px;
  min-width: 180px;
}

.jump-wrap {
  margin: -4px 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.jump-to-me-btn {
  border: 1px solid #9ec4d3;
  background: transparent;
  color: var(--accent);
  border-radius: 8px;
  padding: 4px 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: border-color 0.12s ease, color 0.12s ease;
}

.jump-to-me-btn:hover {
  border-color: var(--accent);
  color: #0c556b;
}

.jump-to-me-btn:active {
  opacity: 0.85;
}

.jump-to-me-btn:focus-visible {
  outline: 2px solid #b6dce8;
  outline-offset: 2px;
}

.mini-chart {
  display: grid;
  gap: 8px;
}

.pie-grid {
  align-items: stretch;
}

.pie-wrap {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: center;
}

.pie-chart {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 1px solid var(--line);
  position: relative;
}

.pie-points {
  background:
    conic-gradient(#1f9d55 0 var(--p1),
      #d97706 var(--p1) calc(var(--p1) + var(--p2)),
      #facc15 calc(var(--p1) + var(--p2)) 100%);
}

.pie-wins {
  background:
    conic-gradient(#1f9d55 0 var(--p1),
      #d97706 var(--p1) 100%);
}

.pie-results {
  background:
    conic-gradient(#1f9d55 0 var(--p1),
      #b23c3c var(--p1) 100%);
}

.pie-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.pie-legend {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dot {
  width: 11px;
  height: 11px;
  min-width: 11px;
  min-height: 11px;
  flex: 0 0 11px;
  border-radius: 50%;
  display: inline-block;
}

.dot-team {
  background: #1f9d55;
}

.dot-team-points {
  background: #f97316;
}

.dot-individual {
  background: #7c3aed;
}

.dot-bonus {
  background: #facc15;
}

.dot-loss {
  background: #b23c3c;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 220px) 1fr 64px;
  gap: 10px;
  align-items: center;
}

.bar-label {
  font-size: 13px;
  color: var(--muted);
}

.bar-track {
  height: 13px;
  background: #eaf0f8;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0f6a87, #1594ba);
}

.bar-fill.alt {
  background: linear-gradient(90deg, #38bdf8, #0ea5e9);
}

.bar-fill.team {
  background: linear-gradient(90deg, #f97316, #fb923c);
}

.bar-fill.individual {
  background: linear-gradient(90deg, #7c3aed, #8b5cf6);
}

.bar-fill.warn {
  background: linear-gradient(90deg, #be7c1f, #d9a33c);
}

.bar-fill.hist-team {
  background: linear-gradient(90deg, #f97316, #fb923c);
}

.bar-fill.hist-team-loss {
  background: linear-gradient(90deg, #6b7280, #9aa3b2);
}

.bar-fill.hist-individual {
  background: linear-gradient(90deg, #7c3aed, #8b5cf6);
}

.bar-fill.hist-individual-loss {
  background: linear-gradient(90deg, #b23c3c, #db6666);
}

.bar-value {
  text-align: right;
  font-weight: 600;
}

.timeline-card {
  background:
    radial-gradient(1200px 280px at 0% -10%, #eef7ff 0%, transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #f9fcff 100%);
}

.timeline-chart-wrap {
  width: 100%;
}

.timeline-chart {
  width: 100%;
  height: 230px;
  display: block;
  border: 1px solid #cddaf0;
  border-radius: 14px;
  background:
    repeating-linear-gradient(to top,
      rgba(77, 121, 201, 0.07) 0 1px,
      transparent 1px 24%),
    linear-gradient(to top, #eff6ff 0%, #ffffff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.timeline-area {
  fill: url(#timelineArea);
}

.timeline-line {
  fill: none;
  stroke: url(#timelineStroke);
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.timeline-dot {
  fill: #ffffff;
  stroke: #1d4ed8;
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
}

.timeline-labels {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #4f6483;
  font-weight: 600;
}

.timeline-milestones {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.best-live-grid {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.best-live-card {
  margin-bottom: 0;
}

.best-live-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.best-live-athlete-box {
  border: 1px solid #cddaf0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
  padding: 10px 12px;
}

.best-live-card .best-live-athlete-box:not(:last-of-type) {
  margin-bottom: 10px;
}

.best-live-athlete-name {
  font-size: 18px;
  font-weight: 700;
  color: #122443;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.best-live-athlete-meta {
  font-size: 14px;
  color: #4f6483;
  margin: 2px 0;
}

.best-live-rank-card .best-live-athlete-box:first-of-type {
  margin-top: 8px;
}

.best-live-improve {
  color: #0f6a2f;
  font-weight: 700;
}

.milestone {
  border: 1px solid #cddaf0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
  padding: 7px 9px;
  box-shadow: 0 6px 18px rgba(31, 55, 91, 0.08);
}

.milestone-label {
  font-size: 10px;
  color: #577094;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.milestone-value {
  font-size: 18px;
  font-weight: 700;
  color: #122443;
  line-height: 1.12;
  margin-top: 2px;
}

.trend-arrow {
  display: inline-block;
  margin-left: 6px;
  font-size: 16px;
  line-height: 1;
  vertical-align: middle;
}

.trend-up {
  color: #0f6a2f;
}

.trend-down {
  color: #a72121;
}

.milestone-date {
  font-size: 11px;
  color: #4f6483;
  margin-top: 2px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  max-height: 420px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.table-wrap.small {
  max-height: 320px;
}

.table-mobile-scroll {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 620px;
}

thead th {
  position: sticky;
  top: 0;
  background: #eaf1f9;
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 8px;
}

td {
  border-bottom: 1px solid #edf1f7;
  padding: 7px 8px;
  white-space: nowrap;
}

.delta-pill {
  display: inline-block;
  min-width: 54px;
  text-align: center;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.delta-pos {
  color: #0f6a2f;
  background: #e9f8ee;
  border-color: #b7e5c4;
}

.delta-neg {
  color: #a72121;
  background: #fdecec;
  border-color: #f5bcbc;
}

.delta-zero {
  color: #4f637d;
  background: #eef3f9;
  border-color: #cfdaea;
}

.delta-points-note {
  margin-left: 4px;
  font-size: 11px;
  font-style: italic;
  color: #6a7f9f;
  white-space: nowrap;
}

.info-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid #c8ddeb;
  background: #f1f7fb;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  line-height: 1;
}

.info-link:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.icon-link {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.club-athlete-link {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.12s ease;
}

.club-athlete-link:hover {
  color: #1e40af;
  text-decoration: underline;
}

.club-row-me td {
  background: #fff7df !important;
  font-weight: 700;
}

.club-row-me td:first-child {
  border-left: 5px solid #d97706;
}

.club-row-me .club-athlete-link {
  color: #9a4f00;
}

.club-me-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid #f1be72;
  background: #ffe8bf;
  color: #8a4800;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

tr.me {
  background: #eef7ff;
  font-weight: 600;
}

tr.recent-invalid-row td {
  background: #f3f4f6;
}

.recent-esito-cell {
  text-align: center;
  font-weight: 700;
}

.recent-esito-win {
  color: #159447;
}

.recent-esito-loss {
  color: #c43a3a;
}

tr.row-focus {
  animation: rowFlash 1s ease;
}

@keyframes rowFlash {
  0% {
    background: #fff7d6;
  }

  100% {
    background: #eef7ff;
  }
}

.error {
  border-color: #e56b6b;
  color: #7d1212;
  background: #ffeded;
}

.auth-body {
  background: var(--auth-bg);
}

.auth-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 26px 16px 36px;
}

.auth-hero {
  text-align: center;
  margin-bottom: 16px;
}

.auth-hero h1 {
  margin: 8px 0 4px;
}

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

.auth-card {
  margin-bottom: 0;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-form label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.auth-form input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
}

.auth-form button,
.settings-form button {
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.settings-form {
  display: grid;
  gap: 12px;
}

.settings-toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.settings-toggle-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.settings-toggle-ui {
  width: 48px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 84%, #9bb2a7 16%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f4fbf8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s ease, background 0.2s ease;
}

.settings-toggle-copy {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.settings-toggle-row:hover .settings-toggle-ui {
  border-color: var(--accent);
}

.settings-toggle-input:checked+.settings-toggle-ui {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 90%, #fff 10%);
}

.settings-toggle-input:checked+.settings-toggle-ui::after {
  transform: translateX(22px);
  background: #ffffff;
}

.settings-toggle-input:focus-visible+.settings-toggle-ui {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.calendar-component-wrap {
  margin-top: 38px;
}

.calendar-component-wrap h3 {
  margin: 0 0 10px;
  font-size: 20px;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.calendar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

.calendar-legend-item::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.calendar-legend-item.legend-torneo::before {
  background: #0ea5a5;
}

.calendar-legend-item.legend-campionato::before {
  background: #ea580c;
}

.calendar-legend-item.legend-mixed::before {
  background: linear-gradient(135deg, #0ea5a5 0%, #0ea5a5 48%, #ea580c 52%, #ea580c 100%);
}

.calendar-months-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.calendar-month-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--card) 92%, #f2f8ff 8%);
}

.calendar-month-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.calendar-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.calendar-weekday-cell {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}

.calendar-day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-day-cell {
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  background: var(--card);
}

.calendar-day-cell.is-outside {
  opacity: 0.42;
}

.calendar-day-cell.is-window {
  opacity: 1;
}

.calendar-day-cell.is-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.calendar-day-cell.has-events {
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--card) 55%);
}

.calendar-day-cell.has-events.kind-torneo {
  border-color: color-mix(in srgb, #0ea5a5 50%, var(--line) 50%);
  background: color-mix(in srgb, #0ea5a5 18%, var(--card) 82%);
}

.calendar-day-cell.has-events.kind-campionato {
  border-color: color-mix(in srgb, #ea580c 50%, var(--line) 50%);
  background: color-mix(in srgb, #ea580c 16%, var(--card) 84%);
}

.calendar-day-cell.has-events.kind-mixed {
  border-color: color-mix(in srgb, #b45309 45%, var(--line) 55%);
  background: linear-gradient(135deg,
      color-mix(in srgb, #0ea5a5 16%, var(--card) 84%) 0%,
      color-mix(in srgb, #0ea5a5 16%, var(--card) 84%) 48%,
      color-mix(in srgb, #ea580c 15%, var(--card) 85%) 52%,
      color-mix(in srgb, #ea580c 15%, var(--card) 85%) 100%);
}

.calendar-day-cell.is-clickable {
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.calendar-day-cell.is-clickable:hover,
.calendar-day-cell.is-clickable:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 36%, transparent);
  transform: translateY(-1px);
}

.calendar-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.calendar-day-number {
  font-size: 12px;
  font-weight: 700;
}

.calendar-day-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 0 4px;
}

.calendar-day-badge.kind-torneo {
  background: #0ea5a5;
}

.calendar-day-badge.kind-campionato {
  background: #ea580c;
}

.calendar-day-badge.kind-mixed {
  background: linear-gradient(135deg, #0ea5a5 0%, #0ea5a5 48%, #ea580c 52%, #ea580c 100%);
}

.calendar-day-title {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.15;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.calendar-day-events {
  display: none;
}

.calendar-event-detail {
  display: grid;
  gap: 5px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 90%, var(--bg) 10%);
}

.calendar-event-detail.event-kind-torneo {
  border-left: 4px solid #0ea5a5;
}

.calendar-event-detail.event-kind-campionato {
  border-left: 4px solid #ea580c;
}

.calendar-event-detail-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.calendar-event-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.calendar-event-kind-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid var(--line);
}

.calendar-event-kind-pill.pill-torneo {
  border-color: color-mix(in srgb, #0ea5a5 55%, var(--line) 45%);
  background: color-mix(in srgb, #0ea5a5 16%, var(--card) 84%);
}

.calendar-event-kind-pill.pill-campionato {
  border-color: color-mix(in srgb, #ea580c 55%, var(--line) 45%);
  background: color-mix(in srgb, #ea580c 14%, var(--card) 86%);
}

.calendar-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
}

.calendar-modal[hidden] {
  display: none !important;
}

.calendar-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 14, 0.56);
}

.calendar-modal-dialog {
  position: relative;
  width: min(100%, 720px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.35);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.calendar-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.calendar-modal-head h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.calendar-modal-close {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--card) 90%, var(--bg) 10%);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}

.calendar-modal-close:hover {
  border-color: var(--accent);
}

.calendar-modal-list {
  display: grid;
  gap: 10px;
}

body.modal-open {
  overflow: hidden;
}

.cookie-banner {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 60;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.cookie-banner[hidden],
.cookie-form[hidden] {
  display: none !important;
}

.cookie-banner p {
  margin: 0;
  font-size: 13px;
}

.cookie-banner button {
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}

.cookie-form {
  margin: 0;
}

.site-footer {
  margin-top: 2px;
  border-top: 1px solid #c8ddeb;
  background: linear-gradient(180deg, #eaf3fa 0%, #dfeaf5 100%);
  width: 100%;
}

.site-footer-inner {
  max-width: none;
  margin: 0;
  padding: 18px 24px 14px;
}

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

.footer-col h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: #122443;
}

.footer-col p {
  margin: 5px 0;
  font-size: 12px;
  color: #4f6483;
}

.footer-socials {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-social-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #0f6a87;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.footer-social-link:hover {
  text-decoration: underline;
}

.footer-social-link svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.footer-bottom {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #c8ddeb;
  font-size: 12px;
  color: #4f6483;
}

/* Dark mode component-level overrides */
body[data-theme="dark"] .hero {
  background: linear-gradient(135deg, #1b2522 0%, #17201d 100%);
}

body[data-theme="dark"] .ad-card {
  background: linear-gradient(180deg, #1a2421 0%, #17201d 100%);
  border-color: #2f423a;
}

body[data-theme="dark"] .ad-card-title {
  color: #9cb9ab;
}

body[data-theme="dark"] .ad-card-body {
  border-color: #3a5148;
  color: #9fb6ac;
  background: repeating-linear-gradient(45deg, #1f2b26, #1f2b26 10px, #1a2420 10px, #1a2420 20px);
}

body[data-theme="dark"] .hero-topline {
  border-color: #365448;
}

body[data-theme="dark"] .message {
  border-color: #7a6535;
  color: #f7e2b2;
}

body[data-theme="dark"] .record-alert {
  background: #1d3328;
  border-color: #2f5a45;
  color: #9ce0b9;
}

body[data-theme="dark"] .athlete-form input,
body[data-theme="dark"] .athlete-form select,
body[data-theme="dark"] .auth-form input,
body[data-theme="dark"] .scope-select {
  background: #0f1513;
  color: #eaf2ef;
  border-color: #344a41;
}

body[data-theme="dark"] .athlete-form input::placeholder,
body[data-theme="dark"] .auth-form input::placeholder {
  color: #93aaa1;
}

body[data-theme="dark"] .live-focus {
  border-color: #355045;
  background: linear-gradient(180deg, #1d2a25 0%, #18221f 100%);
}

body[data-theme="dark"] .live-focus-label,
body[data-theme="dark"] .live-focus-vs,
body[data-theme="dark"] .category-range,
body[data-theme="dark"] .scope-select-label,
body[data-theme="dark"] .timeline-labels,
body[data-theme="dark"] .best-live-athlete-meta,
body[data-theme="dark"] .milestone-label,
body[data-theme="dark"] .milestone-date,
body[data-theme="dark"] .delta-points-note,
body[data-theme="dark"] .footer-col p,
body[data-theme="dark"] .footer-bottom {
  color: #a9bdb4;
}

body[data-theme="dark"] .live-focus-rank,
body[data-theme="dark"] .best-live-athlete-name,
body[data-theme="dark"] .milestone-value,
body[data-theme="dark"] .footer-col h3 {
  color: #edf4f1;
}

body[data-theme="dark"] .live-stat,
body[data-theme="dark"] .athlete-field,
body[data-theme="dark"] .pie-center {
  background: #111815;
  border-color: #32483f;
}

body[data-theme="dark"] .athlete-static-card {
  background: linear-gradient(135deg, #1b2522 0%, #17201d 100%);
}

body[data-theme="dark"] .athlete-static-head {
  border-color: #365448;
  background: #1e3029;
}

body[data-theme="dark"] .athlete-field-highlight {
  border-color: #3a5b4e;
  background: #1a2a24;
}

body[data-theme="dark"] .athlete-category-box {
  border-color: #375246;
  background: #1a2a24;
}

body[data-theme="dark"] .rank-tab {
  border-color: #355045;
  background: #1a2622;
  color: #b6d9ca;
}

body[data-theme="dark"] .jump-to-me-btn {
  border-color: #3c5a4d;
  color: #9ed2ba;
}

body[data-theme="dark"] .bar-track {
  background: #16201d;
  border-color: #33493f;
}

body[data-theme="dark"] .timeline-card {
  background:
    radial-gradient(1200px 280px at 0% -10%, #1f2b26 0%, transparent 55%),
    linear-gradient(180deg, #17201d 0%, #141c19 100%);
}

body[data-theme="dark"] .timeline-chart {
  border-color: #355045;
  background:
    repeating-linear-gradient(to top, rgba(109, 156, 129, 0.12) 0 1px, transparent 1px 24%),
    linear-gradient(to top, #16211d 0%, #121916 100%);
}

body[data-theme="dark"] .timeline-dot {
  fill: #1b2522;
  stroke: #74c89f;
}

body[data-theme="dark"] .best-live-athlete-box,
body[data-theme="dark"] .milestone {
  border-color: #355045;
  background: linear-gradient(180deg, #1b2622 0%, #141d1a 100%);
}

body[data-theme="dark"] .best-live-improve,
body[data-theme="dark"] .trend-up {
  color: #7fdbab;
}

body[data-theme="dark"] .trend-down {
  color: #ff8b8b;
}

body[data-theme="dark"] thead th {
  background: #21312b;
  color: #dce8e3;
}

body[data-theme="dark"] td {
  border-bottom-color: #2d3f38;
}

body[data-theme="dark"] .table-wrap {
  border-color: #355045;
}

body[data-theme="dark"] .delta-pos {
  color: #8ce7b4;
  background: #1d3a2c;
  border-color: #396b53;
}

body[data-theme="dark"] .delta-neg {
  color: #ff9f9f;
  background: #3a2020;
  border-color: #6c3a3a;
}

body[data-theme="dark"] .delta-zero {
  color: #bbcbc5;
  background: #25322d;
  border-color: #3d5048;
}

body[data-theme="dark"] .info-link {
  border-color: #375246;
  background: #1a2521;
  color: #92d5b5;
}

body[data-theme="dark"] .club-row-me td {
  background: #3a2f19 !important;
}

body[data-theme="dark"] .club-row-me td:first-child {
  border-left-color: #d79b3d;
}

body[data-theme="dark"] .club-row-me .club-athlete-link {
  color: #ffcf7a;
}

body[data-theme="dark"] .club-athlete-link {
  color: #93c5fd;
}

body[data-theme="dark"] .club-athlete-link:hover {
  color: #bfdbfe;
}

body[data-theme="dark"] tr.me {
  background: #1d2c26;
}

body[data-theme="dark"] tr.recent-invalid-row td {
  background: #242f2b;
}

body[data-theme="dark"] .recent-esito-win {
  color: #75d9a2;
}

body[data-theme="dark"] .recent-esito-loss {
  color: #ff9292;
}

body[data-theme="dark"] .error {
  border-color: #8a4343;
  color: #ffb2b2;
  background: #3d2020;
}

body[data-theme="dark"] .site-footer {
  border-top-color: #31463d;
  background: linear-gradient(180deg, #17211e 0%, #131b18 100%);
}

body[data-theme="dark"] .footer-social-link {
  color: #9fd9bf;
}

body[data-theme="dark"] .brand-lockup {
  border-color: #375246;
  background: linear-gradient(145deg, #1c2a25 0%, #1a2421 100%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

body[data-theme="dark"] .h2h-summary-card {
  border-color: #355045;
  background: linear-gradient(180deg, #1b2722 0%, #151f1b 100%);
}

body[data-theme="dark"] .h2h-kpi-box,
body[data-theme="dark"] .h2h-pie-center {
  border-color: #355045;
  background: #101815;
}

body[data-theme="dark"] .h2h-kpi-win strong {
  color: #7fdbab;
}

body[data-theme="dark"] .h2h-kpi-loss strong {
  color: #ff9898;
}

body[data-theme="dark"] .h2h-outcome-win {
  background: #1d3a2d;
  border-color: #335b46;
  color: #98e7be;
}

body[data-theme="dark"] .h2h-outcome-loss {
  background: #3a2020;
  border-color: #6c3a3a;
  color: #ff9f9f;
}

body[data-theme="dark"] .h2h-outcome-unknown {
  background: #25322d;
  border-color: #3d5048;
  color: #bbcbc5;
}

body[data-theme="dark"] .h2h-row-win td {
  background: color-mix(in srgb, #1c8c60 18%, transparent);
}

body[data-theme="dark"] .h2h-row-loss td {
  background: color-mix(in srgb, #c54545 16%, transparent);
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    padding: 10px 8px 18px;
  }

  .sidebar {
    position: static;
    width: auto;
    min-height: 0;
    margin-bottom: 12px;
  }

  .sidebar-top {
    align-items: center;
  }

  .side-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.sidebar-collapsed .sidebar {
    width: 60px;
    min-height: 0;
    padding: 10px 8px;
  }

  body.sidebar-collapsed .sidebar-top {
    justify-content: center;
    align-items: center;
  }

  body.sidebar-collapsed .sidebar-icon-home,
  body.sidebar-collapsed .side-nav,
  body.sidebar-collapsed .sidebar-bottom {
    display: none;
  }

  .side-nav-link {
    text-align: center;
    font-size: 12px;
    padding: 7px 6px;
  }

  .sidebar-bottom {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .sidebar-email {
    margin: 0;
    font-size: 12px;
    max-width: 68%;
  }

  .page {
    margin: 12px auto;
    padding: 0 10px 16px;
  }

  .card {
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
  }

  .card,
  .grid>*,
  .hero-search-row>* {
    min-width: 0;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero p {
    font-size: 14px;
  }

  .hero-header-row {
    flex-direction: column;
  }

  .hero-search-row {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 8px;
  }

  .ad-card-top {
    width: 100%;
  }

  .ad-inline-section {
    margin-bottom: 12px;
  }

  .ad-inline-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .athlete-form {
    gap: 10px;
  }

  .athlete-form label {
    width: 100%;
  }

  .athlete-form input {
    min-width: 0;
    width: 100%;
  }

  .athlete-form select {
    min-width: 0;
    width: 100%;
  }

  .athlete-form button {
    width: 100%;
  }

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

  .best-live-grid {
    grid-template-columns: 1fr;
  }

  .scope-select-wrap {
    width: 100%;
  }

  .scope-select {
    min-width: 0;
    width: 100%;
  }

  .summary-grid .card p {
    font-size: 14px;
  }

  .live-focus-rank {
    font-size: 42px;
  }

  .live-quick-stats {
    grid-template-columns: 1fr;
  }

  .athlete-value {
    font-size: 16px;
  }

  .table-wrap {
    max-height: 360px;
    overflow-x: auto;
    overflow-y: auto;
  }

  .table-mobile-scroll {
    max-width: 100%;
  }

  .table-mobile-scroll table {
    min-width: 640px;
  }

  thead th,
  td {
    padding: 7px 6px;
    font-size: 12px;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .bar-value {
    text-align: left;
  }

  .pie-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: left;
  }

  .h2h-summary-grid {
    grid-template-columns: 1fr;
  }

  .h2h-kpi-grid {
    grid-template-columns: 1fr;
  }

  .h2h-pie-card {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .pie-chart {
    width: 150px;
    height: 150px;
  }

  .pie-center {
    width: 74px;
    height: 74px;
    font-size: 19px;
  }

  .pie-legend {
    width: 100%;
    font-size: 13px;
  }

  .timeline-chart {
    height: 190px;
  }

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

  .milestone-value {
    font-size: 17px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .auth-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 420px) {
  .brand-lockup {
    width: 100%;
    padding: 10px 11px;
    gap: 10px;
    border-radius: 18px;
  }

  .brand-lockup-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
  }

  .brand-lockup-title {
    font-size: 33px;
  }

  .brand-lockup-subtitle {
    font-size: 15px;
  }

  .ad-card-body {
    font-size: 11px;
  }

  .hero-topline {
    font-size: 11px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .athlete-form button {
    padding: 11px 14px;
  }

  .meta,
  .message {
    font-size: 12px;
  }

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