/* FickleBall. Grouped layout, system font, no framework. */

:root,
[data-theme="light"]
{
  color-scheme: light;
  --bg: #f2f2f7;
  --card: #ffffff;
  --ink: #1c1c1e;
  --secondary: #6e6e73;
  --tertiary: #8e8e93;
  --separator: rgba(60, 60, 67, 0.12);
  --blue: #007aff;
  --green: #248a3d;
  --amber: #e6a100;
  --red: #d70015;
  --orange: #c93400;
  --chip: #e5e5ea;
  --hover: #e5e5ea;
  --on-result: #ffffff;
  --radius: 12px;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 3px 10px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"]
{
  color-scheme: dark;
  --bg: #000000;
  --card: #1c1c1e;
  --ink: #f5f5f7;
  --secondary: #98989d;
  --tertiary: #636366;
  --separator: rgba(255, 255, 255, 0.12);
  --blue: #0a84ff;
  --green: #30d158;
  --amber: #ffb340;
  --red: #ff453a;
  --orange: #ff9f0a;
  --chip: #2c2c2e;
  --hover: #2c2c2e;
  --on-result: #ffffff;
  --card-shadow: 0 0 0 0 transparent;
}

*
{
  box-sizing: border-box;
}

body
{
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.site-bar
{
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  box-shadow: 0 0.5px 0 var(--separator);
}

.site-bar__inner
{
  max-width: 880px;
  margin: 0 auto;
  padding: 1rem 1.25rem 0.75rem;
}

.site-header
{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.site-header__actions
{
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: none;
}

.account
{
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  color: var(--secondary);
  font-size: 0.95rem;
}

.account .link-button
{
  margin-top: 0;
}

.icon
{
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.icon-button
{
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 0 0 0.5px var(--separator);
}

.icon-button:hover
{
  background: var(--hover);
}

.site-header h1
{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin: 0;
  font-size: 2.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.header-club
{
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  min-width: 0;
  font-weight: 600;
}

.header-club__dash
{
  color: var(--secondary);
  font-weight: 500;
}

.header-club__name
{
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.tabs
{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.2rem;
  margin-top: 0.85rem;
  padding: 0.22rem;
  background: var(--chip);
  border-radius: 12px;
}

.tabs__button
{
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--secondary);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.5rem 0.4rem;
}

.tabs__button[aria-selected="true"]
{
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.tab-panel[hidden]
{
  display: none;
}

.tagline
{
  margin: 0.35rem 0 0;
  color: var(--secondary);
  font-size: 1.05rem;
}

#app
{
  max-width: 880px;
  margin: 0 auto;
  padding: 1.15rem 1.25rem 4rem;
}

.screen h2,
.timeline-header h2,
.choice-panel__title
{
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.field
{
  display: block;
  margin: 1.25rem 0 0.5rem;
}

.field > span
{
  display: block;
  margin: 0 0 0.4rem 0.2rem;
  color: var(--secondary);
  font-size: 0.8rem;
}

select,
input[type="search"],
input[type="text"],
input[type="password"]
{
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: none;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  box-shadow: 0 0 0 0.5px var(--separator);
}

input[type="search"]:focus,
input[type="text"]:focus,
input[type="password"]:focus,
select:focus
{
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.login-error
{
  margin: 0.85rem 0 0;
  color: var(--red);
  font-size: 0.95rem;
}

.primary
{
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.7rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: var(--blue);
  color: var(--on-result);
  font-weight: 600;
  font-size: 1rem;
}

.primary:hover
{
  filter: brightness(1.08);
}

.team-results
{
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.team-results:empty
{
  display: none;
}

.team-results li
{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 0.5px solid var(--separator);
}

.team-results li:last-child
{
  border-bottom: none;
}

.team-results li.hint
{
  display: block;
  background: transparent;
  color: var(--secondary);
  border-bottom: none;
  padding: 0.4rem 0.2rem;
}

.team-results:has(li.hint)
{
  background: transparent;
}

.team-results .team-league
{
  display: block;
  color: var(--secondary);
  font-size: 0.8rem;
  font-weight: 400;
}

button
{
  cursor: pointer;
  font: inherit;
}

.team-results button,
.secondary,
.choice-button
{
  background: var(--bg);
  color: var(--blue);
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
}

.team-results button:hover,
.secondary:hover,
.choice-button:hover
{
  background: var(--hover);
}

.secondary
{
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.link-button
{
  background: none;
  border: none;
  color: var(--blue);
  margin-top: 1.75rem;
  padding: 0;
  font-size: 0.95rem;
}

.support-path
{
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.55rem 0.35rem;
  margin: 0 0 1.25rem;
}

.support-path__club
{
  display: flex;
  flex: 0 0 6.75rem;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  width: 6.75rem;
  height: 7.15rem;
  box-sizing: border-box;
  padding: 0.55rem 0.45rem 0.45rem;
  background: var(--card);
  border-radius: var(--radius);
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--secondary);
  text-align: center;
  cursor: pointer;
  box-shadow: var(--card-shadow);
}

.support-path__club:hover
{
  box-shadow: var(--card-shadow), 0 0 0 0.5px var(--separator);
}

.support-path__club:focus-visible
{
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.support-path__club.is-focused
{
  color: var(--ink);
  box-shadow: var(--card-shadow), 0 0 0 2px var(--blue);
}

.support-path__country
{
  margin-top: auto;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tertiary);
}

.support-path__club.is-current .support-path__country
{
  color: var(--tertiary);
  font-weight: 600;
}

.support-path__club.is-current
{
  color: var(--ink);
  font-weight: 600;
}

.support-path__name
{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  max-width: 100%;
}

.support-path__text
{
  min-width: 0;
}

.support-path__arrow
{
  flex: none;
  align-self: center;
  position: relative;
  color: var(--tertiary);
}

.support-path__order
{
  position: absolute;
  top: calc(100% + 0.2rem);
  left: 50%;
  transform: translateX(-50%);
  color: var(--secondary);
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.club-badge
{
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--chip);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
}

.club-badge--sm
{
  width: 20px;
  height: 20px;
}

.club-badge--sm img
{
  width: 70%;
  height: 70%;
}

.club-badge--sm .club-badge__initial
{
  font-size: 0.7rem;
}

.team-name
{
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.team-name.is-supported
{
  font-weight: 800;
}

.team-flag
{
  width: 1.15rem;
  height: 0.78rem;
  object-fit: cover;
  border-radius: 2px;
  flex: none;
  opacity: 0.5;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.28);
  transition: opacity 0.15s ease;
}

.team-flag:hover
{
  opacity: 1;
}

.timeline__flag
{
  align-self: center;
}

.timeline__flag--home
{
  margin-left: 0.45rem;
}

.timeline__flag--away
{
  margin-right: 0.45rem;
}

.team-title
{
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.team-pick
{
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.club-badge img
{
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.club-badge__initial
{
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--secondary);
}

.badge
{
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--chip);
  color: var(--secondary);
}

.stats
{
  margin-bottom: 0;
}

.stats__grid
{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 0.75rem;
  box-shadow: var(--card-shadow);
}

.stat
{
  padding: 0.9rem 0.5rem;
  text-align: center;
  border-right: 0.5px solid var(--separator);
}

.stat:last-child
{
  border-right: none;
}

.stats__grid--record
{
  grid-template-columns: repeat(4, 1fr);
}

.stats__grid--record .stat:nth-child(4n)
{
  border-right: none;
}

.stats__grid--record .stat:nth-child(-n+4)
{
  border-bottom: 0.5px solid var(--separator);
}

.stat__value
{
  display: block;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stat__label
{
  color: var(--secondary);
  font-size: 0.75rem;
}

.per-club
{
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.per-club:empty
{
  display: none;
}

.per-club .per-club__row
{
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 0.5px solid var(--separator);
  font-size: 0.95rem;
}

.per-club .per-club__row:last-child
{
  border-bottom: none;
}

.per-club .per-club__row span:last-child
{
  color: var(--secondary);
}

.per-club .per-club__row.is-current
{
  color: var(--blue);
}

.timeline-section
{
  margin-top: 0;
}

.timeline-header
{
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.timeline
{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: transparent;
}

.timeline:empty
{
  display: none;
}

.timeline__item
{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.timeline__side
{
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.timeline__side--home
{
  justify-content: flex-end;
  padding: 0.7rem 0.15rem 0.7rem 0.7rem;
}

.timeline__side--away
{
  align-items: stretch;
  padding-left: 0.15rem;
}

.timeline__side .team-title
{
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.timeline__side--home .team-title
{
  justify-content: flex-end;
}

.timeline__side--away .team-title
{
  justify-content: flex-start;
}

.timeline__side .team-name
{
  flex: 0 1 auto;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.15;
}

.timeline__side--home .team-name
{
  text-align: right;
}

.timeline__side--away .club-badge,
.timeline__side--away .team-name
{
  align-self: center;
}

.timeline__side--home .cal
{
  margin: 0;
}

.cal
{
  flex: none;
  align-self: center;
  width: 3.2rem;
  margin: 0.65rem 0 0.65rem 0.7rem;
  border-radius: 8px;
  overflow: hidden;
  text-align: center;
  color: #1c1c1e;
  background: linear-gradient(180deg, #ffffff 0%, #f2f2f4 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), inset 0 0 0 0.5px rgba(0, 0, 0, 0.14);
}

.cal::before
{
  content: "";
  display: block;
  height: 0.38rem;
  background: linear-gradient(#d64545, #a62e2e);
}

.cal__day
{
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  padding: 0.18rem 0 0;
  font-variant-numeric: tabular-nums;
}

.cal__month
{
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a3a3a;
  padding: 0.02rem 0 0.32rem;
}

.timeline__mark
{
  display: flex;
  align-items: stretch;
  flex: none;
  align-self: stretch;
}

.timeline__emblem
{
  width: 3.4rem;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ececf1;
}

[data-theme="dark"] .timeline__emblem-fallback
{
  color: #1c1c1e;
}

.timeline__emblem img
{
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.timeline__emblem-fallback
{
  font-weight: 700;
  color: var(--secondary);
}

.timeline__result
{
  width: 1rem;
  flex: none;
}

.timeline__result.is-win
{
  background: var(--green);
}

.timeline__result.is-loss
{
  background: var(--red);
}

.timeline__result.is-draw
{
  background: var(--amber);
}

.timeline__result.is-live
{
  background: var(--tertiary);
}

.timeline__outcome
{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.45rem;
  padding: 0.1rem 0;
  color: var(--secondary);
  font-size: 0.9rem;
}

.timeline__outcome-words
{
  justify-self: end;
}

.timeline__outcome-club
{
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.timeline__score
{
  align-self: center;
  padding: 0 0.55rem;
  color: var(--secondary);
  font-family: "Oswald", "Arial Narrow", "Segoe UI", sans-serif;
  font-size: 1.8rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

.choice-panel
{
  margin: 0 0 0.85rem;
}

.choice-panel__context:empty
{
  display: none;
}

.choice-buttons
{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.choice-button
{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow), 0 0 0 0.5px var(--separator);
}

.distractor
{
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow), 0 0 0 0.5px var(--separator);
}

.distractor[hidden]
{
  display: none;
}

.distractor__pitch
{
  position: relative;
  flex: none;
  width: 4.6rem;
  height: 1.7rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--chip);
}

.distractor__ball
{
  position: absolute;
  top: 0.28rem;
  left: 0;
  width: 1.12rem;
  height: 1.12rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 32%, #fff 0 16%, transparent 17%),
    repeating-conic-gradient(#f7f7f8 0 18deg, #8e8e96 0 36deg);
  box-shadow: inset 0 0 0 1.5px #5c5c63;
  animation: distractor-roll 1.05s ease-in-out infinite alternate;
}

.distractor__title
{
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.distractor__detail
{
  margin: 0.1rem 0 0;
  color: var(--secondary);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

@keyframes distractor-roll
{
  from { transform: translateX(0.2rem) rotate(0deg); }
  to { transform: translateX(3.15rem) rotate(220deg); }
}

@media (prefers-reduced-motion: reduce)
{
  .distractor__ball
  {
    animation: none;
    transform: translateX(1.7rem);
  }
}

.journey-map
{
  height: min(62vh, 560px);
  min-height: 380px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--chip);
  box-shadow: var(--card-shadow), 0 0 0 0.5px var(--separator);
}

.journey-map.maplibregl-map
{
  font-family: inherit;
}

.journey-map .maplibregl-ctrl-attrib
{
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.8);
}

.map-note
{
  margin: 0.75rem 0 0;
  color: var(--secondary);
  font-size: 0.9rem;
}

.map-pin
{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ececf1;
  box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.map-pin img
{
  width: 78%;
  height: 78%;
  object-fit: contain;
}

.map-pin__letter
{
  font-size: 0.95rem;
  font-weight: 700;
  color: #1c1c1e;
}

.map-pin--current
{
  box-shadow: 0 0 0 3px var(--blue), 0 2px 6px rgba(0, 0, 0, 0.28);
}

.map-leg
{
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #f4f4f6;
  color: #1c1c1e;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  pointer-events: auto;
}

.map-leg::before
{
  content: "";
  position: absolute;
  inset: -8px;
}

.hop-popup .maplibregl-popup-content
{
  padding: 0.5rem 0.7rem;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
}

.hop-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.hop-popup.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.hop-popup.maplibregl-popup-anchor-top-right .maplibregl-popup-tip
{
  border-bottom-color: #fff;
}

.hop-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.hop-popup.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.hop-popup.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip
{
  border-top-color: #fff;
}

.hop-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip
{
  border-right-color: #fff;
}

.hop-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip
{
  border-left-color: #fff;
}

.hop-tip__club
{
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #1c1c1e;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
}

.hop-tip__name
{
  min-width: 0;
}

.hop-tip__miles
{
  margin: 0.2rem 0;
  color: #6e6e73;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.map-popup
{
  font-size: 0.9rem;
  line-height: 1.35;
}

.map-popup strong
{
  display: block;
}

.toast
{
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 0.7rem 1.1rem;
  border-radius: 12px;
  max-width: min(90vw, 28rem);
}

::view-transition-group(root)
{
  animation-duration: 600ms;
}

::view-transition-old(root),
::view-transition-new(root)
{
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root)
{
  z-index: 1;
}

::view-transition-new(root)
{
  z-index: 2;
}

@media (max-width: 520px)
{
  .stats__grid
  {
    grid-template-columns: 1fr;
  }

  .stat
  {
    border-right: none;
    border-bottom: 0.5px solid var(--separator);
    text-align: left;
    padding: 0.75rem 1rem;
  }

  .stat:last-child
  {
    border-bottom: none;
  }

  .choice-buttons
  {
    grid-template-columns: 1fr;
  }

  .timeline-header
  {
    align-items: flex-start;
    flex-direction: column;
  }
}
