:root {
  --bg: #0a0010; --card: #1e0a26; --green: #00ff87; --purple: #2a0433; --muted: #c9b3cd;
  --pill: #3d1a44; --gold: #ffc94a; --pink: #ff7a9a; --cyan: #22d3ee; --plate: #37003c; --sep: #1c0e24;
  --line: #4a2a52;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: #fff; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, sans-serif; font-size: 15px; line-height: 1.45; min-height: 100vh; }
button, input { font: inherit; color: inherit; }
.num { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.hidden { display: none !important; }

/* ---- shell ---- */
.shell { max-width: 1280px; margin: 0 auto; }
.strip { display: flex; align-items: center; gap: 8px; padding: 8px 10px 6px; }
.chips { flex: 1; display: flex; align-items: center; }
.chip { flex: 1; text-align: center; }
.chip b { display: block; font-size: 11px; color: #d9cce0; }
.chip small { display: block; font-size: 9px; color: var(--muted); }
.chip.avail b, .chip.avail small { color: var(--green); }
.chip.played b { color: var(--muted); }
.note { color: var(--muted); font-size: 11px; padding: 0 10px 4px; margin: 0; }
.note.small { font-size: 9px; }
.pillbtn { background: var(--green); color: var(--purple); border: 0; border-radius: 20px; padding: 5px 14px; font-weight: 700; font-size: 12px; cursor: pointer; }
.pill { display: inline-block; border-radius: 20px; padding: 3px 12px; font-size: 13px; font-weight: 700; background: var(--pill); color: var(--muted); border: 0; cursor: pointer; }
.pill.on { background: var(--green); color: var(--purple); }

.layout { display: block; }
.band { background: linear-gradient(180deg, #520d63, #2a0433 55%, #160020); border-radius: 0 0 26px 26px; padding: 18px 16px 16px; }
.band-top { display: flex; align-items: center; gap: 10px; }
.bell { width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.2); border: 1px solid rgba(0,255,135,.4); display: flex; align-items: center; justify-content: center; font-size: 15px; }
.band-title { flex: 1; }
.band-title b { display: block; font-size: 16px; }
.band-title span { color: var(--muted); font-size: 12px; }
.gwpill { color: var(--gold); background: rgba(255,201,74,.2); border: 1px solid rgba(255,201,74,.53); border-radius: 20px; padding: 3px 12px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.gear { width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(0,0,0,.2); color: #fff; font-size: 17px; cursor: pointer; }
.band-main { display: flex; align-items: center; padding-top: 14px; }
.score { width: 110px; text-align: center; }
.score .big { font-size: 46px; font-weight: 700; line-height: 1.1; }
.score .lbl { font-size: 13px; color: var(--muted); }
.ranks { flex: 1; }
.ranks .lbl { font-size: 11px; color: var(--muted); }
.ranks .ov { font-size: 23px; font-weight: 700; direction: ltr; text-align: right; }
.ranks .mv { font-size: 12px; }
.ranks .season { font-size: 12px; color: var(--gold); padding-top: 4px; }
.ranks .played { font-size: 13px; color: var(--green); padding-top: 4px; }
.band-note { font-size: 10px; padding-top: 12px; color: #d9ccE0; margin: 0; }
.nav { display: flex; gap: 8px; padding: 10px 10px 2px; }

.main { padding: 0 4px 28px; }
.page-note { color: var(--muted); font-size: 11px; padding: 8px 12px 0; margin: 0; }

/* ---- cards / forms ---- */
.card { background: var(--card); border-radius: 16px; padding: 12px 14px 14px; margin: 10px 6px 0; }
.card h3 { margin: 0 0 4px; color: var(--green); font-size: 16px; }
.card p { margin: 4px 0; color: var(--muted); font-size: 13px; }
.input { width: 100%; background: transparent; border: 0; border-bottom: 2px solid var(--line); padding: 8px 2px; font-size: 16px; text-align: left; direction: ltr; outline: none; margin-top: 6px; }
.input:focus { border-bottom-color: var(--green); }
.btn { display: block; width: 100%; margin-top: 10px; padding: 11px; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer; text-align: center; }
.btn.fill { background: var(--green); color: var(--purple); border: 0; }
.btn.line { background: transparent; color: var(--green); border: 2px solid var(--green); }
.btn.danger { background: transparent; color: var(--pink); border: 2px solid rgba(255,122,154,.5); }
.msg { font-size: 13px; min-height: 18px; margin-top: 8px; white-space: pre-line; }
.err { color: var(--pink); }
.empty { color: var(--muted); padding: 24px 16px; text-align: center; }

/* ---- board ---- */
.board { margin-top: 4px; }
.brow { display: grid; grid-template-columns: 40px minmax(0, 2fr) 0.8fr 0.95fr 0.95fr 1.1fr; gap: 8px; align-items: center; padding: 9px 10px; border-bottom: 1px solid var(--sep); }
.brow.th { border: 0; padding-top: 12px; padding-bottom: 6px; color: #a89ab0; font-size: 10.5px; text-align: center; }
.brow.dim { opacity: .55; }
.brow.threat { grid-template-columns: 40px minmax(0, 2.8fr) 0.95fr 0.95fr 1.1fr; }
.col { text-align: center; direction: ltr; font-size: 12.5px; color: #c9b8d2; }
.col b { display: block; }
.col small { display: block; font-size: 10px; color: #a89ab0; }
.col.pts b { font-size: 18px; color: #fff; }
.col.gold b { color: var(--gold); }
.circ { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; border: 2px solid; position: relative; }
.circ .cv { position: absolute; top: -3px; inset-inline-start: -3px; width: 17px; height: 17px; border-radius: 50%; color: #160020; font-size: 10px; display: flex; align-items: center; justify-content: center; }
.pname { font-size: 14px; font-weight: 700; direction: ltr; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: #22142b; color: #d9cce0; direction: ltr; }
.tag.o { background: transparent; border: 1px solid; border-radius: 6px; font-size: 9.5px; direction: rtl; padding: 1px 5px; }
.tag.o.proj { border-style: dashed; }
.section { color: #a89ab0; font-size: 12px; font-weight: 700; padding: 14px 16px 4px; }
.foot { color: #a89ab0; font-size: 11px; padding: 14px 16px 8px; line-height: 1.7; }

/* ---- planner ---- */
.planner { padding: 6px; }
.plan-grid { display: block; }
.gwrow { display: flex; align-items: center; justify-content: center; padding: 4px 0; }
.gwrow .arrow { background: none; border: 0; color: var(--muted); font-size: 22px; font-weight: 700; padding: 2px 14px; cursor: pointer; }
.gwrow .arrow[disabled] { color: rgba(255,255,255,.2); cursor: default; }
.gwrow .lab { color: var(--gold); font-weight: 700; font-size: 14px; min-width: 150px; text-align: center; }
.actions { display: flex; gap: 6px; margin-top: 6px; }
.actions .save { flex: 1; background: var(--green); color: var(--purple); border: 0; border-radius: 20px; height: 42px; font-weight: 700; font-size: 13px; cursor: pointer; }
.actions .reset { background: var(--card); color: var(--pink); border: 1px solid rgba(255,122,154,.4); border-radius: 20px; padding: 0 12px; font-weight: 700; font-size: 10.5px; height: 42px; cursor: pointer; }
.selstrip { display: flex; align-items: center; gap: 6px; background: var(--card); border-radius: 14px; padding: 6px 8px; margin-top: 6px; }
.selstrip .nm { flex: 1; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sbtn { background: var(--green); color: var(--purple); border: 0; border-radius: 14px; padding: 5px 10px; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.sbtn.x { background: var(--pill); color: var(--muted); }
.hint { margin-top: 6px; background: var(--card); border: 1px solid rgba(255,255,255,.2); border-radius: 14px; padding: 5px 10px; color: var(--muted); font-size: 11.5px; cursor: pointer; white-space: pre-line; display: inline-block; max-width: 100%; }

.pheader { padding: 10px 14px 0; }
.pheader .t { font-size: 15px; font-weight: 700; }
.pheader .s { font-size: 11.5px; color: var(--muted); white-space: pre-line; line-height: 1.6; }

.pitch-wrap { --u: 1; font-size: calc(10px * var(--u)); margin-top: 6px; }
.pitch { position: relative; border-radius: 16px; overflow: hidden; border: 2px solid rgba(255,255,255,.6); padding: 1em 0.6em 1.2em; background: repeating-linear-gradient(180deg, #2f9142 0, #2f9142 calc(100% / 12), #2a8038 calc(100% / 12), #2a8038 calc(200% / 12)); display: flex; flex-direction: column; gap: 1.2em; }
.pitch .mk { position: absolute; border: 2px solid rgba(255,255,255,.4); pointer-events: none; }
.pitch .mk.mid { left: 0; right: 0; top: 50%; border-width: 2px 0 0; }
.pitch .mk.circle { width: 8em; height: 8em; border-radius: 50%; left: calc(50% - 4em); top: calc(50% - 4em); }
.pitch .mk.boxt { width: 44%; height: 5.6em; left: 28%; top: 0; border-top: 0; }
.pitch .mk.boxb { width: 44%; height: 5.6em; left: 28%; bottom: 0; border-bottom: 0; }
.prow { display: flex; justify-content: space-around; position: relative; z-index: 1; min-height: 9.8em; }
.bench { margin-top: 10px; background: #2a0a30; border-radius: 14px; padding: 6px 6px 8px; }
.bench .bt { text-align: center; color: var(--muted); font-size: 1.1em; padding-bottom: 5px; }
.bench .prow { min-height: 0; justify-content: space-around; }
.pfoot { text-align: center; padding: 10px 0 2px; }
.pfoot .f1 { color: var(--green); font-size: 13px; font-weight: 700; }
.pfoot .f2 { color: var(--muted); font-size: 11px; line-height: 1.6; }
.dots { display: flex; gap: 5px; padding: 6px 10px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.33); display: block; }
.dots i.on { width: 7px; height: 7px; background: var(--green); margin-top: -1px; }

.pl { position: relative; width: 9.6em; display: flex; flex-direction: column; align-items: center; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: pan-y; padding: 0.3em 0 0.1em; border-radius: 1.2em; border: 2px solid transparent; }
.pl.ro { cursor: default; }
.pl.sel { background: rgba(0,255,135,.15); border-color: var(--green); }
.pl.hover { border-color: var(--gold); }
.pl.ok { background: rgba(0,255,135,.15); border-color: var(--green); }
.pl.no { background: rgba(255,77,109,.2); border-color: #ff4d6d; }
.pl.ghost { opacity: .3; }
.pl .badge { background: #fff; color: #00461f; font-weight: 700; font-size: 1.1em; min-width: 2.6em; text-align: center; border-radius: 0.9em; padding: 0.1em 0.5em; height: 1.7em; line-height: 1.7em; direction: ltr; }
.pl.ro .badge { color: #37003c; }
.bench .pl .badge { background: rgba(255,255,255,.8); }
.pl .shirt { width: 4.6em; height: 4.2em; margin-top: 0.5em; position: relative; }
.pl .shirt svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pl .armband { position: absolute; top: 0.2em; inset-inline-end: -0.4em; width: 1.8em; height: 1.8em; border-radius: 50%; background: #00ff85; color: #37003c; font-weight: 700; font-size: 1.1em; display: flex; align-items: center; justify-content: center; line-height: 1; }
.pl .plate { margin-top: 0.4em; background: var(--plate); border-radius: 0.7em; padding: 0.2em 0.5em 0.25em; text-align: center; max-width: 100%; min-width: 4.4em; direction: ltr; }
.bench .pl .plate { background: rgba(55,0,60,.9); }
.pl .plate .n { font-size: 1.15em; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9em; line-height: 1.25; }
.pl .plate .o { font-size: 1em; color: var(--muted); line-height: 1.25; }
.drag-ghost { position: fixed; z-index: 50; pointer-events: none; width: 6em; opacity: .92; font-size: 12px; transform: translate(-50%, -60%); filter: drop-shadow(0 6px 6px rgba(0,0,0,.5)); }

.side-panel { margin-top: 8px; }
.sp-grid { display: flex; background: var(--card); border-radius: 14px; padding: 8px; margin-top: 8px; }
.sp-cell { flex: 1; text-align: center; }
.sp-cell b { display: block; font-size: 14px; direction: ltr; }
.sp-cell small { color: var(--muted); font-size: 9.5px; }
.trlist { margin: 8px 0 0; padding: 0; list-style: none; }
.trlist li { background: var(--card); border-radius: 12px; padding: 8px 12px; margin-top: 6px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.trlist li span { flex: 1; direction: ltr; text-align: right; }
.trlist li .out { color: var(--pink); } .trlist li .in { color: var(--green); }
.sp-note { color: var(--muted); font-size: 11px; padding: 6px 4px 0; }

/* ---- modal / sheets ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.62); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 88vh; border-radius: 22px 22px 0 0; padding: 14px 16px 18px; display: flex; flex-direction: column; }
.sheet .handle { width: 44px; height: 5px; border-radius: 3px; background: #4a2a52; margin: 0 auto 10px; }
.sheet h4 { margin: 0; font-size: 18px; }
.sheet .sub { color: var(--muted); font-size: 12.5px; }
.sheet .close { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px 10px; }
.sheet .hd { display: flex; align-items: center; }
.sheet .hd > div { flex: 1; }
.sheet .stats { display: flex; background: #120018; border-radius: 12px; padding: 6px 8px; margin-top: 8px; }
.sheet .stats div { flex: 1; text-align: center; }
.sheet .stats b { display: block; font-size: 13px; direction: ltr; }
.sheet .stats small { color: var(--muted); font-size: 9.5px; }
.sheet .bar { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.sheet .bar button { background: var(--pill); color: var(--muted); border: 0; border-radius: 16px; padding: 5px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.sheet .search { width: 100%; background: var(--purple); border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px; font-size: 14px; margin-top: 8px; outline: none; }
.sheet .count { font-size: 11px; color: var(--muted); padding: 8px 4px 4px; }
.sheet .list { flex: 1; overflow: auto; min-height: 120px; }
.prow2 { display: flex; align-items: center; gap: 8px; padding: 7px 6px; border-radius: 10px; cursor: pointer; }
.prow2:nth-child(odd) { background: #241030; }
.prow2.off { opacity: .45; }
.prow2 .sh { width: 34px; height: 31px; }
.prow2 .sh svg { width: 100%; height: 100%; overflow: visible; }
.prow2 .nm { flex: 1; min-width: 0; }
.prow2 .nm b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: right; }
.prow2 .nm span { font-size: 11px; color: var(--muted); }
.prow2 .pos { color: #101010; font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 7px; margin-inline-end: 6px; }
.prow2 .pr { text-align: center; direction: ltr; min-width: 58px; }
.prow2 .pr b { display: block; font-size: 12.5px; }
.prow2 .pr small { font-size: 9.5px; color: var(--muted); }
.prow2 .tpv { text-align: center; min-width: 40px; }
.prow2 .tpv b { display: block; font-size: 15px; }
.prow2 .tpv small { font-size: 9px; color: var(--muted); }
.menu button { display: block; width: 100%; text-align: start; background: var(--pill); color: #fff; border: 0; border-radius: 12px; padding: 12px 14px; margin-top: 8px; font-size: 14px; cursor: pointer; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #fff; color: #200028; padding: 10px 16px; border-radius: 12px; font-size: 13px; z-index: 60; max-width: 90vw; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.5); }

/* ---- laptop: two columns ---- */
@media (min-width: 960px) {
  body { font-size: 16px; }
  .layout { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 20px; align-items: start; padding: 0 16px; }
  .side { position: sticky; top: 0; }
  .band { border-radius: 0 0 26px 26px; }
  .nav { padding-top: 14px; }
  .main { padding-top: 10px; }
  .band-note, .page-note { font-size: 12px; }
  .pitch-wrap { --u: 1.2; }
  .plan-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr); gap: 20px; align-items: start; }
  .plan-left { min-width: 0; }
  .side-panel { margin-top: 0; position: sticky; top: 10px; }
  .overlay { align-items: center; }
  .sheet { border-radius: 22px; max-height: 84vh; }
  .brow { padding: 11px 14px; }
  .pname { font-size: 15px; }
}
@media (min-width: 1280px) { .pitch-wrap { --u: 1.3; } }
/* the planner on a phone drops the top band, like the app (the pitch starts at the top) */
@media (max-width: 959px) {
  body.planning .band, body.planning .strip, body.planning .strip-notes { display: none; }
  .side-panel { padding: 0 2px; }
}
.lap-only { display: none; }
@media (min-width: 960px) { .lap-only { display: flex; } }
