:root {
  --bg: #0b1226;
  --bg2: #111b38;
  --card: rgba(20, 31, 64, 0.82);
  --line: rgba(224, 179, 84, 0.18);
  --line2: rgba(255, 255, 255, 0.08);
  --text: #eef0f6;
  --muted: #9aa3bd;
  --gold: #e0b354;
  --gold2: #f3d58d;
  --green: #3fb68b;
  --red: #e5675f;
  --r1: #8b95ad;   /* average */
  --r2: #5b8def;   /* intermediate */
  --r3: #e0b354;   /* pro */
  --radius: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); background: var(--bg);
  font: 16px/1.5 "Outfit", system-ui, sans-serif;
  display: flex; flex-direction: column;
}
/* night-stadium background: moonlit sky, stars, floodlights, faint pitch */
.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(60vmax 40vmax at 85% -5%, rgba(224,179,84,.20), transparent 60%),
    conic-gradient(from 200deg at 0% 0%, transparent 0deg, rgba(255,240,200,.05) 12deg, transparent 24deg),
    conic-gradient(from 130deg at 100% 0%, transparent 0deg, rgba(255,240,200,.05) 12deg, transparent 24deg),
    radial-gradient(70vmax 30vmax at 50% 110%, rgba(47,158,107,.22), transparent 70%),
    linear-gradient(180deg, #070d1d 0%, var(--bg) 45%, #0d2030 100%);
}
.sky .stars {
  position: absolute; inset: 0 0 35% 0; opacity: .7;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff, transparent),
    radial-gradient(1px 1px at 28% 8%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 44% 26%, #ffe9b0, transparent),
    radial-gradient(1px 1px at 61% 12%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 73% 30%, #fff, transparent),
    radial-gradient(1px 1px at 91% 20%, #fff, transparent),
    radial-gradient(1px 1px at 6% 40%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 35% 45%, #fff, transparent),
    radial-gradient(1px 1px at 82% 48%, #ffe9b0, transparent),
    radial-gradient(1px 1px at 55% 5%, #fff, transparent);
  background-size: 420px 300px;
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .45; } to { opacity: .8; } }
.sky .emblem { position: absolute; width: min(58vmax, 720px); top: -6vmax; inset-inline-end: -12vmax; opacity: .05; filter: grayscale(1) blur(1px); transform: rotate(-8deg); }
.sky .field { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 34vh; color: rgba(255,255,255,.07); }
a { color: var(--gold2); }
h1, h2, h3 { font-family: "Reem Kufi", "Outfit", sans-serif; font-weight: 700; line-height: 1.2; margin: 0 0 .6em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .9rem; }

/* header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; max-width: 1180px; width: 100%; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: auto; height: 40px; flex: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.45)); }
.hero-logo { width: auto; height: clamp(150px, 34vw, 210px); display: block; margin: 0 auto 14px; filter: drop-shadow(0 10px 28px rgba(0,0,0,.5)); animation: float 6s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
.top nav a.lang { border: 1px solid var(--line); border-radius: 99px; padding: 3px 12px; color: var(--gold2); }
.top nav a.lang:lang(ar) { font-family: "Tajawal", sans-serif; }
.top nav { display: flex; align-items: center; gap: 16px; flex: none; }
.top nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.top nav a:hover { color: var(--text); }

main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px 40px; flex: 1; }
.foot { text-align: center; color: var(--muted); padding: 24px; font-size: .9rem; }

/* hero */
.hero { position: relative; text-align: center; padding: 48px 0 28px; max-width: 640px; margin: 0 auto; }
.hero.small { padding: 24px 0 16px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.1rem); background: linear-gradient(180deg, var(--gold2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .78rem; color: var(--gold); margin: 0 0 10px; }
.lede { color: var(--muted); font-size: 1.08rem; margin: 0 auto 22px; max-width: 520px; }
.stats { display: inline-flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 18px; min-width: 130px; }
.stats strong { display: block; font-size: 1.4rem; color: var(--gold2); font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: .85rem; }

.lanterns { position: absolute; inset: 0 -60px auto; height: 0; pointer-events: none; }
.lantern { position: absolute; top: -40px; width: 34px; animation: sway 5s ease-in-out infinite; transform-origin: top center; }
.lantern line { stroke: var(--gold); stroke-width: 1; opacity: .6; }
.lantern .cap { fill: var(--gold); }
.lantern .body { fill: rgba(224,179,84,.18); stroke: var(--gold); stroke-width: 1.5; }
.lantern .glow { fill: #ffd98a; opacity: .75; filter: blur(1.5px); animation: flicker 3s ease-in-out infinite; }
.lantern.l0 { left: 0; }
.lantern.l1 { right: 20px; top: -20px; width: 26px; animation-delay: -2s; }
.lantern.l2 { right: -20px; top: -55px; width: 22px; animation-delay: -3.5s; }
@keyframes sway { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes flicker { 0%,100% { opacity: .75; } 50% { opacity: .5; } }
@media (max-width: 760px) { .lanterns { display: none; } }

/* cards & forms */
.card { background: var(--card); border: 1px solid var(--line2); border-radius: var(--radius); padding: 22px; margin: 0 auto 20px; backdrop-filter: blur(8px); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.form-card { max-width: 520px; border-color: var(--line); }
.narrow { max-width: 380px; margin-top: 60px; }
form { display: grid; gap: 18px; }
label { display: grid; gap: 6px; font-weight: 500; font-size: .95rem; }
input[type=text], input[type=email], input:not([type]), input[type=number], input[type=password], input[type=datetime-local] {
  width: 100%; font: inherit; color: var(--text); background: rgba(0,0,0,.25);
  border: 1px solid var(--line2); border-radius: 10px; padding: 12px 14px; color-scheme: dark;
}
input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(224,179,84,.2); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 500; font-size: .95rem; margin-bottom: 6px; padding: 0; }
.positions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 460px) { .positions { grid-template-columns: repeat(2, 1fr); } }
.pos { display: block; cursor: pointer; }
.pos input { position: absolute; opacity: 0; pointer-events: none; }
.pos span { display: grid; place-items: center; text-align: center; gap: 2px; padding: 12px 6px; border-radius: 10px; border: 1px solid var(--line2); background: rgba(0,0,0,.2); font-size: .8rem; color: var(--muted); transition: .15s; }
.pos span b { font-size: 1.05rem; color: var(--text); }
.pos input:checked + span { border-color: var(--gold); background: rgba(224,179,84,.14); color: var(--gold2); }
.pos input:focus-visible + span { box-shadow: 0 0 0 3px rgba(224,179,84,.3); }
.hp { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none; }
html, body { overflow-x: clip; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 10px; padding: 11px 18px;
  background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #241a05; text-decoration: none; display: inline-block; text-align: center;
  transition: transform .1s, opacity .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--gold2); border: 1px solid var(--line); }
.btn.wide { width: 100%; padding: 14px; font-size: 1.05rem; }
.btn.big { padding: 12px 22px; }
.linklike { background: none; border: 0; color: var(--gold2); font: inherit; padding: 0; cursor: pointer; text-decoration: underline; }

.errors { background: rgba(229,103,95,.12); border: 1px solid rgba(229,103,95,.4); color: #ffb4ae; border-radius: 10px; padding-block: 10px; padding-inline: 30px 14px; margin: 0 0 16px; }
.success, .closed { text-align: center; padding: 12px 0; }
.success svg { width: 56px; height: 56px; stroke: var(--green); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; background: rgba(63,182,139,.14); border-radius: 50%; padding: 12px; margin-bottom: 8px; }
.success p, .closed p { color: var(--muted); }

/* admin */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.row-between h2 { margin: 0; }
.pill { font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: rgba(255,255,255,.08); color: var(--muted); }
.pill.open { background: rgba(63,182,139,.16); color: #7fe0bb; }
.pill.closed { background: rgba(229,103,95,.16); color: #ffa39c; }
.settings { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; }
.settings label { flex: 1 1 260px; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.bell { position: relative; background: none; border: 0; cursor: pointer; padding: 4px; color: var(--muted); }
.bell svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.bell.ringing { color: var(--gold2); animation: ring 2.4s ease-in-out infinite; }
.bell span { position: absolute; top: -2px; right: -4px; background: var(--red); color: white; font-size: .7rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
@keyframes ring { 0%,80%,100% { transform: rotate(0); } 85% { transform: rotate(14deg); } 90% { transform: rotate(-12deg); } 95% { transform: rotate(6deg); } }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: .85rem; background: rgba(255,255,255,.05); color: var(--muted); border: 1px solid var(--line2); border-radius: 99px; padding: 5px 12px; cursor: pointer; }
.chip.active { background: rgba(224,179,84,.15); color: var(--gold2); border-color: var(--line); }
.tally { display: flex; gap: 14px; flex-wrap: wrap; font-size: .88rem; color: var(--muted); margin-bottom: 14px; align-items: center; }
.tally b { color: var(--text); }
.tally i { width: 1px; height: 16px; background: var(--line2); }
.tally .r3 b { color: var(--r3); } .tally .r2 b { color: var(--r2); }

.players { display: grid; gap: 8px; }
.prow { display: grid; grid-template-columns: 44px 1fr auto 36px; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.18); border: 1px solid var(--line2); }
.prow.unseen { border-color: rgba(224,179,84,.5); background: rgba(224,179,84,.07); }
.prow .who { min-width: 0; }
.prow .who b { margin-right: 6px; }
.prow .who small { display: block; color: var(--muted); }
.badge { font-size: .65rem; font-weight: 700; letter-spacing: .06em; background: var(--gold); color: #241a05; padding: 1px 6px; border-radius: 4px; vertical-align: 2px; }
.num { display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.07); font-weight: 700; font-variant-numeric: tabular-nums; }
.rate { display: inline-flex; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.rate button { font: inherit; font-size: .82rem; background: transparent; color: var(--muted); border: 0; padding: 7px 11px; cursor: pointer; border-right: 1px solid var(--line2); }
.rate button:last-child { border-right: 0; }
.rate button:hover { color: var(--text); background: rgba(255,255,255,.05); }
.rate .r1.on { background: var(--r1); color: #0b1226; }
.rate .r2.on { background: var(--r2); color: white; }
.rate .r3.on { background: var(--r3); color: #241a05; }
.prow.unrated .rate { border-color: rgba(224,179,84,.45); }
.del { background: none; border: 0; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--muted); }
.del svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.del:hover, .del.confirm { color: var(--red); background: rgba(229,103,95,.12); }
.empty { text-align: center; padding: 24px 0; }
@media (max-width: 640px) {
  .prow { grid-template-columns: 40px 1fr 36px; }
  .prow .rate { grid-column: 1 / -1; order: 3; display: grid; grid-template-columns: repeat(3, 1fr); }
  .card { padding: 16px; }
  main { padding: 0 16px 32px; }
  .top { padding: 12px 16px; }
  .top nav { gap: 12px; }
}

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 10; max-width: calc(100vw - 32px); }
.toast { background: #1b2750; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: slide .25s ease-out; transition: opacity .5s, transform .5s; }
.toast.new { border-color: var(--gold); }
.toast.err { border-color: var(--red); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes slide { from { opacity: 0; transform: translateY(12px); } }

/* teams */
.fair { background: rgba(255,255,255,.04); border: 1px solid var(--line2); border-radius: 12px; padding: 12px 14px; margin: 6px 0 16px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fair b { color: var(--text); }
.fair.good b { color: #7fe0bb; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 20px; }
.team { background: var(--card); border: 1px solid var(--line2); border-top: 3px solid var(--team); border-radius: 14px; padding: 14px; }
.team header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.team h3 { margin: 0; flex: 1; }
.team .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--team); box-shadow: 0 0 0 1.5px rgba(255,255,255,.55), 0 0 10px var(--team); }
.team .score { font-weight: 700; color: var(--gold2); font-size: 1.15rem; }
.team .bar { height: 6px; background: rgba(255,255,255,.06); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.team .bar i { display: block; height: 100%; background: var(--team); border-radius: 3px; }
.mix { font-size: .8rem; color: var(--muted); margin: 0 0 10px; }
.mix span { margin-right: 6px; font-weight: 600; }
.mix .r3 { color: var(--r3); } .mix .r2 { color: var(--r2); } .mix .r1 { color: var(--r1); }
.team ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.team li { display: flex; align-items: center; gap: 10px; font-size: .93rem; }
.team li .num { min-width: 28px; height: 26px; font-size: .82rem; border-radius: 7px; }
.pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: .7rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line2); border-radius: 5px; padding: 1px 5px; }
.rdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.rdot.r1 { background: var(--r1); } .rdot.r2 { background: var(--r2); } .rdot.r3 { background: var(--r3); }
.res-h { margin-top: 4px; }
.reserve-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.reserve-list li { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.2); border: 1px solid var(--line2); border-radius: 10px; padding: 5px 10px 5px 5px; }
.reserve-list .num { min-width: 26px; height: 26px; font-size: .8rem; }

/* ---------- pitch position picker ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pitch {
  position: relative; width: 100%; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; margin-top: 4px;
  background: repeating-linear-gradient(180deg, #1f7a46 0 10%, #1b6e3f 10% 20%);
  box-shadow: inset 0 0 60px rgba(0,0,0,.35), 0 8px 30px rgba(0,0,0,.3);
}
.pitch-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.spot { position: absolute; transform: translate(-50%, -50%); display: block; cursor: pointer; z-index: 1; }
.spot input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.spot .shirt { position: relative; display: grid; place-items: center; width: 50px; height: 46px; transition: transform .15s; }
.spot .shirt svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: rgba(11,18,38,.55); stroke: rgba(255,255,255,.7); stroke-width: 1.5; transition: .15s; }
.spot .shirt b { position: relative; top: 3px; font-size: .72rem; letter-spacing: .02em; color: #fff; }
.spot:hover .shirt { transform: scale(1.08); }
.spot input:focus-visible + .shirt svg { stroke: var(--gold2); stroke-width: 2.5; }
.spot input:checked + .shirt { transform: scale(1.18); }
.spot input:checked + .shirt svg { fill: var(--gold); stroke: #fff6dc; filter: drop-shadow(0 0 10px rgba(224,179,84,.8)); }
.spot input:checked + .shirt b { color: #241a05; font-size: .9rem; }
.pitch-caption { text-align: center; color: var(--muted); margin: 10px 0 0; font-size: .95rem; }
.pitch-caption.on b { color: var(--gold2); }
@media (max-width: 400px) { .spot .shirt { width: 42px; height: 39px; } .spot .shirt b { font-size: .64rem; } }

/* ---------- admin tabs ---------- */
.tabs { display: flex; gap: 4px; margin: 4px 0 18px; border-bottom: 1px solid var(--line2); }
.tab { font: inherit; font-weight: 600; background: none; border: 0; color: var(--muted); padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 8px; align-items: center; }
.tab.active { color: var(--gold2); border-bottom-color: var(--gold); }
.tab .count { font-size: .75rem; background: rgba(255,255,255,.08); border-radius: 99px; padding: 1px 8px; }
.tab .count.alert { background: var(--red); color: #fff; }
.panel[hidden] { display: none; }
.email { color: var(--muted); font-size: .85rem; word-break: break-all; }

/* ---------- team editor ---------- */
.editbar { position: sticky; top: 8px; z-index: 5; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: #1b2750; border: 1px solid var(--gold); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.editbar[hidden] { display: none; }
.help { font-size: .88rem; color: var(--muted); margin: 0 0 12px; }
.team.drop, .reserves.drop { outline: 2px dashed var(--gold); outline-offset: 2px; }
.team li.mv, .reserves li.mv { cursor: grab; border-radius: 8px; padding: 2px 4px; margin: 0 -4px; transition: background .12s; }
.team li.mv:hover, .reserves li.mv:hover { background: rgba(255,255,255,.06); }
.team li.picked, .reserves li.picked { background: rgba(224,179,84,.2) !important; outline: 1px solid var(--gold); }
.team li.dragging { opacity: .4; }
.team .head-name { font-family: "Reem Kufi", "Outfit", sans-serif; font-weight: 700; font-size: 1.1rem; background: transparent; border: 1px solid transparent; color: var(--text); border-radius: 6px; padding: 2px 6px; margin-inline-start: -6px; flex: 1; min-width: 0; width: 100%; }
.team .head-name:hover, .team .head-name:focus { border-color: var(--line2); outline: none; background: rgba(0,0,0,.2); }
.movehere { display: none; font: inherit; font-size: .8rem; font-weight: 600; width: 100%; margin-top: 8px; padding: 6px; border-radius: 8px; border: 1px dashed var(--gold); background: rgba(224,179,84,.08); color: var(--gold2); cursor: pointer; }
.picking .movehere { display: block; }
.team .count-warn { font-size: .75rem; color: #ffa39c; }
.reserves { background: rgba(0,0,0,.15); border: 1px solid var(--line2); border-radius: 14px; padding: 14px; }
.reserves ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; }
.reserves li { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.2); border: 1px solid var(--line2); border-radius: 10px; padding: 4px 10px 4px 4px; }
.reserves li .num { min-width: 26px; height: 26px; font-size: .8rem; }
.empty-state { text-align: center; padding: 30px 10px; color: var(--muted); }
.team .ar { font-family: "Reem Kufi", sans-serif; color: var(--muted); font-size: .95rem; }
.team .names { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.team .sub { color: var(--muted); font-size: .82rem; }
.team .names .ar { font-size: .85rem; padding-left: 0; }
.pname[dir="auto"] { text-align: left; }
[dir="rtl"] .pname[dir="auto"] { text-align: right; }

/* ---------- Arabic / right-to-left ---------- */
[dir="rtl"] body, html[dir="rtl"] body { font-family: "Tajawal", "Outfit", system-ui, sans-serif; }
html[dir="rtl"] .eyebrow { letter-spacing: 0; }
html[dir="rtl"] .toasts { right: auto; left: 16px; }
html[dir="rtl"] .lanterns .l0 { left: auto; right: 0; }
html[dir="rtl"] .lanterns .l1 { right: auto; left: 20px; }
html[dir="rtl"] .lanterns .l2 { right: auto; left: -20px; }
html[dir="rtl"] input[type=number], html[dir="rtl"] input[type=datetime-local] { text-align: right; }
html[dir="rtl"] .rate button { border-right: 0; border-left: 1px solid var(--line2); }
html[dir="rtl"] .rate button:last-child { border-left: 0; }
html[dir="rtl"] .team .names h3 { font-size: 1.05rem; }
.team .names h3 { margin: 0; }

/* ---------- fixtures & standings ---------- */
.fixtures { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-bottom: 20px; }
.fixture { background: var(--card); border: 1px solid var(--line2); border-radius: 14px; padding: 12px 14px; }
.fixture.played { border-color: rgba(63,182,139,.35); }
.fx-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .82rem; margin-bottom: 8px; }
.fx-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.fx-team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fx-team b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-team.away { justify-content: flex-end; text-align: end; }
.fx-score { font-weight: 700; font-size: 1.15rem; color: var(--gold2); min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.fx-loc { font-size: .85rem; color: var(--muted); margin-top: 8px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--team); box-shadow: 0 0 0 1.5px rgba(255,255,255,.55), 0 0 8px var(--team); flex: none; }
.table-wrap { overflow-x: auto; }
.standings { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.standings th, .standings td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line2); }
.standings th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.standings .tl { text-align: start; white-space: nowrap; }
.standings tbody tr:first-child td { color: var(--gold2); }

/* ---------- admin matches ---------- */
.mrow { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr 1.4fr auto; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line2); border-radius: 12px; background: rgba(0,0,0,.18); }
.mrow + .mrow { margin-top: 8px; }
.mrow .teams { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mrow .teams span { display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mrow .lbl { font-size: .75rem; color: var(--muted); }
.mrow input, .add-match input, .add-match select, .gen select { font: inherit; font-size: .9rem; color: var(--text); background: rgba(0,0,0,.25); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 8px; width: 100%; color-scheme: dark; }
.mrow .scores { display: flex; gap: 4px; align-items: center; }
.mrow .scores input { width: 52px; text-align: center; }
.mrow .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn.sm { padding: 7px 11px; font-size: .85rem; }
.btn.ok { background: rgba(63,182,139,.18); color: #7fe0bb; border: 1px solid rgba(63,182,139,.4); }
.btn.warn { background: rgba(229,103,95,.14); color: #ffa39c; border: 1px solid rgba(229,103,95,.4); }
.add-match, .gen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; align-items: end; }
.add-match label, .gen label { font-size: .85rem; }
.email-card .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.email-card input { font: inherit; color: var(--text); background: rgba(0,0,0,.25); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; min-width: 220px; }
.notice { border-radius: 10px; padding: 10px 14px; font-size: .9rem; margin-bottom: 12px; background: rgba(224,179,84,.1); border: 1px solid var(--line); color: var(--gold2); }
.mgroup-h { font-size: .85rem; color: var(--muted); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 820px) { .mrow { grid-template-columns: 1fr 1fr; } .mrow .teams { grid-column: 1 / -1; } .mrow .acts { grid-column: 1 / -1; justify-content: flex-start; } }

/* ---------- tournament dashboard (/matches) ---------- */
.tourney main { max-width: 1120px; }
.tb-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 16px; }
.tb-head h1 { margin: 2px 0 0; font-size: clamp(1.6rem, 5vw, 2.3rem); }
.tb-head .eyebrow { margin: 0; }
.tb-updated { color: var(--muted); font-size: .8rem; white-space: nowrap; }

.crest { vertical-align: middle; --sz: 28px; width: var(--sz); height: var(--sz); flex: none; border-radius: 50%; display: inline-grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.28), transparent 55%), var(--team); color: var(--ink);
  font: 700 calc(var(--sz) * .46)/1 "Outfit", "Tajawal", sans-serif; box-shadow: 0 0 0 2px rgba(255,255,255,.75), 0 2px 8px rgba(0,0,0,.35); }
.crest.xs { --sz: 18px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.6); }
.crest.sm { --sz: 24px; }
.crest.xl { --sz: 64px; box-shadow: 0 0 0 3px rgba(255,255,255,.85), 0 6px 22px rgba(0,0,0,.45); }

/* hero card */
.hero-card { position: relative; overflow: hidden; border-radius: 20px; padding: 16px 16px 14px; margin-bottom: 14px;
  border: 1px solid rgba(255,255,255,.1); background:
    linear-gradient(100deg, color-mix(in srgb, var(--h) 32%, transparent) 0%, transparent 42%, transparent 58%, color-mix(in srgb, var(--a) 32%, transparent) 100%),
    linear-gradient(180deg, #17244a, #0f1834); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
[dir="rtl"] .hero-card { background:
    linear-gradient(260deg, color-mix(in srgb, var(--h) 32%, transparent) 0%, transparent 42%, transparent 58%, color-mix(in srgb, var(--a) 32%, transparent) 100%),
    linear-gradient(180deg, #17244a, #0f1834); }
.hero-card.live { border-color: rgba(229,103,95,.55); }
.hero-top { display: flex; justify-content: space-between; align-items: center; color: var(--gold2); font-weight: 600; font-size: .85rem; letter-spacing: .03em; }
.hero-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 14px 0 12px; }
.hero-team { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; min-width: 0; }
.hero-team b { font-size: clamp(.95rem, 3.6vw, 1.15rem); line-height: 1.25; overflow-wrap: anywhere; }
.hero-mid { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 96px; }
.hero-score { font-size: clamp(2.2rem, 10vw, 3rem); line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-score i { font-style: normal; color: var(--muted); margin: 0 .18em; }
.hero-score.vs { font-size: 1.4rem; color: var(--muted); }
.hero-kick { color: var(--muted); font-size: .78rem; }
.hero-cd { font-size: clamp(1.05rem, 4.4vw, 1.35rem); color: var(--gold2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; color: var(--muted); font-size: .85rem; }
.hero-meta a { color: var(--gold2); text-decoration: none; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; background: #d93f36; color: #fff; font: 700 .72rem/1 "Outfit", sans-serif;
  letter-spacing: .08em; padding: 5px 9px; border-radius: 999px; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
.live-pill.sm { padding: 4px 7px; font-size: .66rem; }
.ft-pill { background: rgba(255,255,255,.1); color: var(--text); font-size: .72rem; font-weight: 700; padding: 4px 9px; border-radius: 999px; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .live-pill i { animation: none; } }

/* stat tiles */
.tb-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line2); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat > b { direction: ltr; unicode-bidi: isolate; align-self: flex-start; font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat > b small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.stat > span { color: var(--muted); font-size: .78rem; }
.stat .prog { display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,.08); margin-top: 6px; overflow: hidden; }
.stat .prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold2)); border-radius: 2px; }
.att-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.att { display: flex; align-items: center; gap: 8px; font-weight: 700; min-width: 0; }
.att span[dir] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-wrap small { color: var(--gold2); font-size: .8rem; }
@media (max-width: 640px) { .tb-stats { grid-template-columns: repeat(2, 1fr); } }

/* segmented control */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: rgba(255,255,255,.05);
  border: 1px solid var(--line2); border-radius: 14px; margin-bottom: 10px; position: sticky; top: 8px; z-index: 5; backdrop-filter: blur(10px); }
.seg button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 600 .92rem "Outfit", "Tajawal", sans-serif;
  padding: 10px 6px; border-radius: 10px; cursor: pointer; display: inline-flex; justify-content: center; align-items: center; gap: 6px; }
.seg button.on { background: var(--gold); color: #241a05; box-shadow: 0 2px 10px rgba(224,179,84,.35); }
.seg .n { font-size: .72rem; background: rgba(255,255,255,.12); border-radius: 999px; padding: 1px 7px; }
.seg .n:empty { display: none; }
.seg button.on .n { background: rgba(0,0,0,.15); }

/* team chips */
.tb-filter { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.tb-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.tchip { flex: none; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line2); background: var(--card); color: var(--text);
  font: 500 .85rem "Outfit", "Tajawal", sans-serif; padding: 6px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tchip.on { border-color: var(--gold); background: rgba(224,179,84,.16); color: var(--gold2); }
.tb-follow { align-self: flex-start; border: 1px dashed rgba(224,179,84,.5); background: transparent; color: var(--gold2);
  font: 600 .85rem "Outfit", "Tajawal", sans-serif; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.tb-follow.on { border-style: solid; background: rgba(224,179,84,.14); }
.star { color: var(--gold); font-size: .85em; }

/* league tables */
.lt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 14px; }
.lt-card { padding: 14px 12px 6px; margin: 0; }
.lt-card h3 { margin: 0 4px 8px; font-size: 1rem; color: var(--gold2); }
.lt { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.lt th { color: var(--muted); font-weight: 500; font-size: .74rem; padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--line2); }
.lt td { padding: 9px 4px; text-align: center; border-bottom: 1px solid var(--line2); }
.lt tbody tr:last-child td { border-bottom: 0; }
.lt tbody tr { cursor: pointer; transition: background .15s; }
.lt tbody tr:hover, .lt tbody tr:focus-visible { background: rgba(255,255,255,.04); outline: none; }
.lt .tl { text-align: start; }
.lt .rk { width: 30px; }
.lt .rk span { vertical-align: middle; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: .8rem; color: var(--muted); }
.lt tr.q .rk span { background: rgba(63,182,139,.18); color: #7fe0b6; font-weight: 700; }
.lt tr.q td.rk { box-shadow: inset 3px 0 0 var(--green); }
[dir="rtl"] .lt tr.q td.rk { box-shadow: inset -3px 0 0 var(--green); }
.lt tr.me { background: rgba(224,179,84,.09); }
.lt tr.sel { background: rgba(255,255,255,.06); }
.tname { display: flex; align-items: center; gap: 9px; min-width: 0; font-weight: 600; }
.tname span[dir] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16ch; }
.lt .pts { font-weight: 700; color: var(--text); font-size: .98rem; }
.lt .gd, .lt .gfga { color: var(--muted); direction: ltr; unicode-bidi: isolate; }
.form { display: inline-flex; gap: 3px; direction: ltr; }
[dir="rtl"] .form { direction: rtl; }
.fm { width: 18px; height: 18px; border-radius: 5px; display: inline-grid; place-items: center; font: 700 .62rem/1 "Outfit", "Tajawal", sans-serif; font-style: normal; color: #fff; }
.fm.w { background: #2fa36e; } .fm.d { background: #7d8699; } .fm.l { background: #d4524a; }
.fm.none { background: rgba(255,255,255,.07); }
.lt-legend { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; margin: 10px 4px 16px; }
.lt-legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--green); }
@media (max-width: 560px) { .lt .xs { display: none; } .lt td { padding: 9px 3px; } .tname span[dir] { max-width: 11ch; } }
@media (max-width: 370px) { .lt .sm { display: none; } }

/* match lists */
.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: 14px; align-items: start; }
.day { padding: 12px 12px 4px; margin: 0; }
.day h3 { margin: 0 4px 6px; font-size: .9rem; color: var(--gold2); }
.mlist { display: flex; flex-direction: column; }
.mr { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 10px 4px; border-top: 1px solid var(--line2); align-items: center; }
.mlist .mr:first-child { border-top: 0; }
.mr-st { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted);
  font-size: .82rem; border-inline-end: 1px solid var(--line2); align-self: stretch; padding-inline-end: 8px; }
.mr-st b { color: var(--text); font-weight: 600; }
.mr.ft .mr-st b { color: var(--muted); }
.mr-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mr-t { display: flex; align-items: center; gap: 9px; min-width: 0; }
.mr-t .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-t .sc { font-size: 1.05rem; font-variant-numeric: tabular-nums; min-width: 20px; text-align: end; }
.mr-t.win .nm, .mr-t.win .sc { font-weight: 700; color: #fff; }
.mr-t.lose .nm, .mr-t.lose .sc { color: var(--muted); font-weight: 500; }
.mr-t.me .nm::after { content: " ★"; color: var(--gold); }
.mr.live .sc { color: #ff8a80; }
.mr-meta { font-size: .76rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; }
.mr-meta a { color: var(--muted); text-decoration: none; }
.mr-meta a:hover { color: var(--gold2); }
.mr-meta .sep { opacity: .5; }
.tb-view > .card { margin-bottom: 14px; }

/* ---------- starters / substitutes ---------- */
.bench-h { margin: 10px 0 6px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 8px; }
.bench-h::after { content: ""; flex: 1; height: 1px; background: var(--line2); }
.team .bench-h:first-of-type { margin-top: 2px; }
html[dir="rtl"] .bench-h { letter-spacing: 0; }
.team ol.bench li { opacity: .82; }
.subtag { font-size: .62rem; font-weight: 700; letter-spacing: .05em; color: var(--gold2); border: 1px solid rgba(224,179,84,.45); border-radius: 5px; padding: 1px 5px; }

/* ---------- history / hall of champions ---------- */
.reigning { display: flex; align-items: center; gap: 18px; padding: 20px; margin-bottom: 14px; border-radius: 20px;
  border: 1px solid rgba(224,179,84,.45); background: radial-gradient(120% 140% at 0% 0%, rgba(224,179,84,.25), transparent 60%), linear-gradient(180deg, #1a2550, #101a38);
  box-shadow: 0 10px 40px rgba(0,0,0,.35); }
[dir="rtl"] .reigning { background: radial-gradient(120% 140% at 100% 0%, rgba(224,179,84,.25), transparent 60%), linear-gradient(180deg, #1a2550, #101a38); }
.reigning .cup { width: 84px; height: 84px; flex: none; filter: drop-shadow(0 6px 16px rgba(224,179,84,.35)); }
.reigning .eyebrow { margin: 0; }
.reigning h2 { margin: 2px 0 6px; font-size: clamp(1.7rem, 7vw, 2.4rem); color: var(--gold2); line-height: 1.15; }
.reigning .awards { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: .9rem; }
.reigning .awards b { color: var(--text); }
.hist-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.timeline { position: relative; display: flex; flex-direction: column; gap: 12px; padding-inline-start: 22px; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 6px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--gold), rgba(224,179,84,.1)); }
.season { position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; background: var(--card);
  border: 1px solid var(--line2); border-radius: 14px; padding: 14px; }
.season::before { content: ""; position: absolute; inset-inline-start: -21px; top: 20px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--gold); }
.season.latest::before { background: var(--gold); box-shadow: 0 0 12px var(--gold); }
.season .yr { font: 700 1.25rem/1 "Outfit", sans-serif; color: var(--gold2); padding-top: 4px; font-variant-numeric: tabular-nums; }
.season h3 { margin: 0 0 6px; font-size: 1.1rem; }
.season dl { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .88rem; }
.season dl div { display: flex; gap: 6px; }
.season dt { color: var(--muted); }
.season dd { margin: 0; font-weight: 600; }
.season .note { margin: 8px 0 0; color: var(--muted); font-size: .85rem; }
@media (max-width: 480px) { .reigning { flex-direction: column; text-align: center; } .reigning .awards { justify-content: center; } .season { grid-template-columns: 1fr; gap: 4px; } }

/* admin history editor */
.hist-rows { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.hist-row { display: grid; grid-template-columns: 90px repeat(4, minmax(0, 1fr)) auto; gap: 8px; align-items: end; padding: 10px;
  border: 1px solid var(--line2); border-radius: 12px; background: rgba(0,0,0,.15); }
.hist-row label { display: flex; flex-direction: column; gap: 4px; font-size: .75rem; color: var(--muted); min-width: 0; }
.hist-row input { width: 100%; min-width: 0; }
.hist-row .note { grid-column: 2 / -2; }
@media (max-width: 760px) { .hist-row { grid-template-columns: 1fr 1fr; } .hist-row .note { grid-column: 1 / -1; } }
