/* Diamond Commander v2 - app + component styles.
 * Direction: "Dugout & Scoreboard" - modern athletic.
 * Each block maps to a future React component (noted in comments).
 */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { overflow-x: clip; }   /* no page-level horizontal scroll; wide tables scroll in their own container */
body {
  font-family: var(--font-body);
  font-size: 15px; line-height: 1.5; color: var(--ink);
  background: var(--page-backdrop);   /* backdrop behind the phone column on wide screens */
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, .display { font-family: var(--font-display); }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-xs); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- AppShell: a centered phone-width column (mobile-first) ---------- */
.app { width: 100%; max-width: 520px; margin: 0 auto; min-height: 100vh; position: relative;
  display: flex; flex-direction: column; background: var(--bg); background-image: var(--field-mesh);
  box-shadow: 0 0 0 1px rgba(14,31,58,.05), 0 18px 60px rgba(14,31,58,.16); }
/* Top bar - the dugout bar (navy brand anchor) */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 13px 20px; color: var(--on-navy);
  background:
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.06)),
    linear-gradient(100deg, var(--navy), var(--navy-2));
  border-bottom: 1px solid rgba(0,0,0,.25);
  box-shadow: 0 2px 14px rgba(14,31,58,.22);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display);
  font-weight: 800; font-size: 18px; letter-spacing: var(--tracking-tight); color: #fff; }
.brand .gem { color: var(--clay-top); font-size: 17px; filter: drop-shadow(0 1px 4px rgba(213,181,102,.5)); }
.brand small { font-weight: 700; color: var(--on-navy-soft); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; border: 1px solid rgba(159,179,212,.35); padding: 2px 6px; border-radius: 999px; }
.topbar .spacer { flex: 1; }
.teamchip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px;
  background: rgba(255,255,255,.08); color: #fff; font-weight: 700; font-size: 13px;
  border: 1px solid rgba(159,179,212,.28); cursor: pointer; transition: background var(--t);
  min-width: 0; max-width: 52vw;
}
.teamchip:hover { background: rgba(255,255,255,.16); }
.teamchip .tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teamchip .caret { flex: 0 0 auto; opacity: .7; }
.topbar .brand { flex: 0 1 auto; min-width: 0; }
.teamchip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--field);
  box-shadow: var(--ring); }

