/* ================================================
   Shakkba — All Screens
   Design system shared with the in-game prototype
================================================ */

:root {
  --gold: #C9A961;
  --gold-bright: #FFD700;
  --gold-deep: #8a6d2e;
  --red: #8B2635;
  --red-bright: #dc283c;
  --blue: #1B4965;
  --emerald: #1F4D3A;
  --emerald-deep: #0f3325;
  --sand: #E8DCC4;
  --olive: #6B7F50;
  --terra: #C65D32;
  --midnight: #14152a;
  --midnight-deep: #0c0d1c;
  --ivory: #fff8e7;
  --ink: #1a1b2e;
  --line: rgba(201, 169, 97, 0.2);
  --line-strong: rgba(201, 169, 97, 0.45);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;

  --shadow-1: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 18px 50px rgba(0, 0, 0, 0.45);
  --shadow-gold: 0 0 0 1px rgba(201, 169, 97, 0.3), 0 14px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Cairo', system-ui, sans-serif;
  background: var(--midnight-deep);
  color: var(--ivory);
  min-height: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(201,169,97,0.08), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(139,38,53,0.10), transparent 60%),
    linear-gradient(180deg, #0d0e1c 0%, #14152a 50%, #0a0b18 100%);
  /* `background-attachment: fixed` is banned per CLAUDE.md — on iOS Safari
     a fixed background renders at viewport size while body uses safe-area-
     inset padding, producing a visible rightward gap under the notch in
     RTL. The hayya body rule (hayya-theme.css) anyway re-shorthands
     `background:` which would reset this to scroll; deleted defensively. */
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }

/* =========================================================
   NAV
========================================================= */
.screens-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 28px;
  background: rgba(12, 13, 28, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: rgba(201,169,97,0.08);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.brand-name {
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--gold-bright);
  letter-spacing: 0.02em;
  line-height: 1;
}
.brand-sub {
  font-size: 10px;
  color: var(--sand);
  opacity: 0.55;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 3px;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 12px;
}
.nav-tab {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--sand);
  opacity: 0.7;
  transition: all 0.2s ease;
}
.nav-tab:hover {
  opacity: 1;
  background: rgba(255,255,255,0.04);
}
.nav-tab.active {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: var(--midnight-deep);
  opacity: 1;
  box-shadow: 0 4px 12px rgba(201,169,97,0.25);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2.5px;
  width: 100%;
  background: var(--gold-bright);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
  transform-origin: center;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(9.75px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-9.75px) rotate(-45deg); }

/* =========================================================
   SCREEN BASE
========================================================= */
.screen {
  display: none;
  padding: 40px 32px 80px;
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  opacity: 1;
}
.screen.active {
  display: block;
  animation: screenIn 0.45s ease;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(201,169,97,0.08);
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  font-size: 13px;
  color: var(--gold);
  margin-bottom: 16px;
}
.screen-eyebrow .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 10px var(--gold-bright);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.screen-title {
  font-family: 'Reem Kufi', sans-serif;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  color: var(--ivory);
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.screen-sub {
  color: var(--sand);
  opacity: 0.7;
  font-size: 16px;
  margin-top: 8px;
}

/* =========================================================
   BUTTONS (shared)
========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  transition: all 0.25s cubic-bezier(.22,1,.36,1);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-deep) 100%);
  color: #20140a;
  box-shadow: 0 6px 18px rgba(201,169,97,0.35), inset 0 1px 0 rgba(255,255,255,0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255,215,0,0.4), inset 0 1px 0 rgba(255,255,255,0.5);
}
.btn-glow {
  position: absolute;
  top: 0; left: -60%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  pointer-events: none;
  /* Animate `transform` (GPU-composited) not `left` (forces a layout reflow
     every frame). This sweep runs infinitely on primary buttons across home,
     every /auth page, lobby and setup — `left` reflow per frame was a real
     mobile main-thread/heat cost. translateX(283.333%) == 1.7x the button
     width (element is 60% wide), so the gleam still travels -60%→110%. */
  will-change: transform;
  animation: btnGlow 3s ease-in-out infinite;
}
@keyframes btnGlow {
  0%,90%,100% { transform: translateX(0); }
  45%,55% { transform: translateX(283.333%); }
}

.btn-ghost {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-strong);
  color: var(--ivory);
}
.btn-ghost:hover {
  background: rgba(201,169,97,0.08);
  border-color: var(--gold);
  transform: translateY(-1px);
}

.btn-block { width: 100%; }
.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

/* =========================================================
   HOME
========================================================= */
.home {
  padding-top: 0;
  padding-bottom: 100px;
}

.ambient-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  animation: orbFloat 20s ease-in-out infinite;
}
.orb-1 { width: 400px; height: 400px; background: var(--gold); top: -10%; right: -5%; animation-delay: 0s; }
.orb-2 { width: 350px; height: 350px; background: var(--red); top: 40%; left: -8%; animation-delay: -7s; }
.orb-3 { width: 300px; height: 300px; background: var(--blue); bottom: -10%; right: 30%; animation-delay: -14s; }
@keyframes orbFloat {
  0%,100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, 30px) scale(1.1); }
  66% { transform: translate(-30px, 50px) scale(0.95); }
}

.floating-cards { position: absolute; inset: 0; pointer-events: none; z-index: 1; opacity: 0.32; }
.float-card {
  position: absolute;
  width: 64px;
  height: 90px;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
.fc1 { top: 8%;     left: 8%;   --r: -15deg; animation: floatA 12s ease-in-out infinite; }
.fc2 { top: 18%;    right: 12%; --r:  20deg; animation: floatA 14s ease-in-out infinite -3s; }
.fc3 { bottom: 30%; left: 6%;   --r:   8deg; animation: floatA 16s ease-in-out infinite -6s; }
.fc4 { bottom: 12%; right: 20%; --r: -10deg; animation: floatA 13s ease-in-out infinite -9s; }
.fc5 { top: 50%;    left: 45%;  --r:  45deg; animation: floatA 18s ease-in-out infinite -2s; opacity: 0.55; }
@keyframes floatA {
  0%,100% { transform: translate(0,0) rotate(var(--r, 0deg)); }
  50% { transform: translate(15px, -20px) rotate(var(--r, 0deg)); }
}

/* `.home-grid` re-declared with full chrome in hayya-theme.css (border,
   background, decorative ::before, refined column ratio). Every property
   set here was already redeclared in the hayya layer, so the rule is
   fully shadowed — kept only as a comment for grep visibility. */

.home-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(201,169,97,0.08);
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  width: fit-content;
  font-size: 13px;
  color: var(--gold);
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold-bright); box-shadow: 0 0 10px var(--gold-bright); animation: pulse 2s infinite; }

.hero-title {
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 700;
  font-size: clamp(48px, 7vw, 88px);
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.line-1 {
  display: block;
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 20px rgba(255,215,0,0.25));
}
.line-2 {
  display: block;
  color: var(--ivory);
  margin-top: 4px;
  font-size: 0.55em;
  font-weight: 500;
  opacity: 0.85;
}

