/* 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: #d7dce7;   /* 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: #6ea0ff; font-size: 17px; filter: drop-shadow(0 1px 4px rgba(110,160,255,.6)); }
.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: 0 0 0 3px rgba(21,163,74,.25); }

/* 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); }
.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(110,160,255,.55)); }

/* ---------- 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; }

.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, #f5702f, var(--clay)); color: #fff;
  box-shadow: 0 2px 0 var(--clay-press), 0 6px 16px rgba(239,99,34,.32); }
.btn-cta:hover:not(:disabled) { filter: brightness(1.04); }
.btn-ghost { background: var(--accent-soft); color: var(--accent-ink); }
.btn-ghost:hover:not(:disabled) { background: #dde9ff; }
.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: #cfe0ff; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: #c4ebcf; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #f0e0a8; }
.badge.if { background: var(--if); color: var(--if-ink); border-color: #bcd3fb; }
.badge.of { background: var(--of); color: var(--of-ink); border-color: #b6e2b9; }

/* 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; }

/* 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%, #d9e6ff 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(21,163,74,.06), transparent); border-radius: 14% 14% 0 0;
  border-top: 2px solid rgba(14,31,58,.06); 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%, 264px); margin: 0 auto 12px; }
.auth-brand-logo, .onboarding-brand-logo { display: block; width: 100%; height: auto; border-radius: 16px; background: #111714;
  box-shadow: 0 12px 28px rgba(14,31,58,.18); }
.auth .logo { display: none; }
.onboarding-shell { max-width: 640px; margin: 0 auto; }
.onboarding-brand { width: min(100%, 178px); margin: 0 auto 12px; }
.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: #c2d6ff; background: #fbfdff; 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: #f3e8ff; color: #7c3aed; }
.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: #eef3fc; } }
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(37,99,235,.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: #b91c1c; }
.linkbtn.danger:hover { background: #fee2e2; }

/* 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: #1f2a37;
  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: #1f2a37; padding: 0; cursor: text;
  -moz-appearance: textfield; }
td.sk input.skin:focus { outline: 2px solid var(--accent); outline-offset: -2px; box-shadow: none; background: #fff; }
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, #fff4ec, #fef0ec); border: 1px solid #f7d4c1; 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, #fff, var(--accent-soft)); }
.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; }

/* ---------- 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; }
  .btn { min-height: 46px; }                         /* generous tap targets */
  .pl { min-height: 54px; }
}
@media (max-width: 400px) {
  .row.c3 { grid-template-columns: 1fr; }            /* swap selects stack on tiny screens */
  .auth { padding: 16px; }
  .auth-brand { width: min(100%, 224px); margin-bottom: 10px; }
  .onboarding-brand { width: min(100%, 152px); margin-bottom: 10px; }
}
/* 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 */
}

/* Print: dugout-ready card */
@media print {
  .topbar, .rail, .tabbar, .paywall, .btn, .card-h .legend { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
  table.lineup thead th { background: #11203b !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  td.cell.if, td.cell.of, td.cell.neu, td.cell.sit { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