/* Single-column body; the desktop left rail is removed in the mobile app. */
.topbar .abk { width: 40px; height: 40px; border: 0; background: transparent; color: var(--on-navy); font-size: 30px; line-height: 1; cursor: pointer; padding: 0; margin-left: -6px; }
.topbar .abtitle { font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: var(--tracking-tight); }
.topbar .abavatar { cursor: pointer; display: flex; }
.topbar .teamchip .dot { background: var(--team); }
.theme-toggle { width: 42px; height: 42px; padding: 0; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); display: inline-grid; place-items: center; cursor: pointer;
  font-size: 19px; line-height: 1; box-shadow: var(--shadow-sm); transition: transform var(--t), background var(--t), border-color var(--t); }
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--clay); }
.theme-toggle:active { transform: translateY(0); }
.theme-toggle .theme-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-sun { display: inline; }
.topbar .theme-toggle { flex: 0 0 auto; background: rgba(255,255,255,.08); color: var(--on-navy); border-color: rgba(255,249,233,.22); box-shadow: none; }
.topbar .theme-toggle:hover { background: rgba(255,255,255,.16); border-color: rgba(255,249,233,.42); }
.teamstripe { height: 4px; background: linear-gradient(90deg, var(--team), var(--team) 42%, var(--team-2) 72%, var(--team-3)); }
.rail { display: none; }
.body { flex: 1; width: 100%; }
.main { width: 100%; padding: 16px 14px 92px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-h h1 { font-size: 24px; font-weight: 800; letter-spacing: var(--tracking-tight); margin: 0; line-height: 1.05; }
.page-h .sub { color: var(--ink-soft); font-size: 14px; margin-top: 4px; font-weight: 500; }

/* Bottom tab bar - always on, aligned to the phone-width column. */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px;
  z-index: 40; display: flex; justify-content: space-around;
  background: linear-gradient(100deg, var(--navy), var(--navy-2));
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 18px rgba(14,31,58,.28);
}
.tabbar .tab {
  flex: 1 1 0; min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 2px;
  color: var(--on-navy-soft); font-size: 12px; font-weight: 700; cursor: pointer; border-radius: var(--r-xs);
  white-space: nowrap; position: relative;
  background: none; border: 0; font-family: inherit; appearance: none; -webkit-appearance: none;   /* <button> reset: real nav element, keyboard + screen-reader reachable */
}
.tabbar .tab:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.tabbar .tab .ic { font-size: 22px; }
.tabbar .tab.active { color: #fff; }
.tabbar .tab.active::before { content: ""; position: absolute; top: 0; left: 26%; right: 26%; height: 3px;
  border-radius: 999px; background: var(--team); box-shadow: 0 1px 6px var(--team); }
.tabbar .tab.active .ic { filter: drop-shadow(0 2px 6px rgba(213,181,102,.45)); }

/* ---------- Primitives (ui.js) ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--card-highlight), var(--shadow-sm); padding: 18px; margin-bottom: 16px;
}
.card.pad-lg { padding: 24px; }
/* The generated Lineup / Field / Grid views are the working surface. Give that
   one card back the space that nested card padding would otherwise waste. */
.lineup-card { padding: 14px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 14px; flex-wrap: wrap; }
.eyebrow { font-family: var(--font-display); font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: var(--tracking-wide); color: var(--ink-soft); margin: 0; }

/* Keep the phone-sized app on phones, but use the available workspace for the
   lineup grid, field card, and roster on a tablet or desktop. The tab bar must
   follow the same width so it remains attached to its app, not the whole page. */
@media (min-width: 720px) {
  .app, .tabbar { max-width: 980px; }
  .main { padding: 24px 28px 104px; }
  .lineup-card { padding: 20px; }
}

.btn {
  font-family: var(--font-display); cursor: pointer; border: 1px solid transparent; border-radius: var(--r-sm);
  min-height: 44px; padding: 0 17px; font-weight: 700; font-size: 15px; letter-spacing: .005em;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  transition: background var(--t), transform var(--t), box-shadow var(--t), border-color var(--t), filter var(--t);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 0 var(--accent-press), var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--accent-press); }
.btn-cta { background: linear-gradient(180deg, var(--clay-top), var(--clay)); color: var(--on-clay); box-shadow: var(--cta-shadow); }
.btn-cta:hover:not(:disabled) { filter: brightness(1.04); }
.btn-ghost { background: var(--accent-soft); color: var(--accent-ink); }
.btn-ghost:hover:not(:disabled) { filter: brightness(.96); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); box-shadow: var(--shadow-sm); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #f3c9c9; }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 17px; padding: 0 22px; border-radius: var(--r); }
.btn-sm { min-height: 36px; padding: 0 13px; font-size: 13px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line);
  font-family: var(--font-display); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: #c4ebcf; }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); border-color: #f0e0a8; }
