/* =====================================================================
   v1.3 visual layer: team identities, player cards, mobile layout.
   Loaded after style.css. Colors per team arrive as --c1 / --c2 / --ci
   (primary, secondary, ink) on the element, and --team / --accent on :root.
   ===================================================================== */

/* ---- team identity ---------------------------------------------------- */
.crest, .helmet, .avatar { flex: none; display: block; }
.team { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; }
.top { border-bottom: 3px solid var(--team, var(--line)); }
.brand { flex-direction: row; align-items: center; gap: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-crest { display: block; line-height: 0; filter: drop-shadow(0 2px 6px #0008); }
.versus { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 6px 0 4px; }
.versus .vs { font-family: var(--cond); font-weight: 800; font-size: 15px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; }
.versus .flip { display: block; line-height: 0; transform: scaleX(-1); }
.matchup { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* title screen */
.prog-card { border-top: 4px solid var(--c1, var(--line)); }
.prog-card-art { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.chosen-name { display: flex; align-items: center; gap: 10px; }

/* league: one card per program */
.prog-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.prog { display: grid; grid-template-columns: 76px 1fr; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.prog.mine { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.prog-band { background: linear-gradient(160deg, var(--c1), color-mix(in srgb, var(--c1) 50%, #000)); border-right: 4px solid var(--c2); display: grid; align-content: space-between; justify-items: center; padding: 10px 4px; color: var(--ci); }
.prog-rank { font-family: var(--cond); font-weight: 800; font-size: 20px; }
.prog-main { padding: 10px 12px; display: grid; gap: 7px; min-width: 0; }
.prog-title { display: flex; gap: 10px; align-items: center; }
.prog-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.prog-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.prog-stats div { display: grid; justify-items: center; }
.prog-stats b { font-family: var(--cond); font-size: 17px; }
.prog-stats span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }

/* ---- player cards ---------------------------------------------------- */
.group-head { display: flex; gap: 10px; align-items: baseline; margin: 6px 0 8px; }
.group-head b { font-family: var(--cond); font-weight: 800; font-size: 20px; letter-spacing: .06em; }
.group-head span { font-size: 12px; }
.pcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 12px; margin-bottom: 20px; }
.pcard { position: relative; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.pcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 104px; background: linear-gradient(135deg, var(--c1), color-mix(in srgb, var(--c1) 48%, #000)); border-bottom: 4px solid var(--c2); }
.pcard.starter { border-color: color-mix(in srgb, var(--c2) 55%, var(--line)); }
.pcard-top { position: relative; display: flex; gap: 6px; align-items: center; padding: 8px 10px 0; height: 30px; color: var(--ci); font-family: var(--cond); font-weight: 800; }
.pcard-pos { padding: 2px 7px; border-radius: 6px; background: #000a; color: #fff; font-family: var(--cond); font-weight: 800; font-size: 13px; letter-spacing: .04em; }
.pcard-depth { font-size: 12px; opacity: .9; order: 1; }
.pcard-c { order: 2; width: 18px; height: 18px; border-radius: 50%; background: var(--c2); color: #14110d; display: grid; place-items: center; font-family: var(--cond); font-weight: 800; font-size: 11px; box-shadow: 0 0 0 1.5px #0006; }
.pcard-num { order: 3; margin-left: auto; font-size: 20px; }
.pcard-art { position: relative; height: 74px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.pcard-body { position: relative; padding: 10px; display: grid; gap: 6px; flex: 1; align-content: start; }
.pcard-name { font-family: var(--cond); font-weight: 800; font-size: 19px; line-height: 1.05; }
.pcard-sub, .pcard-line { font-size: 11.5px; color: var(--ink-3); }
.pcard-gauges, .profile-gauges { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.profile-gauges { justify-content: flex-start; gap: 16px; flex-wrap: wrap; }
.gauge { display: grid; justify-items: center; gap: 1px; font-size: 9.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.gauge.deal b { font-family: var(--cond); font-weight: 700; font-size: 17px; color: var(--ink); letter-spacing: 0; text-transform: none; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.pips i.on { background: var(--accent); }
.pcard-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pcard-actions { display: flex; gap: 6px; margin-top: 2px; }
.pcard-actions .btn { flex: 1; }

/* foil: five-stars and award winners */
.pcard.foil { border: 1.5px solid transparent; background:
  linear-gradient(var(--panel-2), var(--panel-2)) padding-box,
  linear-gradient(115deg, #b98a2a, #fff3c4, #f2c53d, #b98a2a, #fff3c4, #f2a03d, #b98a2a) border-box;
  background-size: 100% 100%, 300% 100%; animation: foil 7s linear infinite; }
.pcard.foil::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 40%, #ffffff2b 50%, transparent 60%); background-size: 300% 100%; animation: sheen 7s linear infinite; }
@keyframes foil { from { background-position: 0 0, 0% 0; } to { background-position: 0 0, 300% 0; } }
@keyframes sheen { from { background-position: 150% 0; } to { background-position: -150% 0; } }

/* faces on list rows */
.face { position: relative; width: 44px; height: 46px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; display: flex; align-items: flex-end; justify-content: center; }
.face-pos { position: absolute; left: 0; top: 0; padding: 1px 5px; border-radius: 0 0 7px 0; background: #000b; color: #fff; font-family: var(--cond); font-weight: 800; font-size: 10.5px; letter-spacing: .04em; }
.dlg-face { width: 56px; height: 62px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; display: flex; align-items: flex-end; justify-content: center; }
.dlg-head { grid-template-columns: auto 1fr auto; }

/* shortlist / pass */
.row.board { touch-action: pan-y; transition: transform .18s ease, background .12s; }
.row.board.shortlisted { background: #f2c53d0f; }
.row.board.swipe-right { background: #3ecf8e2e; }
.row.board.swipe-left { background: #f2555a2e; }
.star-mark { color: var(--star); }
.row-marks { display: flex; gap: 4px; justify-content: flex-end; margin-top: 5px; }
.mark { width: 28px; height: 24px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-3); font-size: 12px; line-height: 1; padding: 0; }
.mark:hover { color: var(--ink); border-color: var(--ink-3); }
.mark.on[data-mark="short"] { color: var(--star); border-color: var(--star); }
.mark.on[data-mark="pass"] { color: var(--bad); border-color: var(--bad); }
.swipe-hint { display: none; }

/* profile hero */
.hero { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: end; padding: 16px 16px 0 18px; color: var(--ci); border-bottom: 4px solid var(--c2); background: linear-gradient(135deg, var(--c1), color-mix(in srgb, var(--c1) 42%, #000)); }
.hero.foil { border-bottom: 0; }
.hero.foil::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: linear-gradient(115deg, #b98a2a, #fff3c4, #f2c53d, #b98a2a, #fff3c4, #f2a03d, #b98a2a); background-size: 300% 100%; animation: sheen 7s linear infinite; }
.hero-art { line-height: 0; align-self: end; }
.hero-main { padding-bottom: 14px; min-width: 0; }
.hero-top { display: flex; align-items: center; gap: 8px; font-family: var(--cond); font-weight: 800; }
.hero-top .pcard-c { order: 0; }
.hero-num { font-size: 22px; opacity: .95; }
.hero-tag { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.hero-name { font-family: var(--cond); font-weight: 800; font-size: 32px; line-height: 1; margin-top: 4px; }
.hero-sub { font-size: 12.5px; opacity: .95; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 3px 6px; align-items: center; }
.hero .x { color: var(--ci); align-self: start; opacity: .85; }

/* timeline as a story */
.timeline { position: relative; display: grid; gap: 0; }
.timeline::before { content: ""; position: absolute; left: 73px; top: 14px; bottom: 14px; width: 2px; background: var(--line); }
.tl, .tl:nth-child(odd) { position: relative; display: grid; grid-template-columns: 46px 30px 1fr; gap: 8px; align-items: center; padding: 6px; border-radius: 0; background: none; }
.tl-y { text-align: right; }
.tl-dot { position: relative; width: 28px; height: 28px; border-radius: 50%; background: var(--panel-2); border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; }
.tl.award .tl-dot, .tl.post .tl-dot, .tl.draft .tl-dot, .tl.captain .tl-dot { border-color: var(--star); }
.tl.promise-broken .tl-dot, .tl.injury .tl-dot, .tl.regress .tl-dot { border-color: var(--bad); }
.tl.promise-kept .tl-dot, .tl.breakout .tl-dot { border-color: var(--good); }

/* tabs: icons only show on small screens */
.tabs button i { display: none; font-style: normal; }
.tab-gap { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .pcard.foil, .pcard.foil::after, .hero.foil::after, dialog { animation: none; }
}

/* ---- mobile layout: design for the thumb ------------------------------ */
@media (max-width: 760px) {
  body:not(.in-menu) { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }

  /* header: compact, and the meters scroll sideways */
  .top { position: static; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 10px 14px 8px; }
  .logo { font-size: 20px; }
  .brand-crest svg { width: 34px; height: 34px; }
  .clock { flex-wrap: wrap; justify-content: flex-end; }
  .meters { grid-column: 1 / -1; display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 18px; padding-bottom: 4px; scrollbar-width: none; justify-content: flex-start; }
  .meters::-webkit-scrollbar { display: none; }
  .meter { flex: 0 0 auto; min-width: 170px; }
  .meter.small { min-width: 0; text-align: left; }

  /* the main action lives where the thumb is */
  .advance { position: fixed; left: 12px; right: 12px; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 30; padding: 14px 16px; font-size: 16px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 30px #000b; white-space: normal; }
  .advance:hover { transform: none; }

  /* bottom tab bar */
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-bottom: 0; border-top: 1px solid var(--line); background: #0d1117f2; backdrop-filter: blur(12px); justify-content: space-around; align-items: stretch; overflow: visible; }
  .tabs button { flex: 1; display: grid; justify-items: center; gap: 1px; padding: 6px 2px; border: 0; font-size: 10.5px; letter-spacing: .06em; }
  .tabs button i { display: block; font-size: 20px; line-height: 1.15; filter: grayscale(1) opacity(.6); }
  .tabs button.on { color: var(--accent); border: 0; }
  .tabs button.on i { filter: none; }
  .tab-gap { display: none; }

  /* dialogs become bottom sheets */
  dialog { margin: auto 0 0 0; width: 100vw; max-width: 100vw; max-height: 92dvh; border-radius: 18px 18px 0 0; border-width: 1px 0 0 0; animation: sheet .22s ease-out; }
  #dlgBody::before { content: ""; display: block; position: absolute; left: 50%; top: 6px; width: 44px; height: 4px; margin-left: -22px; border-radius: 2px; background: #ffffff66; z-index: 2; }
  .dlg-head { padding-top: 22px; }
  .dlg-foot { position: sticky; bottom: 0; background: var(--panel); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .dlg-foot .btn { flex: 1; text-align: center; }
  .hero { padding: 20px 12px 0 14px; gap: 10px; }
  .hero-name { font-size: 26px; }
  .toast { bottom: calc(134px + env(safe-area-inset-bottom)); }

  /* cards, not tables */
  .pcard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pcard-name { font-size: 17px; }
  .pcard-gauges .gauge svg { width: 38px; height: 38px; }
  .prog-list { grid-template-columns: 1fr; }
  .prog-stats { grid-template-columns: repeat(3, 1fr); row-gap: 8px; }
  .swipe-hint { display: block; font-size: 11.5px; color: var(--ink-3); padding: 7px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
  .mark { width: 36px; height: 30px; font-size: 14px; }
  .chosen-name { font-size: 21px; }
  .profile-gauges { gap: 12px; }
  .timeline::before { left: 73px; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* title screen on a phone: no tab bar, so the start button sits at the very bottom */
@media (max-width: 760px) {
  body.in-menu { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.in-menu .advance { bottom: calc(14px + env(safe-area-inset-bottom)); }
}

/* a fade behind the floating action button so cards do not collide with it */
@media (max-width: 760px) {
  body:not(.in-menu)::after { content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 150px; background: linear-gradient(transparent, var(--bg) 60%); pointer-events: none; z-index: 29; }
  .toast { z-index: 40; }
}
@media (max-width: 760px) {
  .row.board { grid-template-columns: 44px 1fr 84px; }
}
@media (max-width: 760px) {
  .row.board { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .row.board .right .meta { white-space: nowrap; flex-wrap: nowrap; }
}
.tag { white-space: nowrap; }
/* card content never widens the card: long tags wrap inside it */
.pcard-body { grid-template-columns: minmax(0, 1fr); }
.pcard-tags .tag { white-space: normal; }
.pcard-gauges { flex-wrap: wrap; }
@media (max-width: 760px) {
  .dlg-foot { gap: 8px; }
  .dlg-foot .btn { flex: 1 1 auto; white-space: nowrap; padding: 12px 10px; }
}
/* the opposing helmet faces ours, but its letters still read left to right */
.versus .flip text { transform: scaleX(-1); transform-box: fill-box; transform-origin: center; }
/* title screen on a phone: only the start button floats; Continue stays in its card */
@media (max-width: 760px) {
  body.in-menu #continueBtn { position: static; width: 100%; margin-top: 10px; box-shadow: none; }
  .continue-row { display: grid; gap: 4px; }
}

/* ---- v1.4: ownership goals, season review, job market ------------------ */
.goals { display: grid; gap: 8px; }
.goal { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.goal-icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--panel); border: 1.5px solid var(--line); color: var(--ink-3); }
.goal.good .goal-icon { border-color: var(--good); color: var(--good); }
.goal.warn .goal-icon { border-color: var(--warn); color: var(--warn); }
.goal.bad .goal-icon { border-color: var(--bad); color: var(--bad); }
.goal-text { font-weight: 600; font-size: 13px; }
.goal .meta { margin: 2px 0 0; }
.hot-seat { display: block; margin-top: 6px; color: #ffb4a8; }
.hot-seat b { color: #fff; }

.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; }
.gaps { display: grid; gap: 5px; }
.gap-row { display: grid; grid-template-columns: 42px 1fr 34px; gap: 8px; align-items: center; font-size: 12.5px; }
.gap-pos { font-family: var(--cond); font-weight: 800; letter-spacing: .04em; }
.gap-track { position: relative; height: 10px; background: var(--panel-2); border-radius: 5px; }
.gap-track::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--ink-3); }
.gap-bar { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.gap-bar.neg { right: 50%; background: var(--bad); }
.gap-bar.pos { left: 50%; background: var(--good); }
.gap-num { text-align: right; font-family: var(--cond); font-weight: 700; font-size: 15px; }
.fixes { margin: 6px 0 12px; padding-left: 20px; display: grid; gap: 6px; line-height: 1.45; }

.offer .prog-band { align-content: center; gap: 10px; }
.offer-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
@media (max-width: 760px) {
  .review-grid { grid-template-columns: 1fr; }
}

/* ---- v1.5: program tab, legacy, autopilot, news ------------------------ */
.fac-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 10px; }
.fac { display: grid; gap: 8px; align-content: start; padding: 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.fac-top { display: flex; gap: 10px; align-items: center; }
.fac-icon { font-size: 26px; line-height: 1; }
.fac-name { font-family: var(--cond); font-weight: 800; font-size: 18px; letter-spacing: .02em; }
.fac .pips i { width: 10px; height: 10px; }
.btn.cand { text-align: left; font-weight: 500; font-size: 12.5px; padding: 8px 10px; }
.rival { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rival:last-child { border-bottom: 0; }
.rival.nemesis b { color: var(--bad); }
.note.rivalry { margin-top: 6px; color: var(--warn); }
.board-tools { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.board-tools:empty { display: none; }
.news { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); line-height: 1.6; }
.legacy-score { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.legacy-score .big { font-size: 40px; color: var(--accent); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 12px; }
.ach { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.ach.on { color: var(--ink); border-color: color-mix(in srgb, var(--star) 45%, var(--line)); }
.ach .meta { margin: 2px 0 0; }
@media (max-width: 760px) {
  .tabs button { font-size: 9.5px; letter-spacing: .03em; }
  .fac-grid, .ach-grid { grid-template-columns: 1fr; }
}

.opts { display: grid; gap: 8px; }
