/* Legendary Playz - violet theme (SPEC 3.3). Phone first. */
:root {
  --bar-top: #611A8E;
  --bar-bottom: #430A75;
  --bottom-top: #5F198A;
  --bottom-bottom: #320661;
  --btn-top: #7E2BB4;
  --btn-bottom: #59148F;
  --ink: #3800AA;
  --heading: #2A0A5E;
  --muted: #6B4FA8;
  --col-head-bg: #F3EEFB;
  --divider: #E7DEF6;
  --glow: #B873F5;
  --line: #A96BDE;
  --outline: #490F79;
  --box-border: #3A12B8;
}

/* Poppins for text, Inter for the odds numbers, as in A_Violet_v13_Games.png. Both self-hosted. */
@font-face { font-family: "Poppins"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/Poppins-Regular.36408cc4fbb9.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/Poppins-Medium.e00010c2184f.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/Poppins-SemiBold.7c77dcebdf39.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/Poppins-Bold.8ea2f32b2457.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/Inter-500.eca29b33d494.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/Inter-600.faad225b4d15.woff2") format("woff2"); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #fff;
  color: var(--heading);
  padding-bottom: calc(42px + env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }

/* Sizes follow SPEC 4 and assets/mockups/A_Violet_v13_Games.png (measured at 390 px wide). */

/* Header: lavender swirl banner, about 63 px high */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 63px; padding: 0 12px 0 17px;
  background: #E4D0F6 url("../img/Banner_Background_Lavender_Swirl.8145451fa735.png") center / cover no-repeat;
}
.logo { height: 53px; width: auto; display: block; }
.header-buttons { display: flex; gap: 8px; flex-shrink: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 90px; height: 31px; border-radius: 999px;
  font-weight: 700; font-size: 12.7px; white-space: nowrap;
  box-shadow: 0 2px 4px rgba(42,10,94,.28);
}
.btn-secondary {
  background: linear-gradient(#fff, #EDE0FA); color: #2A0A5E;
  border: 1px solid #6E21A6;
}
.btn-main {
  background: linear-gradient(var(--btn-top), var(--btn-bottom)); color: #fff;
  border: 1px solid #59148F; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 2px 4px rgba(42,10,94,.28);
}

/* Top menu bar, about 35 px high. The selected item is 10% larger. */
.menu-bar {
  display: flex; height: 35px;
  background: linear-gradient(var(--bar-top), var(--bar-bottom));
  border-top: 1px solid rgba(255,255,255,.35);
}
.menu-bar a {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 500; font-size: 12.15px; white-space: nowrap; position: relative;
  border-left: 1px solid var(--line);
}
.menu-bar a:first-child { border-left: 0; }
.menu-bar a.current { font-weight: 600; font-size: 13.5px; }
/* The selected-item underline: used by the top menu and, identically, the bottom bar. */
.menu-bar a.current .label, .bottom-bar a.current .label {
  border-bottom: 2px solid var(--glow); padding-bottom: 2px;
}

/* Week bar, about 28 px high, tabs about 74 px wide. Arrow buttons show on wide screens only. */
.week-wrap { position: relative; display: flex; background: #F8F5FD; }
.week-wrap .week-banner { flex: 1; min-width: 0; }
.week-arrow { display: none; }
.week-banner {
  display: flex; overflow-x: auto; scrollbar-width: none; height: 28px;
  background: #F8F5FD; border-bottom: 1px solid var(--divider);
  scroll-snap-type: x proximity;
}
.week-banner::-webkit-scrollbar { display: none; }
.week-item {
  flex: 0 0 74px; text-decoration: none; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-weight: 500; font-size: 12px;
  border-right: 1px solid var(--divider); white-space: nowrap; scroll-snap-align: center;
}
.week-item.current {
  background: linear-gradient(var(--bar-top), var(--bar-bottom)); color: #fff;
  font-weight: 700; box-shadow: inset 0 -2px 0 var(--glow);
}

/* Heading row and column header row (24 px) */
.title-row { display: flex; justify-content: space-between; align-items: center; height: 31px; padding: 0 12px; }
h1 { margin: 0; font-size: 21px; font-weight: 700; color: var(--heading); }
.week-label { color: var(--muted); font-weight: 600; font-size: 13px; }
.col-head {
  display: grid; grid-template-columns: 1fr 70px 70px 70px; column-gap: 4px; align-items: center;
  height: 24px; padding: 0 8px 0 12px; background: var(--col-head-bg);
  border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider);
  font-size: 10px; font-weight: 500; color: var(--muted); text-align: center;
}
.col-head .col-nfl { text-align: left; color: var(--heading); font-weight: 700; font-size: 12px; }

/* One game: about 124 px high */
.game { padding: 12px 8px 11px 13px; border-bottom: 1px solid var(--divider); }
.game-grid { display: grid; grid-template-columns: 1fr auto; column-gap: 4px; align-items: center; }
.teams { min-width: 0; }
.team {
  display: flex; align-items: center; gap: 8px; height: 38px;
  font-weight: 600; font-size: 14.52px; color: var(--ink);
}
.team img { flex: 0 0 auto; }
.team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at { display: flex; align-items: center; gap: 3px; height: 5px; margin: 0 0 0 -1px; }
.at b {
  width: 13px; height: 13px; border-radius: 50%; background: var(--divider); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; font-size: 8px; flex: 0 0 auto;
}
.at::after { content: ""; flex: 1; height: 1px; background: #D5C8EC; margin-right: 12px; }
.odds { display: grid; row-gap: 5px; }
.odds-row { display: grid; grid-template-columns: 70px 70px 70px; column-gap: 4px; }
.obox {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 37px; border: 1.5px solid #4A1FC0; border-radius: 6px;
  background:
    radial-gradient(ellipse 28px 14px at 4px 3px, rgba(190,170,255,.4), transparent),
    linear-gradient(#fff, #F8F4FE);
  font-family: "Inter", system-ui, sans-serif; font-weight: 500; font-size: 11.12px; line-height: 1.25; color: #000;
}
.obox i { font-style: normal; }

/* Past weeks and finished games: FINAL column to the left of SPREAD (SPEC 6.1) */
.col-head.with-final { grid-template-columns: 1fr 40px 62px 62px 62px; }
.odds.with-final .odds-row { grid-template-columns: 40px 62px 62px 62px; }
/* Phones: slightly narrower boxes (and gaps) so long team names such as "TB Buccaneers" still fit */
@media (max-width: 480px) {
  .col-head.with-final { grid-template-columns: 1fr 38px 56px 56px 56px; column-gap: 3px; }
  .odds.with-final .odds-row { grid-template-columns: 38px 56px 56px 56px; column-gap: 3px; }
}
.obox.hit { background: #FFFBE0; }
.fbox { font-size: 15px; font-weight: 700; background: #fff; }
.fbox.win, .fbox.tie { color: #1747C9; }
.fbox.lose { color: #C42B2B; }
.fbox.pending { color: #B9AEDB; font-weight: 500; }
.obox i:first-child { color: var(--ink); font-weight: 600; }

.game-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; height: 20px; }
.playz-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 20px; transform: skewX(-8deg);
  border-radius: 6px; font-style: italic; font-weight: 800; font-size: 9.5px; letter-spacing: .03em; color: #fff;
  background: linear-gradient(#5E16AA, #470A90); border: 1.5px solid #8329E9;
  box-shadow: 0 0 0 1px #E9DDFB, inset 4px 2px 3px -2px rgba(255,255,255,.55);
}
.when { font-size: 10.5px; font-weight: 400; color: #3b3350; white-space: nowrap; }
.links { margin-left: auto; display: flex; gap: 14px; }
.link { color: var(--ink); font-weight: 500; font-size: 11.5px; display: inline-flex; align-items: center; gap: 3px; }
.link svg { width: 9px; height: 9px; }

.soon { padding: 0 12px; color: var(--muted); }
.empty-note { margin: 0; padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.inline-link { color: var(--ink); text-decoration: underline; }

/* Log in / Join pop-up (placeholder until accounts exist), SPEC 6.1 */
.lock-dialog {
  width: min(86vw, 340px); padding: 0; border: 2px solid var(--glow); border-radius: 10px;
  overflow: hidden; color: var(--heading); box-shadow: 0 8px 30px rgba(42,10,94,.4);
}
.lock-dialog::backdrop { background: rgba(26,6,56,.55); }
.lock-head {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 12px;
  background: linear-gradient(var(--bar-top), var(--bar-bottom)); color: #fff; font-weight: 600; font-size: 14px;
}
.lock-close { background: none; border: 0; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.lock-body { padding: 14px 14px 16px; font-size: 13px; }
.lock-body p { margin: 0 0 14px; line-height: 1.45; }
.lock-buttons { display: flex; gap: 10px; justify-content: center; }

/* Team Stats and Trends pop-ups, Season Stats page (Phase 2; pictures A_Violet_v15_TeamStats_Popup, _Trends_Popup, _SeasonStats) */
.stats-dialog { width: min(94vw, 420px); padding: 0; border: 2px solid var(--glow); border-radius: 14px; overflow: hidden; color: var(--heading); box-shadow: 0 8px 30px rgba(42,10,94,.4); }
.stats-dialog::backdrop { background: rgba(26,6,56,.55); }
.pop-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; color: #fff; font-size: 16px; font-weight: 700; background: linear-gradient(var(--bar-top), var(--bar-bottom)); }
.pop-close { width: 24px; height: 24px; border: 0; border-radius: 50%; background: #E1D2F5; color: #430A75; font-size: 16px; line-height: 1; cursor: pointer; }
.pop-body { padding: 10px 12px 12px; max-height: 78vh; overflow-y: auto; }
.pop-note { margin: 10px 0 0; font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.pop-gap { height: 14px; }
table.ts { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; color: var(--ink); }
table.ts th { height: 52px; padding: 7px 4px; background: #F3EEFB; font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.25; }
table.ts th small { display: block; margin-top: 2px; font-size: 9.5px; font-weight: 600; color: #8D80AE; }
table.ts th.tsname, table.ts td.tsname { width: 132px; text-align: left; padding-left: 8px; white-space: nowrap; }
table.ts td { padding: 9px 4px; text-align: center; font-size: 13.5px; font-weight: 700; color: var(--heading); border-bottom: 1px solid #ECE5F7; }
table.ts td.tsname { font-size: 12.5px; font-weight: 600; color: var(--ink); }
table.ts td.tsname img { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; margin-right: 6px; }
table.ts .vl { border-left: 2px solid var(--glow); }
table.ts tr.tsat td { padding: 0; height: 16px; vertical-align: middle; }
table.ts .atc { display: inline-block; margin-left: 8px; width: 15px; height: 15px; border-radius: 50%; background: #E1D2F5; color: var(--muted); font-size: 9px; line-height: 15px; text-align: center; font-weight: 700; }
.tm { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.tm img { width: 24px; height: 24px; object-fit: contain; }
.tscroll { overflow-x: auto; }
table.tt { width: 100%; min-width: 340px; border-collapse: collapse; table-layout: fixed; font-size: 10.5px; color: var(--ink); }
table.tt th { padding: 5px 0; background: #F3EEFB; font-weight: 700; color: var(--muted); font-size: 10px; }
table.tt td { padding: 4px 0; text-align: center; border-bottom: 1px solid #ECE5F7; vertical-align: middle; }
table.tt .lb { width: 72px; text-align: left; padding-left: 4px; font-weight: 500; color: var(--muted); }
table.tt td.lb small { display: block; font-size: 8.5px; color: #8D80AE; }
table.tt .opp img { width: 20px; height: 20px; object-fit: contain; display: block; margin: 0 auto 1px; }
table.tt .opp b { display: block; font-size: 9px; }
table.tt .opp i { display: block; font-style: normal; font-size: 8.5px; color: var(--muted); }
table.tt td.wl { font-weight: 600; }
table.tt td.cv { font-weight: 700; }
table.tt td.cv.yes { color: #0000FF; } table.tt td.cv.no { color: #D63A3A; } table.tt td.cv.push { color: var(--muted); }
.tnd { margin: 6px 0 12px; font-size: 11.5px; color: var(--heading); }

.sbar { padding: 9px 14px; color: #fff; background: linear-gradient(var(--bar-top), var(--bar-bottom)); border-bottom: 2px solid #8329E9; }
.sbar b { display: block; font-size: 17px; } .sbar span { font-size: 11.5px; opacity: .95; }
.ss { padding: 4px 10px 14px; }
.ss h2 { margin: 14px 2px 4px; font-size: 18px; }
.ss h3 { margin: 16px 2px 2px; font-size: 14px; color: var(--ink); }
.ss .note { margin: 0 2px 5px; font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 3px; }
table.st { width: 100%; border-collapse: collapse; font-size: 10.5px; }
table.st th { padding: 5px 2px; background: #F3EEFB; color: var(--muted); font-size: 9.5px; font-weight: 700; text-align: right; }
table.st th.wk, table.st td.wk { text-align: left; padding-left: 6px; width: 38px; }
table.st td { padding: 4px 2px; text-align: right; border-top: 1px solid #F0EAFA; }
table.st td img { vertical-align: -1px; margin-right: 1px; }
table.st td.pos { color: #17803D; font-weight: 600; } table.st td.neg { color: #C42B2B; font-weight: 600; }
table.st tr.tot td { background: #F3EEFB; font-weight: 700; border-top: 2px solid #CDBDEB; }
.icard { margin: 10px 0; padding: 10px; border: 1px solid #E1D6F3; border-radius: 12px; }
.icard h4 { margin: 0; font-size: 14px; } .icard p { margin: 1px 0 6px; font-size: 11px; color: var(--muted); }
.drow { display: flex; align-items: center; gap: 10px; }
.legend { flex: 1; font-size: 11px; }
.lg { display: flex; align-items: center; gap: 6px; padding: 2px 0; } .lg i { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 10px; }
.lg span { flex: 1; } .lg b { min-width: 22px; text-align: right; } .lg em { min-width: 30px; text-align: right; font-style: normal; color: var(--muted); }
.tt2 { margin-top: 3px; font-size: 9.5px; color: #8D80AE; }
.by { margin: 8px 0 2px; font-size: 10.5px; color: var(--muted); }
.bars { display: flex; gap: 6px; align-items: flex-end; height: 86px; padding: 0 6px; }
.bc { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; font-size: 10px; color: var(--muted); }
.bc .stack { width: 70%; display: flex; flex-direction: column-reverse; } .bc u { text-decoration: none; margin-top: 2px; }
.wkl { text-align: center; font-size: 9.5px; color: #8D80AE; }
.fn { margin: 8px 2px 0; font-size: 10.5px; color: var(--muted); }

/* Bottom bar, about 42 px high, three equal buttons */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; height: calc(42px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background:
    radial-gradient(circle at 0 0, rgba(123,34,212,.8), transparent 45%),
    radial-gradient(circle at 100% 0, rgba(123,34,212,.8), transparent 45%),
    linear-gradient(var(--bottom-top), var(--bottom-bottom));
  border-top: 1px solid rgba(255,255,255,.35);
}
.bottom-bar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  color: #fff; font-weight: 600; font-size: 10px; line-height: 12px; position: relative; padding: 2px 0 5px;
}
.bottom-bar a + a::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.bottom-bar svg { display: block; }
.bucks { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; line-height: 18px; }
.bucks img { display: block; }

/* Narrow phones (about 360 px): slightly narrower odds boxes so long team names still fit */
@media (max-width: 380px) {
  .col-head { grid-template-columns: 1fr 60px 60px 60px; }
  .odds-row { grid-template-columns: 60px 60px 60px; }
  .col-head.with-final { grid-template-columns: 1fr 34px 50px 50px 50px; }
  .odds.with-final .odds-row { grid-template-columns: 34px 50px 50px 50px; }
  .obox { font-size: 10.6px; }
  .obox.fbox { font-size: 14px; }
  .team { gap: 6px; }
}

/* Wider screens: center the content in a column */
@media (min-width: 760px) {
  .page { max-width: 900px; margin: 0 auto; }
  .site-header { padding: 0 max(12px, calc((100vw - 900px) / 2)); }
  .week-item { flex-basis: 110px; }
  .week-banner { cursor: grab; }
  .week-arrow {
    display: flex; align-items: center; justify-content: center; flex: 0 0 28px; border: 0; cursor: pointer;
    background: linear-gradient(var(--bar-top), var(--bar-bottom)); color: #fff; font-size: 20px; line-height: 1;
  }
  .col-head { padding-left: 24px; padding-right: 24px; grid-template-columns: 1fr 96px 96px 96px; }
  .game { padding-left: 24px; padding-right: 24px; }
  .odds-row { grid-template-columns: 96px 96px 96px; }
  .obox { height: 44px; font-size: 13px; }
}

/* Trends table: fit six weeks on a phone without sideways scrolling where possible */
table.tt { min-width: 0; }
table.tt .lb { width: 58px; }
table.tt th { font-size: 9px; }
table.tt td.wl { font-size: 9.5px; white-space: nowrap; }
.stats-dialog .pop-body { padding-left: 8px; padding-right: 8px; }

/* Season Stats tables: numbers centered under their headings (Week stays on the left) */
table.st th, table.st td { text-align: center; }
table.st th.wk, table.st td.wk { text-align: left; }

/* Team Stats table, second pass: one thick vertical line that never breaks, and the thin line between the two teams
   in two pieces, one on each side of it */
table.ts th.tsname, table.ts td.tsname { width: 142px; }
table.ts td { border-bottom: 0; }
table.ts tr.last td { border-bottom: 1px solid #ECE5F7; }
table.ts tr.tsat td { height: 22px; padding: 0 8px; vertical-align: middle; }
table.ts .atwrap { display: flex; align-items: center; gap: 6px; }
table.ts .atc { margin-left: 0; flex: 0 0 15px; }
table.ts .atline { flex: 1; height: 0; border-top: 1px solid #D9CBF0; }

/* The "@" sits in the middle of its light purple circle (the glyph sits low in the font, so nudge it up) */
.at b { line-height: 1; padding-bottom: 2px; }
table.ts .atc { display: inline-flex; align-items: center; justify-content: center; line-height: 1; padding-bottom: 2px; }

/* Team Stats table, third pass: let every cell in a row stretch to the same height (no stepped edges), and draw the
   bottom line once on the whole table */
table.ts th { height: auto; }
table.ts tr.last td { border-bottom: 0; }
table.ts { border-bottom: 1px solid #ECE5F7; }

/* only one divider between the two teams: the thin lines beside the "@" */
table.ts tr.tsat td { border-bottom: 0; }
