/* ترتيب الصفحة الرئيسية بالمربعات. الألوان والنوافذ في grid-theme.css */
/* ===== الشبكة ===== */
.home { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 1160px; padding: 6px 12px 16px; overflow-x: visible; }
.hero, .room-entry, #games, .scores-wall, .stat-tiles { grid-column: 1 / -1; min-width: 0; }
/* ===== مربع الواجهة ===== */
.hero { display: flex; align-items: flex-end; min-height: 430px; padding: 0; overflow: hidden; border-radius: var(--tile-round); box-shadow: var(--tile-shadow); color: #fff; }
.hero-art { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; border: 0; box-shadow: none; object-fit: cover; object-position: 60% center; }
.hero::after { content: ''; position: absolute; inset: 0; z-index: 0; background: linear-gradient(180deg, transparent 35%, rgba(9, 12, 22, .9) 92%); pointer-events: none; }
.hero-text { position: relative; z-index: 1; width: 100%; max-width: none; padding: 20px; }
.hero h1 { margin-bottom: 8px; color: #fff; font-size: clamp(38px, 11.5vw, 70px); font-weight: 800; line-height: 1.14; letter-spacing: -1px; }
.hero h1 em { color: #fff; font-style: normal; }
.hero p { max-width: none; color: #dfe3ec; font-size: 14px; font-weight: 300; }
.hero-actions { display: grid; gap: 10px; margin-top: 14px; }
.hero-actions .btn.primary { width: 100%; min-height: 52px; border: 0; border-radius: 16px; background: #fff; color: #0f1320; box-shadow: none; font-size: 16px; font-weight: 800; }
.hero-actions .btn.primary:hover { background: #e8ebf3; color: #0f1320; box-shadow: none; transform: none; }
.player-chip { order: -1; justify-self: start; color: #fff; }
.player-chip i { border-radius: 12px; }
.player-chip small { color: #dfe3ec; }

/* ===== مربع كود الغرفة ===== */
.room-entry { margin: 0; padding: 18px; border-radius: var(--tile-round); background: linear-gradient(135deg, #2746f2, #1a2fb5); box-shadow: var(--tile-shadow); color: #fff; text-align: start; }
.room-entry h2 { margin: 0; color: #fff; font-size: 20px; font-weight: 800; }
.room-entry small { color: #c9d2ff; font-size: 13px; }
.room-entry form { flex-wrap: nowrap; gap: 7px; margin-top: 12px; }
.room-entry input { flex: 1; width: auto; min-width: 0; height: 50px; padding-inline: 14px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, .16); color: #fff; font-size: 15px; text-align: start; }
.room-entry input::placeholder { color: #dfe5ff; font-size: 14px; }
.room-entry input:focus-visible { outline: 2px solid #fff; }
.room-entry .btn.primary, .room-entry .btn { flex: none; width: 84px; min-width: 84px; min-height: 50px; padding: 0; border: 0; border-radius: 14px; background: #fff; color: #2746f2; box-shadow: none; font-size: 15px; font-weight: 800; }
.room-entry .btn.primary:hover { background: #e8ebf3; color: #2746f2; box-shadow: none; transform: none; }

/* ===== مربعات الألعاب ===== */
#games { padding-top: 0; }
.section-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.games { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.game { position: relative; display: flex; flex-direction: row; align-items: flex-end; aspect-ratio: 1 / 1.2; overflow: hidden; border: 0; border-radius: var(--tile-round); background: #0f1320; box-shadow: var(--tile-shadow); }
.game-cover { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border: 0; object-fit: cover; transition: transform .45s cubic-bezier(.2, .7, .2, 1); }
.game::after { content: ''; display: block; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, transparent 45%, rgba(9, 12, 22, .88)); }
.game-info { position: relative; z-index: 1; flex: 1; padding: 13px; color: #fff; pointer-events: none; }
.game-info h3 { font-size: 16.5px; font-weight: 800; line-height: 1.3; }
.game-info small { order: 2; color: #dfe3ec !important; font-size: 11.5px; font-weight: 300; }
.game-info > div { display: flex; flex-direction: column; }
.game-link { border-radius: var(--tile-round); }
.game-link:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }
@media (hover: hover) {
  .game:hover { box-shadow: var(--tile-shadow); transform: none; }
  .game:hover .game-cover { transform: scale(1.07); }
}

/* ===== مربع السكورات ===== */
.score-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.score-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border-radius: var(--tile-round); background: #fff; box-shadow: var(--tile-shadow); }
.score-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.score-card-head { display: flex; align-items: center; gap: 9px; padding: 11px 12px 6px; color: #0f1320; text-decoration: none; }
.score-card-head img { flex: none; width: 42px; height: 42px; border: 0; border-radius: 13px; object-fit: cover; }
.score-card-head h3 { min-width: 0; margin: 0; color: #0f1320; font-size: 14.5px; font-weight: 800; line-height: 1.3; }
.score-card .scores-empty { flex: 1; margin: 0; padding: 18px 12px; }
.score-card-all { display: flex; align-items: center; justify-content: center; min-height: 40px; margin-top: auto; color: #2746f2; font-size: 13px; font-weight: 700; text-decoration: none; }
.score-menu-list a, .score-menu-list button { border: 0; }
.score-menu-list [aria-current="true"] { background: rgba(39, 70, 242, .1); box-shadow: none; }
.scores-list.rank-list { --muted: #6c7384; --ink: #0f1320; border: 0; border-radius: 0; background: none; box-shadow: none; color: #0f1320; overflow: visible; }
.scores-list .rank-head { display: none; }
.scores-list .rank-row { gap: 11px; padding: 9px 0; border-top: 1px solid #eef0f4; border-radius: 0; font-size: 15px; font-weight: 700; }
.scores-list .rank-head + .rank-row { border-top: 0; }
.scores-list .rank-no { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; background: #eceef2; color: #0f1320; font-family: var(--display); font-size: 13px; font-weight: 800; }
.scores-list .rank-row.top .rank-no { background: #2746f2; color: #fff; }
.scores-list .rank-avatar { width: 34px; height: 34px; border-radius: 11px; }
.scores-list .rank-pts { color: #0f1320; font-weight: 800; }
.scores-list .rank-row.me { padding-inline: 8px; border-radius: 14px; background: rgba(39, 70, 242, .1); color: #0f1320; }
.scores-list .rank-row.me .rank-no { background: #2746f2; color: #fff; }
.scores-list .rank-row.me .rank-pts { color: #2746f2; }
.scores-list .rank-row:not(.me):hover, .scores-list .rank-row:not(.me):active { background: none; color: #0f1320; }
.scores-list .rank-row:not(.me):hover .rank-no, .scores-list .rank-row:not(.me):active .rank-no { color: #0f1320; }
.scores-list .rank-row.top:not(.me):hover .rank-no, .scores-list .rank-row.top:not(.me):active .rank-no { color: #fff; }
.scores-list .rank-row:not(.me):hover .rank-pts, .scores-list .rank-row:not(.me):active .rank-pts { color: #0f1320; }
/* منصة صغيرة لكل لعبة: الأول والثاني والثالث */
.score-card .scores-list { padding-inline: 8px; }
.score-card .rank-podium { gap: 4px; padding: 8px 0 0; border-bottom: 1px solid #eef0f4; }
.score-card .rank-podium .podium-col .rank-avatar { width: 34px; height: 34px; font-size: 14px; }
.score-card .rank-podium .podium-col.place-1 .rank-avatar { width: 44px; height: 44px; font-size: 18px; }
.score-card .podium-name { font-size: 11.5px; }
.score-card .podium-pts { font-size: 11.5px; }
.score-card .podium-col.place-1 .podium-pts { font-size: 12.5px; }
.score-card .podium-step { height: 26px; font-size: 13px; }
.score-card .podium-col.place-1 .podium-step { height: 42px; }
.score-card .podium-col.place-3 .podium-step { height: 18px; }
/* البطاقة كلها تكبر بالماوس أو بالضغط، وتبان كل الأسماء والسكورات كاملة */
.score-card { position: relative; width: 100%; align-self: start; cursor: pointer; transition: width .18s ease, box-shadow .18s ease, transform .18s ease; }
.podium-full { display: none; }
.score-card.is-open { z-index: 6; width: calc(200% + 10px); box-shadow: 0 16px 36px rgba(15, 19, 32, .3); }
.score-card:nth-child(2).is-open { justify-self: end; }
.score-card:last-child:nth-child(odd).is-open { width: 100%; }
.score-card.is-open .rank-podium .podium-col .rank-avatar { width: 54px; height: 54px; font-size: 21px; }
.score-card.is-open .rank-podium .podium-col.place-1 .rank-avatar { width: 70px; height: 70px; font-size: 27px; }
.score-card.is-open .podium-name { overflow: visible; overflow-wrap: anywhere; font-size: 14px; line-height: 1.3; white-space: normal; }
.score-card.is-open .podium-pts { font-size: 15px; }
.score-card.is-open .podium-col.place-1 .podium-pts { font-size: 17px; }
.score-card.is-open .podium-col .podium-pts:has(.podium-full), .score-card.is-open .podium-col.place-1 .podium-pts:has(.podium-full) { font-size: 0; }
.score-card.is-open .podium-full { display: inline; font-size: 15px; }
.score-card.is-open .podium-col.place-1 .podium-full { font-size: 17px; }
.score-card.is-open .podium-step { height: 44px; font-size: 18px; }
.score-card.is-open .podium-col.place-1 .podium-step { height: 70px; }
.score-card.is-open .podium-col.place-3 .podium-step { height: 32px; }
@media (prefers-reduced-motion: reduce) { .score-card { transition: none; } }
.scores-empty { color: #6c7384; font-size: 14px; text-align: center; }

/* ===== مربعات الأرقام ===== */
.stat-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-tile { padding: 16px; border-radius: var(--tile-round); background: #fff; box-shadow: var(--tile-shadow); }
.stat-tile[hidden] { display: none; }
.stat-tile small { display: block; color: #6c7384; font-size: 12.5px; }
.stat-tile strong { display: block; margin-top: 2px; font-size: 34px; font-weight: 800; letter-spacing: -1px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-tile .is-live { color: #12a150; }

.site-footer { margin: 0; padding: 12px 0 24px; border: 0; background: none; color: #6c7384; font-size: 12.5px; text-align: center; }

/* ===== الشاشات الكبيرة: 4 مربعات بالصف ===== */
@media (min-width: 800px) {
  .home { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .hero { grid-column: span 3; min-height: 520px; }
  .hero-actions .btn.primary { justify-self: start; width: 260px; }
  .hero-text { padding: 30px; }
  .score-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .score-card:last-child:nth-child(odd) { grid-column: auto; }
  .score-card.is-open { width: 100%; transform: scale(1.05); }
  .score-card .rank-podium .podium-col .rank-avatar { width: 54px; height: 54px; font-size: 21px; }
  .score-card .rank-podium .podium-col.place-1 .rank-avatar { width: 70px; height: 70px; font-size: 27px; }
  .score-card .podium-name { font-size: 14px; }
  .score-card .podium-pts { font-size: 15px; }
  .score-card .podium-col.place-1 .podium-pts { font-size: 17px; }
  .score-card .podium-step { height: 44px; font-size: 18px; }
  .score-card .podium-col.place-1 .podium-step { height: 70px; }
  .score-card .podium-col.place-3 .podium-step { height: 32px; }
  .room-entry { grid-column: span 1; display: flex; flex-direction: column; justify-content: center; }
  .room-entry form { flex-direction: column; }
  .room-entry input { flex: none; width: 100%; }
  .room-entry .btn.primary, .room-entry .btn { width: 100%; }
  .games { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .scores-box { grid-column: span 2; }
  .stat-tiles { grid-column: span 2; align-self: start; gap: 14px; }
}
.chat-open { top: 74px; inset-inline-start: 22px; }
