/* CardCollection — built by XmarkBuilds, started 2026-09-09 */
:root {
  --page-gutter: clamp(10px, 1.2vw, 24px);
  --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb; --bg: #f6f7f9; --card: #ffffff;
  --brand: #1e3a8a; --brand-2: #2563eb; --accent: #f59e0b; --accent-ink: #78350f; --danger: #b91c1c;
  --radius: 12px; --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --header-start: var(--brand); --header-end: var(--brand-2); --header-ink: #fff; --header-muted: rgba(255,255,255,.75);
  --button-ink: #fff; --footer-bg: transparent; --footer-ink: #4b5563; --body-bg-image: none;
  --soft: #e5e7eb; --soft-hover: #d1d5db; --input-bg: #fff; --input-line: #cbd5e1; --panel-tint: #f9fafb;
}
* { box-sizing: border-box; }
img { max-width: 100%; }
html, body { margin: 0; }
html { overflow-x: hidden; } /* the page scrolls down only; nothing is meant to be wider than the screen */
body { font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background-color: var(--bg); background-image: var(--body-bg-image); background-attachment: fixed; }
body[data-site-theme] { --input-line: var(--line); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
main p a:not(.btn), main figcaption a, .site-footer a { text-decoration: underline; text-underline-offset: .12em; }
h1 { font-size: 30px; margin: 0 0 8px; line-height: 1.2; }
h2 { font-size: 22px; margin: 22px 0 8px; }
h3 { font-size: 16px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
code { background: #eef; padding: 1px 5px; border-radius: 4px; }
/* The page follows the window: a little margin on a wide screen, not a fixed column. */
.wrap { width: 100%; max-width: none; margin: 0 auto; padding-right: var(--page-gutter); padding-left: var(--page-gutter); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.empty { color: var(--muted); padding: 16px; text-align: center; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.inline { display: inline; }
.linklike { background: none; border: 0; padding: 0; color: var(--brand-2); font: inherit; cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.pill { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; text-align: center; vertical-align: middle; }

/* header / footer */
.site-header { background: linear-gradient(120deg, var(--header-start), var(--header-end)); color: var(--header-ink); }
.header-row { display: flex; align-items: center; gap: 16px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--header-ink); font-weight: 800; font-size: 20px; letter-spacing: .01em; }
.brand-logo { width: 32px; height: 32px; border-radius: 7px; object-fit: cover; }
.brand:hover { text-decoration: none; }
.site-nav { flex: 1; color: var(--header-muted); font-size: 14px; }
.site-nav a { color: var(--header-ink); }
.owner-nav { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 14px; }
.owner-nav a, .owner-nav .linklike { color: var(--header-ink); }
.owner-nav .muted { color: var(--header-muted); }
.sport-years-nav { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--card) 94%, var(--bg)); box-shadow: 0 2px 8px rgba(15,23,42,.05); }
.sport-years-row { display: flex; min-height: 40px; align-items: center; gap: 5px; overflow-x: auto; white-space: nowrap; }
.sport-years-row > span { margin-right: 5px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.sport-years-row a { display: inline-flex; min-height: 32px; padding: 5px 10px; align-items: center; border-radius: 7px; color: var(--ink); font-size: 13px; font-weight: 750; }
.sport-years-row a:hover { background: color-mix(in srgb, var(--accent) 10%, var(--card)); text-decoration: none; }
.sport-years-row a[aria-current=page] { background: var(--brand-2); color: var(--button-ink); }
.site-footer { margin-top: 28px; padding: 18px 0; color: var(--footer-ink); background: var(--footer-bg); font-size: 13px; border-top: 1px solid var(--line); }
.site-footer p { margin: 0; }
.site-footer .credit { margin-top: 6px; font-size: 12px; }
.site-footer .legal { margin-top: 8px; }
.page { max-width: 760px; }
.page h2 { font-size: 18px; margin-top: 24px; }

/* messages */
.messages { list-style: none; padding: 0; margin: 16px 0 0; }
.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.msg-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.msg-warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.msg-warn a { color: inherit; }
.msg-warn p { margin: 0 0 6px; }
.offer-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.form-field .offer-controls select { width: auto; max-width: 100%; }
.roster-open { margin-top: 6px; font-size: 14px; text-align: left; }
.roster-open[disabled] { color: var(--muted); cursor: default; text-decoration: none; }
.roster-panel { margin-top: 8px; }
.roster-panel .form-row { margin: 0; }
.roster-panel label { display: block; margin-top: 8px; }
.msg ul { margin: 0; padding-left: 18px; }

/* buttons */
[hidden] { display: none !important; } /* the attribute wins over any display rule below (scripts toggle it) */
.btn { display: inline-block; background: var(--brand-2); color: var(--button-ink); border: 0; border-radius: 8px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--brand); text-decoration: none; }
.btn-small { padding: 6px 12px; font-size: 14px; }
.btn-secondary { background: var(--soft); color: var(--ink); }
.btn-secondary:hover { background: var(--soft-hover); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #7f1d1d; }

/* landing & pickers */
.hero { padding: 24px 0 8px; }
.hero p { color: var(--muted); max-width: 640px; }
.grid { display: grid; gap: 10px; }
.grid-sports { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-top: 12px; }
.grid-teams { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tile { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; box-shadow: var(--shadow); color: var(--ink); transition: transform .15s, box-shadow .15s; }
.tile:hover { transform: translateY(-2px); text-decoration: none; box-shadow: 0 12px 28px rgba(15,23,42,.12); }
.tile.has-cards { border-width: 3px; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 28%, var(--card)); }
.tile-sport { align-items: center; text-align: center; padding: 28px 16px; }
.tile-icon { font-size: 44px; }
.tile-title { font-weight: 700; }
.tile-sub { color: var(--muted); font-size: 13px; }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.year-nav { display: flex; gap: 12px; font-weight: 600; white-space: nowrap; padding-top: 6px; }
.decade { margin-top: 12px; }
.years { display: flex; flex-wrap: wrap; gap: 8px; }
.year { position: relative; display: inline-block; min-width: 68px; text-align: center; padding: 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-weight: 600; }
.year:hover { border-color: var(--brand-2); text-decoration: none; }
.year.has-cards { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--card)); color: var(--ink); }
.year .pill { position: absolute; top: -8px; right: -6px; }
.league { margin-top: 8px; }
.division { margin-bottom: 8px; }

/* team page */
.field-wrap { margin-top: 14px; }
/* The field scales with the page (100% up to max-width); everything on it is sized in cqw
   (1% of the field's width) so cards and badges scale with it. */
/* Card size comes from the owner's setting (cards-s/m/l on the field element) as a share of the
   field's width; the px floor and ceiling keep it sane, and the phone rules below lower the floor
   so slots keep shrinking with the field instead of colliding. */
.field { --card-min: 30px; --card-w: 7.5cqw; --card-max: 210px; --name-w: 9cqw; --card-landscape: 1.3; /* a sideways card is this much wider than a portrait one */ }
.field.cards-t { --card-w: 5cqw; --card-max: 150px; --name-w: 6.5cqw; }
.field.cards-s { --card-w: 6.5cqw; --card-max: 180px; --name-w: 8cqw; }
.field.cards-l { --card-w: 9cqw; --card-max: 250px; --name-w: 10.5cqw; }
/* The field keeps its shape (stretching the drawing would distort the diamond) and sits centred in a
   stands-coloured band that fills the page width. With fit-window it grows until the whole field
   fits the window height; with fit-width it takes the whole column and the page scrolls. */
.team-layout { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 28px; align-items: start; }
.field-band { display: flex; justify-content: center; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #3b4756 radial-gradient(ellipse at 50% 110%, #4a5768 0%, #3b4756 55%, #2f3946 100%); }
.field-band.fit-window .field { max-width: min(100%, calc((100vh - 200px) * var(--field-aspect, 1.24))); }
.field { position: relative; width: 100%; margin: 0 auto; overflow: hidden; background: #2f6b2f; container-type: inline-size; }
@media (min-width: 1500px) {
  .team-layout { grid-template-columns: minmax(0, 1fr) minmax(340px, 520px); }
  .team-layout .roster { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; margin-top: 20px; }
  .team-layout .roster h2 { margin-top: 0; }
}
.field svg { display: block; width: 100%; height: 100%; }
.slot { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; }
.slot:hover, .slot:focus-within { z-index: 2; }
.slot-main { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 66px; min-width: clamp(44px, 7cqw, 150px); padding: 4px 8px 5px; background: rgba(15, 23, 42, .88); color: #fff; border: 2px solid rgba(255,255,255,.25); border-radius: 10px; font: 600 12px/1.15 system-ui, sans-serif; font-size: clamp(9px, 1.45cqw, 22px); cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.slot-main:hover, .slot-main:focus-visible { border-color: #fff; outline: none; }
.slot.has-cards .slot-main { background: rgba(180, 83, 9, .94); border-color: var(--accent); }
.slot-card .slot-main { min-width: 0; padding: 3px 3px 4px; background: rgba(15, 23, 42, .8); border-radius: 9px; }
/* the card: a share of the field's width set by the owner's card-size setting (cards-s/m/l on
   the field element), whole card visible (contain, never cropped) */
.slot-card .slot-main img { display: block; width: 74px; width: clamp(var(--card-min), var(--card-w), var(--card-max)); aspect-ratio: 2.5 / 3.5; object-fit: contain; border-radius: 5px; box-shadow: 0 4px 10px rgba(0,0,0,.45); background: #0f172a; }
.slot-card .slot-main img.is-landscape { width: calc(clamp(var(--card-min), var(--card-w), var(--card-max)) * var(--card-landscape)); aspect-ratio: 3.5 / 2.5; }
.slot-card .slot-main:hover img { transform: scale(1.04); transition: transform .15s; }
.slot-pos { font-size: .85em; opacity: .8; letter-spacing: .04em; }
.slot-name { white-space: nowrap; }
.slot-card .slot-name { padding-top: 2px; max-width: 80px; max-width: clamp(36px, var(--name-w), 260px); overflow: hidden; text-overflow: ellipsis; }
.slot-extras { display: flex; gap: 4px; }
.slot-more, .slot-cards { font: 700 10px/1.6 system-ui, sans-serif; font-size: clamp(8px, 1.2cqw, 18px); border-radius: 999px; padding: 0 7px; border: 0; background: rgba(15, 23, 42, .85); color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.slot-more { position: relative; cursor: pointer; }
.slot-more:hover, .slot-more:focus-visible { background: #fff; color: var(--ink); outline: none; }
.slot-cards { background: var(--accent); color: var(--accent-ink); }
.pill-outline { display: inline-block; padding: 2px 10px; border: 2px solid var(--accent); border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--accent-ink); background: #fffbeb; vertical-align: middle; }
.star { color: var(--accent); }
.copy { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; background: #e0e7ff; color: #3730a3; font-size: 11px; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.slot-list-thumb { display: inline-block; width: 28px; height: 39px; object-fit: contain; border-radius: 3px; vertical-align: middle; margin-right: 8px; background: #0f172a; }
.slot-list-empty { border: 1px dashed var(--line); background: transparent; }
.roster { margin-top: 8px; }
.roster-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.roster-table th, .roster-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.roster-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--panel-tint); }
.roster-row { cursor: pointer; }
.roster-row:hover, .roster-row:focus-visible { background: #f3f4f6; outline: none; }
.roster-row.has-cards td:first-child { border-left: 4px solid var(--accent); }

/* team look: TeamStyle colours arrive as custom properties on .team-page (and on season tiles);
   an unthemed page never sets them, so every rule below falls back to the site's own colours */
.title-main { display: flex; align-items: center; gap: 18px; min-width: 0; }
.team-logo { height: 72px; width: auto; max-width: 140px; object-fit: contain; flex: none; }
.team-page.themed .title-row { background: linear-gradient(100deg, var(--team-primary), var(--team-secondary)); color: var(--team-ink); border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow); }
.team-page.themed .title-row .muted { color: var(--team-ink); opacity: .88; }
.team-page.themed .title-row a { color: var(--team-ink); text-decoration: underline; }
/* the year links sit on the far end of the gradient, whose colour the ink was not chosen for: give them a
   pill in the primary colour so they read on any banner */
.team-page.themed .year-nav a { background: var(--team-primary); color: var(--team-ink); text-decoration: none; padding: 4px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.35); }
.team-page.themed .year-nav a:hover { text-decoration: underline; }
.team-page.themed .title-row .pill-outline { border-color: var(--team-ink); color: var(--team-ink); background: transparent; }
.team-page.themed .slot-main { background: var(--team-primary); color: var(--team-ink); border-color: var(--team-secondary); }
.team-page.themed .slot.has-cards .slot-main { background: var(--team-primary); border-color: var(--team-accent, var(--accent)); }
.team-page.themed .slot-card .slot-main { background: var(--team-primary); }
.team-page.themed .slot-cards { background: var(--team-accent, var(--accent)); }
.field-band { position: relative; }
.field-band .field { position: relative; z-index: 1; }
.field-band.themed::before, .field-band.themed::after { content: ""; position: absolute; z-index: 0; top: 10%; bottom: 10%; width: 22%; background: var(--team-logo) center / contain no-repeat; opacity: .22; pointer-events: none; }
.field-band.themed::before { left: 1.5%; }
.field-band.themed::after { right: 1.5%; }
.tile-team.themed { border-top: 6px solid var(--team-primary); }
.tile-team.has-cards { border-width: 4px; }
.tile-team.has-cards.themed { border-color: var(--team-accent, var(--accent)); border-top-width: 6px; border-top-color: var(--team-primary); background: color-mix(in srgb, var(--team-primary) 32%, var(--card)); }
.tile-logo { height: 30px; width: auto; max-width: 64px; object-fit: contain; align-self: flex-start; }

/* owner: team looks */
.swatch { display: inline-block; width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.15); vertical-align: middle; margin-right: 3px; }
.badge-preview { display: inline-block; padding: 3px 9px; border: 2px solid; border-radius: 8px; font: 600 12px/1.2 system-ui, sans-serif; vertical-align: middle; margin-left: 6px; }
.logo-thumb { height: 36px; width: auto; max-width: 72px; object-fit: contain; }
.looks-table .is-current td { background: #fffbeb; }
.row-actions { white-space: nowrap; }
.look-preview { display: flex; gap: 10px; align-items: center; padding: 12px; background: #2f6b2f; border-radius: 8px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 720px) { .form-row-3 { grid-template-columns: 1fr; } }

/* dialogs */
.dialog { border: 0; border-radius: var(--radius); padding: 0; max-width: min(92vw, 560px); width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.dialog-wide { max-width: min(94vw, 980px); }
.dialog::backdrop { background: rgba(15, 23, 42, .55); }
.dialog-body { padding: 24px 28px 28px; max-height: 85vh; overflow: auto; }
.dialog-body h2 { margin-top: 0; }
.dialog-close { position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 28px; line-height: 1; color: var(--muted); cursor: pointer; }
.dialog-close:hover { color: var(--ink); }
.slot-list { list-style: none; padding: 0; margin: 0; }
.slot-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }

/* cards & flip */
.cards-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; margin-top: 12px; }
.card-figure { margin: 0; position: relative; }
/* "Copy": the same card shown again under another player on it — the tag sits over both faces */
.copy-tag { position: absolute; top: 8px; left: 8px; z-index: 2; padding: 2px 9px; border-radius: 999px; background: rgba(30, 27, 75, .88); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; pointer-events: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.copy-note { color: var(--muted); }
.slot-main { position: relative; }
.slot-main .copy-tag { top: 3px; left: 3px; padding: 0 5px; font-size: 9px; }
.locked-checks label { color: var(--muted); }
/* the main player on a multi-player card: one radio per man, swap by picking */
.main-player { margin-top: 10px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.main-player-label { display: block; font-weight: 600; margin-bottom: 6px; }
.main-player-radios { display: flex; flex-wrap: wrap; gap: 8px; }
.main-player-radios label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 400; }
.main-player-radios label:has(input:checked) { border-color: var(--brand-2); background: #eef2ff; font-weight: 600; }
.card-figure figcaption { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); margin-top: 8px; }
.card-figure figcaption strong { color: var(--ink); }
.card-figure .notes { white-space: pre-line; }
.flip-card { display: block; width: 100%; aspect-ratio: 2.5 / 3.5; perspective: 1200px; background: none; border: 0; padding: 0; cursor: pointer; }
/* the box takes the shape of the face being shown: a sideways-printed front or back is sideways */
.flip-card.front-landscape:not(.flipped), .flip-card.back-landscape.flipped { aspect-ratio: 3.5 / 2.5; }
.flip-card:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 3px; border-radius: 10px; }
.flip-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform .6s; transform-style: preserve-3d; }
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 10px; overflow: hidden; background: #e5e7eb; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.flip-face img { width: 100%; height: 100%; object-fit: contain; display: block; }
.flip-back { transform: rotateY(180deg); background: #d1d5db; }
.no-back { color: var(--muted); font-size: 14px; }

/* owner: rosters */
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 16px 0; }
.stat { display: flex; flex-direction: column; min-width: 130px; padding: 12px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-value { font-size: 26px; font-weight: 800; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.update-log h2 { margin-top: 24px; }
.log { background: #0f172a; color: #e5e7eb; padding: 14px 16px; border-radius: 8px; font-size: 12px; max-height: 320px; overflow: auto; white-space: pre-wrap; }
.pill-danger { border-color: var(--danger); color: var(--danger); background: #fef2f2; }
.btn[disabled] { opacity: .6; cursor: default; }

/* owner: manage — browse panel beside the grid; tile size from the owner's setting */
.manage-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 8px; }
.browse { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.browse h3 { margin: 2px 0 8px; }
.browse-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; color: var(--ink); }
.browse-item:hover { background: #f3f4f6; text-decoration: none; }
.browse-item.is-active { background: #eef2ff; color: var(--brand); font-weight: 700; }
.browse-teams { margin: 2px 0 6px 10px; padding-left: 6px; border-left: 2px solid var(--line); }
.browse-team { font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 0 0 12px; }
.toolbar-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; min-width: 0; }
.toolbar input[type=search] { flex: 1; min-width: 160px; max-width: 420px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.size-switch { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.seg { border: 1px solid var(--line); background: #fff; padding: 5px 10px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 6px; }
.seg.is-active { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }
.chips { margin: 0 0 12px; color: var(--muted); }
.pagination { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; margin: 20px 0; }
/* A fixed column count per size: a tile is always the same share of the width, so it scales continuously
   as the window resizes instead of shrinking then jumping when an auto-fill column drops out.
   Tiny 8 · Small 6 · Medium 4 · Large 3; on a phone 4 · 3 · 2 · 1. The base (medium) rule must come
   BEFORE the phone block — it once sat below it and won, so medium was the smallest size on phones. */
.manage-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.manage-grid.size-t { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.manage-grid.size-s { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.manage-grid.size-l { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 600px) {
  .manage-grid, .manage-grid.size-m { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manage-grid.size-t { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .manage-grid.size-s { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .manage-grid.size-l { grid-template-columns: repeat(1, minmax(0, 1fr)); }
}
/* tiny: icon buttons in one row, no field link — the tile is for recognising the card */
.manage-grid.size-t .manage-actions { grid-template-columns: repeat(4, 1fr); }
.manage-grid.size-t .btn-text, .manage-grid.size-t .manage-meta a { display: none; }
.manage-grid.size-t .btn-icon { display: inline; }
.btn-icon { display: none; }
@media (max-width: 900px) {
  .manage-layout { grid-template-columns: 1fr; }
  .browse { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
  .browse h3 { width: 100%; }
  .browse-teams { display: contents; }
}

/* owner: manage */
.search-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 20px; }
.search-row input { flex: 1; max-width: 420px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
/* Each tile is its own measurement container: text, padding, buttons and gaps are a share of the
   tile's width (with floors), so the whole tile shrinks together at any size or window width. */
.manage-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; container-type: inline-size; }
.manage-card .flip-card { padding: clamp(4px, 3.5cqw, 8px) clamp(4px, 3.5cqw, 8px) 0; }
.manage-meta { display: flex; flex-direction: column; padding: clamp(4px, 4cqw, 10px) clamp(6px, 5cqw, 12px) clamp(2px, 1.5cqw, 4px); font-size: clamp(9px, 5.8cqw, 14px); line-height: 1.35; }
.manage-meta a { margin-top: clamp(2px, 1.5cqw, 4px); font-size: clamp(9px, 5.3cqw, 13px); }
.manage-meta .copy { font-size: .8em; }
/* four actions in a 2×2 grid that shrinks with the tile, so nothing is ever clipped */
.manage-actions { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(4px, 3cqw, 8px); padding: clamp(4px, 3cqw, 8px) clamp(6px, 5cqw, 12px) clamp(6px, 5cqw, 12px); }
.manage-actions .inline { display: contents; }
.manage-actions .btn { width: 100%; text-align: center; white-space: nowrap; padding: clamp(3px, 2.8cqw, 7px) clamp(3px, 2cqw, 8px); font-size: clamp(9px, 5.4cqw, 13px); border-radius: clamp(4px, 2.5cqw, 8px); }

/* forms */
.card-form fieldset, .login-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px 8px; margin: 18px 0; box-shadow: var(--shadow); }
.card-form legend { font-weight: 700; padding: 0 6px; }
.settings-group { margin: 26px 0 0; font-size: 20px; }
.settings-group + .muted { margin: 2px 0 6px; }
.card-form { max-width: 960px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.form-row > * { min-width: 0; } /* a grid cell may shrink below its content: a long <option> must not widen the page */
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-weight: 600; font-size: 14px; }
.form-field small { color: var(--muted); font-size: 12px; }
.form-field input, .form-field select, .form-field textarea { padding: 8px 10px; border: 1px solid var(--input-line); border-radius: 8px; color: var(--ink); font: inherit; background: var(--input-bg); }
.form-field select, .form-field textarea, .form-field input:not([type=checkbox]):not([type=radio]) { width: 100%; max-width: 100%; }
.form-field input[type=file] { padding: 6px 0; }
.form-field .errorlist { list-style: none; padding: 0; margin: 0; color: var(--danger); font-size: 13px; }
.form-check label { display: flex; align-items: center; gap: 8px; }
.form-radios > div { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.form-radios > div label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form-check input[type=checkbox] { width: 18px; height: 18px; }
.manage-card.is-featured { border-color: var(--accent); box-shadow: 0 0 0 3px #fde68a, var(--shadow); }
.btn-featured { background: var(--accent); color: var(--accent-ink); }
.btn-featured:hover { background: #d97706; color: #fff; }
.form-actions { display: flex; gap: 12px; align-items: center; margin: 8px 0 24px; }
.login-box { max-width: 380px; margin: 48px auto; padding-bottom: 22px; }
.login-box .form-field { margin-bottom: 12px; }

/* card form: photo slots (camera on phones, drop/paste on computers) and the name search */
.photo-row { position: relative; border-radius: var(--radius); transition: background .15s; }
.photo-row.is-drag { background: #eef2ff; outline: 2px dashed var(--brand-2); outline-offset: 6px; }
.photo-field { align-items: stretch; }
.photo-title { font-weight: 600; font-size: 14px; }
.photo-preview-wrap { position: relative; width: 100%; max-width: 240px; aspect-ratio: 2.5 / 3.5; border-radius: 10px; background: #e5e7eb; border: 1px dashed #cbd5e1; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.photo-preview-wrap.is-landscape { aspect-ratio: 3.5 / 2.5; max-width: 336px; }
.photo-preview { width: 100%; height: 100%; object-fit: contain; display: block; background: #0f172a; }
.photo-rotate { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-placeholder { color: var(--muted); font-size: 13px; }
.photo-field.js .photo-real { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.photo-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 16px; flex: 1 1 140px; cursor: pointer; text-align: center; }
.photo-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.photo-btn:focus-within { outline: 3px solid var(--brand-2); outline-offset: 2px; }
.photo-status { color: var(--muted); font-size: 12px; min-height: 1.2em; }
.photo-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 4px 0 12px; }
.form-check-inline { display: flex; align-items: center; gap: 6px; font-size: 13px; }
/* what kind of card: a row of buttons (radio inputs inside the labels) */
.kind-row > div { display: flex; flex-wrap: wrap; gap: 8px; }
.kind-row > div > div { display: contents; }
.kind-row label { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 600; font-size: 14px; }
.kind-row label:has(input:checked) { border-color: var(--brand-2); background: #eef2ff; }
.kind-row input { accent-color: var(--brand-2); margin: 0; }
.kind { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; background: #fef3c7; color: #78350f; font-size: 11px; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.tile-card { width: 42px; aspect-ratio: 2.5 / 3.5; object-fit: cover; border-radius: 4px; align-self: flex-start; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.form-subhead { margin: 4px 0 8px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
#player-search { padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; width: 100%; }
.search-results { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.search-hit { display: block; width: 100%; text-align: left; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; cursor: pointer; }
.search-hit:hover, .search-hit:focus-visible { border-color: var(--brand-2); background: #eef2ff; outline: none; }
.search-note { margin: 4px 0 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; background: #eef2ff; color: #1e3a8a; font-size: 13px; font-weight: 600; }
.chip-x { border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; color: inherit; padding: 0 2px; }

/* in-page camera (camera.js): full screen on a phone, a window on a computer */
.camera-dialog { border: 0; padding: 0; margin: auto; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; background: #0f172a; color: #fff; border-radius: 0; }
.camera-dialog::backdrop { background: rgba(0, 0, 0, .85); }
.camera-live, .camera-review { display: flex; flex-direction: column; height: 100%; }
.camera-stage { position: relative; flex: 1; min-height: 0; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
/* the live picture fills the stage (a viewfinder), so the guide always lies inside it; the review shows the whole crop */
.camera-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.camera-stage video.is-mirrored { transform: scaleX(-1); }
/* the guide is the crop: what is inside the dotted line is the photo */
.camera-guide { position: absolute; inset: 0; margin: auto; height: 90%; max-width: 92%; aspect-ratio: 2.5 / 3.5; border: 3px dashed rgba(255, 255, 255, .85); border-radius: 12px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); }
.camera-stage.is-landscape .camera-guide { aspect-ratio: 3.5 / 2.5; width: 92%; height: auto; max-height: 90%; }
.camera-left { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.camera-head { margin: 8px 16px 0; font-size: 14px; min-height: 1.4em; }
.camera-note { color: #fbbf24; }
.camera-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
.camera-bar > :first-child { justify-self: start; }
.camera-bar > :last-child { justify-self: end; }
.camera-bar-2 { grid-template-columns: 1fr 1fr; }
.camera-bar-2 .btn { padding: 14px; text-align: center; }
.camera-shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: #e5e7eb; box-shadow: inset 0 0 0 4px #0f172a; cursor: pointer; }
.camera-shutter:disabled { opacity: .4; }
.camera-app { color: #cbd5e1; font-size: 13px; }
.camera-size { color: #cbd5e1; font-size: 12px; margin-left: 6px; }
.camera-closer { color: #93c5fd; font-size: 13px; margin-left: 6px; }
/* "Look closer": the shot at 1:1, scrollable, so the small print can be checked before "Use photo" */
.camera-stage.zoomed { display: block; overflow: auto; -webkit-overflow-scrolling: touch; }
.camera-stage.zoomed img { width: auto; height: auto; max-width: none; object-fit: none; }
.camera-cancel { color: #fff; z-index: 2; }
/* a modal dialog is pinned top and bottom by the browser, so `auto` would stretch it: fit-content */
@media (min-width: 721px) { .camera-dialog { width: min(92vw, 640px); height: fit-content; max-height: 92vh; border-radius: var(--radius); } .camera-live, .camera-review { height: auto; } .camera-stage { aspect-ratio: 4 / 3; flex: none; } }

@media (max-width: 720px) {
  h1 { font-size: 24px; }
  .form-row { grid-template-columns: 1fr; }
  /* phone header: brand, then the breadcrumb on its own line, then the owner links */
  .header-row { gap: 6px 12px; padding-top: 8px; padding-bottom: 8px; }
  .site-nav { flex: 1 1 100%; order: 2; }
  .owner-nav { order: 3; }
  .sport-years-row { min-height: 42px; }
  .sport-years-row > span { display: none; }
  .sport-years-row a { min-height: 40px; padding: 7px 10px; }
  .site-footer { margin-top: 20px; padding: 14px 0; }
  /* phone: 16px inputs stop iOS zooming on focus; big, full-width controls */
  .form-field input, .form-field select, .form-field textarea, #player-search { font-size: 16px; min-height: 44px; }
  .photo-preview-wrap { max-width: 200px; }
  .photo-preview-wrap.is-landscape { max-width: 280px; }
  .photo-btn { min-height: 56px; font-size: 16px; }
  .card-form fieldset { padding: 14px 14px 4px; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .btn { padding: 14px; width: 100%; text-align: center; }
  /* phone: everything on the field keeps shrinking with it; names live in the viewer */
  .field { --card-min: 18px; }
  .slot { gap: 1px; }
  .slot-main { padding: 2px 4px 3px; border-width: 1px; min-width: clamp(28px, 7cqw, 76px); font-size: clamp(7px, 1.45cqw, 13px); border-radius: 6px; }
  .slot-card .slot-main { padding: 2px; }
  .slot-card .slot-main img { border-radius: 3px; }
  .slot-card .slot-name { display: none; }
  .slot-more, .slot-cards { font-size: clamp(7px, 1.2cqw, 11px); padding: 0 4px; line-height: 1.5; }
  /* Keep the tiny field badge, but give its button a 24px touch target without changing layout. */
  .slot-more::before { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 24px); height: max(100%, 24px); transform: translate(-50%, -50%); }
  .roster-table th:nth-child(4), .roster-table td:nth-child(4), .roster-table th:nth-child(5), .roster-table td:nth-child(5) { display: none; }
}

/* owner-only design preview and grouped search */
.preview-banner { background: #111827; color: #f9fafb; border-bottom: 1px solid rgba(255,255,255,.18); font-size: 13px; }
.preview-banner-row { display: flex; align-items: center; gap: 10px 18px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.preview-banner-row > span { color: #cbd5e1; }
.preview-banner-actions { display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.preview-banner a, .preview-banner .linklike { color: #fbbf24; }
.eyebrow { margin: 0 0 5px; color: var(--brand-2); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.design-intro { padding: 34px 0 6px; }
.design-intro > p:last-child { max-width: 760px; }
.design-form { max-width: 1180px; }
.design-form fieldset { margin: 22px 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.design-form legend { padding: 0 8px; font-weight: 800; }
.design-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.design-choice { display: flex; gap: 10px; min-height: 88px; padding: 16px; border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.design-choice:has(input:checked) { border-color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 8%, var(--card)); }
.design-choice input { margin-top: 4px; accent-color: var(--brand-2); }
.design-choice span, .theme-copy { display: flex; flex-direction: column; gap: 4px; }
.design-choice small, .theme-copy small { color: var(--muted); }
.theme-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 12px; }
.theme-choice { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; min-height: 112px; padding: 14px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--card); cursor: pointer; }
.theme-choice:has(input:checked) { border-color: var(--brand-2); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-2) 22%, transparent); }
.theme-choice > input { position: absolute; opacity: 0; pointer-events: none; }
.theme-sample { display: grid; width: 58px; height: 72px; padding: 8px; border-radius: 9px; background: var(--sample-bg, #f6f7f9); border: 1px solid var(--sample-line, #d1d5db); }
.theme-sample i { display: block; border-radius: 3px; background: var(--sample-card, #fff); }
.theme-sample i:first-child { margin-bottom: 6px; background: var(--sample-brand, #1e3a8a); }
.theme-sample i:last-child { width: 58%; margin-top: 6px; background: var(--sample-accent, #f59e0b); }
.theme-swatch-night_game { --sample-bg:#071426;--sample-card:#13233b;--sample-brand:#1d4b73;--sample-accent:#f2b84b;--sample-line:#31506d; }
.theme-swatch-stadium_day { --sample-bg:#dff1e6;--sample-card:#fff;--sample-brand:#17633a;--sample-accent:#f0b429;--sample-line:#8ab99b; }
.theme-swatch-holographic_foil { --sample-bg:#171633;--sample-card:#2d2858;--sample-brand:#7c4dff;--sample-accent:#54e6e7;--sample-line:#837ac5; }
.theme-swatch-vintage_ticket { --sample-bg:#ead9b8;--sample-card:#f9edcf;--sample-brand:#6b3026;--sample-accent:#bd7a38;--sample-line:#9c7d55; }
.theme-swatch-scoreboard_amber { --sample-bg:#111006;--sample-card:#201c0d;--sample-brand:#3a310f;--sample-accent:#ffb51b;--sample-line:#6c5614; }
.theme-swatch-ice_rink { --sample-bg:#e8f5fa;--sample-card:#fff;--sample-brand:#075985;--sample-accent:#d62f46;--sample-line:#9bc6d8; }
.theme-swatch-hardwood { --sample-bg:#d9ad72;--sample-card:#f2d5a3;--sample-brand:#512b1f;--sample-accent:#d84b35;--sample-line:#8b5c35; }
.theme-swatch-gridiron { --sample-bg:#173d2b;--sample-card:#23543d;--sample-brand:#10291e;--sample-accent:#f1e8c7;--sample-line:#5d846e; }
.theme-swatch-museum_glass { --sample-bg:#ecebe7;--sample-card:#fff;--sample-brand:#29323a;--sample-accent:#9b7a42;--sample-line:#bbb9b1; }
.theme-swatch-bubblegum_wax { --sample-bg:#fae4e8;--sample-card:#fff9ed;--sample-brand:#a73562;--sample-accent:#45a6bf;--sample-line:#d992ab; }
.theme-swatch-monochrome_pro { --sample-bg:#e7e7e7;--sample-card:#fff;--sample-brand:#111;--sample-accent:#777;--sample-line:#888; }
.favorite-button { position: relative; z-index: 1; min-width: 44px; min-height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; }
.favorite-button:hover, .favorite-button.is-favorite { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.viewer-settings-summary { max-width: 780px; margin-top: 36px; }
.visibility-summary { list-style: none; margin: 12px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.visibility-summary li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.visibility-summary li span { color: var(--muted); }
.visibility-summary .is-public { border-left: 4px solid #16a34a; }
.visibility-summary .is-private { border-left: 4px solid var(--muted); }
.private-tag { display: inline-flex; align-items: center; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--card); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.private-tag-small { align-self: flex-start; font-size: 9px; padding: 2px 6px; }
.deck-search { position: relative; margin: 20px 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.deck-search label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 700; color: var(--muted); }
.deck-search > div { display: flex; gap: 8px; }
.deck-search input, .deck-search select { min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; }
.deck-search input { flex: 1; }
.deck-search .private-tag { position: absolute; top: 12px; right: 12px; }
.search-page { max-width: 1080px; padding-top: 34px; }
.search-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; }
.search-groups section { min-width: 0; }
.search-result { display: flex; align-items: center; gap: 11px; min-height: 62px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--ink); }
.search-result:hover { border-color: var(--brand-2); text-decoration: none; }
.search-result.is-connected { border-left: 4px solid var(--accent); }
.search-result img { width: 34px; height: 48px; object-fit: contain; border-radius: 3px; background: #111827; }
.search-result > span { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.search-result small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result em { color: var(--muted); font-size: 11px; font-style: normal; text-transform: uppercase; }
@media (max-width: 720px) {
  .preview-banner-actions { width: 100%; margin-left: 0; }
  .theme-options, .search-groups { grid-template-columns: 1fr; }
  .deck-search > div { flex-wrap: wrap; }
  .deck-search input { flex: 1 1 100%; min-height: 46px; font-size: 16px; }
  .deck-search select, .deck-search .btn { min-height: 46px; }
}