.hero-sub {
  font-size: 17px;
  line-height: 1.7;
  color: var(--sand);
  opacity: 0.8;
  max-width: 520px;
}

.hero-cta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.stat { text-align: center; }
.stat-num {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--gold-bright);
  line-height: 1;
}
.stat-lbl { font-size: 12px; color: var(--sand); opacity: 0.6; margin-top: 4px; }
.stat-sep { width: 1px; height: 28px; background: var(--line); }

/* hero card stage */
.home-right {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 480px;
}
.hero-card-stage {
  position: relative;
  width: 360px; height: 480px;
  display: grid;
  place-items: center;
  perspective: 1200px;
}
.ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--gold);
  opacity: 0.15;
  animation: ringRot 30s linear infinite;
}
.ring-1 { width: 480px; height: 480px; opacity: 0.1; }
.ring-2 { width: 380px; height: 380px; opacity: 0.18; animation-direction: reverse; animation-duration: 24s; border-style: dashed; }
.ring-3 { width: 280px; height: 280px; opacity: 0.25; animation-duration: 18s; }
@keyframes ringRot { to { transform: rotate(360deg); } }

.hero-card {
  position: relative;
  width: 220px;
  aspect-ratio: 5/7;
  animation: cardFloat 6s ease-in-out infinite;
  transform-style: preserve-3d;
}
@keyframes cardFloat {
  0%,100% { transform: translateY(0) rotateY(-6deg) rotateX(4deg); }
  50% { transform: translateY(-12px) rotateY(6deg) rotateX(-2deg); }
}
.hero-card-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 18px;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 215, 0, 0.25);
  filter: drop-shadow(0 0 18px rgba(255, 215, 0, 0.18));
}

.card-shadow {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 30px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.6) 0%, transparent 70%);
  filter: blur(8px);
  z-index: -1;
  animation: shadowPulse 6s ease-in-out infinite;
}
@keyframes shadowPulse {
  0%,100% { transform: translateX(-50%) scale(1); opacity: 0.6; }
  50% { transform: translateX(-50%) scale(0.85); opacity: 0.3; }
}

.card-label {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Reem Kufi', sans-serif;
  font-size: 22px;
  color: var(--gold-bright);
  letter-spacing: 0.1em;
  text-shadow: 0 2px 10px rgba(255,215,0,0.4);
}

.home-features {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 60px;
}
.feature-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(.22,1,.36,1);
}
.feature-card:hover {
  background: rgba(201,169,97,0.06);
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
}
.feature-icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 14px;
  flex-shrink: 0;
  color: var(--gold-bright);
}
.ico-bot { background: linear-gradient(135deg, rgba(27,73,101,0.4), rgba(27,73,101,0.1)); border: 1px solid rgba(27,73,101,0.5); color: #5dade2; }
.ico-pvp { background: linear-gradient(135deg, rgba(139,38,53,0.4), rgba(139,38,53,0.1)); border: 1px solid rgba(139,38,53,0.5); color: #ec7385; }
.ico-stats { background: linear-gradient(135deg, rgba(201,169,97,0.4), rgba(201,169,97,0.1)); border: 1px solid rgba(201,169,97,0.5); }
.feature-body { flex: 1; }
.feature-title { font-family: 'Reem Kufi', sans-serif; font-size: 18px; color: var(--ivory); }
.feature-sub { font-size: 13px; color: var(--sand); opacity: 0.7; margin-top: 2px; }
.feature-arrow { color: var(--gold); font-size: 22px; transition: transform 0.25s; }
.feature-card:hover .feature-arrow { transform: translateX(-4px); }

.home-proverb {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-top: 60px;
  padding: 32px;
  border-top: 1px solid var(--line);
}
.quote-mark {
  font-family: 'Amiri', serif;
  font-size: 72px;
  color: var(--gold);
  opacity: 0.3;
  line-height: 0.4;
  margin-bottom: 8px;
}
.proverb-text {
  font-family: 'Amiri', serif;
  font-size: 22px;
  color: var(--ivory);
  font-weight: 700;
  margin-bottom: 8px;
}
.proverb-attr {
  font-size: 13px;
  color: var(--gold);
  opacity: 0.8;
}

/* =========================================================
   FEEDBACK SURVEY
========================================================= */
.home-feedback {
  position: relative;
  z-index: 2;
  margin-top: 60px;
  padding: 36px 32px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-2);
}
.feedback-glow {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 200px;
  background: radial-gradient(ellipse, rgba(201,169,97,0.18) 0%, transparent 70%);
  pointer-events: none;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.feedback-icon-wrap {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(201,169,97,0.25), rgba(201,169,97,0.06));
  border: 1px solid rgba(201,169,97,0.4);
  color: var(--gold-bright);
  flex-shrink: 0;
  animation: feedbackIconPulse 3s ease-in-out infinite;
}
@keyframes feedbackIconPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(201,169,97,0); }
  50% { box-shadow: 0 0 20px rgba(201,169,97,0.2); }
}
.feedback-title {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--ivory);
}
.feedback-sub {
  font-size: 14px;
  color: var(--sand);
  opacity: 0.7;
  margin-top: 4px;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feedback-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--sand);
  opacity: 0.85;
}
.feedback-label svg {
  color: var(--gold);
  opacity: 0.7;
}
.feedback-input-wrap {
  position: relative;
}
.feedback-input-wrap input,
.feedback-input-wrap textarea {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ivory);
  font-size: 15px;
  font-family: 'Cairo', sans-serif;
  transition: all 0.25s ease;
  outline: none;
  resize: vertical;
}
.feedback-input-wrap input::placeholder,
.feedback-input-wrap textarea::placeholder {
  color: var(--sand);
  opacity: 0.35;
}
.feedback-input-wrap input:focus,
.feedback-input-wrap textarea:focus {
  border-color: var(--gold);
  background: rgba(201,169,97,0.06);
  box-shadow: 0 0 0 3px rgba(201,169,97,0.12);
}
.feedback-textarea-wrap {
  position: relative;
}
/* `.feedback-char-count` is fully redeclared in hayya-theme.css.
   `pointer-events: none` and `font-feature-settings: "tnum"` (which keep
   the counter from blocking textarea clicks and line digit widths up)
   were moved there so the duplicate here can stay deleted. */

.feedback-submit {
  align-self: flex-start;
  margin-top: 4px;
}
.feedback-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}
.feedback-submit.loading span:last-child {
  visibility: hidden;
}
.feedback-submit.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(32,20,10,0.3);
  border-top-color: #20140a;
  border-radius: 50%;
  animation: fbSpin 0.6s linear infinite;
}
@keyframes fbSpin {
  to { transform: rotate(360deg); }
}

