/* Perfect Season (players see "Flight Path") — Jets edition. Builds on core/shell.css tokens.

   The only game here that needs two columns: a draft board on the left and the roster filling up
   on the right, because the decision is "who from this year, for which empty slot" and both halves
   have to be visible at once. Below 780px it stacks — roster first, so you can see what you still
   need before you look at who is available. */

.jng {
  .game-wrap { max-width: var(--wrap); padding-bottom: 28px; }
  .game-title {
    font-family: var(--ff-display); font-weight: 800;
    letter-spacing: 0; line-height: 1.1;
    font-size: clamp(1.6rem, 6vw, 2.1rem); margin: 10px 0 12px;
  }

  .ps { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }

  /* ---- Left: roll + the rolled season's roster ---- */
  .ps__rollbar {
    display: flex; align-items: center; gap: 14px;
    padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px;
  }
  .ps__year {
    margin: 0; font-family: var(--ff-score); font-weight: 800;
    font-size: 1.7rem; letter-spacing: 0.02em; color: var(--yellow);
    font-variant-numeric: tabular-nums;
  }
  /* The rolling year counter. tabular-nums above is what keeps the digits from jittering sideways
     while they cycle. Both states are motion only — the year is always readable text, so a reader
     who never sees the animation loses nothing but the drama. perfect-season.js also checks
     prefers-reduced-motion directly and skips straight to the landed value, so this media query and
     that branch have to agree: no motion here, no motion there. */
  @media (prefers-reduced-motion: no-preference) {
    .ps__year.is-spinning { opacity: 0.72; filter: blur(0.4px); }
    .ps__year.is-landed { animation: ps-land 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }
  }

  .ps__roster {
    --roster-max: 520px;
    list-style: none; margin: 0; padding: 0;
    max-height: var(--roster-max); overflow-y: auto;
  }

  /* Roll-down. The roster and the season both make the game taller, and the iframe on jetnation.com
     follows the content height, so animating max-height (rather than a transform) lets the frame,
     and the page below it, grow with the reveal instead of jumping. perfect-season.js adds
     .is-dropping on a fresh roll / when the season appears, not on every redraw. Reduced motion is
     handled by shell.css's global rule. */
  .ps__roster.is-dropping { animation: ps-drop 0.26s ease-out; }
  .ps__season.is-dropping { --roster-max: 2400px; animation: ps-drop 0.32s ease-out; overflow: hidden; }
  .ps__group {
    font-family: var(--ff-mono); font-size: 0.58rem; letter-spacing: 0.13em;
    text-transform: uppercase; color: var(--paint-dim);
    padding: 12px 2px 5px; border-bottom: 1px solid var(--line);
  }
  .ps__group.is-filled { color: rgba(107, 100, 97, 0.5); }
  .ps__hint {
    padding: 18px 2px; color: var(--paint-dim); font-size: 0.9rem;
  }

  .ps__pick {
    width: 100%; display: grid;
    grid-template-columns: 1fr auto; grid-template-areas: "name value" "note value";
    gap: 0 12px; align-items: center; text-align: left;
    padding: 8px 10px; margin: 3px 0;
    background: var(--field-2); border: 1px solid var(--line); border-radius: var(--r-panel);
    color: var(--paint); font: inherit; cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
  }
  .ps__pick:not(:disabled):hover { background: var(--field-hover); border-color: var(--line-strong); }
  .ps__pick:disabled { opacity: 0.38; cursor: default; }
  .ps__pick-name { grid-area: name; font-weight: 600; }
  .ps__pick-note {
    grid-area: note; font-family: var(--ff-mono); font-size: 0.62rem;
    letter-spacing: 0.04em; color: var(--paint-dim);
  }
  .ps__pick-value {
    grid-area: value; font-family: var(--ff-score); font-weight: 800;
    font-size: 1.35rem; color: var(--yellow); font-variant-numeric: tabular-nums;
  }

  /* A third row appears only on the options that would pair with someone already drafted, so the
     grid gains its "chem" area on demand rather than reserving empty space on every row. */
  .ps__pick.has-chem {
    grid-template-areas: "name value" "note value" "chem value";
    border-color: rgba(17, 87, 64, 0.45);
  }
  .ps__pick-chem {
    grid-area: chem; font-family: var(--ff-mono); font-size: 0.62rem; font-weight: 600;
    letter-spacing: 0.04em; color: var(--yellow); margin-top: 2px;
  }

  /* The named connections under the finished season. */
  .ps__chem {
    list-style: none; margin: 0 0 14px; padding: 0;
    display: flex; flex-direction: column; gap: 3px;
  }
  .ps__chem li {
    font-family: var(--ff-mono); font-size: 0.68rem; letter-spacing: 0.03em;
    color: var(--yellow);
  }

  /* ---- Right: the roster being built ---- */
  /* The positioned ancestor the chemistry SVG is placed against. */
  .ps__team { position: relative; }

  /* The gutter only exists when there are connections to draw — perfect-season.js sets the custom
     property and removes it again, so a roster with no chemistry keeps its full width. */
  .ps__slots { list-style: none; margin: 0; padding: 0 0 0 var(--chem-gutter, 0); }

  /* Chemistry connectors. Absolutely positioned over the slot list, in its own stacking context so
     the arcs sit behind nothing and catch no clicks. `.ps__team` is the positioned ancestor. */
  .ps__chem-lines {
    position: absolute; left: 0; pointer-events: none; overflow: visible;
  }
  .ps__chem-arc {
    fill: none; stroke: var(--yellow); stroke-width: 1.5; opacity: 0.75;
    pointer-events: stroke;   /* so the <title> tooltip works on hover */
  }
  .ps__chem-label {
    fill: var(--yellow); font-family: var(--ff-mono); font-size: 9px; font-weight: 600;
  }
  /* Cut out from the arc behind the label — see the getBBox note in perfect-season.js. */
  .ps__chem-plate { fill: var(--field-0); }
  .ps__slot {
    display: grid; grid-template-columns: 52px 1fr auto;
    gap: 12px; align-items: center;
    padding: 9px 12px; margin-bottom: 5px;
    border: 1px dashed var(--line); border-radius: var(--r-panel);
    color: var(--paint-dim);
  }
  .ps__slot.is-filled {
    border-style: solid; background: var(--field-1); color: var(--paint);
  }
  .ps__slot-label {
    font-family: var(--ff-mono); font-size: 0.6rem; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--paint-dim);
  }
  .ps__slot-body { display: flex; flex-direction: column; min-width: 0; }
  .ps__slot-body b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ps__slot-body small {
    font-family: var(--ff-mono); font-size: 0.6rem; letter-spacing: 0.04em; color: var(--paint-dim);
  }
  .ps__slot-value {
    font-family: var(--ff-score); font-weight: 800; font-size: 1.2rem;
    color: var(--paint); font-variant-numeric: tabular-nums;
  }
  .ps__total {
    margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line);
    font-family: var(--ff-mono); font-size: 0.7rem; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--paint-dim);
  }

  /* ---- Result ---- */
  .result { margin: 28px auto 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .result__score {
    margin: 0; font-family: var(--ff-score); font-weight: 800;
    font-size: 3.2rem; letter-spacing: 0.03em; line-height: 1;
    font-variant-numeric: tabular-nums; color: var(--paint);
  }
  .result__score.is-perfect { color: var(--yellow); }
  .result__msg {
    margin: 0 0 8px; font-family: var(--ff-mono); text-transform: uppercase;
    letter-spacing: 0.06em; font-size: 0.78rem; color: var(--paint-dim);
  }
  .ps__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

  /* ---- The 17 games ---- */
  .ps__season { margin: 30px 0 0; }
  .ps__season-title {
    font-family: var(--ff-mono); font-size: 0.62rem; letter-spacing: 0.13em;
    text-transform: uppercase; color: var(--paint-dim); font-weight: 400;
    margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
  }
  .ps__games {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px;
  }
  .ps__game {
    display: grid; grid-template-columns: 30px 1fr auto 18px;
    gap: 8px; align-items: center;
    padding: 7px 10px; border-radius: var(--r-tight);
    background: var(--field-1); border-left: 3px solid var(--tile-absent);
  }
  .ps__game.is-win { border-left-color: var(--tile-correct); }
  .ps__game.is-loss { border-left-color: var(--loss); }
  .ps__game-week {
    font-family: var(--ff-mono); font-size: 0.58rem; letter-spacing: 0.06em; color: var(--paint-dim);
  }
  .ps__game-opp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
  .ps__game-score {
    font-family: var(--ff-mono); font-size: 0.66rem; color: var(--paint-dim);
    font-variant-numeric: tabular-nums;
  }
  .ps__game-mark {
    font-family: var(--ff-display); font-weight: 800; font-size: 0.95rem; text-align: right;
  }
  .ps__game.is-win .ps__game-mark { color: var(--tile-correct); }
  .ps__game.is-loss .ps__game-mark { color: var(--loss); }

  /* ---- Modal internals ----
     `.statgrid` is the per-game convention the other three already follow (it is redeclared in
     each game's stylesheet rather than living in shell.css — see TODO.md). */
  .statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
  .statgrid b { display: block; font-family: var(--ff-score); font-weight: 800; font-size: 1.8rem; line-height: 1.1; color: var(--paint); }
  .statgrid span { font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--paint-dim); }
  .statnote {
    margin: 14px 0 0; text-align: center;
    font-family: var(--ff-mono); font-size: 0.66rem; letter-spacing: 0.06em; color: var(--paint-dim);
  }

  /* The how-to's slot line reads as hardware, not prose. */
  .modal__slots {
    font-family: var(--ff-mono); font-size: 0.72rem; letter-spacing: 0.08em;
    color: var(--yellow); text-align: center;
  }

  @media (max-width: 780px) {
    /* Roster first: what you still need should be visible before who is on offer. */
    .ps { grid-template-columns: 1fr; gap: 18px; }
    .ps__team { order: -1; }
    .ps__roster { --roster-max: 2400px; }
  }
}

/* Keyframes must be top-level: an @keyframes nested inside the `.jng { }` block is silently
   dropped by browsers (found 2026-11-26 — this shake and Perfect Season's landing/roll-down had
   never actually played). Names are global, so keep them game-prefixed. */
@keyframes ps-land {
  0%   { transform: scale(1.28); color: var(--paint); }
  100% { transform: scale(1); }
}
@keyframes ps-drop {
  from { max-height: 0; opacity: 0.4; }
  to   { max-height: var(--roster-max); opacity: 1; }
}
