/* ============================================================
   Khteeb Brand Tokens
   ============================================================ */
:root {
  --ink:    #231F20;
  --cream:  #F2EDE7;
  --sand:   #B89A83;
  --teal:   #1C818E;
  --rust:   #7C4D35;
  --gold:   #E8B96A;
  --gold-deep: #C99A4E;
  --silver: #C9C2B6;
  --bronze: #B8896A;
  --emerald: #2FA88C;
  --ink-60: #5d5859;
  --cream-3: #DDD2C2;

  --font-display: "Reem Kufi", "IBM Plex Sans Arabic", system-ui, serif;
  --font-script:  "Aref Ruqaa", "Reem Kufi", serif;
  --font-body:    "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   Scaler (1920×1080 design scaled to viewport)
   ============================================================ */
.scaler {
  width: 1920px;
  height: 1080px;
  transform-origin: center center;
  flex-shrink: 0;
}

/* ============================================================
   Stage
   ============================================================ */
.stage {
  width: 1920px;
  height: 1080px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(circle at 15% 0%, rgba(28,129,142,0.18), transparent 45%),
    radial-gradient(circle at 90% 100%, rgba(232,185,106,0.14), transparent 45%),
    radial-gradient(circle at 100% 0%, rgba(124,77,53,0.16), transparent 40%),
    linear-gradient(180deg, #15110f 0%, #1a1518 100%);
  position: relative;
  overflow: hidden;
}

/* ============================================================
   Decorative diamonds
   ============================================================ */
.deco-diamond {
  position: absolute;
  background: var(--sand);
  transform: rotate(15deg);
  border-radius: 2px;
  opacity: 0.18;
  animation: floatY 8s ease-in-out infinite;
}
.deco-diamond.d1 { top: 8%;  left: 4%;  width: 18px; height: 18px; animation-delay: 0s; }
.deco-diamond.d2 { top: 22%; right: 8%; width: 12px; height: 12px; background: var(--teal); animation-delay: 1.5s; opacity: 0.35; }
.deco-diamond.d3 { bottom: 18%; left: 6%; width: 22px; height: 22px; background: var(--gold); animation-delay: 3s; opacity: 0.28; }
.deco-diamond.d4 { top: 50%; right: 3%; width: 14px; height: 14px; background: var(--rust); animation-delay: 4.5s; opacity: 0.3; }
.deco-diamond.d5 { bottom: 30%; right: 24%; width: 10px; height: 10px; animation-delay: 2s; opacity: 0.25; }
@keyframes floatY {
  0%, 100% { transform: rotate(15deg) translateY(0); }
  50%       { transform: rotate(20deg) translateY(-18px); }
}

/* ============================================================
   Top bar
   ============================================================ */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 56px 22px;
  border-bottom: 1px solid rgba(242,237,231,0.10);
  position: relative;
  z-index: 2;
}

.brand { display: flex; align-items: center; gap: 22px; }

.brand img {
  width: 88px; height: 88px;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 0 1px rgba(232,185,106,0.3);
}

.brand-title {
  font-family: var(--font-script);
  font-weight: 700;
  font-size: 46px;
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, #fff 0%, var(--sand) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 4px;
}

.meta { display: flex; gap: 14px; align-items: center; }
.pill {
  background: rgba(242,237,231,0.06);
  border: 1px solid rgba(242,237,231,0.10);
  padding: 10px 18px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--cream);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.pill strong { color: var(--gold); margin-inline-start: 4px; font-weight: 700; }

.live-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #ff5b6e;
  box-shadow: 0 0 10px #ff5b6e;
  animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.3); opacity: 0.6; }
}

/* ============================================================
   Body grid
   ============================================================ */
.body {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 32px;
  padding: 28px 56px;
  overflow: hidden;
  min-height: 0;
  position: relative;
  z-index: 2;
}

/* ============================================================
   Leaderboard list
   ============================================================ */
