/* The gameday grid (/gameday). Its own file, like admin.css, because nothing
   else on the site uses it. styles.css still loads first for the page ground,
   fonts and .live-dot. */

.gameday-body {
    /* Five follow colors, chosen to stay apart from each other and from the
       green and red that already mean correct and wrong. */
    --gd-hl-0: #ffd23f;
    --gd-hl-1: #3bceac;
    --gd-hl-2: #ff6b9d;
    --gd-hl-3: #5fa8ff;
    --gd-hl-4: #c792ea;

    --gd-card: rgba(255, 255, 255, 0.055);
    --gd-border: rgba(255, 255, 255, 0.08);
    --gd-muted: #8a96b3;
    --gd-correct: #86c232;
    --gd-incorrect: #ff8a80;

    --page-pad: 16px;
    padding: 0 16px 12px;
    min-height: 100vh;
    box-sizing: border-box;
}

/* ---- header bar --------------------------------------------------------- */

.gameday-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 22px;
    padding: 10px 2px 8px;
    color: #cbd3e7;
    font-size: 14px;
}

.gameday-bar__title {
    margin: 0;
    font-family: 'Teko', sans-serif;
    font-weight: 600;
    font-size: 34px;
    line-height: 1;
    color: #e8edf7;
    letter-spacing: 0.5px;
}

.gameday-bar__title span {
    color: #86c232;
}

.gameday-bar__status {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* The state, and the countdown beside it, each keep their own pieces in a
   row: the live dot is sized, so plain inline text would collapse it. */
.gameday-bar__state,
.gameday-bar__countdown {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Every digit the same width, so the text does not shuffle as it ticks. */
.gameday-bar__countdown {
    font-variant-numeric: tabular-nums;
}

.gameday-bar__sep {
    color: var(--gd-muted);
}

.gameday-key {
    display: flex;
    gap: 14px;
    color: var(--gd-muted);
    font-size: 13px;
}

/* Each key takes the color its column uses on the cards, word and symbol
   alike, so the legend reads as a color key. */
.gameday-key__correct { color: var(--gd-correct); }
.gameday-key__incorrect { color: var(--gd-incorrect); }
.gameday-key__season { color: #fff; }
.gameday-key__season span { font-weight: 700; }

/* ---- follow legend ------------------------------------------------------ */

.gameday-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
    border-radius: 999px;
}

.gameday-legend__hint {
    color: var(--gd-muted);
    font-size: 13px;
    font-style: italic;
}

.gameday-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 10px;
    border: 0;
    border-radius: 999px;
    background: var(--gd-hl);
    color: #0b132b;
    font: 700 13px 'Lato', sans-serif;
    cursor: pointer;
}

.gameday-chip i {
    font-size: 11px;
    opacity: 0.6;
}

.gameday-chip:hover i,
.gameday-chip:focus-visible i {
    opacity: 1;
}

.gameday-chip.is-absent {
    opacity: 0.5;
    text-decoration: line-through;
}

.gameday-legend.is-full {
    animation: gd-full 0.5s ease;
}

@keyframes gd-full {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

[data-highlight="0"] { --gd-hl: var(--gd-hl-0); }
[data-highlight="1"] { --gd-hl: var(--gd-hl-1); }
[data-highlight="2"] { --gd-hl: var(--gd-hl-2); }
[data-highlight="3"] { --gd-hl: var(--gd-hl-3); }
[data-highlight="4"] { --gd-hl: var(--gd-hl-4); }

/* ---- winners ------------------------------------------------------------ */

.gameday-winners {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin-bottom: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(255, 210, 63, 0.22), rgba(255, 210, 63, 0.05));
    border: 1px solid rgba(255, 210, 63, 0.4);
    color: #fff4cc;
    font-size: 16px;
}

.gameday-winners:empty {
    display: none;
}

.gameday-winners .fa-trophy {
    color: #ffd23f;
}

.gameday-winners__note {
    margin-left: auto;
    color: var(--gd-muted);
    font-size: 13px;
}

/* ---- the grid ----------------------------------------------------------- */

/* Reads like text: 1st place top left, then across each row and down, so last
   place is the rightmost card on the bottom row. gameday.js sets --gd-cols
   and --gd-font to fit the window. */
.gameday-grid {
    --gd-cols: 4;
    --gd-font: 16px;

    display: grid;
    grid-template-columns: repeat(var(--gd-cols), minmax(0, 1fr));
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--gd-font);
}

