.fo-view {
  min-width: 0;
}

.fo-mode {
  display: flex;
  gap: 8px;
  border: 0;
  margin: 0 0 24px;
  padding: 0;
}

.fo-mode legend {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.fo-mode-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 18px;
  font-weight: 650;
  min-height: 44px;
}

.fo-mode-button[aria-pressed=true] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.fo-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.fo-identity {
  min-width: 0;
}

.fo-select-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.fo-select {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 6px 0 20px;
  border: 1px solid var(--edge);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  padding: 11px;
  font-size: 13px;
  min-height: 44px;
}

.fo-identity-heading {
  display: flex;
  gap: 14px;
  align-items: center;
  min-height: 100px;
}

.fo-identity-heading > div {
  min-width: 0;
}

.fo-image {
  width: 78px;
  height: 78px;
  flex-shrink: 0;
  object-fit: contain;
}

.fo-headshot {
  position: relative;
  border-radius: 50%;
  overflow: hidden;
  background: var(--soft);
  display: grid;
  place-items: center;
}

.fo-headshot img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  inset: 0;
}

.fo-initials {
  font-weight: 750;
  font-size: 20px;
  color: var(--accent);
}

.fo-name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  padding: 0;
  background: none;
  overflow-wrap: anywhere;
}

.fo-name:hover {
  text-decoration: underline;
}

.fo-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 5px;
}

.fo-explainer {
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  margin: 22px 0;
}

.fo-stat-section {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  margin: 22px 0;
  padding: 23px clamp(14px, 3vw, 30px);
}

.fo-stat-section h3,
.fo-availability > h3 {
  font-size: 19px;
}

.fo-section-note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 6px;
}

.fo-stat-row {
  padding: 20px 0 15px;
  border-bottom: 1px solid var(--line);
}

.fo-stat-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.fo-stat-headings {
  display: grid;
  grid-template-columns: minmax(65px, 1fr) minmax(90px, 1.5fr) minmax(65px, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.fo-stat-value {
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.fo-stat-value:last-child {
  text-align: right;
}

.fo-stat-label {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.fo-bars {
  display: flex;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--soft);
}

.fo-bar {
  display: block;
  flex: none;
  min-width: 0;
  height: 100%;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .16);
}

.fo-bar-left {
  border-radius: 5px 0 0 5px;
}

.fo-bar-right {
  border-radius: 0 5px 5px 0;
}

.fo-bars-neutral .fo-bar-left {
  border-right: 1px solid var(--edge);
}

.fo-bars-unavailable {
  background: repeating-linear-gradient(135deg, var(--line) 0, var(--line) 5px, var(--surface) 5px, var(--surface) 10px);
}

.fo-winner {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  padding-top: 7px;
}

.fo-availability {
  margin-top: 32px;
}

.fo-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 17px;
  margin: 17px 0;
  font-size: 11px;
}

.fo-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.fo-team-diagrams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}

.fo-availability-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  background: var(--panel);
  min-width: 0;
}

.fo-availability-card h4 {
  font-size: 16px;
  margin: 0 0 6px;
}

.fo-unit-title {
  font-size: 13px;
  margin: 22px 0 6px;
  font-weight: 700;
}

.fo-coverage {
  font-size: 11px;
  color: var(--gold);
  line-height: 1.6;
  margin: 8px 0;
}

.fo-field {
  height: 340px;
  margin: 13px 0 10px;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 32px, var(--line) 33px, transparent 34px), var(--soft);
  overflow: hidden;
}

.fo-field:before {
  content: "";
  position: absolute;
  inset: 0 27%;
  border-left: 1px dashed var(--edge);
  border-right: 1px dashed var(--edge);
  opacity: .5;
  pointer-events: none;
}

.fo-position {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(45px, 5.5vw, 66px);
  min-height: 51px;
  padding: 5px 3px;
  border-radius: 7px;
  border: 1px solid rgb(0 0 0 / .25);
  box-shadow: 0 1px 4px rgb(0 0 0 / .1);
  font-size: 9px;
  line-height: 1.2;
  color: #18211b;
}

.fo-position strong {
  font-size: 10px;
  white-space: nowrap;
  margin-bottom: 4px;
}

.fo-position span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  width: 100%;
}

.fo-position[aria-expanded=true] {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  z-index: 1;
}

.fo-status-available {
  background: #a3d7ad;
}

.fo-status-out {
  background: #efaaa5;
}

.fo-status-uncertain {
  background: #f2d483;
}

.fo-status-unknown {
  background: #c4cac7;
}

.fo-position-details {
  font-size: 11px;
  line-height: 1.7;
  min-height: 82px;
  border-left: 3px solid var(--line);
  padding: 8px 10px;
  background: var(--surface);
  border-radius: 0 5px 5px 0;
  overflow-wrap: anywhere;
}

.fo-position-details strong {
  display: block;
}

