/* Light theme is the default; dark is opt-in via the moon button. */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #13213a;
  --muted: #5d6b80;
  --border: #e0e6ef;
  --accent: #2458d3;
  --accent-ink: #ffffff;
  --accent-soft: #e7eefc;
  --red: #e0474c;
  --red-soft: #fdeaea;
  --warn: #a96400;
  --warn-soft: #fff2db;
  --ok: #1f8a4c;
  --ok-soft: #e3f5ea;
  --grass: #8fcf8c;
  --grass-2: #a8dba3;
  --dirt: #ecc898;
  --chalk: #ffffff;
  --slot: #ffffff;
  --slot-ink: #13213a;
  --shadow: 0 1px 2px rgba(19,33,58,.05), 0 6px 18px rgba(19,33,58,.06);
  --radius: 14px;
  --texture-dot: rgba(36, 88, 211, .09);
  --texture-line: rgba(19, 33, 58, .018);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1522; --surface: #172033; --surface-2: #1f2a40; --text: #e7edf7; --muted: #9aa8bf;
  --border: #2a3650; --accent: #6b9bff; --accent-ink: #0b1430; --accent-soft: #1d2d52;
  --red: #ff7a7f; --red-soft: #3a1d24; --warn: #f2a94a; --warn-soft: #3a2a14; --ok: #5fd395; --ok-soft: #173826;
  --grass: #2f6b45; --grass-2: #377a50; --dirt: #8c6a45; --slot: #172033; --slot-ink: #e7edf7;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --texture-dot: rgba(255, 255, 255, .05);
  --texture-line: rgba(255, 255, 255, .012);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* faint texture: fine dot grid + soft diagonal weave */
  background-color: var(--bg);
  background-image:
    radial-gradient(var(--texture-dot) 1px, transparent 1.3px),
    repeating-linear-gradient(45deg, var(--texture-line) 0 1px, transparent 1px 14px);
  background-size: 20px 20px, auto;
  background-attachment: fixed;
}
a { color: var(--accent); }
h1 { font-size: 1.7rem; margin: .2rem 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0; }
h3 { font-size: .95rem; margin: 14px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.wrap { flex-wrap: wrap; }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 10px 20px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; text-decoration: none; color: inherit; }
.brand-title { font-weight: 800; letter-spacing: -.01em; }
.brand-sub { font-size: .78rem; color: var(--muted); }
.ball { width: 30px; height: 30px; flex: none; }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav a.link { color: var(--muted); text-decoration: none; font-weight: 600; padding: 6px 10px; border-radius: 8px; }
.nav a.link:hover, .nav a.link.active { color: var(--text); background: var(--surface-2); }
.icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 1rem; }
select, input[type=text], input[type=search], input[type=number] {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 6px 10px;
}
input[type=number] { width: 70px; padding: 5px 8px; }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

main { max-width: 1320px; margin: 0 auto; padding: 20px; }