/* Widths in em so the whole card scales with --gd-font; the name takes what
   is left. CARD_WIDTH_EM in gameday.js is the card width the layout aims for. */
.gameday-card {
    position: relative;
    display: grid;
    grid-template-columns: 1.9em minmax(0, 1fr) 1.2em 1.2em 1.9em 1.9em;
    align-items: center;
    column-gap: 0.45em;
    padding: 0.3em 0.55em 0.3em 0.4em;
    line-height: 1.3;
    border: 1px solid var(--gd-border);
    border-radius: 0.35em;
    background: var(--gd-card);
    color: #e8edf7;
    font-variant-numeric: tabular-nums;
}

.gameday-card__rank {
    color: var(--gd-muted);
    font-size: 0.8em;
    font-weight: 700;
    text-align: right;
}

.gameday-card__name {
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: 700 1em/1.3 'Lato', sans-serif;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.gameday-card__name:hover,
.gameday-card__name:focus-visible {
    text-decoration: underline;
    outline: none;
}

.gameday-card__trophy {
    color: #ffd23f;
    font-size: 0.85em;
}

.gameday-card__correct,
.gameday-card__incorrect,
.gameday-card__tb,
.gameday-card__season {
    text-align: right;
}

.gameday-card__correct {
    color: var(--gd-correct);
    font-weight: 900;
}

.gameday-card__incorrect {
    color: var(--gd-incorrect);
}

.gameday-card__tb,
.gameday-card__season {
    color: var(--gd-muted);
    font-size: 0.85em;
}

.gameday-card__season {
    color: #fff;
}

/* A followed player: the whole card takes the color, with a glow, and sits
   above its neighbours so it stays visible while cards slide past. */
.gameday-card[data-highlight] {
    z-index: 1;
    background: var(--gd-hl);
    border-color: var(--gd-hl);
    color: #0b132b;
    box-shadow: 0 0 0.9em color-mix(in srgb, var(--gd-hl) 55%, transparent);
}

.gameday-card[data-highlight] .gameday-card__rank,
.gameday-card[data-highlight] .gameday-card__tb,
.gameday-card[data-highlight] .gameday-card__season {
    color: rgba(11, 19, 43, 0.7);
}

.gameday-card[data-highlight] .gameday-card__correct { color: #0b3d0b; }
.gameday-card[data-highlight] .gameday-card__incorrect { color: #7a1a12; }
.gameday-card[data-highlight] .gameday-card__trophy { color: #0b132b; }

/* The follow dot takes the rank's place while the card is hovered or has
   focus. Hidden with visibility, not opacity, so an invisible dot cannot be
   clicked by accident. */
.gameday-card__follow {
    position: absolute;
    left: 0.55em;
    top: 50%;
    width: 1em;
    height: 1em;
    padding: 0;
    border: 2px solid #cbd3e7;
    border-radius: 50%;
    background: transparent;
    transform: translateY(-50%);
    cursor: pointer;
    visibility: hidden;
}

.gameday-card:hover .gameday-card__follow,
.gameday-card:focus-within .gameday-card__follow {
    visibility: visible;
}

.gameday-card:hover .gameday-card__rank,
.gameday-card:focus-within .gameday-card__rank {
    visibility: hidden;
}

.gameday-card__follow:hover,
.gameday-card__follow:focus-visible {
    background: rgba(255, 255, 255, 0.35);
    outline: none;
}

.gameday-card[data-highlight] .gameday-card__follow {
    border-color: #0b132b;
    background: #0b132b;
}

/* The player whose picks are open. */
.gameday-card.is-open {
    outline: 2px solid #e8edf7;
    outline-offset: 1px;
}

.has-picks-panel .gameday-card:not(.is-open):not([data-highlight]) {
    opacity: 0.7;
}

.gameday-card[data-place="1"]:not([data-highlight]) {
    border-color: rgba(255, 210, 63, 0.7);
}

/* A score just changed: a green wash that fades over a couple of seconds. */
.gameday-card.is-changed::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    animation: gd-changed 2.6s ease-out forwards;
}

@keyframes gd-changed {
    0% { background: rgba(134, 194, 50, 0.6); }
    100% { background: rgba(134, 194, 50, 0); }
}

/* On a phone the grid is two columns, or three on its side, and scrolls (see
   gameday.js). The cards keep all four numbers, so the only room for a name
   comes from trimming everything around it: a narrower rank, tighter number
   columns and gaps, and less padding either side. The short-screen case is
   the same phone in landscape, which is wide but only ~390px tall. */
@media (max-width: 700px), (max-height: 500px) {
    .gameday-body {
        --page-pad: 8px;
        padding: 0 8px 12px;
    }

    .gameday-card {
        grid-template-columns: 1.7em minmax(0, 1fr) 1.1em 1.1em 1.6em 1.6em;
        column-gap: 0.3em;
        padding: 0.3em 0.4em 0.3em 0.3em;
    }

    .gameday-card__follow {
        left: 0.45em;
    }
}

/* ---- picks panel -------------------------------------------------------- */

/* Dark, like the grid it opens over. The table inside is borrowed from the
   participant page, which is styled for a light ground, so it is recolored
   under "dark table" below rather than restyled at the source -- the player's
   own page stays light.

   It starts beneath the pinned header rather than at the top: it was written
   when the grid had no header, and once the header arrived on a higher layer
   it drew the nav and the switch straight over the player's name and picks.
   gameday.js measures the header, which grows when the nav wraps. */
.picks-panel {
    position: fixed;
    top: var(--sticky-header-height, 0px);
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    width: min(600px, 100vw);
    box-sizing: border-box;
    border-left: 6px solid #2a3857;
    background: #0d1729;
    color: #e8edf7;
    box-shadow: -18px 0 40px rgba(0, 0, 0, 0.55);
    animation: picks-in 0.2s ease-out;
}

/* `display: flex` above outranks the browser's own [hidden] rule, so without
   this, setting panel.hidden changed nothing on screen and the panel could
   not be closed. */
.picks-panel[hidden] {
    display: none;
}

.picks-panel[data-highlight] {
    border-left-color: var(--gd-hl);
}

@keyframes picks-in {
    from { transform: translateX(40px); opacity: 0; }
}

.picks-panel__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 10px 18px;
    border-bottom: 1px solid var(--gd-border);
}

.picks-panel__heading {
    flex: 1;
    min-width: 0;
}

.picks-panel__meta {
    color: var(--gd-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.picks-panel__title {
    margin: 2px 0 0;
    overflow: hidden;
    color: #fff;
    font-family: 'Teko', sans-serif;
    font-size: 36px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.picks-panel__follow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #e8edf7;
    font: 700 14px 'Lato', sans-serif;
    cursor: pointer;
}

.picks-panel__follow i {
    color: #5d6a87;
    font-size: 11px;
}

.picks-panel__follow[aria-pressed="true"] {
    border-color: var(--gd-hl);
    background: var(--gd-hl);
    color: #0b132b;
}

.picks-panel__follow[aria-pressed="true"] i {
    color: #0b132b;
}

.picks-panel__follow:hover,
.picks-panel__follow:focus-visible {
    border-color: #e8edf7;
}

.picks-panel__close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #aab4c8;
    font-size: 18px;
    cursor: pointer;
}

.picks-panel__close:hover,
.picks-panel__close:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.picks-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 12px;
}

.picks-panel__note,
.picks-panel__message {
    margin: 4px 4px 10px;
    color: var(--gd-muted);
    font-size: 13px;
}

.picks-panel__message {
    margin-top: 24px;
    font-size: 15px;
    text-align: center;
}

.picks-panel__full {
    padding: 10px 18px;
    border-top: 1px solid var(--gd-border);
    color: #8ab4ff;
    font-size: 14px;
    font-weight: 700;
    text-align: right;
    text-decoration: none;
}

.picks-panel__full:hover,
.picks-panel__full:focus-visible {
    text-decoration: underline;
}

.picks-panel__back {
    display: none;
    padding: 10px 18px;
    border: 0;
    border-top: 1px solid var(--gd-border);
    background: none;
    color: #8ab4ff;
    font: 700 14px 'Lato', sans-serif;
    text-align: left;
    cursor: pointer;
}

.picks-panel__back:hover,
.picks-panel__back:focus-visible {
    text-decoration: underline;
}

/* ---- dark table ----------------------------------------------------------
   The participant table as the grid would draw it. Same meaning as the light
   original -- a pale tint on the row, the strong one on the pick -- in the
   grid's own green and red, so a "covered by" here matches a right answer on
   a card. Every rule is scoped to the panel: the participant page itself is
   untouched. */

.picks-panel .table-participant {
    background: rgba(255, 255, 255, 0.03);
    color: #e8edf7;
}

.picks-panel .table-participant thead {
    background: #17233e;
}

.picks-panel .table-participant th,
.picks-panel .table-participant td {
    border-bottom-color: var(--gd-border);
}

.picks-panel tr.not-started {
    background: transparent;
}

.picks-panel tr.correct,
.picks-panel tr.completed-correct {
    background: rgba(134, 194, 50, 0.09);
    color: #e8edf7;
}

.picks-panel tr.incorrect,
.picks-panel tr.completed-incorrect {
    background: rgba(255, 138, 128, 0.08);
    color: #e8edf7;
}

.picks-panel .table-participant tr.correct .team-cell.is-pick,
.picks-panel .table-participant tr.completed-correct .team-cell.is-pick {
    background: rgba(134, 194, 50, 0.3);
}

.picks-panel .table-participant tr.incorrect .team-cell.is-pick,
.picks-panel .table-participant tr.completed-incorrect .team-cell.is-pick {
    background: rgba(255, 107, 97, 0.28);
}

.picks-panel .table-participant tr.not-started .team-cell.is-pick {
    background: rgba(255, 255, 255, 0.09);
}

.picks-panel .spread-line {
    color: #d3dae7;
}

/* Logos are drawn for a light ground, and the navy and near-black ones --
   Giants, Patriots, Panthers, Jets -- sank into the rows. A faint light
   outline brings them back without boxing every logo in a white disc. */
.picks-panel .table-participant .team-logo {
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.7)) drop-shadow(0 0 3px rgba(255, 255, 255, 0.25));
}

