/* YouFixture — Valet-inspired transparent dark theme (original implementation).
   Tokens inspired by Valet demo (MIT): near-black bg, glass cards, gold accent. */
:root {
  --radius: .9rem;
  --background: #0f0f10;
  --foreground: #ededed;
  --card-solid: #19191b;
  --card: rgb(24 24 26 / .56);
  --card-strong: rgb(24 24 26 / .68);
  --popover: rgb(24 24 26 / .88);
  --primary: #d9b56c;
  --primary-ink: #1a1508;
  --secondary: rgb(255 255 255 / .1);
  --muted: rgb(255 255 255 / .08);
  --muted-fg: rgb(255 255 255 / .68);
  --accent: rgb(255 255 255 / .1);
  --border: rgb(255 255 255 / .08);
  --input: rgb(255 255 255 / .12);
  --ring: #d9b56c;
  --good: #4cc38a;
  --warn: #f0a23c;
  --bad: #e5484d;
  --frost: 1;
  --glass-blur: blur(calc(36px * var(--frost))) saturate(1.1);
  --glass-edge: rgb(255 255 255 / .09);
  --glass-shadow: inset 0 1px 0 rgb(255 255 255 / .05), 0 24px 48px -24px rgb(0 0 0 / .6);
  --bar-blur: blur(calc(60px * var(--frost))) saturate(1.1);
  --bar-bg: rgb(20 20 22 / .66);
  --glass-sheet: rgb(24 24 26 / .76);
  --wall-dim: .35;
  --shadow-card: var(--glass-shadow);
  --radius-surface: calc(var(--radius) * 1.4);
  --radius-control: calc(var(--radius) * .8);
  --radius-chip: calc(var(--radius) * .6);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html.has-wallpaper { background: #0b0b0d; }
html.has-wallpaper body { background: transparent; }
body {
  background: var(--background);
  color: var(--foreground);
  font-family: "Geist Variable", "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", ui-sans-serif, system-ui, sans-serif;
  font-feature-settings: "ss01", "cv11";
  font-size: 13px;
  line-height: 1.5;
}
h1, h2, h3 { letter-spacing: -0.02em; text-wrap: balance; }

/* Wallpaper layer: the thing glass has to blur. Fixed, behind everything,
   paint + dim veil on ::after. Without this, backdrop-filter has nothing
   to frost and cards read as flat dark. */
.wallpaper { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #0b0b0d; }
.wall-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; filter: saturate(1.05); }
.wall-paint {
  position: absolute; inset: 0;
  background:
    radial-gradient(640px 420px at 12% -8%, rgba(217, 181, 108, .34), transparent 62%),
    radial-gradient(720px 480px at 88% 4%, rgba(100, 210, 255, .26), transparent 60%),
    radial-gradient(560px 420px at 82% 78%, rgba(76, 202, 138, .16), transparent 62%),
    radial-gradient(800px 560px at 18% 92%, rgba(139, 92, 246, .22), transparent 64%),
    radial-gradient(500px 380px at 50% 45%, rgba(240, 162, 60, .10), transparent 65%),
    #0b0b0d;
}
.wall-paint::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.10) 1px, transparent 0);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 75% 55% at 50% 0%, black, transparent);
}
.wall-paint::after {
  content: ""; position: absolute; inset: -40px;
  background:
    radial-gradient(420px 300px at 20% 20%, rgba(217,181,108,.20), transparent 70%),
    radial-gradient(380px 300px at 78% 30%, rgba(100,210,255,.16), transparent 70%);
  filter: blur(30px);
}
.wallpaper::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 50% 0%, transparent 0%, rgb(0 0 0 / .35) 100%),
    rgb(0 0 0 / var(--wall-dim));
}

/* Transparent glass cards */
.card, .glass {
  position: relative;
  /* Own composited layer: keeps the live backdrop blur from flickering
     into blank tiles on (re)paint in Chrome. No fixed descendants inside
     cards, so this is safe. */
  transform: translateZ(0);
  background: var(--card) !important;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
}
/* Floating bar: frost lives on ::before so inner popups (league menu)
   can blur the page themselves instead of being trapped by the bar. */
.glass-bar {
  position: relative; isolation: isolate;
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .05), 0 10px 30px -12px rgb(0 0 0 / .6);
}
.glass-bar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: inherit; background: var(--bar-bg);
  backdrop-filter: var(--bar-blur);
  -webkit-backdrop-filter: var(--bar-blur);
}

/* Tables */
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
#diffTable { border-spacing: 3px; }
#diffTable thead th {
  background: rgba(255,255,255,.04); color: var(--muted-fg);
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
  padding: 8px 6px; white-space: nowrap;
  border: 1px solid var(--border); border-radius: var(--radius-chip);
}
#diffTable thead th:first-child, #diffTable tbody th {
  position: sticky; left: 0; z-index: 2;
  /* Near-opaque on purpose: no nested backdrop-filter here. A translucent
     sticky cell blurring inside an overflow scroller inside a blurred card
     is a known Chrome artifact source (blank blocks until next repaint). */
  background: rgba(25,25,27,.96);
  color: var(--foreground); text-align: left; text-transform: none;
  letter-spacing: 0; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); border-radius: var(--radius-chip); padding: 6px 8px;
}
#diffTable tbody tr:hover th { background: rgba(217,181,108,.12); }
#diffTable td { border: 0; padding: 2px; }
#diffTable thead th.cur-col { background: rgba(217,181,108,.14); border-color: rgba(217,181,108,.4); }
#diffTable tbody td.cur-col { background: rgba(217,181,108,.07); border-radius: 13px; }
#diffTable .cur-dot { display: inline-block; width: 6px; height: 6px; border-radius: 9999px; background: var(--primary); box-shadow: 0 0 0 3px rgba(217,181,108,.2); }
td.fixture, td.avg { font-weight: 700; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--primary); }

