/* Scoreboard */

/* Layout container */
#scoreboard .cards {
  display: grid;
  gap: 18px;
}

/* Card surface */
.score-card {
  /* expects --away and --home on the element */
  background: linear-gradient(
    90deg,
    color-mix(in oklab, var(--away) 70%, #fff),
    color-mix(in oklab, var(--home) 70%, #fff)
  );
  border-radius: 18px;
  padding: 12px 16px;
  box-shadow: 0 3px 10px rgba(0,0,0,.06);
  backdrop-filter: blur(6px);
  color: rgba(255,255,255,.95);
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.score-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,.10);
}

/* 3-column grid: away | center | home */
.score-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

/* Team columns */
.team-col { padding: 6px 10px; }
.team-col .team-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
}
.team-col .logo {
  width: 84px; height: 84px;
  border-radius: 8px;
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.15));
}
.team-col .info { display: grid; min-width: 0; }
.team-col.away .info { text-align: left; }
.team-col.home .info { text-align: right; }

.team-col .abbr {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: .05em;
  color: rgba(255,255,255,.97);
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.team-col .record {
  font-size: .9rem;
  font-weight: 500;
  opacity: .75;
  color: rgba(255,255,255,.85);
}
.team-col .big-score {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 2.3rem;
  color: #fff;
  line-height: 1;
  min-width: 2.2ch;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0,0,0,.25);
}

/* mirror layouts */
.team-col.away .team-row { flex-direction: row; }
.team-col.away .big-score { margin-left: auto; }
.team-col.home .team-row { flex-direction: row-reverse; }
.team-col.home .big-score { margin-right: auto; }

/* Remove old white boxes if present */
.score-card .team-col,
.score-card .team-col .team-row {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}

/* Center “glass” chip (status + chips) */
.center-col {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 16px;
  background: rgba(255,255,255,.14);
  border-radius: 18px;
  backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
  border-left: 2px solid rgba(255,255,255,.20);
  border-right: 2px solid rgba(255,255,255,.20);
}
.score-card.live  .center-col { background: rgba(255,255,255,.18); }
.score-card.final .center-col { background: rgba(255,255,255,.10); }

.center-col .status {
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .02em;
  color: rgba(255,255,255,.95);
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}

/* Status pills */
.pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .3px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,.3);
}

