/* Scoped under .rsr so the app can be embedded in another page (seattlerats.org) without leaking styles.
   Dark-on-transparent to match the host site. */

.rsr {
  --rsr-fg: #fbfbfb;
  --rsr-dim: rgba(251, 251, 251, 0.62);
  --rsr-line: rgba(251, 251, 251, 0.14);
  --rsr-accent: #8ab4f8;
  --rsr-menu-bg: #262626;
  --rsr-radius: 6px;
  color: var(--rsr-fg);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  overflow: hidden;
  box-sizing: border-box;
}

.rsr *, .rsr *::before, .rsr *::after { box-sizing: inherit; }

.rsr a { color: var(--rsr-accent); text-decoration: none; }
.rsr a:hover { text-decoration: underline; }

/* Controls ------------------------------------------------------------------------------------------------------ */
.rsr-controls {
  display: grid;
  grid-template-columns: 2fr 5fr 5fr;
  gap: 16px;
}

.rsr-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rsr-field > span { font-size: 12px; color: var(--rsr-dim); letter-spacing: 0.02em; }

.rsr select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  background: transparent url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fbfbfb'><path d='M7 10l5 5 5-5z'/></svg>") no-repeat right 0 center / 24px;
  color: var(--rsr-fg);
  border: 0;
  border-bottom: 1px solid var(--rsr-dim);
  border-radius: 0;
  padding: 6px 28px 6px 0;
  font: inherit;
  cursor: pointer;
  text-overflow: ellipsis;
}

.rsr select:focus { outline: none; border-bottom-color: var(--rsr-accent); }
.rsr select:disabled { opacity: 0.5; cursor: default; }
.rsr select option { background: var(--rsr-menu-bg); color: var(--rsr-fg); }

.rsr-status { min-height: 1.5em; margin-top: 10px; font-size: 13px; color: var(--rsr-dim); }
.rsr-status.rsr-error { color: #ff8a80; }
.rsr-loading .rsr-status { animation: rsr-pulse 1.2s ease-in-out infinite; }
@keyframes rsr-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Sections ------------------------------------------------------------------------------------------------------ */
.rsr-section { margin-top: 20px; }
.rsr-section[hidden] { display: none; }

.rsr-heading {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rsr-fg);
}

.rsr-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rsr-bar .rsr-heading { margin: 0; }

/* Tables -------------------------------------------------------------------------------------------------------- */
.rsr table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rsr th, .rsr td { padding: 10px 12px; border-bottom: 1px solid var(--rsr-line); vertical-align: top; text-align: left; }
.rsr th { font-weight: 500; color: var(--rsr-dim); font-size: 12px; white-space: nowrap; }
.rsr th:first-child, .rsr td:first-child { padding-left: 0; }
.rsr th:last-child, .rsr td:last-child { padding-right: 0; }
.rsr td.rsr-empty { color: var(--rsr-dim); padding-left: 0; }
.rsr .c-rec, .rsr .rsr-mobile-only { display: none; }
.rsr .c-place, .rsr .c-w, .rsr .c-l, .rsr .c-t, .rsr .c-gf, .rsr .c-ga, .rsr .c-pts, .rsr .c-score { white-space: nowrap; }
.rsr .c-date, .rsr .c-time { white-space: nowrap; }
.rsr-dim { color: var(--rsr-dim); }

.rsr-team { display: inline-flex; align-items: center; gap: 8px; }
.rsr-swatch {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  border-radius: 4px;
  outline: thin solid #888;
  opacity: 0.85;
  font-size: 12px;
  color: var(--rsr-fg);
}
.rsr-swatch-unknown { background: transparent; }
.rsr-notes { margin-left: 2px; font-size: 12px; color: var(--rsr-dim); }

/* Download menu ------------------------------------------------------------------------------------------------- */
.rsr-menu { position: relative; }
.rsr-menu > summary { list-style: none; }
.rsr-menu > summary::-webkit-details-marker { display: none; }

.rsr-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--rsr-radius);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}
.rsr-button::before { content: "⤓"; font-size: 15px; line-height: 1; }
.rsr-button::after { content: ""; border: 5px solid transparent; border-top-color: currentColor; border-bottom: 0; margin-left: 2px; }
.rsr-button:hover { background: rgba(251, 251, 251, 0.08); }
.rsr-disabled > .rsr-button { opacity: 0.4; pointer-events: none; }

.rsr-menu-list {
  position: absolute;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: 4px;
  width: max-content;
  min-width: 220px;
  padding: 6px 0;
  background: var(--rsr-menu-bg);
  border-radius: var(--rsr-radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.rsr-menu-label { padding: 6px 16px; font-size: 12px; color: var(--rsr-dim); text-align: right; }
.rsr-menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 10px 16px;
  background: none;
  border: 0;
  color: var(--rsr-fg);
  font: inherit;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}
.rsr-menu-item:hover { background: rgba(251, 251, 251, 0.08); }
.rsr-icon { width: 22px; height: 22px; border-radius: 4px; flex: none; order: -1; }
.rsr-icon-sheet { background: rgb(83, 148, 103); }
.rsr-icon-sheet::before { content: ""; display: block; margin: 5px; height: 12px; background: repeating-linear-gradient(to bottom, #fff 0 1px, transparent 1px 4px); opacity: 0.9; }
.rsr-icon-tc { background: #1b2d4a; border: 1px solid #c9a24d; }

/* Mobile -------------------------------------------------------------------------------------------------------- */
@media (max-width: 599px) {
  .rsr-controls { grid-template-columns: 1fr; gap: 12px; }
  .rsr thead { display: none; }
  .rsr table, .rsr tbody, .rsr tr, .rsr td { display: block; }
  .rsr td { border: 0; padding: 0; }
  .rsr tr { padding: 10px 0; border-bottom: 1px solid var(--rsr-line); }
  .rsr .rsr-mobile-only { display: inline; }

  .rsr-standings tr {
    display: grid;
    grid-template-columns: 1.6em 1fr auto;
    grid-template-areas: "place team pts" "place rec rec";
    column-gap: 8px;
    align-items: baseline;
  }
  .rsr-standings .c-place { grid-area: place; color: var(--rsr-dim); }
  .rsr-standings .c-place::after { content: "."; }
  .rsr-standings .c-team { grid-area: team; }
  .rsr-standings .c-rec { grid-area: rec; display: block; font-size: 12px; color: var(--rsr-dim); }
  .rsr-standings .c-pts { grid-area: pts; }
  .rsr-standings .c-w, .rsr-standings .c-l, .rsr-standings .c-t, .rsr-standings .c-gf, .rsr-standings .c-ga { display: none; }
  .rsr-standings .rsr-dim { color: inherit; }

  .rsr-schedule tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "date time" "home home" "away away" "loc loc";
    row-gap: 6px;
  }
  .rsr-schedule .c-date { grid-area: date; font-size: 12px; color: var(--rsr-dim); }
  .rsr-schedule .c-time { grid-area: time; font-size: 12px; color: var(--rsr-dim); }
  .rsr-schedule .c-home { grid-area: home; }
  .rsr-schedule .c-away { grid-area: away; }
  .rsr-schedule .c-score { display: none; }
  .rsr-schedule .c-loc { grid-area: loc; padding-left: 32px; }
  .rsr-schedule .rsr-team { display: flex; padding-left: 0; }
  .rsr-schedule .rsr-team-name { flex: 1; }
  .rsr-schedule .rsr-mscore { font-variant-numeric: tabular-nums; }
}