#strengthTable thead th {
  background: transparent; color: var(--muted-fg); font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; font-weight: 600;
  padding: 10px 12px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
#strengthTable tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
#strengthTable tbody tr:last-child td { border-bottom: 0; }
#strengthTable tbody tr:hover { background: rgba(255,255,255,.03); }
td.team-cell { white-space: nowrap; font-size: 13.5px; }
table[aria-label] thead th { background: transparent; color: var(--muted-fg); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
table[aria-label] tbody td, table[aria-label] tbody th { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }

/* Range sliders */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 130px; height: 8px; border-radius: 999px;
  background: #2c2c2e; outline: none; cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.5);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 999px; background: #fff;
  border: 2.5px solid var(--thumb, var(--primary));
  box-shadow: 0 2px 8px rgba(0,0,0,.5); transition: transform .12s ease;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 999px; background: #fff;
  border: 2.5px solid var(--thumb, var(--primary));
}
input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: transparent; }
.rating-val {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; font-weight: 700; font-size: 12.5px;
  background: rgba(255,255,255,.06); color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip); padding: 3px 10px; margin-left: 8px;
}

/* Pills, inputs, buttons */
.pill {
  display: inline-flex; align-items: center; font-size: .78rem; font-weight: 700;
  background: rgba(255,255,255,.06); color: var(--muted-fg); border: 1px solid var(--border);
  border-radius: var(--radius-chip); padding: 5px 12px; white-space: nowrap;
}
.team-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted-fg); }
.small { font-size: .82rem; }
code { background: rgba(255,255,255,.06); border: 1px solid var(--border); padding: 1px 6px; border-radius: 8px; font-size: .85em; }
.err { color: var(--bad); }
button, input[type="button"], input[type="submit"], [role="button"] { cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* Modals use the blue accent instead of the gold focus ring. */
.modal button:focus-visible, .modal a:focus-visible, .modal input:focus-visible, .modal select:focus-visible { outline-color: #3d6a94; }

select, input[type="date"], input[type="text"] {
  background: rgba(255,255,255,.06) !important;
  color: var(--foreground) !important;
  border: 1px solid var(--border) !important;
  color-scheme: dark;
}
select option { background: #19191b; color: #ededed; }

/* Toggles */
.mode-toggle, .groupby-toggle {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.4);
}
.mode-toggle .mode-btn, .groupby-toggle .groupby-btn { cursor: pointer; color: var(--muted-fg); }
.mode-toggle .mode-btn:not(.active):hover, .groupby-toggle .groupby-btn:not(.active):hover { color: #fff; }
.mode-toggle .mode-btn.active, .groupby-toggle .groupby-btn.active {
  background: #3d6a94 !important; color: #fff !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.mode-toggle .mode-btn.active:hover, .groupby-toggle .groupby-btn.active:hover {
  color: #fff !important;
}

/* Overlays */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(8px); }
.overlay[hidden] { display: none; }
.modal {
  background: var(--glass-sheet) !important;
  backdrop-filter: blur(calc(40px * var(--frost))) saturate(1.1);
  -webkit-backdrop-filter: blur(calc(40px * var(--frost))) saturate(1.1);
  border: 1px solid var(--glass-edge);
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / .7);
  animation: pop .2s cubic-bezier(.23,1,.32,1);
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
#lostResult[hidden] { display: none; }

/* Badges */
.badge {
  display: inline-block; width: 32px; height: 32px; flex: none;
  background-image: url("/badges/sprite.png");
  background-size: 640px 32px; background-repeat: no-repeat; vertical-align: middle;
  border-radius: 8px; box-shadow: 0 0 0 1px #ffffff14;
}
.badge-fallback {
  background-image: none; background-color: var(--secondary); color: var(--foreground);
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  display: inline-grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--border);
}

/* Brand: mono gold on near-black, Valet-like */
.matrix-brand {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px; letter-spacing: 0.02em; color: #f5f5f7;
  text-shadow: 0 0 18px rgba(255,255,255,.18); white-space: nowrap;
}
.matrix-brand a { color: inherit; text-decoration: none; }
.matrix-league { color: #f5f5f7; cursor: pointer; }
.matrix-league:hover { color: #4cc38a; }
#leagueMenu[hidden] { display: none; }

#saveBtnTop { display: none; }
@media (min-width:640px){ #saveBtnTop{ display: block; } }
#cloudCard[hidden], #resetTeamBtn[hidden] { display: none; }
.tabs [role="tab"] { cursor: pointer; }
.tabs [role="tab"]:not(.active) { background: transparent; color: var(--muted-fg); }
.tabs [role="tab"].active { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
