@charset "UTF-8";

/* ============================================================
   Aiscore — تعزيزات الواجهة
   ============================================================ */

body { font-family: var(--font-ui); }
h1, h2, h3, .matches-title, .match-drawer, .mgroup-title { font-family: var(--font-display); }

/* شعار الهيدر: كرة Three.js */
.logo { position: relative; overflow: hidden; padding: 0; }
.accent-3d { width: 100%; height: 100%; display: block; }

/* ===== شريط الفلاتر لاصق على الجوال ===== */
@media (max-width: 760px) {
  .matches-toolbar {
    position: sticky; inset-block-start: 0; z-index: 20;
    background: color-mix(in srgb, var(--panel) 88%, transparent);
    backdrop-filter: blur(14px) saturate(1.15);
    border-block-end: 1px solid var(--line);
  }
}

/* ===== تجميع البطولات ===== */
.mgroup {
  position: sticky; inset-block-start: 0; z-index: 3;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 14px; border-block: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel2) 88%, transparent);
  backdrop-filter: blur(12px);
}
.mgroup-toggle {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 7px;
  border: 1px solid var(--line); background: rgba(255,255,255,.03);
  color: var(--dim); font-size: 12px; line-height: 1;
  display: grid; place-items: center;
}
.mgroup-toggle:hover { color: var(--txt); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.mgroup.collapsed .mgroup-toggle { transform: rotate(-90deg); }
.mgroup-title { font-size: 12px; font-weight: 800; color: #dbe8ff; }
.mgroup-country { font-size: 10px; color: var(--dim); }
.mgroup-count {
  margin-inline-start: auto; font-size: 10px; font-weight: 800; color: var(--dim);
  background: rgba(255,255,255,.05); border-radius: 999px; padding: 1px 7px;
}

/* ===== إجراءات الصف ===== */
.mcomp { padding-inline-end: 28px; position: relative; }
.macts { position: absolute; inset-inline-end: 0; inset-block-start: 1px; display: flex; gap: 2px; }
.mstar {
  width: 23px; height: 23px; border-radius: 7px; border: 0; padding: 0;
  display: grid; place-items: center; font-size: 13px; line-height: 1;
  color: var(--dim); background: transparent; cursor: pointer;
  transition: color .15s, background .15s, transform .15s;
}
.mstar:hover { color: var(--warn); background: rgba(255,176,32,.12); transform: scale(1.08); }
.mstar.on { color: var(--warn); text-shadow: 0 0 10px rgba(255,176,32,.55); }
.mrow .mplay { justify-self: center; }
.mrow { cursor: pointer; }

/* ===== وميض الهدف ===== */
@keyframes goalFlash {
  0% { color: #fff; text-shadow: 0 0 0 rgba(39,209,124,0); transform: scale(1); }
  25% { color: var(--ok); text-shadow: 0 0 18px rgba(39,209,124,.9); transform: scale(1.16); }
  100% { color: #fff; text-shadow: none; transform: scale(1); }
}
.mscore.goal { animation: goalFlash .9s var(--ease) 2; }

/* ===== نافذة تفاصيل المباراة ===== */
.match-drawer {
  width: min(460px, 94vw); max-height: 88vh; padding: 0; margin: auto;
  border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
  background: var(--panel); color: var(--txt);
  box-shadow: 0 40px 100px rgba(0,0,0,.65);
}
.match-drawer::backdrop { background: rgba(3,6,12,.62); backdrop-filter: blur(5px); }
.match-drawer[open] { animation: mdIn .28s var(--ease); }
@starting-style { .match-drawer[open] { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes mdIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.md-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 15px; border-block-end: 1px solid var(--line);
  background: radial-gradient(420px 90px at 20% 0%, rgba(62,166,255,.12), transparent 70%);
}
.md-badge { font-size: 11px; font-weight: 900; color: var(--ok); }
.md-badge.live { color: var(--ok); }
.md-badge.ft { color: var(--dim); }
.md-badge.up { color: var(--warn); }
.md-close { width: 32px; height: 32px; border-radius: 9px; font-size: 19px; color: var(--dim); }
.md-close:hover { background: rgba(255,255,255,.08); color: #fff; }
.md-teams { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 18px 8px; }
.md-team { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; min-width: 0; text-align: center; }
.md-team .mlogo { width: 54px; height: 54px; flex-basis: 54px; border-radius: 14px; }
.md-team .mfallback { font-size: 15px; }
.md-team b { font-size: 13px; font-weight: 800; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-score { text-align: center; font-size: 30px; font-weight: 900; direction: ltr; line-height: 1; }
.md-meta { text-align: center; color: var(--dim); font-size: 11px; padding: 10px 18px 0; line-height: 1.8; }
.md-actions { display: grid; gap: 8px; padding: 16px 18px 18px; }
.md-play {
  width: 100%; padding: 13px; border-radius: 13px; font-size: 14px; font-weight: 900;
  color: #fff; background: linear-gradient(135deg, #ff5c6c, #d61f3a);
  box-shadow: 0 10px 26px rgba(244,63,94,.28);
}
.md-play:disabled { background: var(--panel2); color: var(--dim); box-shadow: none; cursor: not-allowed; }
.md-actions a, .md-actions button:not(.md-play) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--txt); font-size: 12px; font-weight: 700; text-decoration: none;
}
.md-actions a:hover, .md-actions button:not(.md-play):hover { border-color: var(--brand); }
.md-actions .on { color: var(--warn); border-color: rgba(255,176,32,.4); }

/* ===== الشريط المصغّر ===== */
.mini-bar .mi-avatar { font-size: 12px; }
.mini-bar .mi-txt b { max-width: 42vw; }

/* ===== بطاقات الجوال ===== */
@media (max-width: 760px) {
  .mrow {
    grid-template-columns: minmax(0, 1fr) 38px;
    grid-template-areas:
      "state play"
      "home  score"
      "away  score"
      "comp  comp";
    row-gap: 5px; padding: 11px 12px; border-radius: 14px;
    border: 1px solid var(--line); margin: 6px 8px;
    background: color-mix(in srgb, var(--panel2) 72%, transparent);
  }
  .mrow:last-child { margin-block-end: 10px; }
  .mstate { grid-area: state; flex-direction: row; align-items: center; gap: 7px; }
  .mstate .msub { padding-right: 0; }
  .mrow .mplay { grid-area: play; align-self: start; justify-self: end; }
  .mteam.home { grid-area: home; }
  .mteam.away { grid-area: away; }
  .mteam .name { font-size: 13px; }
  .mscore { grid-area: score; text-align: end; font-size: 16px; align-self: center; }
  .mcomp { grid-area: comp; display: flex; flex-direction: row; align-items: center; gap: 7px; padding-inline-end: 0; }
  .mcomp .mcountry { font-size: 9.5px; }
  .mcomp .mleague { font-size: 10px; }
  .macts { position: static; margin-inline-start: auto; }
  .mstar { width: 27px; height: 27px; }
  .mhead { display: none; }
  .match-list { max-height: none; }
}

/* ===== تحسينات RTL/الخط ===== */
.mscore, .msub, .mgroup-count { font-variant-numeric: tabular-nums; }
.mteam .name { unicode-bidi: plaintext; }
.match-drawer { font-family: var(--font-ui); }

/* ===== الأقسام القابلة للطي ===== */
.adv-card { padding: 0; overflow: hidden; }
.adv-card > summary {
  display: flex; align-items: center; gap: 9px;
  padding: 13px 16px; list-style: none; cursor: pointer;
  font-size: 13px; font-weight: 800; color: var(--txt);
  transition: background var(--dur-fast, .16s) var(--ease, ease);
}
.adv-card > summary::-webkit-details-marker { display: none; }
.adv-card > summary:hover { background: rgba(255,255,255,.035); }
.adv-card > summary::before {
  content: "›"; width: 20px; height: 20px; flex: 0 0 20px;
  display: grid; place-items: center; border-radius: 6px;
  background: rgba(255,255,255,.05); color: var(--dim);
  font-size: 15px; line-height: 1; transition: transform .18s var(--ease, ease);
}
.adv-card[open] > summary::before { transform: rotate(90deg); }
.adv-card[open] > summary { border-block-end: 1px solid var(--line); }
.adv-card > .row { padding: 12px 14px 0; }
.adv-card > .status { margin: 10px 14px 14px; }
.adv-card > .grid { padding: 14px; }
.adv-card > .label { margin: 12px 14px 0; }
.adv-card > .logs { margin: 6px 14px 14px; }

/* ===== وضع التضمين داخل الرئيسية ===== */
html.embed body {
  --bg:#070a12; --panel:#0f1626; --panel2:#0a1120;
  --line:rgba(120,150,200,.14); --txt:#f1f5ff; --dim:#9fb1d4;
  --brand:#2ee678; --brand2:#14b85c; --ok:#2ee678; --warn:#f7c045; --err:#f43f5e;
  display: block; min-height: 100dvh; padding: 0;
  overflow-x: hidden; overflow-y: auto;
  background:
    radial-gradient(900px 420px at 90% -10%, rgba(46,230,120,.08), transparent 60%),
    var(--bg);
}
html.embed .wrap {
  width: 100%; max-width: none; margin: 0;
  padding: 10px clamp(10px, 2vw, 18px) 26px;
  display: grid; gap: 12px; align-items: start;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, .88fr);
  grid-template-areas: "url matches" "player matches" "tech matches";
}
html.embed header, html.embed #scrollProgress { display: none !important; }
html.embed #matchesCard { grid-area: matches; margin: 0; position: sticky; top: 10px; }
html.embed #shell { grid-area: player; margin: 0; }
html.embed .url-card { grid-area: url; margin: 0; }
html.embed .tech-card { grid-area: tech; margin: 0; }
html.embed .match-list { max-height: calc(100dvh - 236px); }
html.embed .matches-card { background: linear-gradient(180deg, rgba(15,22,38,.96), var(--panel)); }
html.embed .matches-head {
  background: radial-gradient(600px 90px at 15% 0%, rgba(46,230,120,.10), transparent 70%);
}
html.embed .pill {
  background: rgba(46,230,120,.08); border-color: rgba(46,230,120,.22); color: #b9ffd9;
  font-size: 9.5px; line-height: 1.55; white-space: normal; max-width: 100%;
}
html.embed .matches-title { flex-wrap: wrap; gap: 6px; }
html.embed .mrow:hover { background: rgba(46,230,120,.055); }
html.embed .mrow.playable:hover { background: rgba(46,230,120,.09); }
html.embed .mrow.selected { background: rgba(46,230,120,.12); box-shadow: inset -3px 0 0 var(--brand); }
html.embed .mstat.live { color: var(--brand); }
html.embed .player-shell {
  border-radius: 18px;
  box-shadow: 0 24px 60px -26px rgba(0,0,0,.9), 0 0 0 1px rgba(46,230,120,.08);
}
html.embed .bigplay .btn {
  background: rgba(46,230,120,.92);
  box-shadow: 0 10px 40px rgba(46,230,120,.35);
}
html.embed .matches-toolbar input[type=search]:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(46,230,120,.12);
}
html.embed .mrow.selected .mplay.on { box-shadow: 0 0 0 2px rgba(46,230,120,.35); }

@media (max-width: 900px) {
  html.embed .wrap {
    grid-template-columns: 1fr;
    grid-template-areas: "player" "matches" "url" "tech";
  }
  html.embed #shell {
    position: sticky; top: 0; z-index: 6;
    border-radius: 14px;
    box-shadow: 0 18px 40px -18px rgba(0,0,0,.95), 0 0 0 1px rgba(46,230,120,.10);
  }
  html.embed #matchesCard { position: static; }
  html.embed .match-list { max-height: none; }
  html.embed .matches-toolbar {
    position: static; backdrop-filter: none; background: transparent;
  }
}
@media (max-width: 420px) {
  html.embed .wrap { padding-inline: 8px; gap: 9px; }
  html.embed .match-list { max-height: 58dvh; }
}

/* الجدول داخل عمود ضيّق: صف مضغوط من سطرين بدل أعمدة ستة مضغوطة */
html.embed .matches-card { container-type: inline-size; }
@container (max-width: 640px) {
  html.embed .mhead { display: none; }
  html.embed .mrow {
    grid-template-columns: 64px minmax(0, 1fr) 54px minmax(0, 1fr) 32px;
    grid-template-areas:
      "state home score away play"
      "comp  comp comp  comp comp";
    column-gap: 6px; row-gap: 2px; padding: 7px 9px;
    margin: 4px 6px; border-radius: 11px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel2) 72%, transparent);
  }
  html.embed .mrow:last-child { margin-block-end: 9px; }
  html.embed .mstate {
    grid-area: state; flex-direction: column; align-items: flex-start;
    gap: 1px; min-width: 0;
  }
  html.embed .mstat { font-size: 9.5px; gap: 4px; }
  html.embed .msub { font-size: 8.5px; padding-right: 0; }
  html.embed .mteam { gap: 6px; }
  html.embed .mteam.home { grid-area: home; }
  html.embed .mteam.away { grid-area: away; }
  html.embed .mteam .name { font-size: 11.5px; }
  html.embed .mlogo { width: 20px; height: 20px; flex-basis: 20px; border-radius: 6px; }
  html.embed .mfallback { font-size: 8px; }
  html.embed .mscore {
    grid-area: score; text-align: center; font-size: 13px;
    align-self: center;
  }
  html.embed .mrow .mplay {
    grid-area: play; align-self: center; justify-self: end;
    width: 30px; height: 30px;
  }
  html.embed .mplay svg { width: 14px; height: 14px; }
  html.embed .mcomp {
    grid-area: comp; display: flex; flex-direction: row; align-items: center;
    gap: 6px; padding-inline-end: 0; min-width: 0;
  }
  html.embed .mcomp .mcountry { font-size: 8.5px; }
  html.embed .mcomp .mleague { font-size: 9.5px; }
  html.embed .macts { position: static; margin-inline-start: auto; }
  html.embed .mstar { width: 20px; height: 20px; font-size: 11px; }
}
@container (max-width: 430px) {
  html.embed .mrow { grid-template-columns: 54px minmax(0, 1fr) 46px minmax(0, 1fr) 28px; column-gap: 4px; }
  html.embed .mteam .name { font-size: 10.5px; }
  html.embed .mstat { font-size: 8.5px; }
  html.embed .mlogo { width: 18px; height: 18px; flex-basis: 18px; }
  html.embed .mrow .mplay { width: 27px; height: 27px; }
}