.picks-panel .spread-line.is-favorite {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.picks-panel .result-cell .final-badge {
    background: rgba(255, 255, 255, 0.08);
    color: #aab4c8;
}

.picks-panel .table-participant .kickoff,
.picks-panel .table-participant .game-clock {
    color: #aab4c8;
}

.picks-panel .table-participant .margin-line.covered { color: var(--gd-correct); }
.picks-panel .table-participant .margin-line.missed { color: var(--gd-incorrect); }
.picks-panel .table-participant .margin-line.push { color: var(--gd-muted); }

.picks-panel .possession-icon {
    color: #d9a066;
}

/* The ticks are images drawn for a light ground: black while a game is open,
   and a dark green and dark red that all but vanish on navy. Lifted rather
   than redrawn, so the participant page keeps its own. */
.picks-panel tr.not-started .pick-icon {
    filter: invert(1);
}

.picks-panel tr.correct .pick-icon,
.picks-panel tr.completed-correct .pick-icon {
    filter: brightness(1.9);
}

.picks-panel tr.incorrect .pick-icon,
.picks-panel tr.completed-incorrect .pick-icon {
    filter: brightness(1.6);
}

/* Where the panel would take most of the screen anyway -- a phone, or a
   phone on its side (the grid's own cut-offs) -- it takes all of it, over
   the pinned header, a page of its own. There "Open their full page" offered
   what was already on screen, so the footer goes back to the grid instead. */
@media (max-width: 700px), (max-height: 500px) {
    .picks-panel {
        top: 0;
        z-index: 40;
        width: 100%;
    }

    .picks-panel__full {
        display: none;
    }

    .picks-panel__back {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gameday-card.is-changed::after,
    .gameday-legend.is-full,
    .picks-panel {
        animation-duration: 0.01s;
    }
}