.badge.if { background: var(--if); color: var(--if-ink); border-color: #2c7a5c; }
.badge.of { background: var(--of); color: var(--of-ink); border-color: #3f8a54; }

/* Form controls */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
label.fld { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin: 0 0 6px;
  text-transform: uppercase; letter-spacing: .04em; font-family: var(--font-display); }
input[type=text], input[type=date], input[type=number], input[type=email], input[type=password], select {
  width: 100%; padding: 12px 13px; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-family: var(--font-body);
  transition: border-color var(--t), box-shadow var(--t); font-variant-numeric: tabular-nums;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input:disabled { background: var(--surface-2); color: var(--ink-soft); }
.row { display: grid; gap: 12px; }
.row.c2 { grid-template-columns: 1fr 1fr; }
.row.c3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 520px) { .row.c3 { grid-template-columns: 1fr 1fr; } }
.hint { color: var(--ink-soft); font-size: 13px; line-height: 1.55; }

/* Checkbox + label rows (consent + marketing opt-in). Without this the checkbox
   and multi-line label collapse into inline flow and overlap. */
.checkrow { display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  font-size: 14px; line-height: 1.5; }
.checkrow input[type=checkbox] { flex: 0 0 auto; width: 18px; height: 18px;
  margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }
.checkrow > span { min-width: 0; }

/* Pill toggle buttons (player edit: can-play + no-go). Tap to flip. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chiptog { border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink-soft);
  font-family: var(--font-display); font-weight: 700; font-size: 13px; padding: 9px 14px; border-radius: 999px;
  cursor: pointer; min-height: 40px; transition: background var(--t), color var(--t), border-color var(--t); }
.chiptog:hover { border-color: var(--accent); color: var(--accent); }
.chiptog.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chiptog.danger.on { background: var(--danger); color: #fff; border-color: var(--danger); }
.chiptog.danger:hover { border-color: var(--danger); color: var(--danger); }
.chiptog.danger.on:hover { color: #fff; filter: brightness(1.05); }

/* Toggle (switch) */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--line-strong); border-radius: 999px; transition: background var(--t); }
.switch .track::before { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; box-shadow: var(--shadow-sm); transition: transform var(--t); }
.switch input:checked + .track { background: var(--field); }
.switch input:checked + .track::before { transform: translateX(18px); }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; font-family: var(--font-display); font-weight: 700; color: var(--ink-soft);
  padding: 8px 13px; border-radius: var(--r-xs); cursor: pointer; min-height: 36px; }
.seg button.on { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow-sm); }

/* Toast */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 12px 18px; border-radius: var(--r); box-shadow: var(--shadow-lg);
  font-weight: 600; font-size: 14px; animation: rise var(--t-slow); display: flex; align-items: center; gap: 9px; }
.toast::before { content: "●"; font-size: 9px; color: var(--field); }
.toast.ok::before { color: var(--field); }
.toast.err { background: #5b1414; } .toast.err::before { content: "!"; color: #ffb4b4; font-weight: 800; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Modal */
.scrim { position: fixed; inset: 0; background: rgba(14,31,58,.5); backdrop-filter: blur(3px); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 18px; animation: fade var(--t); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 470px;
  max-height: 90vh; overflow: auto; animation: pop var(--t-slow); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 8px; }
.modal-h h2 { font-size: 19px; margin: 0; font-weight: 800; letter-spacing: var(--tracking-tight); }
.modal-b { padding: 8px 22px 22px; }
.x { border: 0; background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 17px; color: var(--ink-soft); }
.x:hover { background: var(--line); }

/* ---------- Sign-in (views: signin) ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden;
  background:
    radial-gradient(1100px 560px at 50% -12%, #dbe8df 0%, transparent 58%),
    linear-gradient(180deg, var(--bg), var(--bg-2)); }
.auth::after { content: ""; position: absolute; left: 50%; bottom: -42vh; width: 130vw; height: 80vh; transform: translateX(-50%) rotate(45deg);
  background: linear-gradient(180deg, rgba(182,138,63,.08), transparent); border-radius: 14% 14% 0 0;
  border-top: 2px solid rgba(16,39,32,.08); pointer-events: none; }   /* faint diamond on the horizon */
.auth .panel { width: 100%; max-width: 408px; text-align: center; position: relative; z-index: 1; }
.auth .logo { font-family: var(--font-display); font-size: 34px; font-weight: 900; letter-spacing: var(--tracking-tight);
  margin-bottom: 6px; color: var(--navy); }
.auth .logo .gem { color: var(--accent); }
.auth .tag { color: var(--ink-soft); margin-bottom: 26px; font-size: 15px; font-weight: 500; }
.auth .card { text-align: left; border-radius: var(--r-xl); box-shadow: var(--shadow-md); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-faint); font-size: 12px; margin: 15px 0;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* ---------- Onboarding preset picker (views: onboarding) ---------- */
.auth-brand { width: min(100%, 308px); margin: 0 auto 16px; }
.auth-brand-logo, .onboarding-brand-logo { display: block; width: 100%; height: auto; border-radius: 16px; background: #111714;
  border: 2px solid var(--clay); box-shadow: 0 14px 32px rgba(16,39,32,.24); }
.auth .logo { display: none; }
.onboarding-shell { max-width: 640px; margin: 0 auto; position: relative; }
.onboarding-brand { width: min(100%, 214px); margin: 0 auto 16px; }
.auth > .theme-toggle { position: absolute; top: 18px; right: 18px; z-index: 2; }
.onboarding-shell > .theme-toggle { position: absolute; top: 0; right: 0; }
.steps { display: flex; gap: 8px; margin-bottom: 20px; }
.steps .step { flex: 1; height: 6px; border-radius: 999px; background: var(--line-strong); transition: background var(--t); }
.steps .step.on { background: var(--clay); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  border: 1.5px solid var(--line-strong); border-radius: var(--r-lg); padding: 18px; cursor: pointer; background: var(--surface);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t); text-align: left;
}
.choice:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.choice.sel { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--ring); }
.choice .emoji { font-size: 30px; line-height: 1; }
.choice .t { font-family: var(--font-display); font-weight: 800; margin-top: 8px; font-size: 16px; }
.choice .d { font-size: 13px; color: var(--ink-soft); margin-top: 3px; }

