:root {
  color-scheme: dark;
  --page: #061813;
  --panel: #0c241e;
  --ink: #f3faf6;
  --muted: #a7bdb4;
  --line: rgba(226, 248, 237, 0.13);
  --line-strong: rgba(226, 248, 237, 0.22);
  --lime: #d7ff54;
  --lime-ink: #102008;
  --red: #ff786c;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, transparent 49.85%, rgba(255,255,255,.035) 50%, transparent 50.15%),
    repeating-linear-gradient(0deg, transparent 0 84px, rgba(255,255,255,.022) 85px 86px),
    radial-gradient(circle at 14% 0%, #174a3b 0, transparent 31rem),
    var(--page);
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
.topbar, main, footer { width: min(1540px, calc(100% - 32px)); margin-inline: auto; }

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(215, 255, 84, .42);
  border-radius: 11px;
  color: var(--lime);
  background: rgba(215, 255, 84, .08);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: -.04em;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: .91rem; letter-spacing: .015em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: .68rem; }
.source-status { color: var(--muted); font-size: .76rem; text-align: right; }
main { padding: 30px 0 24px; }

.control-panel, .board-panel {
  border: 1px solid var(--line);
  background: rgba(8, 31, 25, .9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.control-panel {
  padding: 24px 26px;
  border-radius: var(--radius) var(--radius) 0 0;
  display: grid;
  grid-template-columns: minmax(280px, .72fr) minmax(620px, 1.28fr);
  gap: 34px;
  align-items: end;
}

.control-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.control-heading > p { max-width: 240px; margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.eyebrow { margin: 0 0 7px; color: var(--lime); font-size: .67rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
h1, h2 { margin: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.7rem, 3.1vw, 3rem); font-weight: 500; letter-spacing: -.04em; line-height: 1; }
h2 { font-size: 1.32rem; letter-spacing: -.018em; }

.league-controls { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 12px; }
.league-controls label > span { display: block; margin: 0 0 7px 2px; color: var(--muted); font-size: .69rem; font-weight: 760; letter-spacing: .035em; }
select, input { width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--ink); background: #0a201a; outline: none; }
select { min-height: 44px; padding: 0 34px 0 12px; }
input { min-height: 42px; padding: 0 12px; }
select:focus, input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(215,255,84,.12); }

.board-panel { border-top: 0; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.board-toolbar { padding: 21px 24px 16px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.board-summary { margin: 6px 0 0; color: var(--muted); font-size: .76rem; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: end; }
.button { min-height: 38px; padding: 0 13px; border: 1px solid transparent; border-radius: 9px; color: var(--lime-ink); background: var(--lime); font-size: .73rem; font-weight: 800; }
.button.secondary { color: var(--ink); border-color: var(--line-strong); background: rgba(255,255,255,.035); }
.button.danger { color: #ffb7b0; border-color: rgba(255,120,108,.35); background: rgba(255,120,108,.07); }
.button.danger.solid { color: #240603; background: var(--red); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.button:focus-visible, .position:focus-visible, .draft-toggle:focus-visible, .player-intel-button:focus-visible, .dialog-close:focus-visible { outline: 3px solid white; outline-offset: 2px; }

.quick-filters { padding: 0 24px 16px; display: grid; grid-template-columns: minmax(240px, 420px) auto minmax(250px, 1fr); gap: 14px; align-items: center; }
.search-field input { padding-left: 14px; }
.position-filters { display: flex; gap: 6px; }
.position { min-width: 42px; min-height: 38px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: transparent; font-size: .71rem; font-weight: 850; }
.position.active { color: var(--lime-ink); border-color: var(--lime); background: var(--lime); }
.filter-tip { margin: 0; color: #829f93; font-size: .68rem; text-align: right; }
.filter-tip code { color: #c9ddd4; }

.table-shell { position: relative; min-height: 360px; max-height: calc(100vh - 355px); overflow: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); scrollbar-color: #355e51 #081b16; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .75rem; }
th, td { padding: 0 11px; white-space: nowrap; border-right: 1px solid rgba(255,255,255,.035); }
th:last-child, td:last-child { border-right: 0; }
thead { position: sticky; top: 0; z-index: 5; }
.heading-row th { height: 42px; color: #cde0d7; background: #102f27; border-bottom: 1px solid var(--line-strong); font-size: .66rem; letter-spacing: .035em; text-transform: uppercase; }
.sort-button { width: 100%; height: 100%; padding: 0; display: flex; align-items: center; justify-content: inherit; gap: 6px; border: 0; color: inherit; background: transparent; font: inherit; font-weight: 800; letter-spacing: inherit; text-transform: inherit; }
.sort-indicator { color: var(--lime); font-size: .72rem; }
.filter-row th { height: 45px; padding: 6px; background: #0a211b; border-bottom: 1px solid var(--line); }
.filter-row input, .filter-row select { min-width: 64px; min-height: 31px; padding: 0 8px; border-radius: 7px; font-size: .68rem; }
.filter-row select { padding-right: 24px; }
tbody tr { transition: opacity .15s ease, background .15s ease; }
tbody tr:nth-child(even) { background: rgba(255,255,255,.018); }
tbody tr:hover { background: rgba(215,255,84,.055); }
td { height: 43px; border-bottom: 1px solid rgba(255,255,255,.055); text-align: center; }
td.player { min-width: 250px; text-align: left; font-weight: 760; }
td.rank { font-variant-numeric: tabular-nums; font-weight: 850; }
td.numeric { font-variant-numeric: tabular-nums; }
.market-positive { color: #9ceb8a; font-weight: 850; }
.market-negative { color: #ffaaa2; font-weight: 850; }
.market-neutral { color: #c4d6ce; }
.team-cell { font-variant-numeric: tabular-nums; }
.team-previous { color: #78978b; }
.team-arrow { margin: 0 5px; color: #78978b; }
.team-current { color: var(--lime); font-weight: 850; }

th:nth-child(1), td:nth-child(1) { position: sticky; left: 0; z-index: 2; background: #0c241e; }
th:nth-child(2), td:nth-child(2) { position: sticky; left: 62px; z-index: 2; background: #0c241e; }
th:nth-child(3), td:nth-child(3) { position: sticky; left: 124px; z-index: 2; background: #0c241e; box-shadow: 10px 0 18px rgba(0,0,0,.15); }
thead th:nth-child(-n+3) { z-index: 7; background: #102f27; }
.filter-row th:nth-child(-n+3) { background: #0a211b; }

.draft-toggle { width: 28px; height: 28px; border: 1px solid var(--line-strong); border-radius: 8px; color: transparent; background: rgba(255,255,255,.025); font-weight: 900; }
.draft-toggle[aria-pressed="true"] { color: var(--lime-ink); border-color: var(--lime); background: var(--lime); }
.drafted { opacity: .32; }
.drafted td.player { text-decoration: line-through; }
.player-intel-button { width: 100%; min-height: 48px; padding: 4px 2px; display: flex; align-items: center; gap: 9px; border: 0; color: inherit; background: transparent; text-align: left; }
.player-intel-button:hover .player-name { color: var(--lime); text-decoration: underline; text-underline-offset: 3px; }
.player-labels { min-width: 0; flex: 1; display: flex; align-items: stretch; flex-direction: column; gap: 4px; }
.player-name-line { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.player-name { overflow: hidden; text-overflow: ellipsis; }
.player-photo { position: relative; flex: none; overflow: hidden; display: grid; place-items: center; border: 1px solid rgba(215,255,84,.16); border-radius: 50%; background: linear-gradient(145deg, #173b31, #0a211b); }
.player-photo-small { width: 34px; height: 34px; }
.player-photo-large { width: 66px; height: 66px; }
.player-photo-fallback { color: #a9c2b7; font-size: .63rem; font-weight: 850; letter-spacing: .035em; }
.player-photo-large .player-photo-fallback { font-size: .95rem; }
.player-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; background: #102f27; }
.intel-hint { flex: none; color: #77958a; font-size: .56rem; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
.intel-hint.available { color: var(--lime); }
.player-statuses { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.player-status { max-width: 205px; padding: 3px 6px; overflow: hidden; border: 1px solid transparent; border-radius: 999px; font-size: .5rem; font-weight: 900; letter-spacing: .045em; line-height: 1; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.status-rookie { color: #d8efff; border-color: rgba(140,200,255,.32); background: rgba(66,139,204,.22); }
.status-injury { color: #312801; border-color: rgba(241,213,106,.48); background: #f1d56a; }
.status-injury-risk { color: #350705; border-color: rgba(255,141,132,.55); background: #ff8d84; }
.tag { display: inline-block; min-width: 62px; padding: 5px 7px; border-radius: 999px; font-size: .6rem; font-weight: 900; letter-spacing: .055em; }
.tag-target { color: #0b2716; background: #79e995; }
.tag-value { color: #2e2602; background: #f1d56a; }
.tag-fair { color: #d5e2dc; background: rgba(255,255,255,.08); }
.tag-reach { color: #360806; background: #ff8d84; }
.tag-risk { color: #fff5f4; background: #c93c34; }
.tag-new-team { color: #302300; background: #ffc857; }

.loading-state, .empty-state { position: absolute; inset: 88px 0 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); background: rgba(6,24,19,.93); text-align: center; }
.loading-state strong, .empty-state strong { color: var(--ink); font-size: 1rem; }
.loading-state span { font-size: .76rem; }
.football-loader { width: 38px; height: 25px; margin-bottom: 6px; border: 2px solid var(--lime); border-radius: 50%; animation: rotate 1s linear infinite; }
.empty-state button { border: 0; color: var(--lime); background: transparent; text-decoration: underline; }
.hidden { display: none !important; }

.legend { min-height: 54px; padding: 12px 24px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px 19px; color: var(--muted); font-size: .66rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.legend .target { background: #79e995; }
.legend .value { background: #f1d56a; }
.legend .fair { background: #849b91; }
.legend .reach { background: #ff8d84; }
.legend .risk { background: #c93c34; }
.legend .new-team { background: #ffc857; }
.legend .market { background: #8cc8ff; }
.legend .save-note { margin-left: auto; }

footer { padding: 0 0 30px; display: flex; justify-content: space-between; gap: 20px; color: #769388; font-size: .7rem; }
footer a { text-underline-offset: 3px; }
dialog { width: min(440px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 18px; color: var(--ink); background: #0b241d; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(1, 8, 6, .72); backdrop-filter: blur(4px); }
dialog form { padding: 27px; }
dialog p:not(.eyebrow) { color: var(--muted); font-size: .82rem; line-height: 1.55; }
.dialog-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.intel-dialog { width: min(820px, calc(100% - 28px)); max-height: min(88vh, 920px); overflow: auto; }
.intel-dialog .intel-shell { padding: 0; }
.intel-header { position: sticky; top: 0; z-index: 2; padding: 19px 26px; display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: rgba(11, 36, 29, .97); backdrop-filter: blur(12px); }
.intel-player-heading { display: flex; align-items: center; gap: 14px; }
.intel-photo { flex: none; }
.intel-meta { margin: 6px 0 0; }
.dialog-close { width: 36px; height: 36px; flex: none; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--ink); background: rgba(255,255,255,.035); font-size: 1.4rem; line-height: 1; }
.intel-body { padding: 24px 26px 27px; }
.intel-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.intel-badge { padding: 6px 9px; border-radius: 999px; color: #dbe8e2; background: rgba(255,255,255,.08); font-size: .62rem; font-weight: 850; letter-spacing: .035em; text-transform: uppercase; }
.risk-low, .value-up { color: #082615; background: #79e995; }
.risk-medium, .value-volatile { color: #312801; background: #f1d56a; }
.risk-high, .value-down { color: #350705; background: #ff8d84; }
.risk-unknown, .value-neutral, .intel-badge.neutral { color: #dbe8e2; background: rgba(255,255,255,.08); }
.intel-headline { margin: 18px 0 7px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.25rem, 3vw, 1.8rem); font-weight: 500; letter-spacing: -.025em; }
.intel-summary { margin: 0 0 22px; color: #d0e0d8 !important; font-size: .9rem !important; }
.intel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.intel-section { min-height: 120px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.intel-section h3, .intel-sources h3 { margin: 0 0 9px; color: var(--lime); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; }
.intel-section p, .intel-section ul, .intel-sources p, .intel-sources ul { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.intel-section ul, .intel-sources ul { padding-left: 18px; }
.intel-section li + li, .intel-sources li + li { margin-top: 6px; }
.intel-sources { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.intel-sources a { color: #d9e9e1; text-underline-offset: 3px; }
.intel-sources a:hover { color: var(--lime); }
.intel-note { margin: 18px 0 0; padding: 12px 14px; border-radius: 9px; color: #819e92 !important; background: rgba(0,0,0,.14); font-size: .69rem !important; }
.intel-empty { min-height: 240px; display: grid; place-content: center; justify-items: center; text-align: center; }
.intel-empty strong { font-size: 1.02rem; }
.intel-empty p { max-width: 520px; margin: 8px 0 0; }
.intel-feed-notice { padding: 14px 15px; display: flex; align-items: center; gap: 12px; border: 1px solid rgba(215,255,84,.18); border-radius: 11px; background: rgba(215,255,84,.045); }
.intel-feed-notice p { margin: 0; }
.news-timeline { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.news-heading { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.news-heading h3 { margin: 0; font-size: 1.05rem; }
.news-signal { padding: 6px 10px; border-radius: 999px; font-size: .62rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.signal-stable { color: #082615; background: #79e995; }
.signal-watch { color: #312801; background: #f1d56a; }
.signal-risk { color: #350705; background: #ff8d84; }
.news-list { display: grid; gap: 9px; }
.news-event { position: relative; padding: 15px 16px 14px 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.023); }
.news-event::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: #789289; }
.news-event.severity-watch::before { background: #f1d56a; }
.news-event.severity-risk::before { background: #ff786c; }
.news-event.severity-stable::before { background: #79e995; }
.news-meta { margin-bottom: 6px; display: flex; justify-content: space-between; gap: 14px; color: #89a499; font-size: .61rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.news-event h4 { margin: 0; color: #eff8f3; font-size: .84rem; }
.news-event p { margin: 5px 0 8px !important; font-size: .76rem !important; }
.news-event a { color: var(--lime); font-size: .68rem; text-underline-offset: 3px; }
.news-attribution { margin: 13px 0 0; color: #79958a !important; font-size: .66rem !important; }
.news-attribution a { color: #a8cabc; text-underline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes rotate { to { transform: rotate(360deg); } }

@media (max-width: 1080px) {
  .control-panel { grid-template-columns: 1fr; }
  .quick-filters { grid-template-columns: minmax(260px, 1fr) auto; }
  .filter-tip { grid-column: 1 / -1; text-align: left; }
  .table-shell { max-height: calc(100vh - 440px); }
}
@media (max-width: 720px) {
  .topbar, main, footer { width: min(100% - 20px, 1540px); }
  .topbar { min-height: 68px; }
  .source-status { display: none; }
  main { padding-top: 18px; }
  .control-panel { padding: 21px 18px; gap: 22px; }
  .control-heading > p { display: none; }
  .league-controls { grid-template-columns: 1fr 1fr; }
  .board-toolbar { align-items: start; flex-direction: column; }
  .toolbar-actions { width: 100%; justify-content: start; }
  .quick-filters { grid-template-columns: 1fr; }
  .position-filters { overflow-x: auto; }
  .filter-tip { display: none; }
  .table-shell { max-height: 58vh; }
  .legend .save-note { width: 100%; margin-left: 0; }
  footer { flex-direction: column; }
  .intel-header { padding: 20px 18px 16px; }
  .intel-body { padding: 19px 18px 22px; }
  .intel-grid { grid-template-columns: 1fr; }
  .intel-section { min-height: 0; }
  .intel-feed-notice { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
