html,
body {
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fb;
  color: #1d2735;
  margin: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

main {
  max-width: 900px;
  margin: 1rem auto;
  padding: 0 1rem 2rem;
}

.panel {
  background: #fff;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.08);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.panel-heading h2 {
  margin: 0;
}

.home-dashboard-panel {
  background: linear-gradient(180deg, #f9fbff 0%, #f2f6fc 100%);
  border: 1px solid #d7e0ed;
  box-shadow: 0 8px 24px rgba(18, 31, 54, 0.08);
  padding-bottom: calc(4rem + env(safe-area-inset-bottom));
}

.dashboard-meta {
  margin-top: 0.3rem;
  margin-bottom: 0.9rem;
}

label {
  display: block;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
}

input,
select,
button {
  font: inherit;
  padding: 0.5rem;
}

input,
select {
  width: 100%;
  box-sizing: border-box;
}

button {
  margin-top: 0.75rem;
  cursor: pointer;
}

.row {
  display: flex;
  gap: 0.5rem;
}

.row input {
  flex: 1;
}

.muted {
  color: #596579;
}

.meta {
  color: #455266;
  font-size: 0.95rem;
}

.error,
.bad {
  color: #9b1c1c;
}

.good {
  color: #0f6f3d;
}

.athlete-list li,
.split-list li {
  margin-bottom: 0.35rem;
}

#search-results button {
  margin-top: 0.3rem;
  width: 100%;
  text-align: left;
}

.button-link {
  display: inline-block;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  background: #16324f;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid #16324f;
  font-weight: 600;
}

.button-link:hover {
  background: #0f2740;
}

.button-link-danger {
  margin: 0.75rem 0 1rem;
  background: #9b1c1c;
  border-color: #9b1c1c;
}

.button-link-danger:hover {
  background: #7d1717;
}

.button-link-secondary {
  background: #e6ecf5;
  color: #1d2735;
}

.config-dashboard-panel {
  background: linear-gradient(180deg, #f9fbff 0%, #f2f6fc 100%);
  border: 1px solid #d7e0ed;
  box-shadow: 0 8px 24px rgba(18, 31, 54, 0.08);
}

.config-dashboard-form {
  display: grid;
  gap: 0.5rem;
}

.config-search-row {
  align-items: center;
}

.config-search-button {
  margin-top: 0;
  min-width: 8rem;
  text-align: center;
}

.config-feedback {
  min-height: 1.25rem;
  margin-top: 0.2rem;
}

.search-results-list {
  list-style: none;
  margin: 0.15rem 0 0.5rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.search-results-list li {
  margin: 0;
}

.search-results-list button {
  margin-top: 0;
  width: 100%;
  text-align: left;
  border-radius: 10px;
  border: 1px solid #c8d4e8;
  background: #ffffff;
  color: #1a314f;
  font-weight: 600;
  box-shadow: 0 2px 7px rgba(23, 44, 71, 0.05);
}

.search-results-list button:hover {
  background: #eef4fd;
}

.search-results-list button.is-selected {
  border-color: #234d79;
  background: #e9f2ff;
  box-shadow: 0 0 0 2px rgba(35, 77, 121, 0.18);
}

.config-save-button {
  margin-top: 0.55rem;
  text-align: center;
}

.athlete-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

.athlete-list-item {
  background: #ffffff;
  border: 1px solid #c8d4e8;
  border-left: 4px solid #234d79;
  border-radius: 12px;
  padding: 0.9rem;
  box-shadow: 0 3px 10px rgba(23, 44, 71, 0.06);
  cursor: pointer;
  touch-action: pan-y;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.athlete-list-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(23, 44, 71, 0.1);
}

.athlete-list-item:focus-visible {
  outline: 3px solid #4f83c3;
  outline-offset: 2px;
}

.athlete-row-top {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.athlete-name-link {
  color: #183d63;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.athlete-name-link:hover {
  text-decoration: underline;
}

.athlete-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.athlete-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #edf3fb;
  border: 1px solid #cfdbec;
  color: #274365;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.16rem 0.55rem;
}

.athlete-latest-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.athlete-latest-meta {
  color: #3a4c6a;
  font-weight: 500;
}

.split-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.48rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.split-status-live {
  color: #0a6a38;
  background: #e5f7ee;
  border: 1px solid #b9e9ce;
}

.split-status-loading {
  color: #684f00;
  background: #fff6dc;
  border: 1px solid #f1dc99;
}

.split-status-offline {
  color: #8a1d1d;
  background: #ffeded;
  border: 1px solid #f0bcbc;
}

.athlete-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.action-button {
  margin-top: 0;
  border-radius: 8px;
  border: 1px solid #b5c1d5;
  font-weight: 600;
  min-width: 6.4rem;
}

.action-button-secondary {
  background: #f1f5fc;
  color: #162a44;
}

.action-button-danger {
  background: #fff1f1;
  color: #8c1d1d;
  border-color: #e2b7b7;
}

.athlete-cheer-card {
  text-align: center;
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
}

.athlete-actions {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.athlete-actions-bar {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.athlete-actions span {
  margin: 0 0.45rem;
  color: #7a8598;
}

.detail-nav-link {
  min-width: 10.5rem;
  text-align: center;
}

.detail-icon-action-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.6rem;
}

.detail-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  width: 100%;
  min-height: 2.4rem;
  border-radius: 10px;
  border: 1px solid #ced9ea;
  background: #f4f8ff;
  color: #173a5f;
  text-decoration: none;
  cursor: pointer;
}

.detail-icon-button:hover {
  background: #e8f0fc;
}

.detail-icon-button:focus-visible {
  outline: 3px solid #4f83c3;
  outline-offset: 1px;
}

.detail-icon-button svg {
  width: 1.15rem;
  height: 1.15rem;
}

.athlete-detail-chip-row {
  justify-content: center;
  margin-top: 0.85rem;
}

.athlete-detail-latest-row {
  justify-content: center;
  margin-top: 1.15rem;
}

.athlete-headline {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.2;
  font-weight: 500;
}

.athlete-subhead {
  margin-top: 0.75rem;
  color: #58667c;
}

.athlete-latest {
  margin: 0;
  font-size: 1.1rem;
}

.athlete-metric-row {
  margin: 1rem 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.75rem;
}

.athlete-detail-metric-row {
  background: #ffffff;
  border: 1px solid #d4ddec;
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  box-shadow: 0 3px 10px rgba(23, 44, 71, 0.05);
}

.athlete-metric-label {
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: #3f4958;
}

.athlete-metric-value {
  font-size: clamp(2.2rem, 8vw, 3.5rem);
  font-weight: 700;
  line-height: 1;
}

.athlete-metric-unit {
  font-size: 0.55em;
  font-weight: 500;
  color: #4a5567;
}

.athlete-context {
  margin-top: 1.4rem;
  font-size: clamp(1.1rem, 3.4vw, 1.8rem);
  line-height: 1.25;
  color: #3f4958;
}

.athlete-progress-callout {
  margin-top: 1rem;
  margin-bottom: 0;
  font-size: 1.15rem;
}

@media (max-width: 640px) {
  .panel-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .row {
    flex-direction: column;
  }

  .athlete-actions {
    text-align: left;
  }

  .athlete-actions-bar {
    justify-content: center;
  }

  .button-link,
  #clear-all-athletes {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
  }

  .config-search-row .config-search-button {
    min-width: 0;
  }

  .athlete-row-actions .action-button {
    flex: 1 1 45%;
    min-width: 0;
  }

  .athlete-metric-row {
    justify-content: flex-start;
  }

  .athlete-context {
    text-align: left;
  }

  .athlete-detail-latest-row {
    align-items: flex-start;
  }
}