/* Success state */
.feedback-success {
  text-align: center;
  padding: 32px 0 8px;
  animation: fbFadeIn 0.5s cubic-bezier(.22,1,.36,1);
}
@keyframes fbFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.feedback-success-icon {
  font-size: 52px;
  margin-bottom: 12px;
  animation: fbBounce 0.6s cubic-bezier(.34,1.56,.64,1);
}
@keyframes fbBounce {
  0% { transform: scale(0.3); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.feedback-success-text {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 20px;
  color: var(--gold-bright);
  margin-bottom: 18px;
}

/* Error toast */
.feedback-error {
  padding: 10px 16px;
  background: rgba(220,40,60,0.12);
  border: 1px solid rgba(220,40,60,0.35);
  border-radius: 10px;
  font-size: 14px;
  color: #f87171;
  text-align: center;
  animation: fbFadeIn 0.3s ease;
}

@media (max-width: 700px) {
  .home-feedback {
    padding: 24px 18px;
    margin-top: 40px;
  }
  .feedback-header {
    flex-direction: column;
    text-align: center;
  }
  .feedback-submit {
    align-self: stretch;
  }
}

/* =========================================================
   AUTH (Login + Register)
========================================================= */
.auth {
  padding: 0;
  max-width: none;
  height: calc(100vh - 67px);
  min-height: 700px;
  display: grid;
  place-items: center;
}
/* The pre-redesign two-column auth layout (`.auth-shell`, `.auth-art*`,
   `.perks`, `.auth-form-wrap`, `.auth-tabs`, `.auth-tab`) lived here but
   was retired when /auth/login + /auth/signin moved to the
   `.login-stage` single-column shell (see _login-stage.css). Every
   selector in this block was unreachable. Form-level styles below
   (.auth-form, .field*, .form-*) are still in use by signup/forgot. */

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.form-title { font-family: 'Reem Kufi', sans-serif; font-size: 26px; color: var(--ivory); }
.form-sub { font-size: 13px; color: var(--sand); opacity: 0.7; margin-top: -8px; margin-bottom: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-lbl { font-size: 13px; color: var(--sand); opacity: 0.85; }
.field-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: all 0.2s;
}
.field-input:focus-within {
  border-color: var(--gold);
  background: rgba(201,169,97,0.06);
  box-shadow: 0 0 0 3px rgba(201,169,97,0.12);
}
.field-input svg { color: var(--gold); opacity: 0.7; flex-shrink: 0; }
.field-input-password {
  padding-block: 4px;
}
.field-input-password input {
  min-height: 44px;
}
.field-input-password .eye-toggle {
  flex-shrink: 0;
}
.field-input input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ivory);
  font-size: 15px;
}
.field-input input::placeholder { color: var(--sand); opacity: 0.4; }
.screen.auth .field-input :is(input, select) { min-width: 0; }
.screen.auth form[aria-busy="true"] button { opacity: 0.55; cursor: wait; }
.field-input .prefix { color: var(--gold); font-weight: 700; }
.field-input .suffix-good { color: #10B981; font-size: 12px; font-weight: 600; }
/* <select> rendered inside a .field-input (signup country / city picker)
   needs the same transparent / flex styling the bare <input> gets so
   the dropdown sits flush with the field's gold-bordered shell. */
.field-input select {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ivory);
  font-size: 15px;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 1.4em;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%),
                    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 14px) center, calc(100% - 9px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.field-input select option { background: #15101c; color: var(--ivory); }
/* Inline hint inside the label (e.g. "(اختياري)" suffix). */
.field-hint {
  font-size: 11px;
  color: var(--sand);
  opacity: 0.5;
  font-weight: 400;
  margin-inline-start: 6px;
}
.eye-toggle {
  color: var(--sand);
  opacity: 0.6;
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
}
.eye-toggle:hover { opacity: 1; color: var(--gold); }

.pw-strength { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.pw-bar { flex: 1; height: 4px; background: rgba(255,255,255,0.06); border-radius: 100px; overflow: hidden; }
.pw-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red-bright), #f59e0b, var(--gold-bright), #10B981);
  background-size: 400% 100%;
  background-position: 65% 0;
  border-radius: 100px;
}
.pw-label { font-size: 12px; color: #10B981; font-weight: 600; }

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--sand);
}
.check input { display: none; }
.check-box {
  width: 18px; height: 18px;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  display: grid; place-items: center;
  transition: all 0.2s;
}
.check input:checked + .check-box {
  background: var(--gold);
  border-color: var(--gold);
}
.check input:checked + .check-box::after {
  content: '✓';
  color: var(--midnight-deep);
  font-weight: 700;
  font-size: 12px;
}
.check-block { font-size: 12px; line-height: 1.5; }

.form-link { color: var(--gold-bright); cursor: pointer; }
.form-link:hover { text-decoration: underline; }
button.form-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 4px;
  font: inherit;
}

.form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  color: var(--sand);
  opacity: 0.5;
  font-size: 12px;
}
.form-divider::before, .form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.oauth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ivory);
  transition: all 0.2s;
}
.oauth-btn:hover { background: rgba(255,255,255,0.08); border-color: var(--line-strong); }

.form-foot {
  text-align: center;
  font-size: 13px;
  color: var(--sand);
  opacity: 0.7;
  margin-top: 8px;
}

.form-error {
  background: rgba(220, 40, 60, 0.12);
  border: 1px solid rgba(220, 40, 60, 0.4);
  color: #FFB4B4;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  margin-top: -4px;
}
/* Used when an error slot is repurposed for an info banner (e.g. the
   "your account needs verification" message on /signup deep-link). */
.form-error.form-banner {
  background: rgba(201, 169, 97, 0.12);
  border-color: rgba(201, 169, 97, 0.4);
  color: var(--gold);
}
.form-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6EE7B7;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  margin-top: -4px;
}
.hidden { display: none !important; }

.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}
.auth-mode-btn {
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--sand);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-mode-btn:hover { background: rgba(255,255,255,0.04); }
.auth-mode-btn.active {
  background: rgba(201, 169, 97, 0.14);
  border-color: var(--gold);
  color: var(--ivory);
}

.otp-input {
  letter-spacing: 0.5em;
  font-size: 20px;
  text-align: center;
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
}

.auth-landing {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}
.auth-landing .form-title { margin-bottom: 0; }
.auth-landing .form-sub { margin-bottom: 12px; }
.landing-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
}
.landing-divider {
  position: relative;
  text-align: center;
  margin: 6px 0;
  color: var(--sand);
  opacity: 0.6;
  font-size: 13px;
}
.landing-divider::before,
.landing-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 24px);
  height: 1px;
  background: var(--line);
}
.landing-divider::before { right: 0; }
.landing-divider::after  { left: 0; }
.landing-divider span { background: var(--midnight); padding: 0 12px; }
.landing-guest { border-style: dashed; }
.landing-guest-note {
  text-align: center;
  font-size: 12px;
  color: var(--sand);
  opacity: 0.6;
  line-height: 1.5;
  margin: 0;
}

.guest-cta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  margin-top: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
}
.guest-cta-title { font-size: 13px; color: var(--sand); opacity: 0.85; }
.guest-cta-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  color: var(--ivory);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.guest-cta-btn:hover { background: rgba(255,255,255,0.08); border-color: var(--gold); }