/* Segmented + buttons */
.tabs, .seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.tabs button, .seg button { font: inherit; border: 0; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.tabs button.active, .seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg { margin-bottom: 10px; }
.season-seg { margin: 0; }
.season-seg button { padding: 5px 12px; font-size: .88rem; }
.small-seg button { padding: 5px 10px; font-size: .85rem; }
.btn { font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; border-radius: 9px; padding: 7px 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.lg { padding: 11px 20px; font-size: 1rem; border-radius: 11px; }
.btn.xs { padding: 2px 8px; font-size: .75rem; border-radius: 6px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; cursor: pointer; }

/* Home */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; padding: 28px 0 18px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.eyebrow { display: inline-block; font-weight: 700; font-size: .8rem; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; }
.hero h1 { font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.1; margin: 12px 0; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 1.1rem; color: var(--muted); max-width: 560px; }
.hero-art { background: #7ab676; border: 1px solid var(--border); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); max-width: 560px; width: 100%; justify-self: center; }
.hero-art svg { width: 100%; height: auto; display: block; }
.strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 10px 0 28px; }
@media (max-width: 700px) { .strip { grid-template-columns: repeat(2, 1fr); } }
.strip div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.strip b { display: block; font-size: 1.5rem; letter-spacing: -.02em; }
.strip span { color: var(--muted); font-size: .85rem; }
.section-title { font-size: 1.35rem; margin: 30px 0 12px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.feature .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 1.15rem; margin-bottom: 10px; }
.feature h3 { margin: 0 0 4px; font-size: 1.02rem; }
.feature p { margin: 0; color: var(--muted); font-size: .92rem; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; counter-reset: s; }
.step { position: relative; padding: 16px 16px 16px 58px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.step::before { counter-increment: s; content: counter(s); position: absolute; left: 16px; top: 16px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }
.step b { display: block; }
.step span { color: var(--muted); font-size: .9rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.cta { margin: 34px 0 10px; padding: 26px; border-radius: 20px; background: var(--accent); color: var(--accent-ink); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.cta h2 { font-size: 1.3rem; }
.cta .btn { background: var(--accent-ink); color: var(--accent); border-color: transparent; }
:root[data-theme="dark"] .cta .btn { background: var(--text); color: var(--bg); }

/* Team picker */
.picker-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.picker-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.picker-tools .seg { margin: 0; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.team-card {
  text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.team-card:hover, .team-card:focus-visible { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); outline: none; }
/* Team logos */
.logo { width: 58px; height: 46px; border-radius: 10px; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; padding: 4px; flex: none; overflow: hidden; }
.logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.logo.lg, .mono.lg { width: 76px; height: 60px; border-radius: 12px; }
.logo-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.logo-row a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); font-size: .8rem; font-weight: 600; text-align: center; transition: border-color .12s, transform .12s; }
.logo-row a:hover { border-color: var(--accent); transform: translateY(-1px); }
.logo-row .logo { border: 0; width: 72px; height: 54px; }
/* Collapsible add-player form */
.add-wrap > summary { list-style: none; width: fit-content; }
.add-wrap > summary::-webkit-details-marker { display: none; }
.add-wrap[open] > summary { display: none; }
#removedWrap { margin-top: 10px; }
.add-wrap[open] .removed-panel { padding: 12px; background: var(--surface-2); border-radius: 12px; }
.add-wrap[open] .add-form { margin-top: 2px; padding: 12px; background: var(--surface-2); border-radius: 12px; }
.mono { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: .85rem; letter-spacing: .03em; color: #fff; }
.team-card .name { font-weight: 700; font-size: 1.05rem; }
.team-card .meta { color: var(--muted); font-size: .82rem; }
.team-card .rec { text-align: right; }
.team-card .rec b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.team-card .rec span { display: block; color: var(--muted); font-size: .75rem; }
.winbar { grid-column: 1 / -1; height: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.winbar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.rank { font-size: .72rem; font-weight: 800; color: var(--muted); margin-right: 6px; }
.empty { padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }

/* Team view */
.team-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; }
.team-title { display: flex; align-items: center; gap: 14px; }
.team-title .mono { width: 54px; height: 54px; font-size: 1rem; }
.banner { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: .9rem; }
.banner b { color: var(--warn); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.stats { border-collapse: collapse; width: 100%; font-size: .86rem; font-variant-numeric: tabular-nums; }
.stats th, .stats td { padding: 8px 9px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.stats th { position: sticky; top: 0; background: var(--surface-2); cursor: pointer; user-select: none; font-size: .76rem; color: var(--muted); font-weight: 700; }
.stats th.sorted { color: var(--accent); }
.stats th.sorted::after { content: " ▾"; }
.stats th.sorted.asc::after { content: " ▴"; }
.stats .l { text-align: left; }
.stats tbody tr:hover { background: var(--accent-soft); }
.stats td.player { cursor: pointer; font-weight: 600; }
.stats td.player:hover { color: var(--accent); }
.stats tfoot td { font-weight: 700; background: var(--surface-2); }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); margin-left: 4px; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.pos { background: var(--accent-soft); color: var(--accent); }
.tag.new { background: var(--ok-soft); color: var(--ok); }

/* Roster editor (2027) */
.roster-edit { margin-bottom: 14px; }
.add-form { display: grid; grid-template-columns: 1fr 1fr 80px 90px 80px 80px; gap: 8px; align-items: end; }
.add-form label { display: flex; flex-direction: column; font-size: .75rem; color: var(--muted); font-weight: 600; gap: 3px; }
.add-form input, .add-form select { width: 100%; }
.pos-pick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pos-pick label { flex-direction: row; align-items: center; gap: 4px; background: var(--surface-2); padding: 4px 8px; border-radius: 7px; color: var(--text); cursor: pointer; }
.add-actions { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }
@media (max-width: 760px) { .add-form { grid-template-columns: 1fr 1fr; } }
.removed-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.removed-list span { background: var(--surface-2); border-radius: 8px; padding: 3px 4px 3px 9px; font-size: .82rem; display: inline-flex; align-items: center; gap: 6px; }

/* Planner */
.planner { display: grid; grid-template-columns: 270px minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
@media (max-width: 1150px) { .planner { grid-template-columns: 1fr 1fr; } .field-card { grid-column: 1 / -1; order: -1; } }
@media (max-width: 720px) { .planner { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head input[type=search] { width: 120px; }

.bench-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; max-height: 640px; overflow: auto; }
.chip { display: grid; grid-template-columns: 34px 1fr auto; gap: 6px; align-items: center; padding: 7px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: grab; user-select: none; }
.chip:hover { border-color: var(--accent); }
.chip.selected { outline: 2px solid var(--accent); background: var(--accent-soft); }
.chip.used { opacity: .5; }
.chip .num { font-weight: 800; text-align: center; color: var(--accent); }
.chip .nm { font-weight: 600; line-height: 1.15; }
.chip .sub { font-size: .74rem; color: var(--muted); }
.chip .where { font-size: .72rem; font-weight: 700; color: var(--accent); }

.field { position: relative; width: 100%; max-width: 640px; margin: 0 auto; aspect-ratio: 600 / 560; }
.field-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.grass { fill: var(--grass); }
.infield-grass { fill: var(--grass-2); }
.dirt { fill: var(--dirt); }
.line { stroke: var(--chalk); stroke-width: 3; fill: none; }
.mound { fill: var(--dirt); stroke: rgba(0,0,0,.08); }
.base { fill: var(--chalk); stroke: rgba(0,0,0,.08); }
.slot { position: absolute; translate: -50% -50%; width: 22%; max-width: 138px; min-height: 46px; background: var(--slot); color: var(--slot-ink); border-radius: 11px; border: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent); padding: 4px 6px; text-align: center; font-size: .78rem; line-height: 1.15; cursor: pointer; box-shadow: 0 3px 10px rgba(19,33,58,.14); }
.slot.filled { border-style: solid; border-color: var(--accent); }
.slot.over { outline: 3px solid #ffc94a; }
.slot.target { border-color: #f5a623; border-style: solid; }
.slot .pos { font-weight: 800; font-size: .7rem; color: var(--accent); letter-spacing: .04em; }
.slot .who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .bo { position: absolute; top: -9px; right: -9px; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 800; font-size: .75rem; display: grid; place-items: center; }
.slot .exp { font-size: .66rem; color: var(--muted); }
.slot .x { position: absolute; top: -9px; left: -9px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--red); color: #fff; font-size: .75rem; cursor: pointer; display: none; line-height: 20px; padding: 0; }
.slot.filled:hover .x { display: block; }
@media (max-width: 520px) { .slot { font-size: .68rem; min-height: 38px; padding: 3px 4px; } .slot .exp { display: none; } }
.pitcher-info { margin-top: 8px; text-align: center; min-height: 1.2em; }
.dh-seg { margin: 0; }
.dh-seg button.active { background: var(--accent); color: var(--accent-ink); }

.algo { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.order-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.order-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: start; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: grab; }
.order-item.over { border-color: var(--accent); background: var(--accent-soft); }
.order-item .n { font-weight: 800; font-size: 1.1rem; color: var(--red); text-align: center; }
.order-item .nm { font-weight: 700; }
.order-item .why { font-size: .76rem; color: var(--muted); }
.order-item .role { font-size: .72rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .03em; }
.order-item .mv { display: flex; flex-direction: column; gap: 2px; }
.order-item .mv button { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 5px; font-size: .7rem; padding: 0 6px; cursor: pointer; }
.order-empty { border: 1px dashed var(--border); border-radius: 10px; padding: 8px; color: var(--muted); font-size: .85rem; }
.saved-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 4px; }
.saved-list li { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: .85rem; padding: 5px 8px; background: var(--surface-2); border-radius: 8px; }

.how { margin-top: 14px; }
.how summary { font-weight: 700; cursor: pointer; }
.how table { border-collapse: collapse; font-size: .86rem; margin: 8px 0; }
.how td, .how th { border-bottom: 1px solid var(--border); padding: 5px 10px 5px 0; text-align: left; vertical-align: top; }

dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); width: min(640px, calc(100vw - 32px)); padding: 20px; }
dialog::backdrop { background: rgba(19,33,58,.35); }
dialog .close { position: absolute; top: 8px; right: 12px; border: 0; background: none; color: var(--muted); font-size: 1.6rem; cursor: pointer; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 10px 0; }
.kv div { background: var(--surface-2); border-radius: 9px; padding: 6px 8px; }
.kv b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.kv span { font-size: .72rem; color: var(--muted); }
.bars { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 12px; }
.bar { display: grid; grid-template-columns: 40px 1fr 32px; gap: 6px; align-items: center; font-size: .8rem; }
.bar i { display: block; height: 10px; background: var(--accent); border-radius: 4px; }

.foot { max-width: 1320px; margin: 0 auto; padding: 8px 20px 28px; }
#printCard { display: none; }
@media print {
  body { background: #fff !important; }
  body > *:not(#printCard) { display: none !important; }
  #printCard { display: block !important; color: #000; font-size: 11pt; }
  #printCard h1 { font-size: 16pt; } #printCard h2 { font-size: 13pt; margin: 14px 0 6px; }
  #printCard table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
  #printCard td, #printCard th { border: 1px solid #000; padding: 4px 6px; text-align: left; font-size: 9.5pt; }
  #printCard .pnote { font-size: 8pt; color: #555; }
  #printCard .print-logo { height: 22px; width: auto; display: block; margin-bottom: 10px; }
}

/* ---- New features ---- */
.nowrap { white-space: nowrap; }
.ok-txt { color: var(--ok); } .warn-txt { color: var(--warn); }
.tag.goal { background: var(--warn-soft); color: var(--warn); }
/* export menu */
.menu { position: relative; }
.menu > summary { list-style: none; } .menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 210px; display: flex; flex-direction: column; }
.menu-pop button { font: inherit; text-align: left; background: none; border: 0; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.menu-pop button:hover { background: var(--accent-soft); color: var(--accent); }
/* second planner row */
.planner-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 900px) { .planner-2 { grid-template-columns: 1fr; } }
/* defense rating */
.def-panel { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.def-head { display: flex; justify-content: space-between; align-items: baseline; }
.def-score { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.def-score small { font-size: .8rem; color: var(--muted); font-weight: 600; }
.def-score.good { color: var(--ok); } .def-score.ok { color: var(--warn); } .def-score.bad { color: var(--red); }
.def-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 6px 0; }
.def-bar i { display: block; height: 100%; border-radius: 99px; }
.def-bar i.good { background: var(--ok); } .def-bar i.ok { background: var(--warn); } .def-bar i.bad { background: var(--red); }
.sug-list { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 5px; }
.sug-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .85rem; background: var(--surface-2); border-radius: 8px; padding: 6px 8px; }
.gain { color: var(--ok); }
/* pitching plan */
.pp-row { display: grid; grid-template-columns: 90px 1fr auto 90px 28px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.pp-row input[type=number] { width: 56px; }
.pp-row select { max-width: 100%; }
.pp-role { font-weight: 700; font-size: .82rem; color: var(--accent); }
@media (max-width: 600px) { .pp-row { grid-template-columns: 1fr 1fr; } }
/* simulator */
.sim-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.sim-table th, .sim-table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.sim-table td.num { font-weight: 800; font-size: 1.05rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sim-table tr.best td { background: var(--ok-soft); }
/* goals */
.goal-list { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.goal-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; background: var(--surface-2); border-radius: 9px; padding: 7px 9px; }
.goal-list li.done span { text-decoration: line-through; color: var(--muted); }
.goal-list .goal-prog { grid-column: 1 / -1; height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.goal-list .goal-prog i { display: block; height: 100%; background: var(--ok); }
.goal-list .goal-prog + span { grid-column: 1 / -1; }
.goal-form { display: grid; grid-template-columns: 1fr 120px 80px auto; gap: 6px; }
@media (max-width: 560px) { .goal-form { grid-template-columns: 1fr 1fr; } }
/* scouting */
.scout-head { margin-bottom: 12px; }
.scout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 900px) { .scout-grid { grid-template-columns: 1fr; } }
table.mini { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
table.mini th, table.mini td { padding: 6px 6px; border-bottom: 1px solid var(--border); text-align: left; }
table.mini th { font-size: .74rem; color: var(--muted); }
table.mini td.n { font-weight: 800; color: var(--red); width: 26px; }
table.mini td.r { text-align: right; }
.form-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip { font-size: .8rem; font-weight: 700; padding: 4px 8px; border-radius: 8px; background: var(--surface-2); }
.fchip.w { background: var(--ok-soft); color: var(--ok); } .fchip.l { background: var(--red-soft); color: var(--red); }
.fchip small { font-weight: 500; color: var(--muted); }
.h2h { list-style: none; padding: 0; margin: 0; font-size: .88rem; display: flex; flex-direction: column; gap: 3px; }

/* ---- Motion effects (GSAP / Lenis / React Bits-style) ---- */
/* React Bits "SpotlightCard": soft light that follows the pointer (position set by fx.js) */
.feature, .team-card, .logo-row a, .logo-tile, .scout-grid .card, .sug-list li {
  background-image: radial-gradient(260px circle at var(--mx, -999px) var(--my, -999px), var(--spot, rgba(36, 88, 211, .09)), transparent 70%);
}
:root[data-theme="dark"] { --spot: rgba(107, 155, 255, .12); }
/* React Bits "ShinyText": a light sheen sweeping across the hero badge */
.eyebrow {
  background-image: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .85) 50%, transparent 65%);
  background-color: var(--accent-soft); background-size: 250% 100%; background-repeat: no-repeat;
  animation: shine 3.8s linear infinite;
}
:root[data-theme="dark"] .eyebrow { background-image: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .18) 50%, transparent 65%); }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -150% 0; } }
/* React Bits "ClickSpark" */
.spark-layer { position: fixed; width: 0; height: 0; pointer-events: none; z-index: 1000; }
.spark-layer i { position: absolute; left: -1px; top: -16px; width: 2px; height: 9px; border-radius: 2px; background: var(--accent); transform-origin: 50% 16px; }
/* SplitText masks keep descenders visible */
.hero h1 .word-mask, .hero h1 [class*="mask"] { padding-bottom: .08em; margin-bottom: -.08em; }
.btn { will-change: transform; }
@media (prefers-reduced-motion: reduce) { .eyebrow { animation: none; } }

/* ---- Accounts (login / sign-up / account) ---- */
.btn.sm { padding: 6px 12px; font-size: .85rem; }
.btn.block { width: 100%; justify-content: center; }
.btn.busy { opacity: .7; pointer-events: none; }
.btn.busy::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.link-btn { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }
.auth-wrap { display: grid; grid-template-columns: 1fr minmax(320px, 440px); gap: 28px; align-items: center; max-width: 960px; margin: 24px auto; }
@media (max-width: 820px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { order: 2; } }
.auth-side { padding: 28px; border-radius: 22px; background: linear-gradient(150deg, var(--accent), #1a3f9e); color: #fff; box-shadow: var(--shadow); }
.auth-side h2 { font-size: 1.6rem; margin: 10px 0 14px; line-height: 1.15; }
.auth-side ul { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 10px; }
.auth-side li::before { content: "✓"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.18); margin-right: 10px; font-size: .8rem; }
.auth-side .muted { color: rgba(255,255,255,.75); }
.auth-brand { font-weight: 800; letter-spacing: .02em; opacity: .9; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { margin: 0; font-size: 1.6rem; }
.auth-card > p.muted { margin: -6px 0 4px; }
.fld { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.fld input, .fld select { font-size: 1rem; padding: 10px 12px; border-radius: 10px; width: 100%; font-weight: 400; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .two { grid-template-columns: 1fr; } }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; font-size: 1rem; padding: 6px; }
.pw-meter { display: block; height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 2px; }
.pw-meter i { display: block; height: 100%; width: 0; transition: width .25s, background .25s; background: var(--red); }
.pw-meter i.ok { background: var(--warn); } .pw-meter i.strong { background: var(--ok); }
.pw-hint { font-weight: 400; }
.form-err { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 9px 12px; font-size: .88rem; font-weight: 600; }
.auth-alt { text-align: center; margin: 2px 0 0; font-size: .9rem; color: var(--muted); }
.auth-alt a { font-weight: 700; }
.auth-done { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.auth-done .big { font-size: 2.6rem; }
/* account page */
.account { max-width: 1000px; margin: 10px auto; }
.acct-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.acct-head h1 { margin: 0; }
.acct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .acct-grid { grid-template-columns: 1fr; } }
.acct-grid .card { display: flex; flex-direction: column; gap: 10px; }
.acct-grid .card > .btn, .acct-grid form > .btn { align-self: flex-start; }
.danger-zone { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.danger-zone h2 { color: var(--red); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .8rem; }
.avatar.lg { width: 58px; height: 58px; font-size: 1.2rem; }
.acct-nav { display: flex; align-items: center; }
.acct-menu > summary { list-style: none; cursor: pointer; } .acct-menu > summary::-webkit-details-marker { display: none; }
.avatar-btn { position: relative; display: inline-flex; }
.acct-menu .menu-pop a, .acct-menu .menu-pop button { font: inherit; text-align: left; background: none; border: 0; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; text-decoration: none; }
.acct-menu .menu-pop a:hover, .acct-menu .menu-pop button:hover { background: var(--accent-soft); color: var(--accent); }
.menu-who { display: flex; flex-direction: column; padding: 6px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--muted); border: 2px solid var(--surface); }
.avatar-btn .sync-dot { position: absolute; right: -2px; bottom: -2px; }
.sync-dot.synced { background: var(--ok); } .sync-dot.saving { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
.sync-dot.error, .sync-dot.offline { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }
.cloud-note { background: var(--accent-soft); color: var(--text); border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; font-size: .9rem; }
.cloud-note a { font-weight: 700; }
/* toasts */
#toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow); animation: toastIn .3s ease-out; transition: opacity .4s, transform .4s; }
.toast.err { background: var(--red); color: #fff; }
.toast.out { opacity: 0; transform: translateY(10px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ---- Signed-out visitors: informative home only ---- */
body.signed-out .nav [data-nav="teams"], body.signed-out #seasonSeg { display: none; }
.acct-nav { gap: 6px; }
.logo-row .logo-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: .8rem; font-weight: 600; text-align: center; }
.logo-row .logo-tile .logo { border: 0; width: 72px; height: 54px; }
/* ---- Privacy policy ---- */
.legal { max-width: 760px; margin: 10px auto 30px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px 36px; box-shadow: var(--shadow); line-height: 1.65; }
.legal h1 { font-size: 2rem; margin-bottom: 4px; }
.legal h2 { font-size: 1.15rem; margin: 26px 0 8px; }
.legal h3 { font-size: 1rem; margin: 16px 0 6px; }
.legal ul { padding-left: 20px; } .legal li { margin: 4px 0; }
@media (max-width: 600px) { .legal { padding: 22px 18px; } }

/* ---- Dugout logo ---- */
.on-dark { display: none !important; }
:root[data-theme="dark"] .on-light { display: none !important; }
:root[data-theme="dark"] .on-dark { display: inline-block !important; }
.brand-title { line-height: 0; }
.brand-word { height: 20px; width: auto; display: inline-block; }
.brand-sub { margin-top: 3px; }
.hero-word { display: block; height: clamp(34px, 5vw, 52px); width: auto; margin-bottom: 18px; }
:root[data-theme="dark"] .hero-word.on-dark { display: block !important; }
.foot-mark { height: 18px; width: auto; vertical-align: -4px; margin-right: 6px; opacity: .85; }
.auth-brand img { height: 26px; width: auto; display: block; }
@media (max-width: 520px) { .brand-word { height: 16px; } }