.lb-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 16px;
  font-family: var(--font-script);
  font-weight: 700;
  font-size: 36px;
  color: var(--cream);
}
.section-title .accent {
  display: inline-block;
  width: 14px; height: 14px;
  background: var(--gold);
  transform: rotate(15deg);
  border-radius: 2px;
  box-shadow: 0 0 16px rgba(232,185,106,0.6);
}
.section-title .count {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--gold);
  letter-spacing: 0.14em;
  margin-inline-start: auto;
}

.lb-list {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.lb-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto 56px;
  gap: 22px;
  align-items: center;
  background: linear-gradient(90deg, rgba(242,237,231,0.05), rgba(242,237,231,0.02));
  border: 1px solid rgba(242,237,231,0.08);
  border-radius: 16px;
  padding: 14px 22px;
  margin-bottom: 10px;
  position: relative;
  transition: transform 0.7s cubic-bezier(0.34, 1.2, 0.64, 1), background 0.5s, border-color 0.5s;
  will-change: transform;
}

/* Podium */
.lb-row.podium-1 {
  background: linear-gradient(90deg, rgba(232,185,106,0.32) 0%, rgba(232,185,106,0.06) 100%);
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 0 1px rgba(232,185,106,0.2), 0 8px 32px rgba(232,185,106,0.18);
}
.lb-row.podium-1::before {
  content: "";
  position: absolute; inset: -1.5px;
  border-radius: 16px;
  background: linear-gradient(90deg, transparent, rgba(232,185,106,0.5), transparent);
  background-size: 200% 100%;
  animation: shimmer 3.5s linear infinite;
  pointer-events: none;
  z-index: -1;
  opacity: 0.6;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.lb-row.podium-2 {
  background: linear-gradient(90deg, rgba(201,194,182,0.2), rgba(201,194,182,0.04));
  border-color: var(--silver);
}
.lb-row.podium-3 {
  background: linear-gradient(90deg, rgba(184,137,106,0.22), rgba(184,137,106,0.04));
  border-color: var(--bronze);
}

/* Rank badge */
.rank-cell { display: flex; align-items: center; justify-content: center; }
.rank {
  font-family: "Cairo", var(--font-display);
  font-weight: 800;
  font-size: 38px;
  line-height: 1;
  color: var(--cream);
}
.rank-medal {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: "Cairo", sans-serif;
  font-weight: 900;
  font-size: 28px;
  color: #15110f;
  flex-shrink: 0;
}
.rank-medal.gold   { background: radial-gradient(circle at 30% 30%, #ffe27a, var(--gold) 60%, #a8722d); box-shadow: 0 6px 20px rgba(232,185,106,0.5), inset 0 -3px 8px rgba(0,0,0,0.2); }
.rank-medal.silver { background: radial-gradient(circle at 30% 30%, #f5f1e8, var(--silver) 60%, #897d6b); box-shadow: 0 6px 18px rgba(201,194,182,0.4), inset 0 -3px 8px rgba(0,0,0,0.2); }
.rank-medal.bronze { background: radial-gradient(circle at 30% 30%, #d8a574, var(--bronze) 60%, #6e4a2c); box-shadow: 0 6px 18px rgba(184,137,106,0.4), inset 0 -3px 8px rgba(0,0,0,0.2); }

/* Player */
.player { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.name {
  font-family: "Cairo", "IBM Plex Sans Arabic", sans-serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--cream);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: -0.01em;
}
.lb-row.podium-1 .name { font-size: 32px; font-weight: 800; }
.lb-row.podium-2 .name { font-size: 30px; }

.game-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--cream); opacity: 0.85; width: fit-content; }
.game-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  font-family: "IBM Plex Sans Arabic", sans-serif;
}
.game-chip.puzzle  { background: rgba(28,129,142,0.22);  color: #6dcad6; border: 1px solid rgba(28,129,142,0.5); }
.game-chip.invest  { background: rgba(124,77,53,0.28);   color: #d8a07d; border: 1px solid rgba(124,77,53,0.6); }
.game-chip.team    { background: rgba(184,154,131,0.22); color: #e8c9ae; border: 1px solid rgba(184,154,131,0.55); }
.game-chip.company { background: rgba(232,185,106,0.22); color: #f0d18a; border: 1px solid rgba(232,185,106,0.5); }

.ago { font-family: var(--font-mono); font-size: 12px; color: rgba(242,237,231,0.55); }

/* Score */
.score-cell { text-align: end; }
.score {
  font-family: "Cairo", var(--font-display);
  font-weight: 800;
  font-size: 36px;
  color: var(--cream);
  line-height: 1;
}
.lb-row.podium-1 .score {
  font-size: 44px;
  background: linear-gradient(180deg, #fff 0%, var(--gold) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.score-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gold);
  opacity: 0.7;
  margin-top: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Delta */
.delta-cell { display: flex; align-items: center; justify-content: center; }
.delta {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: "Cairo", sans-serif;
  font-weight: 800;
  font-size: 13px;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}
.delta.up    { background: rgba(47,168,140,0.18); color: var(--emerald); border: 1px solid rgba(47,168,140,0.4); }
.delta.down  { background: rgba(255,91,110,0.18); color: #ff7f8e;        border: 1px solid rgba(255,91,110,0.4); }
.delta.same  { background: rgba(242,237,231,0.06); color: rgba(242,237,231,0.4); border: 1px solid rgba(242,237,231,0.1); }
.delta.new   { background: var(--gold); color: #15110f; border: 1px solid var(--gold); }
.delta .arrow { font-size: 14px; font-weight: 900; line-height: 1; }
.delta .nval  { font-size: 11px; opacity: 0.85; }

/* Row animations */
.lb-row.entered { animation: rowEnter 0.7s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
@keyframes rowEnter {
  0%   { opacity: 0; transform: translateX(60px) scale(0.92); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
.lb-row.flash-up   { animation: flashUp 1.6s ease-out; }
@keyframes flashUp {
  0%   { box-shadow: 0 0 0 0 rgba(47,168,140,0.7), 0 0 32px rgba(47,168,140,0.5); transform: scale(1.02); }
  50%  { box-shadow: 0 0 0 12px rgba(47,168,140,0), 0 0 32px rgba(47,168,140,0.3); }
  100% { box-shadow: 0 0 0 0 rgba(47,168,140,0); transform: scale(1); }
}
.lb-row.flash-down { animation: flashDown 1.4s ease-out; }
@keyframes flashDown {
  0%   { box-shadow: 0 0 0 0 rgba(255,91,110,0.5); }
  40%  { box-shadow: 0 0 0 10px rgba(255,91,110,0); transform: translateX(-4px); }
  60%  { transform: translateX(3px); }
  100% { box-shadow: 0 0 0 0 rgba(255,91,110,0); transform: translateX(0); }
}
.lb-row.flash-new  { animation: flashNew 1.6s ease-out; }
@keyframes flashNew {
  0%   { box-shadow: 0 0 0 0 rgba(232,185,106,0.8); background: rgba(232,185,106,0.4); }
  100% { box-shadow: 0 0 0 14px rgba(232,185,106,0); }
}

/* Empty state */
.empty-row {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--sand); opacity: 0.7;
  font-family: "Cairo", sans-serif; font-weight: 600; font-size: 18px;
  padding: 60px 20px; gap: 8px;
  background: rgba(242,237,231,0.03);
  border: 1px dashed rgba(242,237,231,0.12);
  border-radius: 16px;
}
.empty-row .em-glyph { font-size: 36px; opacity: 0.4; }
.empty-row .em-sub { font-family: var(--font-mono); font-size: 13px; opacity: 0.6; letter-spacing: 0.08em; }

/* ============================================================
   Right column
   ============================================================ */
.right { display: flex; flex-direction: column; gap: 22px; min-height: 0; position: relative; }

/* Games/QR container */
.games-qr-container {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Hero */
.hero {
  background:
    radial-gradient(ellipse at top right, rgba(232,185,106,0.32), transparent 60%),
    linear-gradient(135deg, rgba(232,185,106,0.16) 0%, rgba(124,77,53,0.16) 100%);
  border: 1.5px solid rgba(232,185,106,0.5);
  border-radius: 24px;
  padding: 30px 32px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "👑";
  position: absolute;
  top: -10px; left: -10px;
  font-size: 100px;
  opacity: 0.06;
  transform: rotate(-15deg);
  pointer-events: none;
}
.hero-kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 13px;
  color: var(--gold); letter-spacing: 0.2em; text-transform: uppercase; font-weight: 600;
}
.hero-kicker .crown { font-size: 18px; }
.hero-title {
  font-family: "Cairo", sans-serif; font-weight: 800;
  font-size: 52px; margin: 12px 0 18px; line-height: 1;
  color: var(--cream);
  text-shadow: 0 2px 20px rgba(0,0,0,0.4);
}
.hero-stats { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.stat-card {
  background: rgba(0,0,0,0.32);
  border: 1px solid rgba(242,237,231,0.08);
  border-radius: 14px; padding: 14px 18px;
}
.stat-label { font-family: var(--font-mono); font-size: 11px; color: var(--gold); letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; }
.stat-value { font-family: "Cairo", sans-serif; font-weight: 800; font-size: 32px; margin-top: 4px; color: var(--cream); line-height: 1.1; }
.stat-value.small { font-size: 18px; font-weight: 700; }

/* Games block */
.games-block {
  background: rgba(242,237,231,0.04);
  border: 1px solid rgba(242,237,231,0.10);
  border-radius: 24px;
  padding: 26px 28px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex; 
  flex-direction: column; 
  gap: 16px;
  min-height: 0;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
  transform: translateX(0);
  opacity: 1;
}
.games-block.hidden {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

/* QR Code block */
.qr-block {
  background: rgba(242,237,231,0.04);
  border: 1px solid rgba(242,237,231,0.10);
  border-radius: 24px;
  padding: 26px 28px;
  flex: 1;
  display: flex; 
  flex-direction: column; 
  gap: 16px;
  min-height: 0;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}
.qr-block.visible {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.qr-title {
  font-family: var(--font-script); font-weight: 700; font-size: 28px;
  display: flex; align-items: center; gap: 12px;
}
.qr-title .accent {
  width: 12px; height: 12px;
  transform: rotate(15deg); border-radius: 2px;
}
.qr-title .accent.teal { background: var(--teal); box-shadow: 0 0 12px rgba(28,129,142,0.6); }

/* Navigation arrows */
.nav-arrow {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(242,237,231,0.15);
  color: var(--cream);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-inline-start: auto;
  flex-shrink: 0;
  font-family: monospace;
  line-height: 1;
}
.nav-arrow:hover {
  background: rgba(28,129,142,0.3);
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(28,129,142,0.3);
}
.nav-arrow:active {
  transform: translateY(0);
}

.qr-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-height: 0;
}

.qr-code-container {
  background: var(--cream);
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

#qr-image {
  display: block;
  width: 280px;
  height: 280px;
  border-radius: 8px;
  object-fit: contain;
}

.qr-instructions {
  text-align: center;
  max-width: 320px;
}

.qr-main-text {
  font-family: "Cairo", sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: var(--cream);
  margin-bottom: 8px;
}

.qr-sub-text {
  font-family: "IBM Plex Sans Arabic", sans-serif;
  font-size: 15px;
  color: rgba(242,237,231,0.7);
  line-height: 1.6;
}
.games-title {
  font-family: var(--font-script); font-weight: 700; font-size: 28px;
  display: flex; align-items: center; gap: 12px;
}
.games-title .accent {
  width: 12px; height: 12px;
  transform: rotate(15deg); border-radius: 2px;
}
.games-title .accent.teal { background: var(--teal); box-shadow: 0 0 12px rgba(28,129,142,0.6); }

.games-list { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.game-row {
  display: grid; grid-template-columns: 52px 1fr auto;
  gap: 16px; align-items: center;
  background: rgba(0,0,0,0.2);
  border-radius: 14px; padding: 12px 16px;
  border-inline-start: 4px solid;
}
.game-row.puzzle  { border-color: var(--teal); }
.game-row.invest  { border-color: var(--rust); }
.game-row.team    { border-color: var(--sand); }
.game-row.company { border-color: var(--gold); }

.game-glyph {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: "Cairo", sans-serif; font-weight: 800; font-size: 24px;
  color: #15110f;
}
.game-row.puzzle  .game-glyph { background: linear-gradient(135deg, #6dcad6, var(--teal)); }
.game-row.invest  .game-glyph { background: linear-gradient(135deg, #d8a07d, var(--rust)); color: var(--cream); }
.game-row.team    .game-glyph { background: linear-gradient(135deg, #e8c9ae, var(--sand)); }
.game-row.company .game-glyph { background: linear-gradient(135deg, #f0d18a, var(--gold)); }

.game-name { font-family: "Cairo", sans-serif; font-weight: 700; font-size: 18px; color: var(--cream); }
.game-best { font-family: "IBM Plex Sans Arabic", sans-serif; font-size: 13px; color: rgba(242,237,231,0.65); margin-top: 3px; }
.game-best .nm { color: var(--gold); font-weight: 600; }
.game-count { font-family: "Cairo", sans-serif; font-weight: 800; font-size: 28px; color: var(--cream); line-height: 1; }
.game-count-sub { font-family: var(--font-mono); font-size: 10px; color: var(--gold); opacity: 0.7; text-align: end; letter-spacing: 0.08em; text-transform: uppercase; }

/* ============================================================
   Bottom marquee
   ============================================================ */
.bottom {
  border-top: 1px solid rgba(242,237,231,0.10);
  padding: 16px 56px;
  display: flex; align-items: center; justify-content: space-between;
  font-family: "IBM Plex Sans Arabic", sans-serif; font-size: 15px;
  color: var(--cream); opacity: 0.92;
  min-width: 0; overflow: hidden;
  background: rgba(0,0,0,0.3);
  position: relative; z-index: 2;
}
.bottom-brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 13px;
  color: var(--gold); letter-spacing: 0.05em;
}
.bottom-diamond {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--gold);
  transform: rotate(15deg);
  border-radius: 1px;
}

.marquee-track {
  flex: 1; overflow: hidden; margin-inline: 28px;
  min-width: 0;
  mask-image: linear-gradient(90deg, transparent, black 6%, black 94%, transparent);
}
.marquee {
  display: inline-flex; gap: 44px;
  white-space: nowrap;
  animation: scroll 42s linear infinite;
}
@keyframes scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee-item {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: "IBM Plex Sans Arabic", sans-serif; font-size: 16px;
}
.marquee-item .who { font-weight: 700; color: var(--cream); }
.marquee-item .pts { color: var(--gold); font-weight: 600; }
.marquee-item .dot {
  width: 7px; height: 7px;
  transform: rotate(15deg); border-radius: 1px; flex-shrink: 0;
}
.marquee-item .dot.puzzle  { background: var(--teal); }
.marquee-item .dot.invest  { background: var(--rust); }
.marquee-item .dot.team    { background: var(--sand); }
.marquee-item .dot.company { background: var(--gold); }

.clock {
  font-family: "Cairo", sans-serif; font-weight: 800; font-size: 24px;
  color: var(--gold); letter-spacing: 0.05em;
}

.tabular { font-variant-numeric: tabular-nums; }

/* ============================================================
   Responsive — mobile / tablet  (< 1024px)
   Desktop keeps the 1920×1080 scaler approach unchanged.
   ============================================================ */
@media (max-width: 1023px) {

  /* ── Reset the fixed-canvas scaler ── */
  html, body {
    height: auto;
    overflow: auto;
    display: block;
    align-items: unset;
    justify-content: unset;
  }

  .scaler {
    width: 100%;
    height: auto;
    transform: none !important;
  }

  .stage {
    width: 100%;
    height: auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  /* ── Top bar ── */
  .top {
    padding: 16px 20px 14px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .brand img {
    width: 52px;
    height: 52px;
    border-radius: 12px;
  }

  .brand { gap: 14px; }

  .brand-title { font-size: 28px; }
  .brand-sub   { font-size: 11px; letter-spacing: 0.1em; }

  .meta { gap: 8px; flex-wrap: wrap; }

  .pill {
    padding: 7px 12px;
    font-size: 12px;
    gap: 7px;
  }

  /* ── Body: single column ── */
  .body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 16px 16px 20px;
    overflow: visible;
  }

  /* ── Leaderboard list ── */
  .lb-wrap { gap: 12px; }

  .section-title { font-size: 22px; gap: 10px; }
  .section-title .accent { width: 10px; height: 10px; }
  .section-title .count  { font-size: 12px; }

  .lb-list { overflow: visible; }

  .lb-row {
    grid-template-columns: 52px minmax(0, 1fr) auto 40px;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: 12px;
  }

  .rank        { font-size: 24px; }
  .rank-medal  { width: 44px; height: 44px; font-size: 20px; }

  .name                   { font-size: 18px; }
  .lb-row.podium-1 .name  { font-size: 20px; }
  .lb-row.podium-2 .name  { font-size: 19px; }

  .game-chip { font-size: 11px; padding: 2px 8px; }
  .ago       { font-size: 11px; }

  .score                   { font-size: 22px; }
  .lb-row.podium-1 .score  { font-size: 26px; }
  .score-sub               { font-size: 10px; }

  .delta       { width: 34px; height: 34px; font-size: 11px; border-radius: 8px; }
  .delta .arrow { font-size: 12px; }

  /* ── Right column: stacks below leaderboard ── */
  .right { gap: 16px; }

  .hero { padding: 20px 20px; border-radius: 18px; }
  .hero-kicker { font-size: 11px; }
  .hero-title  { font-size: 32px; margin: 8px 0 14px; }
  .stat-value  { font-size: 22px; }
  .stat-value.small { font-size: 15px; }
  .stat-label  { font-size: 10px; }
  .stat-card   { padding: 10px 14px; border-radius: 10px; }

  .games-block { padding: 18px 16px; border-radius: 18px; }
  .games-title { font-size: 20px; }

  .qr-block { padding: 18px 16px; border-radius: 18px; }
  .qr-title { font-size: 20px; }
  .qr-code-container { padding: 16px; }
  #qr-image { width: 200px !important; height: 200px !important; }
  .qr-main-text { font-size: 22px; }
  .qr-sub-text { font-size: 13px; }
  
  .nav-arrow { width: 32px; height: 32px; font-size: 16px; border-radius: 8px; }

  .game-row    { padding: 10px 12px; border-radius: 10px; gap: 12px; }
  .game-glyph  { width: 40px; height: 40px; font-size: 18px; border-radius: 8px; }
  .game-name   { font-size: 15px; }
  .game-best   { font-size: 12px; }
  .game-count  { font-size: 22px; }
  .game-count-sub { font-size: 9px; }

  /* ── Bottom bar ── */
  .bottom {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .bottom-brand { font-size: 11px; }
  .clock        { font-size: 18px; }

  /* Slow marquee slightly on small screens */
  .marquee { animation-duration: 28s; }
  .marquee-item { font-size: 14px; gap: 8px; }

  /* Decorative diamonds — tone down on mobile */
  .deco-diamond { display: none; }
}

/* ── Extra-small phones (< 400px) ── */
@media (max-width: 399px) {
  .brand-title { font-size: 22px; }
  .name        { font-size: 16px; }
  .score       { font-size: 19px; }
  .lb-row.podium-1 .score { font-size: 22px; }
  .hero-title  { font-size: 26px; }
  .pill        { font-size: 11px; padding: 6px 10px; }
}