/* =========================================================
   LOBBY
========================================================= */
.lobby-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.lobby-actions { display: flex; gap: 10px; }

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.lobby-main { display: flex; flex-direction: column; gap: 20px; }

.quick-match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(201,169,97,0.15) 0%, rgba(139,38,53,0.1) 100%);
  border: 1px solid var(--gold);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
}
.quick-match::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 50% 80% at 80% 50%, rgba(255,215,0,0.15), transparent 70%);
}
.qm-content { display: flex; align-items: center; gap: 20px; position: relative; z-index: 1; }
.qm-pulse {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  position: relative;
}
.qm-pulse::before, .qm-pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--gold-bright);
  animation: qmPulse 2.5s ease-out infinite;
}
.qm-pulse::after { animation-delay: 1.25s; }
@keyframes qmPulse {
  0% { transform: scale(0.4); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.qm-pulse {
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--gold-bright);
}
.qm-pulse::before, .qm-pulse::after { background: var(--gold); }

.qm-title { font-family: 'Reem Kufi', sans-serif; font-size: 22px; color: var(--ivory); }
.qm-sub { font-size: 13px; color: var(--sand); opacity: 0.8; margin-top: 4px; }

.lobby-section {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
}
.lobby-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.lobby-section-head h3 { font-family: 'Reem Kufi', sans-serif; font-size: 20px; }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 6px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 13px;
  color: var(--sand);
  opacity: 0.7;
  transition: all 0.2s;
}
.pill:hover { opacity: 1; }
.pill.active {
  background: rgba(201,169,97,0.15);
  border-color: var(--gold);
  color: var(--gold-bright);
  opacity: 1;
}