.pill.live  {
  background: #ffe5e5; color: #b80000; border: none; text-shadow: none;
  box-shadow: 0 0 0 3px rgba(255,0,0,.06);
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse {
  0%,100% { transform: translateZ(0); filter: brightness(1); }
  50%     { transform: translateZ(0) scale(1.03); filter: brightness(1.08); }
}

/* Chips (TV, down&distance, etc.) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.center-col .chips { justify-content: center; max-width: 18rem; }
.chip  {
  font-size: .78rem; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  font-weight: 600;
}

/* Possession arrow */
.pos-arrow {
  width: 0; height: 0; display: inline-block;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}
.pos-arrow.left  { margin-right: 2px;  border-right: 8px solid #ea4335; }
.pos-arrow.right { margin-left:  2px;  border-left:  8px solid #ea4335; }

/* Live drive progress */
.drivebar {
  margin-top: 10px; height: 6px;
  background: rgba(0,0,0,.08);
  border-radius: 999px; overflow: hidden;
}
.drivebar .drivebar-fill {
  height: 100%; background: #0b74ff; width: 0%; transition: width .25s ease;
}
.drivebar.rz .drivebar-fill { background: #d21f3c; box-shadow: 0 0 10px rgba(210,31,60,.35); }

/* --- Expanded details --- */
.score-card .details {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(0,0,0,.18);
  backdrop-filter: blur(4px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  color: #fff;
}
.score-card .loading { opacity: .85; }

/* Details grid: away | linescore | home */
.details-grid {
  display: grid;
  grid-template-columns: 1fr minmax(260px, auto) 1fr;
  gap: 16px;
  align-items: start;
}

/* Linescore (center) */
.linescore { display: grid; gap: 6px; justify-self: center; }
.ls-row {
  display: grid;
  grid-template-columns: minmax(80px,1fr) repeat(4, 2.2ch) 3ch; /* Team | 1 2 3 4 | T */
  gap: 10px; align-items: center;
}
.ls-row .ls-cell { text-align: center; opacity: .95; font-variant-numeric: tabular-nums; }
.ls-row .team   { text-align: left; opacity: .92; font-weight: 700; }
.ls-row .total  { font-weight: 900; }
.ls-row.head .ls-cell { font-weight: 800; opacity: .85; }

/* Top performers */
.toplist .toplist-title {
  font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  opacity: .85; margin-bottom: 6px;
}
.toplist-row {
  display: grid;
  grid-template-columns: 1fr auto auto; /* name | pos | pts */
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255,255,255,.12);
}
.toplist-row:last-child { border-bottom: 0; }
.toplist .name { font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.toplist .pos  { opacity: .85; font-weight: 700; }
.toplist .pts  { font-weight: 900; font-variant-numeric: tabular-nums; }
.toplist .line { grid-column: 1 / -1; font-size: .85rem; opacity: .8; }

/* Left list: name & pts adjacent; Right list: align to right */
.toplist.away .toplist-row { grid-template-columns: auto auto 1fr; gap: 6px; }
.toplist.away .pts { text-align: left; }
.toplist.home .name,
.toplist.home .pts,
.toplist.home .line { text-align: right; }

/* Responsive stack */
@media (max-width: 780px) {
  .details-grid { grid-template-columns: 1fr; }
  .toplist.home .toplist-title, .toplist.home .name,
  .toplist.home .pts, .toplist.home .line { text-align: left; }
}

/* Small screens: shrink logos/scores a bit */
@media (max-width: 600px) {
  .team-col .logo { width: 36px; height: 36px; }
  .team-col .abbr { font-size: 1.1rem; }
  .team-col .big-score { font-size: 1.8rem; }
}

/* Right team "TOP FANTASY" alignment fix */
.toplist.home .toplist-title {
  text-align: right;
  width: 100%;
}

/* --- Desktop: keep right team's title right-aligned --- */
.toplist.home .toplist-title {
  text-align: right;
  width: 100%;
}

/* --- Mobile layout polish + visibility fix --- */
@media (max-width: 780px) {
  /* Allow scoreboard container to scroll horizontally if content is wide */
  #scoreboard {
    overflow-x: auto;
    padding-inline: 10px;
  }

  /* Ensure each card fits better within viewport */
  .score-card {
    min-width: 100%;
    box-sizing: border-box;
    margin-right: 10px;
  }

  /* Stack details vertically */
  .details-grid {
    grid-template-columns: 1fr;
  }

  /* Left-align right team's info when stacked */
  .toplist.home .toplist-title,
  .toplist.home .name,
  .toplist.home .pts,
  .toplist.home .line {
    text-align: left !important;
  }

  /* Simplify toplist rows: name ..... pts */
  .toplist-row {
    grid-template-columns: 1fr auto !important;
    gap: 8px !important;
  }
  .toplist .pts {
    justify-self: end;
  }

  /* Slightly smaller team logos & scores to fit narrow width */
  .team-col .logo {
    width: 42px;
    height: 42px;
  }
  .team-col .big-score {
    font-size: 1.9rem;
  }

  /* Padding and spacing adjustments */
  .score-grid {
    gap: 6px;
  }

  .toplist {
    padding-inline: 2px;
  }
  .toplist .toplist-title {
    margin-bottom: 6px;
  }
}

/* --- Ultra-mobile fit: avoid horizontal scrolling --- */
@media (max-width: 480px) {
  /* shrink card padding and internal gaps */
  .score-card {
    padding: 8px 10px;
    border-radius: 14px;
  }

  .score-grid {
    grid-template-columns: 1fr auto 1fr;
    gap: 4px;
    align-items: center;
  }

  /* smaller team logos and scores */
  .team-col .logo {
    width: 32px;
    height: 32px;
  }

  .team-col .abbr {
    font-size: 0.95rem;
  }

  .team-col .big-score {
    font-size: 1.6rem;
    min-width: 2ch;
  }

  /* tighten center chip and status */
  .center-col {
    padding: 6px 8px;
    gap: 4px;
    border-radius: 12px;
  }

  .center-col .status {
    font-size: 0.8rem;
  }

  .pill,
  .chip {
    font-size: 0.7rem;
    padding: 2px 6px;
  }

  /* allow long team names or networks to wrap safely */
  .center-col,
  .team-col .info {
    overflow-wrap: anywhere;
  }

  /* remove any overflow at container level */
  #scoreboard {
    overflow-x: hidden;
    padding-inline: 0;
  }

  /* optional: reduce font sizes in details for smaller view */
  .details {
    font-size: 0.9rem;
  }
}

:root{
  --header-h: 56px;          /* base header height */
  --header-bg: #1c1f24;      /* dark like ESPN */
  --header-fg: #ffffff;
}

html, body { height: 100%; }
body {
  margin: 0;
  background: #f9f9f9;       /* prevents gray flash behind content */
  color: #111;
  -webkit-font-smoothing: antialiased;
}

.app-header{
  position: sticky;          /* or use fixed if you prefer */
  top: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;

  /* Safe area: adds padding under the notch on iPhones */
  padding-top: env(safe-area-inset-top);
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-inline: 12px;

  background: var(--header-bg);
  color: var(--header-fg);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}

.hamburger{
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 22px;
  color: inherit;
  padding: 8px;
  border-radius: 8px;
}

.brand{
  justify-self: center;      /* center title like ESPN */
  font-weight: 700;
  text-decoration: none;
  color: inherit;
  letter-spacing: .3px;
}

.actions{ display: flex; gap: 8px; }

/* Push page content below the header (accounts for notch) */
.page{
  padding-top: calc(var(--header-h) + env(safe-area-inset-top));
  padding-bottom: env(safe-area-inset-bottom);
}

/* Hero banner that won’t show a gray strip at the top */
.hero{
  background: url(/img/your-hero.jpg) center/cover no-repeat;
  min-height: 40vh;
  display: grid;
  place-items: center;
  /* keep text readable over image */
  position: relative;
}
.hero::before{
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), rgba(0,0,0,0));
}
.hero > .title{
  position: relative;
  color: #fff;
  margin: 0 16px;
  text-align: center;
}

/* --- Brand theming to match scoreboard cards --- */
:root{
  --brand-left:  #425e91;   /* echo "away" cool tone */
  --brand-right: #6a4aa6;   /* echo "home" warm-violet */
  --brand-fg:    #ffffff;
  --header-h:    68px;      /* taller so the hamburger fits nicely */
}

/* Upgraded header surface */
.app-header.app-header--score{
  background: linear-gradient(
    90deg,
    color-mix(in oklab, var(--brand-left) 78%, #000),
    color-mix(in oklab, var(--brand-right) 78%, #000)
  );
  color: var(--brand-fg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
  gap: 10px;
}

/* Brand title */
.app-header .brand{
  font-family: sportsFont, system-ui, sans-serif;
  font-size: 1.25rem;
  letter-spacing: .6px;
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
}

/* Action tabs (right side) */
.app-header .actions{ display:flex; gap: 8px; align-items:center; }
.app-header .actions .tab{
  display:inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.14);
  color: #fff; font-weight: 700; font-size: .9rem;
  text-decoration: none;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
}
.app-header .actions .tab:hover{
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.app-header .actions .tab.is-active{
  background: rgba(255,255,255,.22);
}

/* Hamburger (left) */
.hamburger{
  width: 44px; height: 44px;
  display:grid; place-items:center;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.10);
  border-radius: 12px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.hamburger:hover{
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.hamburger span{
  display:block; width: 20px; height: 2px; background:#fff;
  border-radius: 2px; margin: 2px 0;
}

/* Page top padding (keep content clear of sticky header) */
.page{
  padding-top: calc(var(--header-h) + env(safe-area-inset-top));
}

/* Responsive tweaks */
@media (max-width: 900px){
  .app-header .brand{ font-size: 1.1rem; }
  .app-header .actions{ gap: 6px; }
  .app-header .actions .tab{ padding: 5px 10px; font-size: .85rem; }
}
@media (max-width: 700px){
  /* turn right-side tabs into a subtle horizontal scroll so nothing wraps */
  .app-header .actions{ overflow:auto; max-width: 50vw; }
}
@media (max-width: 520px){
  .app-header{
    grid-template-columns: auto 1fr auto;
    padding-inline: 8px;
  }
  .app-header .brand{ font-size: 1rem; }
  .hamburger{ width: 40px; height: 40px; }
}
