:root {
  --bg: #f2f5f9; --panel: #fff; --ink: #18212d; --muted: #667085; --line: #dde3ec; --line2: #edf0f5; --soft: #eef2f7; --soft2: #f7f9fc; --field: #fff; --field-line: #c6cfdc; --label: #3b4656;
  --side: #13294b; --side2: #1d3a66; --side-ink: #d3def0; --side-muted: #93a7c6;
  --accent: #2f6fd0; --accent2: #1f56aa; --accent-soft: #e4edfb; --accent-softer: #f3f7fe; --focus: #a9c6f2;
  --zone-up: #1f8a4c; --zone-po: #6fbf73; --zone-rpo: #e6a23c;
  --err: #c0392b; --err-soft: #fbe9e7; --warn: #b7791f; --warn-soft: #fdf3dc; --info-soft: #e8f0fb; --info-ink: #234a7a;
  --rt-red: #d6382f; --rt-orange: #ef8a17; --rt-green: #2f9e44; --rt-blue: #2f74d0;
  --gold: #c99a16; --gold-soft: #fbf1d4; --r: 10px;
}
html[data-theme="green"] { --bg: #f3f5f2; --line: #dfe5e0; --line2: #eef1ee; --soft: #eef2ef; --soft2: #f6f8f6; --field-line: #c9d2cc; --label: #3d4a43; --ink: #1b2420; --muted: #6b7670;
  --side: #12241c; --side2: #1b3428; --side-ink: #cfe0d6; --side-muted: #8fae9c; --accent: #1f8a4c; --accent2: #156a39; --accent-soft: #e3f3e9; --accent-softer: #f4fbf6; --focus: #9fd5b4; }
html[data-theme="crimson"] { --bg: #f7f3f3; --line: #e8dede; --line2: #f2eaea; --soft: #f4eded; --soft2: #faf6f6; --field-line: #d6c8c8;
  --side: #3a1218; --side2: #571c25; --side-ink: #f0d6d9; --side-muted: #c79aa0; --accent: #b8323f; --accent2: #8f2430; --accent-soft: #f8e3e5; --accent-softer: #fdf4f5; --focus: #eab0b6; }
html[data-theme="purple"] { --bg: #f5f3f9; --line: #e2ddec; --line2: #eeebf4; --soft: #f0edf6; --soft2: #f8f6fb; --field-line: #cdc5dc;
  --side: #24163d; --side2: #36235a; --side-ink: #e0d6f2; --side-muted: #a796c6; --accent: #7246c4; --accent2: #57339f; --accent-soft: #ece4fa; --accent-softer: #f7f3fd; --focus: #c6b2ee; }
html[data-theme="teal"] { --bg: #f1f6f6; --line: #d9e5e5; --line2: #e9f0f0; --soft: #e9f2f2; --soft2: #f5fafa; --field-line: #c2d4d4;
  --side: #0f2f33; --side2: #18474c; --side-ink: #cfe6e7; --side-muted: #8db5b8; --accent: #13918f; --accent2: #0d6f6d; --accent-soft: #dff3f2; --accent-softer: #f1faf9; --focus: #9ad9d7; }
html[data-theme="amber"] { --bg: #f8f5ef; --line: #e7dfd0; --line2: #f1ebe0; --soft: #f3ede2; --soft2: #faf7f1; --field-line: #d7cbb5;
  --side: #33240e; --side2: #4d3616; --side-ink: #efe0c6; --side-muted: #c3a97c; --accent: #c27a0c; --accent2: #985f08; --accent-soft: #fbeed6; --accent-softer: #fdf7ec; --focus: #edc98a; }
html[data-theme="graphite"] { --bg: #f3f4f6; --line: #e0e2e7; --line2: #eceef1; --soft: #eef0f3; --soft2: #f7f8fa; --field-line: #c9cdd4;
  --side: #1f2329; --side2: #2f343c; --side-ink: #d8dbe0; --side-muted: #9aa0aa; --accent: #3f4a5a; --accent2: #2b3440; --accent-soft: #e5e8ed; --accent-softer: #f4f5f7; --focus: #b5bdc9; }
html[data-theme="midnight"] { --bg: #0e1522; --panel: #162032; --ink: #e4eaf4; --muted: #94a3b8; --line: #26344b; --line2: #1f2b3f; --soft: #1e2a3e; --soft2: #1a2537; --field: #0f1828; --field-line: #33445f; --label: #b8c4d6;
  --side: #0a0f1a; --side2: #172238; --side-ink: #c9d5ea; --side-muted: #7f8fab; --accent: #4f8cff; --accent2: #7aa7ff; --accent-soft: #1d3157; --accent-softer: #172640;
  --focus: #3a64b0; --err-soft: #3a1e22; --warn-soft: #3a2f17; --info-soft: #1b2a45; --info-ink: #b7cdf5; --gold-soft: #3a3115; }
html[data-theme="midnight"] .alert.err { color: #ffc2b8; } html[data-theme="midnight"] .alert.warn { color: #f5d9a0; } html[data-theme="midnight"] .alert.ok { color: #a9e2bf; }
html[data-theme="midnight"] .champ-banner { background: var(--gold-soft); border-color: #6b5a1f; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--ink); background: var(--bg); }
#app { display: flex; height: 100vh; }
a { color: var(--accent2); cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
h2 { font-size: 17px; margin: 18px 0 10px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
h3 { font-size: 14px; margin: 14px 0 8px; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sp { flex: 1; }
.hl { color: var(--accent2); }

/* sidebar */
#sidebar { width: 230px; flex: none; background: var(--side); color: var(--side-ink); overflow-y: auto; display: flex; flex-direction: column; }
.brand { font-weight: 700; font-size: 18px; color: #fff; padding: 18px 18px 12px; display: flex; gap: 8px; align-items: center; }
.world-name { margin: 0 12px 10px; padding: 10px 12px; background: var(--side2); border-radius: 8px; color: #fff; font-weight: 600; }
.world-name small { display: block; color: var(--side-muted); font-weight: 400; }
#sidebar nav { display: flex; flex-direction: column; padding: 0 8px; gap: 2px; }
#sidebar nav a { color: var(--side-ink); padding: 9px 12px; border-radius: 7px; display: flex; gap: 10px; align-items: center; text-decoration: none; }
#sidebar nav a i { font-style: normal; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; opacity: .8; }
#sidebar nav a i .ico { display: block; }
#sidebar nav a:hover { background: var(--side2); }
#sidebar nav a.active { background: var(--accent); color: #fff; }
.sb-foot { margin-top: auto; padding: 14px 18px; font-size: 12px; color: var(--side-muted); word-break: break-all; }
.save-state.saving { color: #f5d77a; } .save-state.error { color: #ff9a8a; font-weight: 700; }

/* main */
#main { flex: 1; overflow: auto; }
.page { padding: 24px 32px 60px; max-width: 1400px; }
.page.narrow { max-width: 1000px; }
.page-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.page-head h1, .page-head h2 { margin-bottom: 8px; }
.page-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; margin-bottom: 10px; }
.cards .card { margin: 0; }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--r); }
.hero { padding: 20px 0 10px; } .hero h1 { font-size: 32px; } .hero p { color: var(--muted); font-size: 15px; max-width: 640px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; color: var(--ink); }
.stat:hover { text-decoration: none; border-color: var(--accent); }
.stat b { display: block; font-size: 26px; } .stat span { color: var(--muted); }
.tips ol { margin: 0; padding-left: 20px; } .tips li { margin: 4px 0; }

/* forms */
.field { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.field label { font-weight: 600; font-size: 12px; color: var(--label); }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--field-line); border-radius: 7px; background: var(--field); color: var(--ink); min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--focus); border-color: var(--accent); }
input:disabled, select:disabled { background: var(--soft); color: var(--muted); }
input.sm { width: 80px; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
label.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; cursor: pointer; }
label.check.disabled { color: var(--muted); }
label.check.inline { margin: 0; }
.sub { border-left: 3px solid var(--accent-soft); padding: 4px 0 4px 14px; margin: 6px 0 10px 6px; }
.btn { font: inherit; border: 1px solid var(--field-line); background: var(--panel); color: var(--ink); padding: 7px 14px; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { color: var(--err); } .btn.danger:not(.ghost) { border-color: #e6b3ac; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.big { padding: 11px 22px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 999px; padding: 3px 10px; font-size: 12px; margin: 2px 0; }
.chip.gold { background: var(--gold-soft); }
.btn-chip { border: 1px solid var(--field-line); cursor: pointer; font-family: Consolas, monospace; }
.btn-chip:hover { border-color: var(--accent); }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent2); font-weight: 600; }
.pill.err { background: var(--err-soft); color: var(--err); }
.pill.ok { background: var(--accent-soft); }
.alert { border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.alert ul { margin: 4px 0 0; padding-left: 20px; }
.alert.err { background: var(--err-soft); color: #7d2318; }
.alert.warn { background: var(--warn-soft); color: #7a5410; }
.alert.ok { background: var(--accent-soft); color: var(--accent2); }
.alert.info { background: var(--info-soft); color: var(--info-ink); }
.danger-zone { border-color: #efc9c3; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.presets { margin-bottom: 10px; color: var(--muted); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; width: 1%; white-space: nowrap; }
.tbl .actions { text-align: right; white-space: nowrap; width: 1%; }
.standings td.pos { font-weight: 700; color: var(--muted); border-left: 4px solid transparent; }
.standings tr.z-up td.pos { border-left-color: var(--zone-up); } .legend .z-up::before { background: var(--zone-up); }
.standings tr.z-champ td.pos { border-left-color: var(--gold); } .legend .z-champ::before { background: var(--gold); }
.standings tr.z-po td.pos { border-left-color: var(--zone-po); } .legend .z-po::before { background: var(--zone-po); }
.standings tr.z-rpo td.pos { border-left-color: var(--zone-rpo); } .legend .z-rpo::before { background: var(--zone-rpo); }
.standings tr.z-down td.pos { border-left-color: var(--err); } .legend .z-down::before { background: var(--err); }
.standings tr.z-q td.pos { border-left-color: var(--zone-up); }
.standings tr.z-q { background: var(--accent-softer); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend span::before { content: ""; width: 10px; height: 10px; border-radius: 2px; border-left: 0 solid; }

/* teams & logos */
.team { display: inline-flex; align-items: center; vertical-align: middle; gap: 7px; color: var(--ink); }
.team .tn { line-height: 1.25; }
.logo { align-self: center; }
a.team:hover .tn { text-decoration: underline; }
a.team:hover { text-decoration: none; }
.logo { width: 22px; height: 22px; object-fit: contain; flex: none; border-radius: 3px; }
.logo.ph { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 9px; font-weight: 700; border-radius: 50%; letter-spacing: -.02em; }
.logo.xl { width: 72px; height: 72px; font-size: 22px; }
.team-h { display: flex; align-items: center; gap: 8px; }
.logo-field { display: flex; gap: 14px; align-items: center; }
.logo-preview { width: 84px; height: 84px; border: 1px dashed var(--field-line); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; background: var(--soft2); }
.logo-preview img { max-width: 76px; max-height: 76px; }
.club-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.club-head h1 { margin: 0; } .club-head p { margin: 4px 0 0; }

/* picker */
.picker { border: 1px solid var(--line); border-radius: 8px; }
.picker-head { display: flex; gap: 8px; align-items: center; padding: 8px; border-bottom: 1px solid var(--line); background: var(--soft2); flex-wrap: wrap; border-radius: 8px 8px 0 0; }
.picker-head input { flex: 1; min-width: 160px; }
.picker-head .count { color: var(--muted); }
.picker-list { max-height: 300px; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px; padding: 6px; }
.pick { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.pick:hover { background: var(--soft); }
.pick.on { background: var(--accent-soft); }
.pick.busy { opacity: .55; }
.pick small { color: var(--muted); margin-left: auto; }
.pick small.warn-t { color: var(--warn); }
.pad { padding: 10px; }

/* competition editor */
.stage { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--soft2); }
.stage-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.stage-head input { flex: 1; }
.num-badge { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: none; }
.flow { background: var(--soft2); border-radius: 8px; padding: 10px 10px 10px 30px; margin: 12px 0 0; color: var(--label); }
.slot { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.slot select:first-child { min-width: 260px; }
.slot input { width: 70px; }
.balance { display: flex; align-items: center; gap: 18px; padding: 10px 16px; border-radius: 8px; margin: 12px 0 6px; }
.balance > div { display: flex; flex-direction: column; } .balance small { color: var(--muted); }
.balance b { font-size: 20px; }
.balance .eq { font-size: 26px; font-weight: 700; }
.balance.ok { background: var(--accent-soft); } .balance.ok .eq { color: var(--accent); }
.balance.bad { background: var(--err-soft); } .balance.bad .eq { color: var(--err); }

/* seasons */
.season-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { font: inherit; border: 1px solid var(--line); background: var(--panel); padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.tab.active { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; position: relative; margin: 8px 0; }
.progress div { height: 100%; background: var(--accent); }
.progress.big { height: 22px; margin-bottom: 14px; }
.progress.big span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.ed-card .ed-title { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.ed-card.complete { background: var(--soft2); }
.ed-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.champ { font-size: 13px; }
.muted-card { background: var(--soft2); color: var(--muted); }
ul.plain { list-style: none; padding: 0; } ul.plain li { padding: 5px 0; border-bottom: 1px solid var(--line2); }
.crumbs { margin-bottom: 6px; }
.champ-banner { background: linear-gradient(90deg, var(--gold-soft), #fff); border: 1px solid #efdca0; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 15px; }
.split { display: grid; grid-template-columns: minmax(420px, 1.2fr) 1fr; gap: 14px; align-items: start; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; margin-bottom: 12px; }
.groups .card { margin: 0; }
details summary { cursor: pointer; color: var(--accent2); margin-top: 8px; font-size: 13px; }
.md-nav { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin-bottom: 10px; }
.md-nav span { color: var(--muted); font-size: 12px; margin-right: 6px; }
.md { font: inherit; font-size: 12px; min-width: 28px; padding: 3px 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 5px; cursor: pointer; }
.md.done { background: var(--accent-soft); }
.md.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.match { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; padding: 5px 4px; border-bottom: 1px solid var(--line2); }
.match .home { display: flex; justify-content: flex-end; text-align: right; }
.match .home .team { flex-direction: row-reverse; }
.match .score { display: flex; align-items: center; gap: 4px; min-width: 80px; justify-content: center; }
.match input.sc { width: 44px; text-align: center; padding: 4px; -moz-appearance: textfield; }
.match input.sc::-webkit-inner-spin-button { -webkit-appearance: none; }
.match.played input.sc { background: var(--accent-softer); font-weight: 700; }
.bracket { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.round { min-width: 330px; flex: none; }
.round h4 { margin: 0 0 8px; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .05em; }
.tie { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; background: var(--panel); }
.tie.done { background: var(--soft2); }
.tie-sum { padding: 6px 10px; border-bottom: 1px solid var(--line2); }
.tie-sum > div { display: flex; justify-content: space-between; align-items: center; padding: 2px 0; }
.tie-sum .win { font-weight: 700; } .tie-sum .lose { opacity: .55; }
.tie-legs { padding: 4px 8px; font-size: 12px; }
.tie-legs .match { grid-template-columns: 1fr auto 1fr; }
.tie-legs .logo { width: 16px; height: 16px; }
.pens { padding: 6px 10px; border-top: 1px dashed var(--line); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.branch { margin-bottom: 18px; }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 25, 20, .45); display: flex; align-items: flex-start; justify-content: center; padding-top: 4vh; z-index: 50; }
.modal { background: var(--panel); border-radius: 12px; width: 520px; max-width: 94vw; box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: 90vh; display: flex; flex-direction: column; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal header h3 { margin: 0; font-size: 16px; }
.modal .x { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 16px 18px 4px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal header, .modal footer { flex: 0 0 auto; }
.modal footer { display: flex; gap: 8px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--ink); color: var(--panel); padding: 10px 18px; border-radius: 8px; transition: transform .25s; z-index: 60; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--err); }

@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } .row3 { grid-template-columns: 1fr 1fr; } .stats { grid-template-columns: 1fr 1fr; } }

.update-box { display: flex; align-items: center; gap: 14px; justify-content: space-between; }
.update-box small { opacity: .8; }
.redraw-link { text-align: right; margin: -6px 0 8px; font-size: 12px; }

#offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: var(--err); color: #fff; padding: 12px 20px; font-size: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.backup-list { max-height: 320px; overflow: auto; }

/* v0.2 — navigation sections, themes, tabs, fitted tables */
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--side-muted); padding: 14px 12px 4px; font-weight: 600; }
.page.wide { max-width: none; }
.crumbs { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.theme-card { font: inherit; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 10px; border: 2px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); cursor: pointer; }
.theme-card:hover { border-color: var(--accent); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-card .swatch { display: flex; width: 100%; height: 38px; border-radius: 6px; overflow: hidden; }
.theme-card .swatch i { flex: 1; } .theme-card .swatch b { flex: 2; }
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin: 4px 0 14px; }
.tabbtn { font: inherit; font-weight: 600; background: none; border: none; padding: 9px 18px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabbtn:hover { color: var(--ink); }
.tabbtn.active { color: var(--accent2); border-bottom-color: var(--accent); }
.subtabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.champ-pill { background: var(--gold-soft); border-radius: 999px; padding: 4px 12px; font-weight: 600; }
.md.wide { padding: 4px 10px; }
.grp-h { margin: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ties { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 10px; }
.byes { margin-top: 10px; }
.card.tight { padding: .6em .9em; margin-bottom: .7em; }
/* fitted Table tab: everything sized in em so the whole tab scales with one font size */
.fit { font-size: 14px; line-height: 1.22; }
.fit h2 { font-size: 1.15em; margin: .4em 0 .3em; }
.fit h3 { font-size: 1em; margin: 0 0 .4em; }
.fit .tbl th { font-size: .78em; padding: .18em .5em; }
.fit .tbl td { padding: .1em .5em; }
.fit .logo { width: 1.3em; height: 1.3em; }
.fit .logo.ph { font-size: .6em; width: 2.4em; height: 2.4em; }
.fit .team { gap: .45em; }
.fit .legend { font-size: .82em; margin-top: .6em; }
.fit .legend span::before { width: .8em; height: .8em; }
.fit .groups { grid-template-columns: repeat(auto-fill, minmax(26em, 1fr)); gap: .8em; margin-bottom: .8em; }
.fit .bracket { gap: 1em; }
.fit .round { min-width: 17em; }
.fit .round h4 { font-size: .8em; }
.fit .tie { margin-bottom: .6em; }
.fit .tie-sum { padding: .35em .7em; }
.fit .tie-legs { font-size: .85em; padding: .2em .6em; }
.fit .tie-legs .logo { width: 1.2em; height: 1.2em; }
.fit .chip { font-size: .85em; }
.fit .muted-card, .fit p { font-size: .9em; }

/* v0.3 */
.backbar { padding: 12px 24px 0; }
.page .backbar { padding: 0 0 10px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--accent); }
th.sortable.sorted { color: var(--accent); }
.filters .range { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.filters .range input { width: 64px; }
input.narrow { width: 56px; }
.cupbox { background: var(--accent-softer); border-radius: 8px; padding: 10px 12px; margin: 6px 0 12px; line-height: 2; }

.ring { display: inline-flex; position: relative; vertical-align: middle; }
.ring svg { display: block; }
.ring .rfill { transition: stroke-dashoffset .3s; }
.ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--ink, inherit); }
.ring.xl b { font-size: 20px; } .ring small { font-size: 9px; position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; opacity: .6; }
.ring-cell { display: inline-flex; align-items: center; gap: 6px; }
.club-head .ring { margin-right: 6px; }
.ed-switch { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; }
.ed-switch select { max-width: 360px; }
.grp-h { margin: 18px 0 4px; font-size: 20px; }
.grp-n { margin: 12px 0 4px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

.tiebreak { margin-top: 12px; }
.tiebreak ol { list-style: none; margin: 6px 0 8px; padding: 0; counter-reset: tb; max-width: 640px; }
.tiebreak li { counter-increment: tb; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 4px; background: var(--panel); }
.tiebreak li::before { content: counter(tb) "."; color: var(--muted); width: 22px; }
.tiebreak li > span:first-of-type { flex: 1; }
.tiebreak li.fixed { background: var(--accent-softer); }
.tiebreak .tb-btns { display: inline-flex; gap: 2px; }
.tiebreak select { max-width: 420px; }

/* ---------- flexible tables (v0.4.0) */
.grid-bar { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; flex-wrap: wrap; }
.grid-bar .sp { flex: 1; }
.grid-bar .btn.on { border-color: var(--accent); color: var(--accent); }
.grid-bar label.check.small { font-size: 13px; margin-right: 6px; }
.grid-card { overflow-x: auto; }
table.grid thead th[data-gcol] { cursor: pointer; user-select: none; white-space: nowrap; }
table.grid thead th[data-gcol]:hover { color: var(--accent); }
table.grid thead th.sorted { color: var(--accent); }
table.grid thead th.drop-before { box-shadow: inset 3px 0 0 var(--accent); }
table.grid thead th.drop-after { box-shadow: inset -3px 0 0 var(--accent); }
table.grid tr.grid-filter th { padding: 4px 6px 8px; text-transform: none; letter-spacing: 0; font-weight: normal; }
table.grid tr.grid-filter input, table.grid tr.grid-filter select { width: 100%; min-width: 70px; font-size: 12px; padding: 3px 5px; }
table.grid tr.grid-filter th.gf-on input, table.grid tr.grid-filter th.gf-on select { border-color: var(--accent); }
table.grid .gf-range { display: flex; gap: 3px; }
table.grid .gf-range input { min-width: 48px; width: 56px; }
table.grid tr.grid-group td { background: var(--soft); padding: 7px 8px; font-size: 14px; border-bottom: 1px solid var(--line); }
table.grid .grid-empty { text-align: center; padding: 18px; }
.grid-menu { position: fixed; z-index: 2000; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.22); padding: 6px; width: 260px; max-height: 80vh; overflow-y: auto; font-size: 13px; }
.grid-menu .gm-h { font-weight: 600; padding: 4px 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.grid-menu .gm-h small { text-transform: none; letter-spacing: 0; font-weight: normal; }
.grid-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 5px; cursor: pointer; color: inherit; font: inherit; }
.grid-menu button:hover, .grid-menu .gm-col:hover { background: var(--line2); }
.grid-menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.grid-menu .gm-col { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 5px; cursor: grab; }
.grid-menu .gm-grip { color: var(--muted); font-size: 11px; letter-spacing: -2px; }
.grid-menu .gm-col.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.grid-menu .gm-col.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
table.grid td .team { white-space: nowrap; }

table.grid tr.grid-group td .gg { display: flex; align-items: center; gap: 6px; }
table.grid tr.grid-group td .gg small { line-height: 1; }

/* ---------- simulation layers (v0.5.0) */
.simbtn { border: 0; background: none; cursor: pointer; font-size: 13px; padding: 2px 3px; border-radius: 5px; opacity: .55; line-height: 1; }
.simbtn:hover { opacity: 1; background: var(--soft); }
.simbtn.off { visibility: hidden; }
.simbar { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
h4.grp-h { display: flex; align-items: center; gap: 8px; }
h4.grp-h .sp, h2.grp-h .sp { flex: 1; }

.preview-list { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; margin: 8px 0; }
.preview-list .match { padding: 4px 2px; }
.preview-list .match:last-child { border-bottom: 0; }
.pv-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 2px; border-bottom: 1px solid var(--line2); }
.pv-row:last-child { border-bottom: 0; }

/* simulate menu on the season overview (v0.5.1) */
h2.grp-h, h3.grp-n { display: block; }
.ed-card { position: relative; }
.ed-card .card-sim { position: absolute; top: 8px; right: 8px; opacity: 0; }
.ed-card:hover .card-sim, .ed-card .card-sim:focus { opacity: .8; }
@media (hover: none) { .ed-card .card-sim { opacity: .6; } }
.sim-menu { position: fixed; z-index: 2000; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.22); padding: 6px; width: 300px; max-height: 70vh; overflow-y: auto; font-size: 13px; }
.sim-menu .sm-h { padding: 4px 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.sim-menu .sm-i { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 5px; cursor: pointer; color: inherit; font: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-menu .sm-i:hover { background: var(--soft); }
.sim-menu .sm-i.d1 { font-weight: 600; margin-top: 4px; }
.sim-menu .sm-i.d2 { padding-left: 20px; font-weight: 600; color: var(--muted); }
.sim-menu .sm-i.d3 { padding-left: 34px; }

/* ---------- locking, branches, start year (v0.6.0) */
.pill.lock { background: var(--soft); color: var(--muted); border: 1px solid var(--line); padding: 4px 10px; font-size: 13px; }
.inline-year { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; color: var(--label); }
.inline-year input { width: 84px; flex: none; }

/* ---------- stadiums (v0.7.0) */
.hidden { display: none !important; }
.pickbox { max-height: 190px; overflow: auto; border: 1px solid var(--field-line); border-radius: 8px; padding: 4px; background: var(--field); }
.pickbox .pick { padding: 3px 6px; }
.dupes { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.dupe { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.dupe .sp { flex: 1; }

/* ---------- pop-ups never scroll sideways (v0.7.1) */
.modal-body { overflow-x: hidden; }
.modal-body input, .modal-body select, .modal-body textarea { max-width: 100%; box-sizing: border-box; min-width: 0; }
.row2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.row2 > .field, .modal .field { min-width: 0; }
.inline-pick { display: flex; gap: 8px; align-items: center; }
.inline-pick select { flex: 1 1 auto; min-width: 0; }
.inline-pick .btn { flex: none; white-space: nowrap; }
input.ro { background: var(--soft); color: var(--muted); cursor: default; }
.modal-top { box-shadow: 0 24px 70px rgba(0,0,0,.4); width: 480px; }
#modal-root2 .modal-bg { z-index: 60; background: rgba(15, 25, 20, .35); }

.note { margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--accent-soft, rgba(80,140,255,.12)); font-size: 13px; }
.note.hidden { display: none; }
.pickbox.tall { max-height: 300px; }
.newcity-row { margin-top: 6px; }
.newcity-row.hidden { display: none; }

.geo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 8px; }
.geo-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font: inherit; color: var(--ink); text-align: center; }
.geo-card:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(0,0,0,.14); }
.geo-card b { font-size: 18px; } .geo-card small { color: var(--muted); } .geo-ico { color: var(--accent); display: flex; }
.geo-n { font-size: 26px; font-weight: 700; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 24px; }
.kv-row { display: flex; flex-direction: column; gap: 2px; }  .kv-row b { font-weight: 600; }
.honours { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.honour { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--soft2); border: 1px solid var(--line); border-radius: 12px; }
.h-trophy { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 110px; text-align: center; flex: none; }
.h-name { font-size: 12px; font-weight: 600; line-height: 1.25; }
.h-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .h-count { font-size: 26px; font-weight: 700; } .h-years { font-size: 12px; color: var(--muted); }

.h-group { margin: 14px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; } .h-group:first-of-type { margin-top: 4px; }
.honour .h-count { font-size: 32px; font-weight: 700; }

.mpbtn { background: none; border: none; cursor: pointer; color: var(--muted); padding: 2px 4px; border-radius: 6px; opacity: .55; display: inline-flex; vertical-align: middle; }
.mpbtn:hover, .mpbtn.has { opacity: 1; color: var(--accent); } .mpbtn:hover { background: var(--soft); }
.ptag { display: inline-block; min-width: 2.7em; text-align: center; padding: 1px 6px; border-radius: 4px; color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.ptag.g-GK { background: #ef8a17; } .ptag.g-DF { background: #2f9e44; } .ptag.g-MF { background: #2f74d0; } .ptag.g-FW { background: #d6382f; } .ptag.g-sub { background: #8a94a3; }
.mp-score { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: start; text-align: center; }
.mp-team { display: flex; flex-direction: column; align-items: center; gap: 6px; } .mp-tn { font-size: 20px; font-weight: 700; }
.gs { font-size: 13px; min-height: 18px; } .gs-line { margin: 1px 0; }
.mp-mid { padding-top: 6px; } .mp-result { font-size: 44px; font-weight: 700; line-height: 1.1; }
.mp-info { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; } .mp-info label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); } .mp-info input, .mp-info select { min-width: 150px; }
.mp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 250px minmax(0, 1fr); gap: 14px; align-items: start; margin: 14px 0; }
.mp-pitch-wrap { position: sticky; top: 8px; } svg.mp-pitch { width: 100%; height: auto; display: block; border-radius: 6px; }
svg.mp-pitch .turf { fill: #2a7a3b; } svg.mp-pitch .pl-lines * { fill: none; stroke: rgba(255,255,255,.6); stroke-width: .5; }
svg.mp-pitch .pc { fill: #d9dce1; stroke: #4b5058; stroke-width: 1; } svg.mp-pitch .empty .pc { fill: rgba(217,220,225,.3); stroke: rgba(75,80,88,.55); } svg.mp-pitch .pe { font-size: 2.6px; text-anchor: middle; fill: rgba(255,255,255,.75); font-weight: 600; }
svg.mp-pitch .pn { font-size: 4px; text-anchor: middle; fill: #3a3f46; font-weight: 800; } svg.mp-pitch .pl { font-size: 2.8px; text-anchor: middle; fill: #fff; font-weight: 600; paint-order: stroke; stroke: rgba(0,0,0,.55); stroke-width: .5px; }
.mp-lineup .lu-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 4px 0 10px; font-size: 13px; } .lu-meta label { display: flex; align-items: center; gap: 6px; color: var(--muted); } .lu-meta input { width: 150px; }
.lu-h { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.lu-list { display: flex; flex-direction: column; gap: 4px; align-items: stretch; } .lu-row { display: flex; align-items: center; gap: 6px; min-height: 30px; }
.lu-num { width: 46px; flex: none; padding-left: 4px; padding-right: 4px; text-align: center; -moz-appearance: textfield; appearance: textfield; } .lu-num::-webkit-inner-spin-button, .lu-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } .lu-name { width: 100%; min-width: 0; } .lu-nw { position: relative; flex: 1; min-width: 0; display: block; } .lu-nw.has-flag .lu-name { padding-right: 52px; } .lu-nw .lu-flag { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: auto; pointer-events: none; } .lu-n { width: 26px; text-align: right; color: var(--muted); flex: none; } .lu-nm { flex: 1; }
.lu-row .cap { display: flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); flex: none; cursor: pointer; } .lu-flag { width: 34px; text-align: right; flex: none; font-size: 12px; font-weight: 600; } .lu-flag .off { color: #d6382f; } .lu-flag .on { color: #2f9e44; }
.sub-row .min { width: 56px; flex: none; } .sub-row select { flex: 1; min-width: 0; }
.x { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 14px; padding: 2px 6px; border-radius: 6px; flex: none; } .x:hover { background: var(--soft); color: var(--err); }
.ev-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; } .ev-row .ev-name { flex: 1; min-width: 140px; } .ev-row .min { width: 64px; } .ev-row.ro { gap: 12px; } .ev-row.ro .min { width: 40px; text-align: right; font-weight: 600; }
.cardico { display: inline-block; width: 11px; height: 15px; border-radius: 2px; vertical-align: -3px; } .cardico.yel { background: #f2c230; } .cardico.red { background: #d6382f; }
.pastelist { display: flex; flex-direction: column; gap: 6px; } .pastelist .pick { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 1150px) { .mp-grid { grid-template-columns: 1fr; } .mp-pitch-wrap { position: static; max-width: 340px; margin: 0 auto; order: -1; } }

.awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.award { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--soft2); border: 1px solid var(--line); border-radius: 12px; } .aw-body { flex: 1; min-width: 0; } .aw-act { display: flex; flex-direction: column; gap: 4px; }

.numc { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid #4b5058; background: #d9dce1; color: #3a3f46; font-weight: 800; font-size: 12px; }
.posel { width: 64px; font-weight: 700; text-align: center; text-align-last: center; border-radius: 4px; padding: 2px 4px; } .posel.g-GK, .posel.g-DF, .posel.g-MF, .posel.g-FW { color: #fff; border-color: transparent; } .posel.g-GK { background-color: #ef8a17; } .posel.g-DF { background-color: #2f9e44; } .posel.g-MF { background-color: #2f74d0; } .posel.g-FW { background-color: #d6382f; } .posel option, .rate option { color: var(--ink); background: var(--field); }
.mp-info small { color: var(--muted); font-size: 11px; }

th.ic { text-align: right; } th.ic .si { width: 17px; height: 17px; vertical-align: middle; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; } th.ic .si.crd { stroke-width: 1.2; }
table.squad td.num { width: 52px; }
table.squad th.num, table.squad td.num { text-align: center; }

.natbtn { background: none; border: 1px dashed transparent; border-radius: 6px; padding: 2px 4px; cursor: pointer; display: inline-flex; align-items: center; } .natbtn:hover { border-color: var(--line); background: var(--soft2); }
.natbtn .logo, td.natc .logo { width: 24px; height: 24px; } .natnone { width: 24px; height: 24px; border-radius: 50%; border: 1px dashed var(--line); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.mp-lineup > .row { flex-wrap: wrap; row-gap: 6px; } .mp-lineup > .row .btn { white-space: nowrap; }
table.squad th.natth, table.squad td.natc { width: 70px; text-align: center; }

/* ---- news */
.news-list { display: flex; flex-direction: column; gap: 10px; } .news-list.big { gap: 14px; }
.news-card { display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; } .news-card:hover { border-color: var(--accent); }
.card .news-card { background: var(--soft2); }
.nc-cover { width: 150px; height: 96px; object-fit: cover; border-radius: 8px; flex: none; }
.nc-body { min-width: 0; flex: 1; } .nc-body h3 { margin: 0 0 2px; font-size: 16px; } .nc-body p { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.nc-meta { font-size: 12px; } .nc-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.chip.nlink { background: var(--soft2); border: 1px solid var(--line); color: inherit; font-size: 12px; text-decoration: none; padding: 2px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; } a.chip.nlink:hover { border-color: var(--accent); }
.chip.nlink .x { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 0; font-size: 12px; } .chip.gone { opacity: .6; font-style: italic; }
.draft-tag { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; background: #f2c40f; color: #3a2f00; padding: 2px 6px; border-radius: 4px; vertical-align: middle; }
.newsbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; padding: 7px 10px; background: var(--soft2); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; } .newsbar i { display: inline-flex; color: var(--muted); }
em.nb { font-style: normal; position: absolute; top: -6px; right: -6px; min-width: 15px; height: 15px; line-height: 15px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; text-align: center; padding: 0 3px; } .md-nav .md { position: relative; }
.article h1 { margin: 0 0 4px; } .art-cover { width: 100%; max-height: 340px; object-fit: cover; border-radius: 10px; margin-bottom: 14px; } .art-meta { margin-bottom: 14px; }
.art-body { font-size: 16px; line-height: 1.65; } .art-body p { margin: 0 0 14px; } .art-body h3 { margin: 22px 0 8px; font-size: 19px; } .art-body blockquote { margin: 16px 0; padding: 6px 16px; border-left: 4px solid var(--accent); font-size: 18px; font-style: italic; color: var(--muted); }
.art-body.preview { background: var(--soft2); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; }
.mcards { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.mcard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; background: var(--soft2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: inherit; text-decoration: none; } .mcard:hover { border-color: var(--accent); }
.mc-t { display: flex; align-items: center; gap: 8px; } .mc-t.r { justify-content: flex-end; } .mc-s { font-size: 22px; font-weight: 800; letter-spacing: .02em; } .mcard small { grid-column: 1 / -1; text-align: center; }
.art-links { margin-top: 18px; } .art-actions { margin-top: 16px; gap: 8px; }
.art-form .field { margin-bottom: 12px; } .art-text { width: 100%; font: inherit; line-height: 1.55; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: inherit; resize: vertical; box-sizing: border-box; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .fmtbar { display: flex; gap: 4px; }
.cover-field { display: flex; align-items: center; gap: 14px; } .cover-field img { width: 150px; height: 96px; object-fit: cover; border-radius: 8px; }
.linkadd { flex-wrap: wrap; gap: 8px; margin-top: 12px; } .linkadd select { max-width: 280px; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }

/* ---- news: compact panels side by side */
.news-list, .news-list.big { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; align-items: stretch; }
.news-card { flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
.nc-cover { width: 100%; height: 118px; border-radius: 0; }
.nc-body { padding: 11px 13px 12px; display: flex; flex-direction: column; } .nc-body h3 { font-size: 15px; line-height: 1.25; }
.nc-body .nc-sum { margin: 6px 0 0; color: inherit; font-weight: 700; font-size: 13px; line-height: 1.4; } .nc-body p { font-size: 13px; }
.nc-body .nc-meta { margin-top: 8px; font-size: 11.5px; } .nc-body .nc-links { margin-top: 8px; } .nc-body .chip.nlink { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-sum { font-size: 18px; font-weight: 700; line-height: 1.4; margin: 4px 0 10px; }
.art-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; } .md-panel { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; }
.md-panel h3 { margin: 0 0 8px; font-size: 13px; } .mp-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; width: 100%; background: none; border: 0; border-top: 1px solid var(--line); padding: 6px 2px; font: inherit; font-size: 13px; color: inherit; cursor: pointer; text-align: left; } .mp-row:first-of-type { border-top: 0; } .mp-row:hover { background: var(--soft2); } .mp-row .a { text-align: right; } .mp-row b { white-space: nowrap; }
.art-form textarea[data-art=summary] { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: inherit; resize: vertical; box-sizing: border-box; font-weight: 600; }

/* ---- news: bigger titles with a divider before the standfirst */
.nc-body h3 { font-size: 18px; line-height: 1.25; margin: 0; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.nc-body .nc-sum, .nc-body > p { margin-top: 9px; }
.article h1 { font-size: 30px; line-height: 1.2; margin: 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.art-sum { margin: 12px 0 10px; }
.article h1 + .art-meta { margin-top: 10px; }

/* ---- player stats: tables side by side, wrapping when the window is narrow */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 14px; align-items: start; } .stat-grid > .card { min-width: 0; margin: 0; overflow-x: auto; }
.aw-win { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 15px; } .aw-win .aw-name { font-weight: 600; } .aw-win .aw-dot { color: var(--muted); }
.aw-win .team { display: inline-flex; align-items: center; gap: 7px; } .aw-win .logo { width: 26px; height: 26px; font-size: 10px; }
.awards { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); } .aw-win { flex-wrap: wrap; row-gap: 4px; } .aw-win .aw-name, .aw-win .team, .aw-win .tn { white-space: nowrap; }

/* match ratings */
.rt { display: inline-block; min-width: 2.9em; text-align: center; padding: 1px 6px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 700; flex: none; font-variant-numeric: tabular-nums; }
.rt-red { background: var(--rt-red); } .rt-orange { background: var(--rt-orange); } .rt-green { background: var(--rt-green); } .rt-blue { background: var(--rt-blue); }
select.rate { width: 54px; flex: none; font-weight: 700; text-align: center; text-align-last: center; padding: 2px 2px; border-radius: 4px; }
select.rate.rt-red, select.rate.rt-orange, select.rate.rt-green, select.rate.rt-blue { color: #fff; border-color: transparent; }
.rate-gap { width: 54px; flex: none; }
.lu-row > .rt { margin-left: 2px; }
svg.mp-pitch .cap-b circle { fill: var(--gold); stroke: #fff; stroke-width: .35; } svg.mp-pitch .cap-b text { font-size: 2.5px; font-weight: 800; text-anchor: middle; fill: #fff; }

/* player picker pop-up */
.pk-pop { position: fixed; z-index: 3000; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(10, 20, 40, .22); overflow-y: auto; padding: 4px; }
.pk-h { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 7px 8px 3px; }
.pk-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 7px; cursor: pointer; }
.pk-row:hover, .pk-row.act { background: var(--accent-soft); }
.pk-row.dim .pk-n, .pk-row.dim .numc { opacity: .55; }
.pk-row .numc { width: 24px; height: 24px; font-size: 11px; border-width: 2px; }
.pk-n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; } .pk-n b { color: var(--accent2); font-weight: 800; }
.pk-st { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pk-w { font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.pk-new { border-top: 1px solid var(--line2); border-radius: 0 0 7px 7px; margin-top: 4px; color: var(--accent2); font-weight: 600; } .pk-plus { width: 24px; text-align: center; font-weight: 800; font-size: 16px; }
.pk-empty { padding: 10px 10px; color: var(--muted); font-size: 13px; }
.pk-foot { font-size: 11px; color: var(--muted); padding: 6px 8px 3px; border-top: 1px solid var(--line2); margin-top: 4px; }
.sq-count { display: inline-block; vertical-align: 2px; min-width: 24px; text-align: center; padding: 0 9px; margin-left: 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent2); font-size: 13px; font-weight: 700; line-height: 20px; }
.row > h2.sq-h { margin: 0; }
.mv { display: inline-flex; flex-direction: column; gap: 1px; width: 26px; flex: none; align-items: center; }
.mvb { border: 0; background: transparent; color: var(--muted); font-size: 9px; line-height: 12px; padding: 0 6px; cursor: pointer; border-radius: 3px; } .mvb:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent2); } .mvb:disabled { opacity: .25; cursor: default; }

/* squad: editable shirt number and captain circle */
input.numin { padding: 0; text-align: center; cursor: text; font-family: inherit; line-height: 1; -moz-appearance: textfield; appearance: textfield; } input.numin:hover { border-color: var(--accent); } input.numin:focus { outline: none; border-color: var(--accent); background: var(--field); }
.cap-c { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 20px; height: 20px; margin-left: 8px; border-radius: 50%; border: 2px solid var(--gold); background: var(--gold); color: #fff; font-size: 11px; font-weight: 800; line-height: 1; padding: 0; font-family: inherit; vertical-align: middle; }
button.cap-c { cursor: pointer; } .cap-c.off { background: transparent; border: 1.5px dashed var(--muted); color: var(--muted); opacity: 0; } tr:hover .cap-c.off, .cap-c.off:focus-visible { opacity: .7; } .cap-c.off:hover { opacity: 1; border-color: var(--gold); color: var(--gold); }

/* match screen: player drop-down, read-only numbers, links */
.lu-nc { width: 36px; flex: none; display: inline-flex; justify-content: center; } .lu-nc .numc { width: 26px; height: 26px; font-size: 11px; border-width: 2px; }
.lu-nw { position: static; display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; } .lu-nw .lu-flag { position: static; transform: none; width: auto; pointer-events: auto; flex: none; }
.pnbtn { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; min-width: 0; flex: 1; text-align: left; font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.pnbtn:hover:not(:disabled) { border-color: var(--accent); } .pnbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; } .pnbtn:disabled { opacity: .45; cursor: default; }
.pnbtn .pn-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; } .pnbtn .pn-ph { color: var(--muted); font-weight: 400; } .pn-car { color: var(--muted); font-style: normal; font-size: 11px; flex: none; }
.ev-row .pnbtn { flex: 1 1 150px; width: auto; }
.pl-link { color: inherit; text-decoration: none; cursor: pointer; } .pl-link:hover { color: var(--accent2); text-decoration: underline; }
.pl-go { flex: none; width: 20px; text-align: center; color: var(--muted); text-decoration: none; font-size: 13px; line-height: 1; cursor: pointer; border-radius: 4px; } .pl-go:hover { color: var(--accent2); background: var(--accent-soft); }
svg.mp-pitch .pp.pl-click { cursor: pointer; } svg.mp-pitch .pp.pl-click:hover .pc { stroke-width: .9; }
.pk-clear .pk-x { width: 24px; text-align: center; color: var(--muted); } .pk-row.sel { background: var(--soft); } .pk-row.sel.act { background: var(--accent-soft); }
.pk-row.sel .pk-n::after { content: ' ✓'; color: var(--accent2); }
/* squads: dividers between position groups */
table.squad tbody tr.grp-start td { border-top: 2px solid var(--line); }
/* player page */
.pl-head .pl-flag { display: inline-flex; } .pl-head h1 { margin: 0 0 4px; } .pl-head p { display: flex; align-items: center; gap: 8px; margin: 0; flex-wrap: wrap; }
.pl-club { display: inline-flex; align-items: center; gap: 6px; color: inherit; text-decoration: none; cursor: pointer; font-weight: 600; } .pl-club:hover { color: var(--accent2); text-decoration: underline; }
.hn-team { padding: 10px 0; border-top: 1px solid var(--line2); } .hn-team:first-of-type { border-top: 0; } .hn-th { margin-bottom: 6px; font-size: 15px; }
.hn-row { display: flex; align-items: baseline; gap: 8px; padding: 4px 0 4px 6px; flex-wrap: wrap; } .hn-ico { font-style: normal; width: 20px; text-align: center; } .hn-n { font-weight: 700; } .hn-x { background: var(--accent-soft); color: var(--accent2); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 800; } .hn-s { font-size: 12.5px; } .hn-sub { font-size: 12.5px; }
table.career tr.tot td { border-top: 2px solid var(--line); font-weight: 700; }

/* 1.12.1 player page + players list */
.pl-head h1.pl-title { display: flex; align-items: center; gap: .35em; margin: 0 0 6px; line-height: 1.15; }
.pl-title .pl-flag, .pl-natc, .pl-nat { display: inline-flex; align-items: center; }
.logo.fl { height: .78em; width: auto; max-width: 1.6em; border-radius: 2px; vertical-align: middle; }
.logo.ph.fl { width: 2.4em; height: 2.4em; font-size: .33em; border-radius: 50%; }
.pl-title .logo.fl { height: .78em; }
.pl-nat { gap: 7px; } .pl-nat .logo.fl { height: 1.1em; max-width: 1.8em; font-size: 14px; } .pl-nat .logo.ph.fl { width: 1.3em; height: 1.3em; font-size: 9px; }
td .pl-natc .logo.fl { height: 16px; max-width: 26px; } td .pl-natc .logo.ph.fl { width: 22px; height: 22px; font-size: 9px; }
.kv-row > .kv-k { font-size: 12px; color: var(--muted); } .kv-row b { display: inline-flex; align-items: center; min-height: 26px; }
.kv-row b .ptag, .kv-row b .numc { color: #fff; } .kv-row b .numc { color: #3a3f45; }
.ret-ico { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; color: var(--muted); flex: none; }
.rt.rt-none { background: var(--soft); color: var(--muted); border: 1px solid var(--line); padding: 0 5px; }
td .rt, td .rt.rt-none { min-width: 3.4em; box-sizing: border-box; }
.pl-title .logo.ph.fl { width: .85em; height: .85em; font-size: 11px; }
.pl-nat .logo.ph.fl { width: 20px; height: 20px; font-size: 9px; } .pl-nat .tn { font-weight: 600; }

table.grid th.pl-narrow, table.grid td.pl-narrow { width: 1%; white-space: nowrap; padding-left: 8px; padding-right: 8px; text-align: center; }
table.grid th.pl-name, table.grid td.pl-name { text-align: left; padding-right: 28px; }

/* resizable grid columns */
table.grid thead th { position: relative; } table.grid thead th.num .g-rs, table.grid thead th .g-rs { position: absolute; top: 0; right: -3px; width: 8px; height: 100%; cursor: col-resize; z-index: 2; }
table.grid thead th .g-rs::after { content: ''; position: absolute; top: 25%; bottom: 25%; left: 3px; width: 2px; border-radius: 1px; background: var(--line); opacity: 0; } table.grid thead th:hover .g-rs::after, body.g-resizing .g-rs::after { opacity: 1; } .g-rs:hover::after { background: var(--accent) !important; }
table.grid.sized { table-layout: fixed; }
table.grid.sized th, table.grid.sized td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: auto; }
table.grid.sized th.pl-narrow, table.grid.sized td.pl-narrow { width: auto; text-align: left; }
body.g-resizing { cursor: col-resize; user-select: none; }
b.sn { font-weight: 700; }

/* transfers */
.pl-head { display: flex; align-items: flex-start; gap: 12px; } .pl-head .pl-main { min-width: 0; } .pl-head > .btn { flex: none; }
.tr-box { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent); } .tr-box.loan { border-style: dashed; }
.tr-box .tr-ico { font-style: normal; font-size: 20px; color: var(--accent2); flex: none; } .tr-box .tr-txt { flex: 1; min-width: 0; line-height: 1.7; } .tr-box .pl-club { vertical-align: middle; }
.tr-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 10px; } @media (min-width: 1100px) { .tr-grid { grid-template-columns: 1fr 1fr; } }
.pill.tr-transfer { background: #dbeafe; color: #1e40af; } .pill.tr-loan { background: #fef3c7; color: #92400e; } .pill.tr-free { background: #dcfce7; color: #166534; } .pill.tr-retire { background: #e5e7eb; color: #374151; } .pill.tr-return { background: var(--soft); color: var(--muted); }
tr.tr-plan-row td { background: var(--accent-soft); }
.tr-break { margin-bottom: 14px; }
.btn.danger { color: #b91c1c; border-color: #fca5a5; }

/* ---- news front page */
.np-mast { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 0 0 10px; margin-bottom: 18px; border-bottom: 3px double var(--ink); }
.np-mast h1 { margin: 0; font-size: 40px; line-height: 1; letter-spacing: -.5px; } .np-sub { margin-top: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.np-ctrl { gap: 8px; align-items: center; }
.np-kick { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent2); margin-bottom: 5px; }
.np-meta { font-size: 12px; color: var(--muted); margin-top: 8px; }
.np article { cursor: pointer; } .np h2, .np h3 { margin: 0; } .np article:hover h2, .np article:hover h3 { color: var(--accent2); }
.np-ph { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--soft), var(--soft2)); color: var(--muted); }
.np-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 22px; }
.np-lead .np-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; display: block; } .np-lead-b { padding-top: 12px; } .np-lead h2 { font-size: 34px; line-height: 1.12; letter-spacing: -.4px; }
.np-sum { margin: 10px 0 0; font-size: 17px; line-height: 1.5; color: var(--ink); opacity: .85; }
.np-side { border-left: 1px solid var(--line); padding-left: 22px; display: flex; flex-direction: column; } .np-sh, .np-sec span { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.np-sh { padding-bottom: 8px; border-bottom: 2px solid var(--ink); margin-bottom: 2px; }
.np-sitem { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); } .np-sitem:last-child { border-bottom: 0; } .np-sitem h3 { font-size: 17px; line-height: 1.25; }
.np-simg { width: 96px; height: 68px; object-fit: cover; border-radius: 3px; flex: none; } .np-sb { min-width: 0; } .np-sitem .np-meta { margin-top: 5px; }
.np-sec { margin: 28px 0 14px; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }
.np-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.np-cimg { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 3px; display: block; } .np-cb { padding-top: 10px; } .np-cb h3 { font-size: 20px; line-height: 1.2; } .np-cb p { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.np-list { display: flex; flex-direction: column; } .np-row { display: flex; gap: 18px; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--line); } .np-row:first-child { padding-top: 0; }
.np-rb { min-width: 0; } .np-rb h3 { font-size: 21px; line-height: 1.2; } .np-rb p { margin: 6px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--muted); } .np-rimg { width: 190px; height: 120px; object-fit: cover; border-radius: 3px; flex: none; }
@media (max-width: 900px) { .np-top { grid-template-columns: 1fr; } .np-side { border-left: 0; padding-left: 0; } .np-lead h2 { font-size: 27px; } .np-mast h1 { font-size: 30px; } .np-rimg { width: 110px; height: 76px; } }

.dfield { display: inline-flex; align-items: center; } .dfield input[type=date] { width: auto; min-width: 150px; color-scheme: light; } html[data-theme="midnight"] .dfield input[type=date] { color-scheme: dark; }

/* ---- dashboard widgets (three columns) */
.dash { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; grid-auto-flow: row dense; }
.dw-s1 { grid-column: span 1; } .dw-s2 { grid-column: span 2; } .dw-s3 { grid-column: span 3; }
.dw { min-width: 0; } .dw-card { margin: 0; } .dw-head { align-items: baseline; } .dw-head h2 { margin: 0 0 8px; font-size: 18px; } .dw-head a { cursor: pointer; }
.dw.editing .dw-card { outline: 2px dashed var(--line); outline-offset: 2px; }
.dw-bar { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; } .dw-bar .btn.small { padding: 2px 8px; min-width: 28px; }
.dw-table { overflow: hidden; container-type: inline-size; } .dw-table .tbl { font-size: 13px; }
.np { container-type: inline-size; }
.np-art .np-lead h2 { font-size: 24px; }
@container (max-width: 640px) { .np-top { grid-template-columns: 1fr; } .np-side { border-left: 0; padding-left: 0; } .np-lead h2 { font-size: 24px; } .np-rimg { width: 110px; height: 76px; } .np-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; } .dw-s1, .dw-s2, .dw-s3 { grid-column: span 1; } }
.np-lead .np-img { max-height: 380px; }
/* every widget has exactly the same height; long content scrolls inside */
.dash { grid-auto-rows: 272px; align-items: stretch; }
.dw { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.dw-card { flex: 1; min-height: 0; display: flex; flex-direction: column; } .dw-head { flex: none; }
.dw-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.dw-r1 { grid-row: span 1; } .dw-r2 { grid-row: span 2; } .dw-r3 { grid-row: span 3; } .dw-r4 { grid-row: span 4; } .dw-r5 { grid-row: span 5; } .dw-r6 { grid-row: span 6; }
.dw { position: relative; } .dw-rh { position: absolute; z-index: 3; background: var(--accent); opacity: .0; border-radius: 4px; } .dw.editing .dw-rh { opacity: .25; } .dw.editing .dw-rh:hover, .dw-dragging .dw-rh { opacity: .8; }
.dw-rx { top: 12px; bottom: 12px; right: -5px; width: 6px; cursor: ew-resize; } .dw-ry { left: 12px; right: 12px; bottom: -5px; height: 6px; cursor: ns-resize; } .dw-rxy { right: -6px; bottom: -6px; width: 14px; height: 14px; cursor: nwse-resize; border-radius: 50%; }
.dw-dragging { user-select: none; cursor: grabbing; }
@media (max-width: 900px) { .dw-s1, .dw-s2, .dw-s3 { grid-column: span 1 !important; } }

/* league-table widget: show as many columns as fit, never a sideways scrollbar */
.dw-table .tbl { width: 100%; table-layout: auto; } .dw-table .tbl td:nth-child(2) { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@container (max-width: 540px) { .dw-table .standings th:nth-child(n+7):nth-child(-n+9), .dw-table .standings td:nth-child(n+7):nth-child(-n+9) { display: none; } }
@container (max-width: 400px) { .dw-table .standings th:nth-child(n+4):nth-child(-n+9), .dw-table .standings td:nth-child(n+4):nth-child(-n+9) { display: none; } }

/* scrollbars: slim, rounded, floating thumb (macOS Lion style) in the theme colours */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 60%, transparent) transparent; }
@supports selector(::-webkit-scrollbar) {
  * { scrollbar-width: auto; scrollbar-color: auto; }
  ::-webkit-scrollbar { width: 14px; height: 14px; background: transparent; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--muted) 55%, transparent); border-radius: 999px; border: 4px solid transparent; background-clip: padding-box; min-height: 40px; min-width: 40px; }
  ::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--muted) 85%, transparent); border-width: 3px; }
  ::-webkit-scrollbar-thumb:active { background-color: var(--accent); }
  ::-webkit-scrollbar-corner { background: transparent; } ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
}

/* ---- dashboard: fixed 4 x 3 grid, widgets placed by x / y / w / h */
.dash { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 3), 250px); grid-auto-rows: 250px; gap: 16px; align-items: stretch; grid-auto-flow: row; position: relative; }
.dw, .dg-cell, .dw-ghost { grid-column: calc(var(--x) + 1) / span var(--w, 1); grid-row: calc(var(--y) + 1) / span var(--h, 1); }
.dg-cell { border: 2px dashed var(--line); border-radius: 10px; background: color-mix(in srgb, var(--soft) 50%, transparent); }
.dw.editing { z-index: 1; } .dw.dragging { opacity: .45; }
.dw-ghost { z-index: 4; border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 10px; pointer-events: none; } .dw-ghost[hidden] { display: none; } .dw-ghost.bad { border-color: #d64545; background: rgba(214, 69, 69, .14); }
.dw-bar { cursor: grab; } .dw-dragging .dw-bar { cursor: grabbing; }
.dash-title { font: inherit; font-size: 40px; line-height: 1; font-weight: 800; letter-spacing: -.5px; border: 0; border-bottom: 2px dashed var(--accent); background: transparent; color: var(--ink); padding: 0 0 2px; width: min(100%, 640px); outline: none; }
.dw-r1, .dw-r2, .dw-r3, .dw-r4, .dw-r5, .dw-r6 { grid-row: auto; }
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; grid-template-rows: none; } .dw, .dg-cell, .dw-ghost { grid-column: 1; grid-row: span var(--h, 1); } .dg-cell { display: none; } }

/* the 4 x 3 board always fills the window: cells stretch with the screen */
.dash { grid-template-rows: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); height: calc(100vh - 160px); min-height: 560px; }
@media (max-width: 900px) { .dash { height: auto; min-height: 0; grid-template-rows: none; grid-auto-rows: 250px; } }

/* the dashboard never scrolls: header + the 4 x 3 board share exactly the window */
#main:has(.dashpage) { display: flex; flex-direction: column; overflow: hidden; }
.dashpage { flex: 1; min-height: 0; display: flex; flex-direction: column; box-sizing: border-box; }
.dashpage .np-mast { flex: none; }
.dashpage .dash { flex: 1; min-height: 0; height: auto; }
@media (max-width: 900px) { #main:has(.dashpage) { display: block; overflow: auto; } .dashpage { display: block; } .dashpage .dash { flex: none; } }
.inline-check { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 10px; font-size: 13.5px; line-height: 1.4; } .inline-check input { margin-top: 3px; }

/* ---- Seasons page */
.ss-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ss-pick { display: flex; align-items: center; gap: 4px; } .ss-sel { font-size: 20px; font-weight: 700; padding: 6px 10px; min-width: 220px; }
.ss-tabs { flex-wrap: wrap; margin-bottom: 16px; }
.ss-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.ss-panel { margin: 0; padding: 14px 16px 10px; }
.ss-ph { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; min-height: 28px; }
.ss-ph h3 { margin: 0; font-size: 17px; line-height: 28px; }
.ss-ph .logo { width: 28px; height: 28px; flex: none; display: block; object-fit: contain; }
.ss-tbl { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ss-tbl td { padding: 6px 0; vertical-align: middle; border-top: 1px solid var(--line); } .ss-tbl tr:first-child td { border-top: 0; }
.ss-name { padding-right: 10px !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ss-name a { cursor: pointer; font-weight: 600; }
.ss-prog { width: 74px; } .ss-cnt { width: 52px; text-align: right; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ss-bar { height: 7px; border-radius: 4px; background: var(--soft2, var(--line)); overflow: hidden; } .ss-bar div { height: 100%; background: var(--accent); border-radius: 4px; }
.ss-done .ss-bar div { background: var(--ok, #2f9e44); } .ss-done .ss-cnt { color: var(--ok, #2f9e44); }
.ss-tbl tr.ss-div td { padding: 0; height: 0; border-top: 2px solid var(--ink); opacity: .5; }
.ss-empty { margin: 4px 0 8px; }
.ss-panel.ss-edit { cursor: grab; outline: 2px dashed var(--line); outline-offset: 2px; } .ss-grip { color: var(--muted); font-size: 18px; line-height: 1; cursor: grab; }
.ss-dragging { opacity: .4; } .ss-over { outline: 2px solid var(--accent) !important; background: color-mix(in srgb, var(--accent) 8%, var(--card, transparent)); }
@media (max-width: 1250px) { .ss-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .ss-grid { grid-template-columns: 1fr; } .ss-sel { min-width: 0; font-size: 17px; } }
.ss-ph .logo.ph { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; border-radius: 50%; line-height: 1; overflow: hidden; }
.ss-bar { background: var(--line); }
/* every panel is the same height: room for 5 leagues + 5 cups; anything more scrolls inside */
.ss-grid { align-items: stretch; grid-auto-rows: 510px; }
.ss-panel { height: 100%; min-height: 0; display: flex; flex-direction: column; box-sizing: border-box; }
.ss-ph { flex: none; } .ss-panel > .ss-tbl, .ss-panel > .ss-empty { flex: none; }
.ss-panel { overflow-y: auto; overflow-x: hidden; }

/* buttons without their own colour must follow the theme (dark mode showed black matchday numbers) */
button.md, button.tab { color: var(--ink); }
html[data-theme="midnight"] .tabbtn { color: rgba(255, 255, 255, .78); } html[data-theme="midnight"] .tabbtn:hover, html[data-theme="midnight"] .tabbtn.active { color: #fff; }
html[data-theme="midnight"] .md { color: #fff; }
.ss-pick { align-items: stretch; gap: 6px; } .ss-pick .ss-arrow { font-size: 24px; line-height: 1; padding: 0 14px; min-width: 46px; display: flex; align-items: center; justify-content: center; }
.ss-pick .ss-arrow:disabled { opacity: .35; }
/* seasons page: arrows centred, labelled leagues / cups, divider under the panel title */
.ss-pick .ss-arrow { padding: 0; width: 46px; } .ss-arrow svg { display: block; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ss-ph { padding-bottom: 10px; margin-bottom: 4px; border-bottom: 2px solid var(--line); }
.ss-tbl td { border-top: 1px solid var(--line2, var(--line)); } .ss-tbl tr.ss-sec td { border-top: 0; padding: 12px 0 4px; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ss-tbl tr.ss-sec + tr td { border-top: 0; }
.ss-tbl tr.ss-sec:not(:first-child) td { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 14px; }
.ss-tbl col.ss-c2 { width: 74px; } .ss-tbl col.ss-c3 { width: 52px; }
/* bulk selection in tables */
.tbl.grid th.gsel, .tbl.grid td.gsel { width: 38px; min-width: 38px; max-width: 38px; padding-left: 12px; padding-right: 0; text-align: center; }
.tbl.grid th.gsel input, .tbl.grid td.gsel input { width: 16px; height: 16px; margin: 0; vertical-align: middle; cursor: pointer; accent-color: var(--accent); }
.tbl.grid tr.selected td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.grid-bar .gb-sel { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 3px 6px 3px 10px; border: 1px solid var(--accent); border-radius: 8px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.bulk-list { margin: 6px 0 10px; padding-left: 20px; max-height: 220px; overflow: auto; }
.bulk-list li { padding: 1px 0; }
/* flags in tables: one identical box for every flag, centred in the row */
td .pl-natc { display: flex; align-items: center; justify-content: flex-start; height: 24px; }
td .pl-natc .logo.fl { width: 24px; height: 16px; max-width: none; object-fit: cover; border-radius: 2px; display: block; box-shadow: 0 0 0 1px rgba(0,0,0,.14); flex: none; }
td .pl-natc .logo.ph.fl { width: 22px; height: 22px; font-size: 9px; border-radius: 50%; box-shadow: none; }
td.pl-narrow { vertical-align: middle; }
.kv-row b small { margin-left: 8px; font-weight: 400; }
/* club history tab */
.ch-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.ch-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ch-stat b { font-size: 24px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-stat span { font-size: 12px; color: var(--muted); }
.ch-tbl .ch-s { width: 90px; color: var(--muted); }
.ch-mv { font-size: 12px; font-weight: 700; } .ch-mv.up { color: #15803d; } .ch-mv.down { color: #b91c1c; }
html[data-theme="midnight"] .ch-mv.up { color: #4ade80; } html[data-theme="midnight"] .ch-mv.down { color: #f87171; }
.ch-titles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 8px; }
.ch-title { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.ch-tn { display: flex; align-items: center; gap: 8px; } .ch-tn .h-count { margin-left: auto; }
.ch-yrs { margin-top: 6px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.ch-tn svg { width: 28px; height: 28px; flex: none; }
/* themed table checkboxes (no bright native boxes in the dark theme) */
.tbl.grid th.gsel input, .tbl.grid td.gsel input { -webkit-appearance: none; appearance: none; width: 17px; height: 17px; border: 1.5px solid var(--muted); border-radius: 5px; background: transparent; display: inline-grid; place-content: center; transition: background .12s, border-color .12s; }
.tbl.grid th.gsel input:hover, .tbl.grid td.gsel input:hover { border-color: var(--accent); }
.tbl.grid th.gsel input:checked, .tbl.grid td.gsel input:checked { background: var(--accent); border-color: var(--accent); }
.tbl.grid th.gsel input:checked::after, .tbl.grid td.gsel input:checked::after { content: ""; width: 9px; height: 5px; border: solid #fff; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.tbl.grid th.gsel input:focus-visible, .tbl.grid td.gsel input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html[data-theme="midnight"] .tbl.grid tr.selected td { background: color-mix(in srgb, var(--accent) 22%, transparent); }
/* the big figure shrinks to fit its box (one line, never cut off) */
.ch-stat { container-type: inline-size; }
.ch-stat b { font-size: clamp(12px, calc(100cqw / (var(--n, 1) * 0.6)), 24px); overflow: visible; text-overflow: clip; }
.ch-stat b { font-size: clamp(10px, calc(100cqw / (var(--n, 1) * 0.6)), 24px); overflow: hidden; text-overflow: ellipsis; }
.ch-strip { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 2fr); }
.ch-stat b { line-height: 30px; white-space: nowrap; }
.aw-lead, .aw-note, .aw-also { margin-top: 5px; font-size: 13px; } .aw-note { font-size: 12px; font-style: italic; }
.aw-btns { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.aw-rules { margin-top: 14px; font-size: 13px; color: var(--muted); } .aw-rules summary { cursor: pointer; font-weight: 600; } .aw-rules p { margin: 8px 0 0; }
/* qualifying rounds: editor + league table tags */
.qplan { margin: 10px 0; } .qplan .tot td { font-weight: 600; border-top: 2px solid var(--line); }
.qf { font-size: 12px; color: var(--muted); } .qf.ok { color: #15803d; font-weight: 600; } .qf.bad { color: #b91c1c; font-weight: 600; }
html[data-theme="midnight"] .qf.ok { color: #4ade80; } html[data-theme="midnight"] .qf.bad { color: #f87171; }
.standings tr.qrow td { background: color-mix(in srgb, hsl(var(--qh) 75% 50%) calc(var(--qa) * 1%), transparent); }
.qtag { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; color: #fff; background: hsl(var(--qh) 62% 44%); vertical-align: middle; white-space: nowrap; }
.legend .qk::before { background: hsl(var(--qh) 62% 44%); opacity: calc(.45 + var(--qa) / 50); border-radius: 50%; }
.qnote { font-size: 12px; font-style: italic; margin: 6px 0 0; }
.ntag { margin-left: 5px; font-size: .78em; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
/* drop-downs between competitions */
.standings tr.z-d td.pos { border-left-color: var(--zone-po); } .standings tr.z-d { background: color-mix(in srgb, var(--zone-po) 12%, transparent); }
.legend .z-q::before { background: var(--zone-up); } .legend .z-d::before { background: var(--zone-po); }
#update-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 9999; background: var(--ink); color: var(--panel); padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.3); font-size: 13.5px; display: flex; gap: 12px; align-items: center; }
#update-bar button { border: 0; border-radius: 8px; padding: 5px 12px; font-weight: 600; background: var(--accent); color: #fff; cursor: pointer; }
/* cloud sync */
.cloud-state { margin-top: 6px; font-size: 11.5px; color: var(--muted); } .cloud-state.offline, .cloud-state.signedout { color: #b45309; } html[data-theme="midnight"] .cloud-state.offline, html[data-theme="midnight"] .cloud-state.signedout { color: #fbbf24; }
.cloud-state:empty { display: none; }
#remote-bar { position: sticky; top: 0; z-index: 9998; background: #fef3c7; color: #78350f; padding: 8px 14px; font-size: 13.5px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid #f59e0b; }
html[data-theme="midnight"] #remote-bar { background: #422006; color: #fde68a; border-color: #b45309; }
.g-btn { min-height: 44px; margin-top: 8px; }

.app-ver{margin-top:4px;font-size:11px;opacity:.6}
.usage{margin:10px 0}.meter{height:8px;border-radius:4px;background:var(--line,rgba(128,128,128,.25));overflow:hidden}.meter>div{height:100%;background:var(--accent,#2a7)}.meter>div.mid{background:#d9a020}.meter>div.hi{background:#c0392b}

/* ---- phones: everything below only applies on narrow screens; the desktop layout is untouched ---- */
#topbar, #scrim { display: none; }
@media (max-width: 800px) {
  html, body { overflow-x: hidden; }
  #app { flex-direction: column; height: 100vh; height: 100dvh; }
  #topbar { display: flex; align-items: center; gap: 10px; flex: none; height: 54px; padding: 0 10px; background: var(--side); color: #fff; font-weight: 700; z-index: 40; }
  #menu-btn { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--side2); color: #fff; font-size: 22px; cursor: pointer; }
  #top-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
  #sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 84vw; max-width: 320px; z-index: 70; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 30px rgba(0,0,0,.4); }
  body.menu-open #sidebar { transform: none; }
  body.menu-open #scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 65; }
  #sidebar nav a { padding: 13px 12px; }
  #main { min-height: 0; width: 100%; -webkit-overflow-scrolling: touch; }
  .page { padding: 14px 12px 70px; max-width: 100%; }
  h1 { font-size: 21px; flex-wrap: wrap; }
  .hero h1 { font-size: 26px; }
  .split, .row3, .stats, .row2, .grid2, .grid3 { grid-template-columns: 1fr !important; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 12px; overflow-x: auto; }
  .btn, button, select, textarea, input:not([type=checkbox]):not([type=radio]) { min-height: 40px; }
  input, select, textarea { font-size: 16px; max-width: 100%; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  .btn.small, .btn.ghost.small { min-height: 34px; }
  .page-head { gap: 6px; }
  .page-foot { flex-wrap: wrap; }
  .modal-bg { padding-top: 0; align-items: stretch; }
  .modal { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  table { max-width: 100%; }
  #remote-bar, #update-bar { font-size: 13px; }
}

/* news placeholder: a stylised pitch in the theme colours, for stories without a cover photo */
.np-ph, .nc-ph { position: relative; overflow: hidden; display: flex !important; align-items: center; justify-content: center; color: rgba(255,255,255,.92); background: linear-gradient(135deg, var(--accent2), var(--accent)); }
.np-ph::before, .nc-ph::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent calc(50% - 1px), rgba(255,255,255,.28) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)), repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 12.5%, transparent 12.5% 25%); }
.np-ph::after, .nc-ph::after { content: ''; position: absolute; left: 50%; top: 50%; height: 90%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 2px solid rgba(255,255,255,.28); border-radius: 50%; }
.np-ph svg, .nc-ph svg { position: relative; z-index: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.np-ph[class*="simg"] svg, .np-ph[class*="cimg"] svg { width: 24px; height: 24px; }
/* dashboard on narrow screens: keep the order you see on a wide screen (top to bottom, then left to right) */
@media (max-width: 900px) { .dash > .dw { order: calc(var(--y, 0) * 10 + var(--x, 0)); } }