.tables-list { display: flex; flex-direction: column; gap: 10px; }
.table-row {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: all 0.2s;
}
.table-row:hover { border-color: var(--line-strong); background: rgba(255,255,255,0.04); }
.table-row.featured {
  background: linear-gradient(90deg, rgba(201,169,97,0.1), rgba(255,255,255,0.025));
  border-color: var(--gold);
}
.table-row.locked { opacity: 0.7; }
.table-icon { width: 48px; height: 48px; display: grid; place-items: center; }
.table-name {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 16px;
  color: var(--ivory);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.badge-host { background: rgba(201,169,97,0.15); color: var(--gold-bright); border-color: var(--gold); }
.badge-libyan { background: rgba(139,38,53,0.2); color: #ec7385; border-color: var(--red); }
.badge-lock { background: rgba(255,255,255,0.04); color: var(--sand); }
.table-meta { font-size: 12px; color: var(--sand); opacity: 0.7; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.table-host-mini { display: flex; align-items: center; gap: 10px; }
.mini-ava {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c, var(--gold)), color-mix(in srgb, var(--c, var(--gold)) 60%, #000));
  color: var(--ivory);
  font-weight: 700;
  font-size: 13px;
  font-family: 'Reem Kufi', sans-serif;
  border: 2px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}
.mini-name { font-size: 13px; color: var(--ivory); font-weight: 600; }
.mini-rank { font-size: 11px; color: var(--sand); opacity: 0.7; margin-top: 2px; }

/* Country flag chip beside a player name. Slightly larger than the name
   text so the emoji is recognisable, and inherits no underline/colour from
   the surrounding link. */
.player-flag {
  font-size: 1.1em;
  margin-inline-end: 4px;
  vertical-align: -0.05em;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4));
}

/* Per-player ping/RTT chip in the lobby header. Colour-codes the latency:
   green ≤120ms, yellow ≤250ms, red beyond — driven by data-quality attr
   set from JS. Hidden until the first probe lands. */
.ping-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: 0.8rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  font-size: 11px;
  font-family: 'Reem Kufi', sans-serif;
  color: var(--sand);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.ping-chip.hidden { display: none; }
.ping-chip .ping-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #999;
  box-shadow: 0 0 6px currentColor;
}
.ping-chip .ping-unit { opacity: 0.65; font-size: 10px; }
.ping-chip[data-quality="good"]   { color: #6cd47a; border-color: rgba(108,212,122,0.4); }
.ping-chip[data-quality="good"]   .ping-dot { background: #6cd47a; }
.ping-chip[data-quality="ok"]     { color: #f0c454; border-color: rgba(240,196,84,0.4); }
.ping-chip[data-quality="ok"]     .ping-dot { background: #f0c454; }
.ping-chip[data-quality="poor"]   { color: #ec7385; border-color: rgba(236,115,133,0.4); }
.ping-chip[data-quality="poor"]   .ping-dot { background: #ec7385; }

.lobby-side { display: flex; flex-direction: column; gap: 16px; }
.side-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
}
.side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.side-head h4 { font-family: 'Reem Kufi', sans-serif; font-size: 16px; }
.online-count {
  background: rgba(16,185,129,0.2);
  border: 1px solid #10B981;
  color: #10B981;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
}

.friends-list { display: flex; flex-direction: column; gap: 8px; }
.friend {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  transition: background 0.2s;
}
.friend:hover { background: rgba(255,255,255,0.03); }
.friend-ava {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c, var(--gold)), color-mix(in srgb, var(--c, var(--gold)) 60%, #000));
  color: var(--ivory);
  font-weight: 700;
  font-size: 12px;
  font-family: 'Reem Kufi', sans-serif;
  flex-shrink: 0;
}
.status {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid var(--midnight-deep);
}
.status.online { background: #10B981; }
.status.away { background: #f59e0b; }
.friend-body { flex: 1; min-width: 0; }
.friend-name { font-size: 13px; color: var(--ivory); font-weight: 600; }
.friend-state { font-size: 11px; color: var(--sand); opacity: 0.7; }

.champ-list { display: flex; flex-direction: column; gap: 6px; }
.champ {
  display: grid;
  grid-template-columns: 24px 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px;
  border-radius: 8px;
}
.champ .rk { font-family: 'Reem Kufi', sans-serif; font-size: 18px; color: var(--gold); text-align: center; }
.champ-1 { background: linear-gradient(90deg, rgba(255,215,0,0.1), transparent); }
.champ-2 { background: linear-gradient(90deg, rgba(192,192,192,0.08), transparent); }
.champ-3 { background: linear-gradient(90deg, rgba(205,127,50,0.08), transparent); }
.champ-name { font-size: 13px; color: var(--ivory); font-weight: 600; }
.champ-pts { font-family: 'Reem Kufi', sans-serif; font-size: 13px; color: var(--gold-bright); }

/* =========================================================
   SETUP
========================================================= */
.setup-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

.setup-main { display: flex; flex-direction: column; gap: 20px; }

.setup-section {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
}
.section-h {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--gold-bright);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.25s;
  text-align: center;
}
/* Visually-hide the underlying radio but keep it focusable + announced.
   `display: none` removed it from the tab order, so the setup screen was
   keyboard-unreachable. The `.selected` class still drives the visual. */
.mode-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.mode-card:focus-within {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
.mode-card:hover { background: rgba(255,255,255,0.05); border-color: var(--line-strong); }
.mode-card.selected {
  background: linear-gradient(135deg, rgba(201,169,97,0.15), rgba(201,169,97,0.05));
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,169,97,0.12);
}
.mode-ico { width: 40px; height: 40px; display: grid; place-items: center; color: var(--gold); }
.mode-card.selected .mode-ico { color: var(--gold-bright); }
.mode-name { font-family: 'Reem Kufi', sans-serif; font-size: 16px; color: var(--ivory); }
.mode-sub { font-size: 12px; color: var(--sand); opacity: 0.7; }
.mode-check {
  position: absolute;
  top: 10px; right: 10px;
  width: 22px; height: 22px;
  background: var(--gold);
  color: var(--midnight-deep);
  border-radius: 50%;
  display: none;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}
.mode-card.selected .mode-check { display: grid; }

.diff-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.diff-pill {
  padding: 16px;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: center;
  transition: all 0.25s;
}
.diff-pill input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.diff-pill:focus-within {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
.diff-pill:hover { background: rgba(255,255,255,0.05); }
.diff-pill.selected {
  background: linear-gradient(135deg, rgba(201,169,97,0.15), rgba(201,169,97,0.05));
  border-color: var(--gold);
}
.diff-emoji { font-size: 32px; line-height: 1; }
.diff-name { font-family: 'Reem Kufi', sans-serif; font-size: 16px; margin-top: 6px; }
.diff-sub { font-size: 11px; color: var(--sand); opacity: 0.7; margin-top: 2px; }

.score-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.score-card {
  position: relative;
  padding: 14px 10px;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: center;
  transition: all 0.25s;
}
.score-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.score-card:focus-within {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
.score-card:hover { background: rgba(255,255,255,0.05); }
.score-card.selected {
  background: linear-gradient(135deg, rgba(201,169,97,0.15), rgba(255,215,0,0.05));
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(201,169,97,0.2);
}
.score-num { font-family: 'Reem Kufi', sans-serif; font-size: 28px; font-weight: 700; color: var(--gold-bright); line-height: 1; }
.score-name { font-size: 12px; color: var(--sand); margin-top: 4px; }
.score-tag { font-size: 10px; color: var(--gold); margin-top: 4px; font-weight: 700; }

.rule-group {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  margin-bottom: 12px;
  background: rgba(0,0,0,0.15);
}
.rule-group:last-child { margin-bottom: 0; }
.rule-group-h {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}
.rg-spacer { flex: 1; }
.rg-toggle { font-size: 12px; color: var(--gold); font-weight: 600; }
.dot-emerald { background: #10B981; }
.dot-amber { background: #f59e0b; }
.dot-red { background: var(--red-bright); }
.dot-emerald, .dot-amber, .dot-red { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.rule-core { border-color: rgba(16,185,129,0.3); }
.rule-common { border-color: rgba(245,158,11,0.3); }
.rule-libyan { border-color: rgba(220,40,60,0.3); background: linear-gradient(135deg, rgba(220,40,60,0.05), rgba(0,0,0,0.15)); }

.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 4px;
  border-bottom: 1px dashed var(--line);
}
.rule-row:last-child { border-bottom: none; }
.rule-row.locked { opacity: 0.85; }
.rule-info { flex: 1; }
.rule-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ivory);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chip {
  display: inline-block;
  padding: 1px 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
}
.chip-gold { background: rgba(255,215,0,0.18); color: var(--gold-bright); border: 1px solid var(--gold); }
.chip-red { background: rgba(220,40,60,0.18); color: #ec7385; border: 1px solid var(--red); }
.chip-crown { background: linear-gradient(90deg, var(--gold), var(--gold-bright)); color: var(--midnight-deep); }
.rule-sub { font-size: 12px; color: var(--sand); opacity: 0.7; margin-top: 2px; }

.switch {
  width: 42px; height: 24px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
  border-radius: 100px;
  position: relative;
  cursor: pointer;
  transition: all 0.25s;
  flex-shrink: 0;
}
/* Hit-target extension — keeps the visible switch 42×24 but expands the
   tap-able area to ≥44×44 via an invisible pseudo-element. The click
   handler is bound on `.switch` itself (_screens-helpers.js), so any
   click that lands on the pseudo still fires the parent handler. */
.switch::before {
  content: '';
  position: absolute;
  inset: -10px -2px;
  border-radius: inherit;
}
.switch span {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--sand);
  transition: all 0.25s cubic-bezier(.22,1,.36,1);
}
.switch.on { background: var(--gold); border-color: var(--gold); }
.switch.on span { right: calc(100% - 20px); background: var(--midnight-deep); }
.switch.locked { opacity: 0.7; cursor: not-allowed; }
/* Visible focus ring for keyboard users — paired with role="switch"
   + tabindex="0" wired in _screens-helpers.js. */
.switch:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.theme-grid { display: flex; flex-direction: column; gap: 14px; }
.theme-h { font-size: 13px; color: var(--sand); opacity: 0.85; }
.swatch-row { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  position: relative;
  width: 76px; height: 60px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: linear-gradient(135deg, var(--c1), var(--c2));
  cursor: pointer;
  transition: all 0.2s;
  display: grid;
  place-items: end center;
  padding-bottom: 4px;
}
.swatch input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.swatch:focus-within {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
.swatch span { font-size: 10px; color: var(--ivory); text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.swatch:hover { transform: translateY(-2px); }
.swatch.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,169,97,0.25), 0 6px 14px rgba(0,0,0,0.4);
}
.swatch.selected::before {
  content: '✓';
  position: absolute;
  top: 4px; right: 4px;
  width: 18px; height: 18px;
  background: var(--gold);
  color: var(--midnight-deep);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.cardback-row { display: flex; gap: 12px; flex-wrap: wrap; }
.cardback-swatch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.2s;
  padding: 6px;
  border-radius: 12px;
  border: 1.5px solid transparent;
}
.cardback-swatch input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.cardback-swatch:focus-within {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
.cardback-swatch:hover { transform: translateY(-2px); }
.cardback-swatch span { font-size: 11px; color: var(--ivory); opacity: 0.9; }
.cardback-swatch.selected {
  border-color: var(--gold);
  background: rgba(201,169,97,0.08);
  box-shadow: 0 0 0 3px rgba(201,169,97,0.18), 0 6px 14px rgba(0,0,0,0.35);
}
.cardback-swatch.selected::after {
  content: '✓';
  position: absolute;
  top: 4px; right: 4px;
  width: 18px; height: 18px;
  background: var(--gold);
  color: var(--midnight-deep);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  z-index: 2;
}
.cardback-preview {
  position: relative;
  width: 56px;
  height: 78px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
}
.cardback-preview .card-back {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  overflow: hidden;
}

.setup-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 90px; }

.summary-card {
  background: linear-gradient(180deg, rgba(201,169,97,0.1), rgba(0,0,0,0.2));
  border: 1px solid var(--gold);
  border-radius: var(--r-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.summary-h {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 16px;
  color: var(--gold-bright);
  margin-bottom: 4px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--sand);
  padding: 4px 0;
}
.summary-row b { color: var(--ivory); }
.text-gold { color: var(--gold-bright) !important; }
.summary-divider { height: 1px; background: var(--line); margin: 8px 0; }

.tip-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: rgba(255,215,0,0.06);
  border: 1px solid rgba(255,215,0,0.25);
  border-radius: var(--r-md);
}
.tip-icon { font-size: 28px; line-height: 1; }
.tip-h { font-family: 'Reem Kufi', sans-serif; font-size: 14px; color: var(--gold-bright); }
.tip-body { font-size: 13px; color: var(--sand); opacity: 0.85; line-height: 1.5; margin-top: 4px; }
.tip-body a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 6px;
  color: var(--gold-bright);
  font-weight: 700;
  text-underline-offset: 3px;
}

.tip-body a:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* =========================================================
   RULES
========================================================= */
.rules-head {
  text-align: center;
  margin-bottom: 32px;
}
.rules-head .screen-eyebrow { margin-inline: auto; display: inline-flex; }

.rules-toc {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 12px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: 100px;
  margin-bottom: 32px;
  position: sticky;
  top: 80px;
  z-index: 10;
  backdrop-filter: blur(10px);
}
.toc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  color: var(--sand);
  cursor: pointer;
  transition: all 0.2s;
}
.toc-item:hover { background: rgba(255,255,255,0.04); color: var(--ivory); }
.toc-item.active {
  background: rgba(201,169,97,0.15);
  color: var(--gold-bright);
}
.toc-num {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  font-family: 'Reem Kufi', sans-serif;
  font-size: 12px;
  font-weight: 700;
}
.toc-item.active .toc-num { background: var(--gold); color: var(--midnight-deep); }

.rules-content { display: flex; flex-direction: column; gap: 24px; }

.rule-block {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 24px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 32px;
  position: relative;
  overflow: hidden;
}
.libyan-block {
  background: linear-gradient(135deg, rgba(139,38,53,0.08) 0%, rgba(255,255,255,0.025) 100%);
  border-color: var(--red);
}
.block-num {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 80px;
  font-weight: 700;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--gold);
  text-stroke: 1.5px var(--gold);
  line-height: 1;
  opacity: 0.6;
}
.block-body h3 {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 28px;
  color: var(--ivory);
  margin-bottom: 16px;
}
.block-intro { font-size: 15px; color: var(--sand); opacity: 0.85; margin-bottom: 20px; line-height: 1.7; }

.basics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.basic-card {
  text-align: center;
  padding: 18px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.basic-num {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 48px;
  color: var(--gold-bright);
  line-height: 1;
  font-weight: 700;
}
.basic-lbl {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 14px;
  color: var(--ivory);
  margin-top: 6px;
}
.basic-sub { font-size: 12px; color: var(--sand); opacity: 0.7; margin-top: 4px; }

.suits-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.suit-mini {
  text-align: center;
  padding: 14px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  border-top: 3px solid var(--c, var(--gold));
}
.suit-glyph { font-size: 28px; color: var(--c); line-height: 1; }
.suit-name { font-family: 'Reem Kufi', sans-serif; font-size: 14px; margin-top: 6px; }
.suit-sub { font-size: 11px; color: var(--sand); opacity: 0.6; margin-top: 2px; }

.steps { display: flex; flex-direction: column; gap: 16px; }
.step {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  align-items: flex-start;
}
.step-n {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: var(--midnight-deep);
  display: grid; place-items: center;
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.step-h { font-family: 'Reem Kufi', sans-serif; font-size: 17px; color: var(--ivory); margin-bottom: 4px; }
.step p { font-size: 14px; color: var(--sand); opacity: 0.85; line-height: 1.7; }

.capture-demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.cap-side {
  padding: 20px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.cap-side h4 { font-family: 'Reem Kufi', sans-serif; font-size: 16px; margin-bottom: 8px; color: var(--gold-bright); }
.cap-side p { font-size: 13px; color: var(--sand); opacity: 0.85; line-height: 1.6; margin-bottom: 14px; }
.mini-table {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  position: relative;
}
.mc {
  aspect-ratio: 5/7;
  background: linear-gradient(135deg, var(--ivory), #f0e5c5);
  border: 1px solid var(--gold);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-family: 'Reem Kufi', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--midnight-deep);
}
.mc.match {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 2px var(--gold-bright), 0 0 16px rgba(255,215,0,0.4);
  animation: matchGlow 2s ease-in-out infinite;
}
@keyframes matchGlow {
  0%,100% { box-shadow: 0 0 0 2px var(--gold-bright), 0 0 16px rgba(255,215,0,0.4); }
  50% { box-shadow: 0 0 0 2px var(--gold-bright), 0 0 26px rgba(255,215,0,0.7); }
}
.mc.played {
  grid-column: 2 / 4;
  background: linear-gradient(135deg, #fff8e7, #f0d570);
  border-color: var(--red-bright);
  color: var(--red-bright);
  box-shadow: 0 8px 20px rgba(220,40,60,0.3);
}
.cap-arrow {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 24px;
  color: var(--gold);
  margin: 6px 0;
  animation: arrowBob 2s ease-in-out infinite;
}
@keyframes arrowBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

.shakkba-callout {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px;
  background: linear-gradient(90deg, rgba(255,215,0,0.12), rgba(201,169,97,0.05));
  border: 1px solid var(--gold);
  border-radius: var(--r-md);
}
.shakkba-emoji { font-size: 40px; }
.shakkba-h { font-family: 'Reem Kufi', sans-serif; font-size: 22px; color: var(--gold-bright); margin-bottom: 4px; }
.shakkba-callout p { font-size: 14px; color: var(--sand); opacity: 0.95; line-height: 1.6; }

.libyan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.lib-card {
  padding: 20px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  position: relative;
  transition: all 0.25s;
}
.lib-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.lib-card.highlight {
  background: linear-gradient(180deg, rgba(255,215,0,0.12), rgba(0,0,0,0.25));
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(255,215,0,0.3), 0 12px 28px rgba(0,0,0,0.4);
}
.lib-icon { font-size: 36px; line-height: 1; margin-bottom: 8px; }
.lib-h { font-family: 'Reem Kufi', sans-serif; font-size: 18px; color: var(--ivory); }
.lib-card-sub { font-size: 11px; color: var(--gold); opacity: 0.85; margin-top: 2px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.lib-card p { font-size: 13px; color: var(--sand); opacity: 0.85; line-height: 1.6; margin-bottom: 12px; }
.lib-tag {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(201,169,97,0.15);
  border: 1px solid var(--gold);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-bright);
}
.tag-red { background: rgba(220,40,60,0.18); border-color: var(--red); color: #ec7385; }
.tag-crown { background: linear-gradient(90deg, var(--gold), var(--gold-bright)); border-color: var(--gold-bright); color: var(--midnight-deep); }

.score-table {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.score-table .row {
  display: grid;
  grid-template-columns: 1.2fr 2fr 0.8fr;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  align-items: center;
}
.score-table .row:last-child { border-bottom: none; }
.score-table .row.row-h {
  background: rgba(201,169,97,0.1);
  font-weight: 700;
  color: var(--gold-bright);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.score-table .row span:nth-child(2) { color: var(--sand); opacity: 0.85; font-size: 13px; }
.rt { text-align: end; font-family: 'Reem Kufi', sans-serif; color: var(--gold-bright); font-size: 16px; }
.gold-row { background: linear-gradient(90deg, rgba(255,215,0,0.08), transparent); }
.score-table .total {
  background: linear-gradient(90deg, rgba(201,169,97,0.15), transparent);
  font-weight: 700;
}
.score-table .total span:first-child { color: var(--ivory); font-family: 'Reem Kufi', sans-serif; }
.score-table .total .rt { font-size: 22px; }

.rules-cta {
  text-align: center;
  margin-top: 40px;
}

/* =========================================================
   STATS
========================================================= */
.stats-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.stats-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 12px;
}
.stab {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sand);
  opacity: 0.65;
  transition: all 0.2s;
}
.stab.active {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: var(--midnight-deep);
  opacity: 1;
}

.stats-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.profile-big {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(201,169,97,0.12), rgba(255,255,255,0.025));
  border: 1px solid var(--gold);
  border-radius: var(--r-lg);
}
.big-ava {
  position: relative;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
  color: var(--midnight-deep);
  display: grid; place-items: center;
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 700;
  font-size: 32px;
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 5px rgba(201,169,97,0.2), 0 8px 20px rgba(0,0,0,0.4);
  flex-shrink: 0;
}
.ava-frame {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px dashed var(--gold);
  opacity: 0.4;
  animation: ringRot 12s linear infinite;
}
.profile-meta { flex: 1; }
.profile-name { font-family: 'Reem Kufi', sans-serif; font-size: 22px; color: var(--ivory); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rank-badge {
  font-size: 12px;
  padding: 3px 10px;
  background: rgba(255,215,0,0.18);
  border: 1px solid var(--gold);
  border-radius: 100px;
  color: var(--gold-bright);
  font-weight: 700;
}
.profile-handle { font-size: 12px; color: var(--sand); opacity: 0.7; margin-top: 4px; }
.profile-rating { margin-top: 14px; }
.rating-bar { height: 6px; background: rgba(255,255,255,0.06); border-radius: 100px; overflow: hidden; margin-bottom: 6px; }
.rating-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  border-radius: 100px;
  position: relative;
}
.rating-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}
@keyframes shimmer { 0% { background-position: -100% 0; } 100% { background-position: 200% 0; } }
.rating-info { display: flex; justify-content: space-between; font-size: 12px; }
.rating-num { font-family: 'Reem Kufi', sans-serif; color: var(--gold-bright); font-size: 16px; }
.rating-to { color: var(--sand); opacity: 0.7; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stat-card {
  padding: 18px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 60%; height: 100%;
  background: radial-gradient(ellipse at top right, rgba(201,169,97,0.1), transparent 70%);
  pointer-events: none;
}
.sc-icon { font-size: 28px; line-height: 1; }
.sc-num { font-family: 'Reem Kufi', sans-serif; font-size: 32px; color: var(--gold-bright); line-height: 1; margin-top: 6px; }
.sc-lbl { font-size: 13px; color: var(--ivory); margin-top: 4px; }
.sc-trend { font-size: 11px; color: var(--sand); opacity: 0.7; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.sc-trend.up { color: #10B981; opacity: 1; }
.sc-trend.up::before { content: '↑ '; }

.stats-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
.stats-panel {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
}
.stats-panel.wide { grid-column: 1 / -1; }
.panel-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.panel-h h3 { font-family: 'Reem Kufi', sans-serif; font-size: 18px; color: var(--ivory); }
.panel-h .muted { font-size: 12px; color: var(--sand); opacity: 0.7; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--sand); }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; }
.legend .dot-emerald { background: #10B981; }
.legend .dot-red { background: var(--red-bright); }

.perf-chart { width: 100%; height: 200px; }

.ach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ach {
  padding: 14px 10px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-align: center;
  position: relative;
  opacity: 0.5;
  filter: grayscale(0.5);
}
.ach.unlocked { opacity: 1; filter: none; background: rgba(201,169,97,0.06); border-color: var(--line-strong); }
.ach.rare {
  background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(0,0,0,0.2));
  border-color: var(--gold-bright);
}
.ach-icon { font-size: 28px; line-height: 1; }
.ach-name { font-family: 'Reem Kufi', sans-serif; font-size: 13px; margin-top: 6px; color: var(--ivory); }
.ach-sub { font-size: 10px; color: var(--sand); opacity: 0.7; margin-top: 2px; }
.ach-prog {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
  margin-top: 8px;
  overflow: hidden;
}
.ach-prog div {
  height: 100%;
  background: var(--gold);
  border-radius: 100px;
}

.bar-row {
  display: grid;
  grid-template-columns: 80px 1fr 50px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.bar-row:last-child { border-bottom: none; }
.bar-row span { color: var(--sand); }
.bar { height: 8px; background: rgba(255,255,255,0.06); border-radius: 100px; overflow: hidden; }
.bar div { height: 100%; background: var(--c, var(--gold)); border-radius: 100px; }
.bar-row b { font-family: 'Reem Kufi', sans-serif; color: var(--ivory); font-size: 14px; text-align: end; }

.matches-list { display: flex; flex-direction: column; gap: 8px; }
.match {
  display: grid;
  grid-template-columns: 70px 1.5fr 100px 1fr 100px 60px;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  border-right: 3px solid;
}
.match.win { border-right-color: #10B981; }
.match.loss { border-right-color: var(--red-bright); }
.match-result {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 14px;
  font-weight: 700;
}
.match.win .match-result { color: #10B981; }
.match.loss .match-result { color: var(--red-bright); }
.match-vs { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ivory); }
.match-score { font-family: 'Reem Kufi', sans-serif; font-size: 18px; color: var(--gold-bright); text-align: center; }
.match-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag {
  padding: 2px 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  font-size: 12px;
}
.tag-gold { background: rgba(255,215,0,0.18); border: 1px solid var(--gold); }
.match-time { font-size: 12px; color: var(--sand); opacity: 0.85; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.match-time .match-rel { font-weight: 600; }
.match-time .match-abs { font-size: 10px; opacity: 0.7; font-feature-settings: "tnum"; margin-top: 1px; }
.match-elo { font-family: 'Reem Kufi', sans-serif; font-size: 14px; font-weight: 700; text-align: center; }
.match-elo.up { color: #10B981; }
.match-elo.down { color: var(--red-bright); }

.mini-ava {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--c, var(--gold));
  color: var(--midnight-deep);
  display: grid; place-items: center;
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

/* Personal-record tiles below the achievements panel. Smaller than
   .stat-card so they don't compete with the headline numbers up top. */
.record-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.record-card {
  padding: 14px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-align: center;
}
.record-lbl {
  font-size: 11px;
  color: var(--sand);
  opacity: 0.7;
  margin-bottom: 6px;
}
.record-val {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 24px;
  color: var(--gold-bright);
  line-height: 1;
}

.leaderboard-list { display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  border-right: 3px solid var(--tier-color, var(--gold));
}
.lb-row.lb-me {
  background: rgba(201,169,97,0.1);
  border-color: var(--gold);
}
.lb-rank {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 16px;
  color: var(--gold-bright);
  text-align: center;
}
.lb-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ivory);
}
.lb-tier { font-size: 16px; }
.lb-elo {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 13px;
  color: var(--sand);
}

.stats-empty {
  display: grid;
  place-items: center;
  padding: 60px 20px;
}
.stats-empty-card {
  text-align: center;
  max-width: 460px;
  padding: 40px 32px;
  background: linear-gradient(135deg, rgba(201,169,97,0.08), rgba(255,255,255,0.025));
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
}
.stats-empty-icon { font-size: 56px; margin-bottom: 16px; }
.stats-empty-card h3 {
  font-family: 'Reem Kufi', sans-serif;
  color: var(--ivory);
  font-size: 22px;
  margin-bottom: 10px;
}
.stats-empty-card p {
  color: var(--sand);
  opacity: 0.8;
  margin-bottom: 22px;
  line-height: 1.7;
}
.stats-empty-mini {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--sand);
  opacity: 0.7;
}

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 1024px) {
  .home-grid { grid-template-columns: 1fr; gap: 40px; }
  .home-right { min-height: 380px; }
  .lobby-grid, .setup-grid, .stats-grid, .stats-hero { grid-template-columns: 1fr; }
  /* .auth-shell + .auth-art retired with the auth redesign (see note above). */
  .libyan-grid, .basics-grid, .ach-grid, .mode-grid, .diff-row { grid-template-columns: repeat(2, 1fr); }
  .score-row { grid-template-columns: repeat(3, 1fr); }
  .capture-demo { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .match { grid-template-columns: 60px 1fr 80px; gap: 10px; }
  .match-tags, .match-time, .match-elo { display: none; }
}

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .screens-nav { padding: 12px 16px; gap: 12px; }
  .brand-sub { display: none; }
  .nav-tabs {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline: 12px;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    padding: 10px;
    background: rgba(12, 13, 28, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-2);
    z-index: 110;
  }
  .screens-nav.open .nav-tabs { display: flex; }
  .nav-tabs .nav-tab {
    padding: 12px 14px;
    text-align: start;
    font-size: 15px;
    border-radius: 10px;
  }
  .nav-tabs .nav-user { cursor: default; opacity: 0.85; }
  .screen { padding: 24px 16px 60px; }
  .home-features { grid-template-columns: 1fr; }
  .libyan-grid, .basics-grid, .ach-grid, .mode-grid, .diff-row, .stat-grid { grid-template-columns: 1fr; }
  .record-grid { grid-template-columns: repeat(2, 1fr); }
  .lb-row { grid-template-columns: 32px 1fr auto; padding: 8px 10px; gap: 8px; }
  .lb-name { font-size: 13px; }
  .score-row { grid-template-columns: repeat(2, 1fr); }
  .suits-row { grid-template-columns: repeat(2, 1fr); }
  .table-row { grid-template-columns: 40px 1fr; }
  .table-host-mini, .table-row .btn { grid-column: 2; justify-self: end; }
  .rule-block { grid-template-columns: 1fr; padding: 20px; }
  .block-num { font-size: 56px; }
  /* .auth-form-wrap retired with the auth redesign (see note around line 777). */
}

@media (max-width: 760px) {
  /* A height-limited column must scroll vertically instead of wrapping
     later navigation actions into a clipped second column. */
  .screens-nav.open .nav-tabs {
    position: absolute;
    top: 100%;
    inset-inline: 0;
    width: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-height: calc(100dvh - 104px);
    overflow-x: hidden;
    overflow-y: auto;
  }
  .screens-nav.open .nav-tabs .nav-tab { flex: 0 0 auto; }
}

@media (max-width: 480px) {
  /* Keep the expanded touch areas of wrapped OTP actions from overlapping. */
  .login-form:is([data-step="verify"], [data-step="reset"]) .login-foot {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .login-form:is([data-step="verify"], [data-step="reset"]) .login-foot .form-link {
    min-height: 44px;
    padding: 10px 8px;
    margin: 0;
  }
  .login-form:is([data-step="verify"], [data-step="reset"]) .login-foot .dot-sep { display: none; }
}

/* =========================================================
   ADMIN DASHBOARD
========================================================= */
.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.admin-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.admin-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  text-align: center;
}
.tile-num {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--gold-bright);
  line-height: 1.1;
}
.tile-lbl {
  margin-top: 6px;
  font-size: 13px;
  color: var(--sand);
  opacity: 0.75;
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 22px;
}
.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.admin-card-title {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ivory);
  margin: 0;
}
.admin-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-controls input,
.admin-controls select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--ivory);
  font-size: 13px;
  font-family: inherit;
  min-width: 200px;
}
.admin-controls input:focus,
.admin-controls select:focus {
  outline: none;
  border-color: var(--gold);
}

.admin-countries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.country-row {
  display: grid;
  grid-template-columns: 28px 36px 1fr 60px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.country-flag { font-size: 18px; line-height: 1; }
.country-code { color: var(--sand); opacity: 0.85; font-weight: 600; }
.country-bar {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.country-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  border-radius: 4px;
}
.country-num { text-align: end; color: var(--ivory); font-weight: 600; }

.admin-table-wrap {
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th,
.admin-table td {
  padding: 10px 12px;
  text-align: start;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  vertical-align: middle;
}
.admin-table th {
  background: rgba(255,255,255,0.03);
  color: var(--sand);
  opacity: 0.85;
  font-weight: 600;
  white-space: nowrap;
}
.admin-table td.muted,
.admin-table .muted { color: var(--sand); opacity: 0.7; font-size: 12px; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }

.kind-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.kind-user {
  background: rgba(16, 185, 129, 0.14);
  color: #6EE7B7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.kind-guest {
  background: rgba(255,255,255,0.06);
  color: var(--sand);
  border: 1px solid var(--line);
}
.admin-badge {
  background: rgba(201, 169, 97, 0.18);
  color: var(--gold-bright);
  border: 1px solid rgba(201, 169, 97, 0.5);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-inline-start: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.status-online {
  background: rgba(16, 185, 129, 0.16);
  color: #6EE7B7;
  border: 1px solid rgba(16, 185, 129, 0.45);
}
.status-offline {
  background: rgba(255,255,255,0.04);
  color: var(--sand);
  border: 1px solid var(--line);
  opacity: 0.75;
}
.status-dot,
.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: statusPulse 1.6s ease-out infinite;
  display: inline-block;
}
.online-dot { margin-inline-end: 6px; vertical-align: middle; }
@keyframes statusPulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.admin-tile-online .tile-num { color: #6EE7B7; }

.admin-loading,
.admin-empty {
  text-align: center;
  color: var(--sand);
  opacity: 0.6;
  padding: 18px;
  font-size: 13px;
}