.fo-position-sources {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.fo-field-empty {
  text-align: center;
  padding: 130px 20px;
  color: var(--muted);
  font-size: 12px;
}

.fo-dates {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

html[data-theme=dark] .fo-bar {
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .35);
}

@media (max-width: 1100px) {
  .fo-team-diagrams {
    grid-template-columns: 1fr;
  }

  .fo-position {
    width: 65px;
  }

  .fo-field {
    height: 370px;
  }

  .fo-pickers {
    gap: 18px;
  }

  .fo-image {
    width: 62px;
    height: 62px;
  }

  .fo-name {
    font-size: 16px;
  }
}

@media (max-width: 560px) {
  .fo-pickers {
    gap: 13px;
  }

  .fo-identity-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .fo-select {
    font-size: 12px;
    padding: 9px;
    margin-bottom: 14px;
  }

  .fo-name {
    font-size: 15px;
  }

  .fo-meta {
    font-size: 10px;
  }

  .fo-image {
    width: 66px;
    height: 66px;
  }

  .fo-stat-section {
    padding: 18px 12px;
  }

  .fo-stat-headings {
    gap: 7px;
    grid-template-columns: minmax(55px, 1fr) minmax(88px, 1.4fr) minmax(55px, 1fr);
  }

  .fo-stat-value {
    font-size: 14px;
    overflow-wrap: anywhere;
  }

  .fo-stat-label {
    font-size: 10px;
  }

  .fo-winner {
    font-size: 9px;
  }

  .fo-availability-card {
    padding: 13px;
  }

  .fo-position {
    width: 44px;
    font-size: 8px;
    padding: 4px 2px;
    min-height: 49px;
  }

  .fo-position strong {
    font-size: 9px;
  }

  .fo-field {
    height: 330px;
  }

  .fo-mode {
    margin-bottom: 18px;
  }

  .fo-mode-button {
    font-size: 12px;
    padding: 10px 14px;
  }

  .fo-legend {
    font-size: 10px;
    gap: 8px 12px;
  }

  .fo-explainer {
    font-size: 10px;
  }
}

.fo-position-line {
  width: 12.5%;
  max-width: 60px;
}

.fo-value-number {
  display: inline-block;
  padding: 3px 7px;
  border: 2px solid transparent;
  border-radius: 999px;
  max-width: 100%;
}

.fo-value-winner {
  border-color: var(--ink);
  background: var(--soft);
}

.fo-bar-wrap {
  position: relative;
  margin: 9px 0 8px;
}

.fo-bar-midpoint,
.fo-bar-boundary {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.fo-bar-midpoint {
  left: 50%;
  width: 2px;
  height: 26px;
  background: repeating-linear-gradient(to bottom, #000 0 4px, transparent 4px 7px);
  mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent);
  filter: drop-shadow(1px 0 0 #fff) drop-shadow(-1px 0 0 #fff);
  z-index: 1;
}

.fo-bar-boundary {
  width: 4px;
  height: 20px;
  background: #000;
  box-shadow: 0 0 0 1px #fff;
  z-index: 2;
}

.fo-team-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 6px;
  min-width: 44px;
  min-height: 44px;
}

.fo-team-picker:hover {
  background: var(--soft);
}

.fo-team-picker-hint {
  font-size: 9px;
  color: var(--accent);
  font-weight: 650;
  white-space: nowrap;
}

.fo-team-dialog {
  padding: 20px;
  width: min(650px, calc(100% - 24px));
  max-height: 85dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.fo-team-dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: -20px;
  background: var(--panel);
  padding: 12px 0;
  z-index: 1;
}

.fo-team-dialog-close {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--surface);
}

.fo-team-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 16px;
}

.fo-team-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 6px;
  min-height: 105px;
  min-width: 44px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}

.fo-team-option img {
  width: 56px;
  height: 49px;
  object-fit: contain;
}

.fo-team-option:hover:not(:disabled) {
  background: var(--soft);
  border-color: var(--edge);
}

.fo-team-option[aria-pressed=true] {
  border-color: var(--accent);
  background: var(--soft);
}

.fo-team-option:disabled {
  opacity: .45;
  cursor: default;
}

.fo-unit-controls {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.fo-unit-tab {
  flex: 1;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 650;
  font-size: 12px;
}

.fo-unit-tab[aria-selected=true] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.fo-unit-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  min-width: 0;
  max-width: 100%;
  align-items: flex-start;
  scrollbar-width: thin;
  scrollbar-color: var(--edge) var(--surface);
}

.fo-unit-panel {
  flex: 0 0 100%;
  width: 100%;
  min-width: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.fo-unit-panel > .fo-unit-title {
  margin-top: 15px;
}

.fo-unit-panel[inert] {
  pointer-events: none;
}

.fo-unit-panel .fo-position-details {
  margin-bottom: 10px;
}

@media (max-width: 560px) {
  .fo-value-number {
    padding: 3px 4px;
  }

  .fo-team-dialog {
    padding: 14px;
  }

  .fo-team-dialog-heading {
    top: -14px;
  }

  .fo-team-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .fo-team-option {
    font-size: 10px;
    min-height: 98px;
  }

  .fo-team-option img {
    width: 48px;
    height: 43px;
  }

  .fo-team-picker {
    padding: 5px;
  }

  .fo-team-picker-hint {
    font-size: 8px;
  }
}

.fo-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.fo-histories {
  margin: 24px 0 28px;
}

.fo-histories > .th-heading {
  margin-top: 0;
}

.fo-histories > .th-ratings-note {
  max-width: 85ch;
}

.fo-histories-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
  align-items: start;
}

.fo-histories-grid .th-history-compact {
  display: grid;
  gap: 12px;
}

@supports (grid-template-rows: subgrid) {
  .fo-histories-grid {
    grid-template-rows: repeat(var(--th-pair-rows), auto);
  }

  .fo-histories-grid .th-history-compact {
    grid-template-rows: subgrid;
    grid-row: span var(--th-pair-rows);
  }

  .fo-histories-grid .th-games {
    grid-template-rows: subgrid;
    grid-row: span var(--th-game-rows);
    align-self: stretch;
  }

  .fo-histories-grid .th-average {
    align-self: stretch;
  }
}

@media (max-width: 1100px) {
  .fo-histories-grid {
    column-gap: 18px;
  }
}

@media (max-width: 560px) {
  .fo-histories-grid {
    column-gap: 12px;
    row-gap: 10px;
  }

  .fo-histories-grid .th-history-compact {
    row-gap: 10px;
  }
}