/* ---------- Game Day (views: gameday) ---------- */
.gameday-top { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
@media (max-width: 860px) { .gameday-top { grid-template-columns: 1fr; } }

.presence { display: grid; gap: 7px; max-height: 430px; overflow: auto; padding-right: 2px; }
.pl { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 9px 14px; border: 1px solid var(--line);
  border-radius: var(--r); cursor: pointer; user-select: none; transition: background var(--t), border-color var(--t), box-shadow var(--t); }
.pl:hover { background: var(--surface-2); }
.pl.on { border-color: var(--accent-line); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.pl.off { opacity: .5; background: var(--surface-2); }
.pl input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); flex: 0 0 auto; cursor: pointer; }
.pl { min-width: 0; }
.pl .nm { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl .meta { margin-left: auto; display: flex; gap: 5px; flex: 0 0 auto; }
.pl .tag { font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 999px; font-family: var(--font-display); letter-spacing: .03em; }
.pl .tag.p { background: var(--clay-soft); color: var(--clay-press); }
.pl .tag.c { background: var(--chip-neu); color: var(--chip-neu-ink); }
.pl .tag.no { background: var(--danger-soft); color: var(--danger); }

.gamebadge { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-display); font-size: 15px; font-weight: 800;
  color: #fff; background: linear-gradient(100deg, var(--navy), var(--navy-2)); padding: 7px 15px; border-radius: 999px; letter-spacing: .01em; }

/* Lineup grid (views: lineupGrid) - the scoreboard */
.grid-wrap { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); -webkit-overflow-scrolling: touch; }
table.lineup { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
table.lineup th, table.lineup td { padding: 10px 8px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.lineup td.name { text-align: left; }
table.lineup thead th { position: sticky; top: 0; z-index: 2; background: linear-gradient(180deg, var(--navy-2), var(--navy));
  color: #fff; font-family: var(--font-display); font-weight: 700; letter-spacing: .03em; font-size: 12px; text-transform: uppercase; }
table.lineup thead th:first-child { text-align: left; border-top-left-radius: var(--r-lg); }
table.lineup thead th:last-child { border-top-right-radius: var(--r-lg); }
table.lineup tbody td.idx { color: var(--ink-faint); font-family: var(--font-display); font-weight: 800; width: 28px; }
table.lineup tbody td.name { text-align: left; font-weight: 600; position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.lineup tbody tr:nth-child(even) td.name { background: var(--surface-2); }
@media (hover:hover) { table.lineup tbody tr:hover td.name, table.lineup tbody tr:hover td.idx { background: var(--surface-2); } }
td.cell { font-family: var(--font-display); font-weight: 800; font-size: 16px; letter-spacing: .02em; }
td.cell.if { background: var(--if); color: var(--if-ink); }
td.cell.of { background: var(--of); color: var(--of-ink); }
td.cell.neu { background: var(--neu); color: var(--neu-ink); }
td.cell.sit { background: var(--sit); color: var(--sit-ink); font-weight: 700; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-soft); align-items: center; flex-wrap: wrap; font-weight: 600; }
.legend .k { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }

/* Reveal cascade on generate (added via .reveal by app.js) */
table.lineup.reveal tbody tr { opacity: 0; animation: rowIn .42s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes rowIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
table.lineup.reveal tbody tr:nth-child(1){animation-delay:.03s}
table.lineup.reveal tbody tr:nth-child(2){animation-delay:.06s}
table.lineup.reveal tbody tr:nth-child(3){animation-delay:.09s}
table.lineup.reveal tbody tr:nth-child(4){animation-delay:.12s}
table.lineup.reveal tbody tr:nth-child(5){animation-delay:.15s}
table.lineup.reveal tbody tr:nth-child(6){animation-delay:.18s}
table.lineup.reveal tbody tr:nth-child(7){animation-delay:.21s}
table.lineup.reveal tbody tr:nth-child(8){animation-delay:.24s}
table.lineup.reveal tbody tr:nth-child(9){animation-delay:.27s}
table.lineup.reveal tbody tr:nth-child(10){animation-delay:.30s}
table.lineup.reveal tbody tr:nth-child(11){animation-delay:.33s}
table.lineup.reveal tbody tr:nth-child(12){animation-delay:.36s}
table.lineup.reveal tbody tr:nth-child(13){animation-delay:.39s}
table.lineup.reveal tbody tr:nth-child(n+14){animation-delay:.42s}

/* Fair-play check strip (views: fairnessSummary) */
.fairstrip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-strong); }
.fairstrip .fp { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--ok);
  background: var(--ok-soft); border: 1px solid #c4ebcf; padding: 6px 11px; border-radius: 999px; }
.fairstrip .fp .ck { width: 16px; height: 16px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 10px; }

/* Empty / hero states */
.empty { text-align: center; padding: 40px 18px; color: var(--ink-soft); }
.empty .big { font-size: 46px; margin-bottom: 8px; color: var(--accent); filter: drop-shadow(0 4px 12px rgba(30,106,76,.25)); }
.empty h3 { font-family: var(--font-display); color: var(--ink); margin: 0 0 4px; font-size: 19px; }

/* Roster table (views: roster) */
.rtable { width: 100%; border-collapse: separate; border-spacing: 0; }
.rtable th { text-align: left; font-family: var(--font-display); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-soft); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.rtable td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rtable tr:last-child td { border-bottom: 0; }
.rtable tr:hover td { background: var(--surface-2); }
.rtable .jersey { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(180deg, var(--navy-3), var(--navy));
  color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 16px; box-shadow: var(--shadow-sm); }
.rtable .nm { font-weight: 700; font-size: 15px; }
.rtable .flags { display: flex; gap: 5px; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; color: var(--accent); font-family: var(--font-display); font-weight: 700; cursor: pointer; padding: 6px 8px; border-radius: var(--r-xs); }
.linkbtn:hover { background: var(--accent-soft); }
.linkbtn.danger { color: var(--danger); }
.linkbtn.danger:hover { background: var(--danger-soft); }

/* Team / coaches (views: team) */
.coach { display: flex; align-items: center; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.coach > div { min-width: 0; }
.coach > div > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coach .role { flex: 0 0 auto; }
.coach:last-child { border-bottom: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display);
  font-weight: 800; color: #fff; box-shadow: var(--shadow-sm); }
.coach .role { margin-left: auto; }

/* Skills matrix (views: skills) */
.skills-wrap { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: var(--r); -webkit-overflow-scrolling: touch; }
table.skills { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
table.skills th, table.skills td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; }
table.skills th.grp { font-family: var(--font-display); font-weight: 800; font-size: 11px; padding: 6px 4px; color: var(--ink);
  text-transform: uppercase; letter-spacing: .04em; }
table.skills th.vh { height: 118px; vertical-align: bottom; padding: 6px 0; background: var(--navy); position: sticky; top: 0; z-index: 1; }
table.skills th.vh span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: 11px; font-weight: 600;
  color: #fff; display: inline-block; }
table.skills th.corner { background: var(--navy); }
table.skills th.ply, table.skills td.ply { position: sticky; left: 0; z-index: 2; text-align: left; white-space: nowrap; }
table.skills th.ply { background: var(--navy); color: #fff; vertical-align: bottom; font-family: var(--font-display); padding: 8px 10px;
  min-width: 120px; box-shadow: 1px 0 0 var(--navy); }
table.skills td.ply { background: var(--surface); font-weight: 700; padding: 8px 10px; min-width: 120px; box-shadow: 1px 0 0 var(--line-strong); }
table.skills tr:nth-child(even) td.ply { background: var(--surface-2); }
td.sk { width: 46px; min-width: 46px; height: 34px; padding: 0; }
td.sk input.skin { width: 100%; height: 34px; border: 0; border-radius: 0; background: transparent; text-align: center;
  font-family: var(--font-display); font-weight: 700; font-size: 11.5px; color: var(--ink); padding: 0; cursor: text;
  -moz-appearance: textfield; }
td.sk input.skin:focus { outline: 2px solid var(--accent); outline-offset: -2px; box-shadow: none; background: var(--surface); }
td.sk.v1 { background: #f8696b; color: #fff; } td.sk.v2 { background: #fca85f; }
td.sk.v3 { background: #ffd666; } td.sk.v4 { background: #a6d96a; } td.sk.v5 { background: #63be7b; color: #fff; }

/* Team switcher rows (views: teamSwitcher / account) */
.teamrow { display: flex; align-items: center; gap: 13px; width: 100%; padding: 13px 15px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface); cursor: pointer; text-align: left;
  transition: border-color var(--t), background var(--t), box-shadow var(--t); font-family: var(--font-body); color: var(--ink); }
.teamrow:hover { border-color: var(--accent); background: var(--surface-2); box-shadow: var(--shadow-sm); }
.teamrow.on { border-color: var(--accent); background: var(--accent-soft); }

/* Paywall banner (views: ui.paywall) */
.paywall { display: flex; align-items: center; gap: 12px 14px; flex-wrap: wrap; padding: 15px 18px; border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--clay-soft), var(--surface)); border: 1px solid var(--clay-top); margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.paywall .ic { font-size: 22px; }
.paywall .txt { flex: 1 1 200px; min-width: 0; font-size: 14px; }
.paywall .txt b { color: var(--clay-press); }

/* Price card */
.pricecard { border: 1.5px solid var(--accent); border-radius: var(--r-lg); padding: 18px; background:
  linear-gradient(180deg, var(--surface), var(--accent-soft)); }
.appearance-toggle { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--line-strong);
  border-radius: var(--r); background: var(--surface-2); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.appearance-toggle:hover { border-color: var(--accent); }
.appearance-toggle .appearance-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--clay-soft); color: var(--clay-press); font-size: 17px; }
.appearance-toggle .appearance-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.appearance-toggle .appearance-copy b { font-family: var(--font-display); font-size: 14px; }
.appearance-toggle .appearance-copy span { font-size: 12.5px; color: var(--ink-soft); }
.appearance-toggle .appearance-state { font-size: 12px; font-weight: 800; color: var(--accent-ink); background: var(--accent-soft); border-radius: var(--r-pill); padding: 4px 8px; }
.pricecard .amt { font-family: var(--font-display); font-weight: 900; font-size: 30px; letter-spacing: var(--tracking-tight); color: var(--navy); }
.pricecard .amt small { font-size: 14px; font-weight: 700; color: var(--ink-soft); }

/* Spinner */
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Misc helpers */
.stack > * + * { margin-top: 12px; }
.muted { color: var(--ink-soft); }
.right { margin-left: auto; }
.center { text-align: center; }
.flex { display: flex; align-items: center; gap: 10px; }
.wrap-gap { display: flex; flex-wrap: wrap; gap: 8px; }

/* Phone install offer. It sits above the app chrome but below modals/toasts,
   uses only fixed product colours, and never inherits a team's jersey palette. */
.install-nudge { position: fixed; z-index: 55; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(calc(100% - 24px), 500px); display: flex; align-items: center; gap: 12px; padding: 12px;
  border: 1px solid rgba(215,183,109,.58); border-radius: var(--r-lg); background: var(--navy); color: var(--on-navy);
  box-shadow: var(--shadow-lg); }
.install-nudge.with-tabs { bottom: calc(80px + env(safe-area-inset-bottom)); }
.install-nudge-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; line-height: 1.28; }
.install-nudge-copy b { font-family: var(--font-display); font-size: 14px; }
.install-nudge-copy span { color: var(--on-navy-soft); font-size: 12.5px; }
.install-nudge-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; }
.install-nudge .btn { white-space: nowrap; }
.install-later { appearance: none; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--on-navy-soft); font: inherit; font-size: 12px; font-weight: 700; padding: 8px 5px; cursor: pointer; }
.install-later:hover { color: var(--on-navy); background: rgba(255,255,255,.09); }
.install-guide p { margin: 0 0 12px; line-height: 1.5; }
.install-guide ol { margin: 0; padding-left: 22px; line-height: 1.65; }
.install-guide-note { margin: 0 0 13px; padding: 10px 11px; border-radius: var(--r-sm); background: var(--warn-soft); border: 1px solid #efd08b; color: #5f4108; font-size: 13px; line-height: 1.42; }

/* ---------- Mobile refinements (phone-first polish) ---------- */
@media (max-width: 560px) {
  .main { padding: 14px 13px 96px; }
  .main > .lineup-card { margin-left: -9px; margin-right: -9px; padding: 14px 10px; }
  .page-h { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-h h1 { font-size: 23px; }
  .page-h .sub { font-size: 13.5px; }
  .card { padding: 15px; border-radius: var(--r); }
  .card.pad-lg { padding: 18px; }
  .row.c2 { grid-template-columns: 1fr; }          /* stack paired inputs for fat fingers */
  .choice-grid { grid-template-columns: 1fr; }      /* preset cards stack full-width */
  .gameday-top { gap: 12px; }
  .topbar { padding: 11px 14px; gap: 8px; }
  .brand { font-size: 16px; }
  .brand small { display: none; }
  .teamchip { max-width: 44vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .modal-b { padding: 8px 16px 18px; }
  .modal-h { padding: 16px 18px 6px; }
  .presence { max-height: 50vh; }
  .fairstrip .fp { font-size: 12px; padding: 5px 9px; }
  table.lineup th, table.lineup td { padding: 8px 7px; }
  /* Roster: tighten so all four columns (incl. Actions/Remove) fit the phone width
     instead of clipping against body{overflow-x:clip}. */
  .rtable th, .rtable td { padding-left: 6px; padding-right: 6px; }
  .rtable td { padding-top: 9px; padding-bottom: 9px; }
  .rtable .jersey { width: 34px; height: 34px; border-radius: 10px; }
  .rtable td .linkbtn { padding: 4px 5px; }
  .btn { min-height: 46px; }                         /* generous tap targets */
  .pl { min-height: 54px; }
  .install-nudge { align-items: stretch; flex-direction: column; gap: 8px; padding: 13px; }
  .install-nudge-actions { width: 100%; justify-content: space-between; }
  .install-nudge .btn { flex: 1; }
  .install-later { min-height: 42px; padding: 8px 10px; }
}
@media (max-width: 400px) {
  .row.c3 { grid-template-columns: 1fr; }            /* swap selects stack on tiny screens */
  .auth { padding: 16px; }
  .auth-brand { width: min(100%, 258px); margin-bottom: 12px; }
  .onboarding-brand { width: min(100%, 180px); margin-bottom: 12px; }
}
/* Larger touch feedback + no accidental text-select on taps */
@media (hover: none) {
  .pl, .choice, .navitem, .tab, .btn, .teamchip { -webkit-tap-highlight-color: transparent; }
  .choice:hover { transform: none; box-shadow: none; }  /* no sticky hover on touch */
}

:root[data-theme="dark"] .auth { background:
  radial-gradient(900px 520px at 50% -12%, rgba(49,111,76,.35) 0%, transparent 60%),
  linear-gradient(180deg, var(--bg), var(--bg-2)); }
:root[data-theme="dark"] .auth::after { border-top-color: rgba(211,173,90,.16); background: linear-gradient(180deg, rgba(211,173,90,.08), transparent); }
:root[data-theme="dark"] .badge.accent { border-color: var(--accent-line); }
:root[data-theme="dark"] .btn-danger { border-color: #714247; }
:root[data-theme="dark"] td.sk input.skin:focus { background: var(--surface); }

/* Print: dugout-ready card. Printouts use a FIXED high-contrast light palette,
   never the viewer's dark/light theme (matches the #dc-print card and shared
   link). Scoped to #app so the hardcoded #dc-print card is left untouched.
   Without this, a raw browser Ctrl+P in dark theme prints the dark cell colors
   and, worse, light --ink text that vanishes on the forced-white page. */
@media print {
  /* The boot script sets an inline dark color-scheme. `!important` is needed
     to make raw Ctrl+P use this fixed light palette as well as the print cards. */
  :root {
    color-scheme: light !important;
    --page-backdrop: #fff !important;
    --bg: #fff !important;
    --bg-2: #f8fafc !important;
    --surface: #fff !important;
    --surface-2: #f8fafc !important;
    --ink: #10213b !important;
    --ink-soft: #334155 !important;
    --ink-faint: #475569 !important;
    --line: #cbd5e1 !important;
    --line-strong: #94a3b8 !important;
    --danger: #b91c1c !important;
    --danger-ink: #b91c1c !important;
    --danger-soft: #fef2f2 !important;
    --ok: #166534 !important;
    --ok-soft: #ecfdf3 !important;
    --warn: #8a5a00 !important;
    --warn-ink: #8a5a00 !important;
    --warn-soft: #fff7e6 !important;
    --if: #dbeafe !important;
    --if-ink: #0f2f66 !important;
    --of: #dcfce7 !important;
    --of-ink: #14532d !important;
    --neu: #e5e7eb !important;
    --neu-ink: #1f2937 !important;
    --sit: #fef3c7 !important;
    --sit-ink: #78350f !important;
    --chip-if: #dcefe4 !important;
    --chip-if-ink: #164e3b !important;
    --chip-of: #e0f0df !important;
    --chip-of-ink: #245d35 !important;
    --chip-neu: #e4eceb !important;
    --chip-neu-ink: #2d4c58 !important;
  }
  .topbar, .rail, .tabbar, .paywall, .btn, .card-h .legend, .install-nudge { display: none !important; }
  body { background: #fff !important; }
  #app { color: #10213b !important; }
  #app .card { background: #fff !important; box-shadow: none; border: 0; }
  /* Raw Ctrl+P can catch the mobile List view rather than the purpose-built
     print card. Keep that useful, but remove editing controls and give its
     scorebug, rows, and position pills an explicit high-contrast paper palette. */
  #app .scorebug { background: #10213b !important; color: #fff !important; box-shadow: none !important; }
  #app .scorebug .sb-eye, #app .scorebug .sb-lbl, #app .scorebug .sb-sub { color: #d8e1e7 !important; }
  #app .scorebug .sb-stat.ok .sb-num { color: #9ae6b4 !important; }
  #app .scorebug .sb-stat.warn .sb-num { color: #ffcf6b !important; }
  #app .inntabs > span, #app .inntab:not(.on), #app .bl-grip, #app .bl-mvs, #app .fieldbox > .hint { display: none !important; }
  #app .blrow { background: #fff !important; color: #10213b !important; border-color: #cbd5e1 !important; }
  #app .bl-num { background: #f8fafc !important; color: #334155 !important; border-color: #cbd5e1 !important; }
  #app .bl-pos.if { background: #dcefe4 !important; color: #164e3b !important; }
  #app .bl-pos.of { background: #e0f0df !important; color: #245d35 !important; }
  #app .bl-pos.sit { background: #fef3c7 !important; color: #78350f !important; }
  #app .eyebrow, #app .hint, #app .sub, #app .muted { color: #334155 !important; }
  #app table.lineup td, #app table.lineup td.name, #app table.lineup td.idx { color: #10213b !important; }
  #app table.lineup { background: #fff !important; }
  #app table.lineup td.name, #app table.lineup tbody tr:nth-child(even) td.name { background: #f8fafc !important; }
  #app table.lineup thead th { background: #11203b !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #app td.cell.if, #app td.cell.neu { background: #dbe9ff !important; color: #10213b !important; }
  #app td.cell.of  { background: #d9f2d9 !important; color: #10213b !important; }
  #app td.cell.sit { background: #e0e0e0 !important; color: #10213b !important; }
  #app td.cell.if, #app td.cell.of, #app td.cell.neu, #app td.cell.sit { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
