/* ============================================================
   كويزنا — التصميم الرئيسي
   هوية: ليل أزرق دافئ + ألوان ألعاب مبهجة، واجهة عربية RTL
   ============================================================ */

:root {
  --bg: #10162f;
  --bg-2: #1b2447;
  --card: #222d55;
  --card-2: #2a3765;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f6ff;
  --muted: #9aa5cc;
  --yellow: #ffb020;
  --coral: #f05252;
  --teal: #31c48d;
  --blue: #3f83f8;
  --pink: #e74694;
  --violet: #9061f9;
  --radius: 20px;
  --shadow: 0 12px 32px rgba(5, 9, 26, 0.45);
  --font-display: "Baloo Bhaijaan 2", "Rubik", sans-serif;
  --font-body: "Rubik", "Baloo Bhaijaan 2", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* قاعدة عامة: أي عنصر عليه hidden يختفي مهما كانت قواعد عرضه */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: radial-gradient(1200px 600px at 85% -10%, #26346b 0%, var(--bg) 55%) fixed;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------- الأشكال العائمة في الخلفية ---------- */
.bg-shapes { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bg-shapes .shape {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 800;
  opacity: 0.06;
  animation: floaty 14s ease-in-out infinite;
  user-select: none;
}
.s1 { top: 12%; right: 6%;  font-size: 120px; color: var(--yellow); }
.s2 { top: 30%; left: 8%;   font-size: 60px;  color: var(--teal);   animation-delay: -3s; }
.s3 { top: 62%; right: 12%; font-size: 90px;  color: var(--pink);   animation-delay: -6s; }
.s4 { top: 78%; left: 15%;  font-size: 70px;  color: var(--blue);   animation-delay: -9s; }
.s5 { top: 45%; left: 45%;  font-size: 150px; color: var(--violet); animation-delay: -5s; }
.s6 { top: 8%;  left: 30%;  font-size: 50px;  color: var(--coral);  animation-delay: -11s; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50%      { transform: translateY(-28px) rotate(6deg); }
}
@media (prefers-reduced-motion: reduce) {
  .bg-shapes .shape { animation: none; }
}

/* ---------- الشريط العلوي ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(16, 22, 47, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark {
  display: grid; place-items: center;
  flex-shrink: 0;
  width: 42px; height: 42px;
  font-family: var(--font-display); font-size: 26px; font-weight: 800; color: #10162f;
  background: linear-gradient(135deg, var(--yellow), #ff8a3d);
  border-radius: 14px;
  transform: rotate(-8deg);
  box-shadow: 0 4px 14px rgba(255, 176, 32, 0.4);
}
.brand-mark.small { width: 30px; height: 30px; font-size: 18px; border-radius: 9px; }
.brand-name { font-family: var(--font-display); font-size: 26px; font-weight: 800; }
.topnav { display: flex; gap: 4px; margin-inline-start: auto; min-width: 0; flex-shrink: 1; }
.nav-link {
  padding: 9px 16px; border-radius: 12px;
  color: var(--muted); font-size: 15px; font-weight: 600;
  transition: 0.2s;
}
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; font-size: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  transition: 0.2s;
  flex-shrink: 0; /* لا تنكمش الأزرار عند ضيق الشريط فتفقد شكلها */
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.icon-btn.off { opacity: 0.35; }

/* ---------- الشاشات ---------- */
.screen { display: none; position: relative; z-index: 1; }
.screen.active { display: block; }

/* ---------- البطل ---------- */
.hero { padding: clamp(40px, 8vw, 90px) clamp(16px, 4vw, 48px) 30px; text-align: center; }
.hero-inner { max-width: 760px; margin: 0 auto; }
.hero-badge {
  display: inline-block; padding: 8px 18px;
  background: rgba(255, 176, 32, 0.12);
  border: 1px solid rgba(255, 176, 32, 0.35);
  color: var(--yellow);
  border-radius: 999px; font-weight: 700; font-size: 14px;
  margin-bottom: 22px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(38px, 7vw, 64px);
  font-weight: 800; line-height: 1.25;
}
.grad-text {
  background: linear-gradient(90deg, var(--yellow), var(--pink), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { margin: 18px auto 30px; max-width: 520px; color: var(--muted); font-size: 18px; line-height: 1.8; }
.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn-daily {
  display: flex; align-items: center; gap: 12px; text-align: start;
  padding: 12px 22px;
  background: linear-gradient(135deg, #ff5f6d, #ff9f43);
  border-radius: 18px; color: #fff;
  box-shadow: 0 8px 24px rgba(255, 95, 109, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-daily:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(255, 95, 109, 0.45); }
.btn-daily-icon { font-size: 28px; }
.btn-daily strong { display: block; font-family: var(--font-display); font-size: 19px; }
.btn-daily small { font-size: 12.5px; opacity: 0.9; }

.btn-play {
  padding: 16px 30px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 18px;
  font-family: var(--font-display); font-size: 19px; font-weight: 700;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.btn-play:hover { transform: translateY(-3px); border-color: var(--teal); background: var(--card-2); }

.hero-stats { display: flex; justify-content: center; gap: clamp(20px, 6vw, 60px); margin-top: 46px; }
.hstat { display: grid; gap: 2px; }
.hstat strong { font-family: var(--font-display); font-size: 30px; color: var(--yellow); }
.hstat span { color: var(--muted); font-size: 13.5px; }

/* ---------- بطاقة التحدي اليومي ---------- */
.daily-section { padding: 26px clamp(16px, 4vw, 48px); }
.daily-card {
  max-width: 900px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 26px; flex-wrap: wrap;
  padding: 28px 32px;
  background: linear-gradient(135deg, #2b1f4d 0%, #14305c 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  box-shadow: var(--shadow);
}
.daily-right { display: flex; align-items: center; gap: 20px; flex: 1; min-width: 260px; }
.daily-flame { font-size: 52px; animation: flamePulse 1.8s ease-in-out infinite; }
@keyframes flamePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.daily-card h2 { font-family: var(--font-display); font-size: 24px; margin-bottom: 6px; }
.daily-num { color: var(--yellow); }
.daily-card p { color: var(--muted); line-height: 1.7; font-size: 15px; max-width: 420px; }
.daily-left { display: flex; align-items: center; gap: 18px; }
.streak-box {
  display: grid; place-items: center; gap: 2px;
  padding: 10px 18px;
  background: rgba(255, 176, 32, 0.1);
  border: 1px dashed rgba(255, 176, 32, 0.4);
  border-radius: 16px;
}
.streak-count { font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--yellow); }
.streak-label { font-size: 12px; color: var(--muted); }
.btn-cta {
  padding: 15px 30px;
  background: linear-gradient(135deg, var(--yellow), #ff8a3d);
  color: #10162f;
  font-family: var(--font-display); font-size: 18px; font-weight: 800;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(255, 176, 32, 0.35);
  transition: transform 0.15s;
}
.btn-cta:hover { transform: translateY(-3px) scale(1.02); }

/* ---------- التصنيفات ---------- */
.cats-section { padding: 50px clamp(16px, 4vw, 48px); }
.section-title { font-family: var(--font-display); font-size: clamp(26px, 4vw, 34px); text-align: center; }
.section-sub { text-align: center; color: var(--muted); margin-top: 8px; }
.cats-grid {
  max-width: 1000px; margin: 34px auto 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px;
}
.cat-card {
  position: relative; overflow: hidden; text-align: start;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid; gap: 8px;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.cat-card::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: 6px; background: var(--cat-color, var(--yellow));
}
.cat-card:hover {
  transform: translateY(-5px);
  border-color: var(--cat-color, var(--yellow));
  box-shadow: 0 14px 30px rgba(5, 9, 26, 0.5);
}
.cat-icon {
  width: 64px; height: 64px; display: grid; place-items: center;
  font-size: 28px; border-radius: 16px;
  background: color-mix(in srgb, var(--cat-color) 16%, transparent);
  overflow: hidden;
}
.cat-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-name { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.cat-desc { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.cat-count { font-size: 12.5px; color: var(--cat-color, var(--yellow)); font-weight: 600; }

/* ---------- التحديات الخاصة ---------- */
.modes-section { padding: 50px clamp(16px, 4vw, 48px) 10px; }
.modes-grid {
  max-width: 1000px; margin: 34px auto 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px;
}
.mode-card {
  position: relative; overflow: hidden;
  padding: 24px 18px; text-align: center;
  background: linear-gradient(160deg, color-mix(in srgb, var(--mode-color) 22%, var(--card)), var(--card) 70%);
  border: 1px solid color-mix(in srgb, var(--mode-color) 40%, transparent);
  border-radius: var(--radius);
  display: grid; gap: 8px; justify-items: center;
  transition: transform 0.18s, box-shadow 0.18s;
}
.mode-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 16px 34px rgba(5, 9, 26, 0.55);
}
.mode-icon {
  width: 72px; height: 72px; display: grid; place-items: center;
  font-size: 32px; border-radius: 18px;
  background: color-mix(in srgb, var(--mode-color) 25%, transparent);
  border: 1px solid color-mix(in srgb, var(--mode-color) 45%, transparent);
  overflow: hidden;
}
.mode-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mode-name { font-family: var(--font-display); font-size: 18px; font-weight: 800; }
.mode-desc { color: var(--muted); font-size: 12.5px; line-height: 1.6; min-height: 40px; }
.mode-count {
  font-size: 12px; font-weight: 700; color: var(--mode-color);
  padding: 4px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--mode-color) 14%, transparent);
}

/* ---------- كيف تلعب ---------- */
.how-section { padding: 50px clamp(16px, 4vw, 48px); }
.how-grid {
  max-width: 1000px; margin: 34px auto 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px;
}
.how-card {
  padding: 26px 22px; text-align: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.how-num {
  width: 44px; height: 44px; margin: 0 auto 14px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 22px; font-weight: 800;
  color: #10162f;
  background: linear-gradient(135deg, var(--teal), #7ee7c0);
  border-radius: 50%;
}
.how-card h3 { font-family: var(--font-display); font-size: 18px; margin-bottom: 6px; }
.how-card p { color: var(--muted); font-size: 14px; line-height: 1.7; }

/* ---------- إنجازاتي ---------- */
.stats-section { padding: 50px clamp(16px, 4vw, 48px); }
.stats-grid {
  max-width: 900px; margin: 34px auto 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px;
}
.stat-card {
  display: grid; place-items: center; gap: 6px;
  padding: 26px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stat-icon { font-size: 30px; }
.stat-card strong { font-family: var(--font-display); font-size: 32px; color: var(--yellow); }
.stat-card span:last-child { color: var(--muted); font-size: 13.5px; }

/* ---------- قريبًا ---------- */
.soon-section { padding: 40px clamp(16px, 4vw, 48px) 60px; }
.soon-card {
  max-width: 900px; margin: 0 auto; text-align: center;
  padding: 34px 28px;
  background: linear-gradient(135deg, rgba(63, 131, 248, 0.12), rgba(144, 97, 249, 0.12));
  border: 1px solid rgba(144, 97, 249, 0.25);
  border-radius: 26px;
}
.soon-card h2 { font-family: var(--font-display); font-size: 24px; margin-bottom: 18px; }
.soon-items { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.soon-chip {
  padding: 9px 16px; font-size: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* ---------- التذييل ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 34px clamp(16px, 4vw, 48px);
  text-align: center; color: var(--muted);
  display: grid; gap: 8px;
}
.footer-brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--text); }
.footer-copy { font-size: 12.5px; opacity: 0.7; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 13.5px; }
.footer-links a:hover { color: var(--yellow); text-decoration: underline; }

/* ---------- الصفحات الفرعية (من نحن / الخصوصية) ---------- */
.page-wrap {
  max-width: 760px; margin: 0 auto;
  padding: 40px clamp(16px, 5vw, 32px) 70px;
  position: relative; z-index: 1;
}
.page-title { font-family: var(--font-display); font-size: clamp(28px, 5vw, 38px); font-weight: 800; }
.page-updated { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.page-card {
  margin-top: 18px; padding: 22px 24px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.page-card h2 { font-family: var(--font-display); font-size: 20px; margin-bottom: 10px; color: var(--yellow); }
.page-card p { line-height: 1.9; color: #d8def5; margin-bottom: 10px; }
.page-card ul { padding-inline-start: 20px; display: grid; gap: 10px; }
.page-card li { line-height: 1.9; color: #d8def5; }
.page-card a { color: var(--teal); }
.contact-line { font-size: 15px; }
.page-links { margin-top: 20px; text-align: center; }
.page-links a { color: var(--muted); }
.btn-back {
  display: inline-block; margin-top: 26px;
  padding: 13px 26px;
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: 14px; color: var(--text); text-decoration: none;
  font-family: var(--font-display); font-weight: 700;
}
.btn-back:hover { background: #33417a; }

/* ============================================================
   شاشة اللعب
   ============================================================ */
.quiz-wrap {
  max-width: 680px; margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 32px) 60px;
  display: grid; justify-items: center; gap: 18px;
  min-height: 100vh; align-content: start;
}
.quiz-top { display: flex; align-items: center; gap: 14px; width: 100%; padding-top: 6px; }
.quiz-progress {
  flex: 1; height: 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08); overflow: hidden;
}
.quiz-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--yellow));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.quiz-score {
  min-width: 64px; text-align: center;
  font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--yellow);
  background: rgba(255, 176, 32, 0.1);
  border: 1px solid rgba(255, 176, 32, 0.3);
  padding: 6px 14px; border-radius: 12px;
}
.quiz-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.quiz-cat {
  padding: 6px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line);
}
.quiz-counter { color: var(--muted); font-size: 14px; }
.quiz-streak { color: var(--coral); font-weight: 700; font-size: 14px; min-height: 20px; }

/* مؤقت دائري */
.timer-ring { position: relative; width: 108px; height: 108px; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 8; }
.ring-fg {
  fill: none; stroke: var(--teal); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 276.5; stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.timer-ring.warn .ring-fg { stroke: var(--yellow); }
.timer-ring.danger .ring-fg { stroke: var(--coral); }
.timer-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 36px; font-weight: 800;
}
.timer-ring.danger .timer-num { color: var(--coral); animation: tickPulse 1s infinite; }
@keyframes tickPulse { 50% { transform: scale(1.15); } }

.question-text {
  font-family: var(--font-display);
  font-size: clamp(21px, 4vw, 27px);
  font-weight: 700; text-align: center; line-height: 1.6;
  min-height: 96px; display: grid; place-items: center;
}

.answers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
.answer-btn {
  position: relative;
  padding: 18px 16px; min-height: 72px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 18px;
  font-size: 17px; font-weight: 600; line-height: 1.5;
  transition: transform 0.12s, border-color 0.12s, background 0.15s;
  display: grid; place-items: center; text-align: center;
}
.answer-btn:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--blue); background: var(--card-2); }
.answer-btn:disabled { cursor: default; }
.answer-btn.correct {
  background: rgba(49, 196, 141, 0.18);
  border-color: var(--teal);
  color: #b8f5dd;
  animation: popIn 0.3s;
}
.answer-btn.wrong {
  background: rgba(240, 82, 82, 0.15);
  border-color: var(--coral);
  color: #ffc9c9;
  animation: shake 0.35s;
}
.answer-btn.faded { opacity: 0.45; }
@keyframes popIn { 0% { transform: scale(0.96); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* وسائط السؤال: علم أو إيموجي */
.q-media { display: grid; place-items: center; }
.q-media img.flag-img {
  width: min(320px, 78vw);
  border-radius: 14px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 28px rgba(5, 9, 26, 0.5);
}
.q-media .q-emoji {
  font-size: clamp(48px, 10vw, 72px);
  letter-spacing: 8px;
  direction: ltr;
}

/* صح أم خطأ */
.answers-grid.tf-grid { grid-template-columns: 1fr 1fr; max-width: 440px; margin: 0 auto; }
.answers-grid.tf-grid .answer-btn { font-size: 22px; font-family: var(--font-display); min-height: 86px; }

/* ترتيب الحروف */
.scramble-area { display: grid; gap: 18px; justify-items: center; width: 100%; }
.scramble-slots { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; direction: rtl; }
.scramble-slot {
  width: 52px; height: 58px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 26px; font-weight: 800;
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  transition: 0.15s;
}
.scramble-slot.filled {
  border-style: solid; border-color: var(--violet);
  background: rgba(144, 97, 249, 0.15);
  cursor: pointer;
}
.scramble-slot.good { border-color: var(--teal); background: rgba(49, 196, 141, 0.2); color: #b8f5dd; }
.scramble-slots.bad .scramble-slot { border-color: var(--coral); animation: shake 0.35s; }
.scramble-tiles { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; direction: rtl; }
.scramble-tile {
  width: 54px; height: 58px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 26px; font-weight: 800;
  background: var(--card-2);
  border: 2px solid var(--line);
  border-radius: 14px;
  transition: transform 0.12s, opacity 0.15s;
}
.scramble-tile:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--violet); }
.scramble-tile:disabled { opacity: 0.25; cursor: default; }
.scramble-clear { padding: 10px 22px; }
.scramble-hint { color: var(--muted); font-size: 15px; }

/* اكتب الإجابة */
.typed-area { display: flex; gap: 10px; width: 100%; max-width: 480px; flex-wrap: wrap; justify-content: center; }
.typed-input {
  flex: 1; min-width: 220px;
  padding: 16px 20px;
  font-family: var(--font-body); font-size: 18px; color: var(--text);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 16px;
  outline: none;
  text-align: center;
  transition: border-color 0.15s;
}
.typed-input:focus { border-color: var(--yellow); }
.typed-input.bad { border-color: var(--coral); animation: shake 0.35s; }
.typed-input.good { border-color: var(--teal); background: rgba(49, 196, 141, 0.12); }
.typed-submit { padding: 14px 26px; font-size: 17px; }

.speed-bonus {
  min-height: 26px;
  font-family: var(--font-display); font-weight: 800; font-size: 17px;
  color: var(--teal);
}
.speed-bonus.show { animation: riseFade 1s forwards; }
@keyframes riseFade {
  0% { opacity: 0; transform: translateY(8px); }
  25% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* ============================================================
   شاشة النتيجة
   ============================================================ */
.result-wrap {
  max-width: 560px; margin: 0 auto;
  padding: 50px clamp(16px, 4vw, 32px) 70px;
  display: grid; justify-items: center; gap: 16px; text-align: center;
}
.result-emoji { font-size: 74px; animation: popIn 0.5s; }
.result-title { font-family: var(--font-display); font-size: clamp(28px, 5vw, 38px); font-weight: 800; }
.result-sub { color: var(--muted); font-size: 17px; }
.result-score-card {
  display: flex; gap: 12px; width: 100%; justify-content: center; flex-wrap: wrap;
  margin-top: 10px;
}
.rs-item {
  flex: 1; min-width: 130px;
  display: grid; gap: 4px; place-items: center;
  padding: 20px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
}
.rs-item strong { font-family: var(--font-display); font-size: 32px; color: var(--yellow); }
.rs-item span { color: var(--muted); font-size: 13px; }
.result-squares { font-size: 26px; letter-spacing: 3px; direction: ltr; }
.new-record {
  padding: 10px 22px;
  background: rgba(255, 176, 32, 0.12);
  border: 1px solid rgba(255, 176, 32, 0.4);
  color: var(--yellow);
  font-family: var(--font-display); font-weight: 800;
  border-radius: 999px;
  animation: popIn 0.5s;
}
.result-actions { display: grid; gap: 12px; width: 100%; max-width: 380px; margin-top: 12px; }
.btn-share {
  padding: 17px 24px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  font-family: var(--font-display); font-size: 18px; font-weight: 800;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(37, 211, 102, 0.3);
  transition: transform 0.15s;
}
.btn-share:hover { transform: translateY(-3px); }
.btn-secondary {
  padding: 14px 20px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; font-size: 15.5px; font-weight: 600;
  transition: 0.15s;
}
.btn-secondary:hover { background: var(--card-2); }
.result-actions-row { display: flex; gap: 12px; }
.result-actions-row .btn-secondary { flex: 1; }

#confettiCanvas { position: fixed; inset: 0; pointer-events: none; z-index: 100; }

/* ============================================================
   الملف الشخصي والصور الرمزية
   ============================================================ */
.profile-btn { overflow: hidden; padding: 0; }
.profile-btn svg { width: 100%; height: 100%; display: block; }
.profile-btn.attention { animation: profilePulse 2s ease-in-out infinite; }
@keyframes profilePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 176, 32, 0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(255, 176, 32, 0); }
}

.stats-head { display: flex; align-items: center; justify-content: center; gap: 12px; }
.stats-avatar { width: 52px; height: 52px; border-radius: 16px; overflow: hidden; display: none; }
.stats-avatar.show { display: block; }
.stats-avatar svg { width: 100%; height: 100%; display: block; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 18px;
  background: rgba(6, 10, 26, 0.75);
  backdrop-filter: blur(6px);
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  padding: 30px 26px;
  background: linear-gradient(160deg, #232e5c, #1a2348);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  display: grid; gap: 16px; justify-items: center;
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.modal-close { position: absolute; top: 14px; inset-inline-start: 14px; }
.modal-title { font-family: var(--font-display); font-size: 26px; font-weight: 800; }
.modal-sub { color: var(--muted); font-size: 14px; text-align: center; line-height: 1.7; max-width: 380px; }
.profile-name { width: 100%; max-width: 320px; }

.avatar-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  width: 100%;
}
.avatar-option {
  position: relative;
  padding: 8px 6px 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid var(--line);
  border-radius: 18px;
  display: grid; gap: 4px; justify-items: center;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.avatar-option:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, 0.3); }
.avatar-option.selected {
  border-color: var(--yellow);
  background: rgba(255, 176, 32, 0.1);
  box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.25);
}
.avatar-option svg { width: 100%; max-width: 74px; height: auto; border-radius: 14px; }
.avatar-name { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.avatar-option.selected .avatar-name { color: var(--yellow); }
.profile-save { width: 100%; max-width: 320px; }

@media (max-width: 480px) {
  .avatar-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   طابع الألعاب: أزرار ثلاثية الأبعاد مرحة (أسلوب ألعاب المسابقات)
   ============================================================ */

/* حافة سفلية سميكة + كبسة حقيقية عند الضغط */
.btn-cta, .btn-play, .btn-daily, .btn-share, .btn-secondary,
.answer-btn, .diff-btn, .scramble-tile, .typed-submit, .profile-save {
  border-bottom: 5px solid rgba(0, 0, 0, 0.35) !important;
  font-family: var(--font-display);
}
.btn-cta:active, .btn-play:active, .btn-daily:active, .btn-share:active,
.btn-secondary:active, .answer-btn:active:not(:disabled), .diff-btn:active,
.scramble-tile:active:not(:disabled), .typed-submit:active, .profile-save:active {
  transform: translateY(3px) !important;
  border-bottom-width: 2px !important;
}

/* أزرار الإجابات الملونة (لكل زر لون مبهج مختلف) */
.answers-grid:not(.tf-grid) .answer-btn {
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 17.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.answers-grid:not(.tf-grid) .answer-btn:nth-child(1) { background: #f05252; }
.answers-grid:not(.tf-grid) .answer-btn:nth-child(2) { background: #3f83f8; }
.answers-grid:not(.tf-grid) .answer-btn:nth-child(3) { background: #e8a412; }
.answers-grid:not(.tf-grid) .answer-btn:nth-child(4) { background: #23a873; }
.answers-grid:not(.tf-grid) .answer-btn:hover:not(:disabled) {
  filter: brightness(1.12);
  transform: translateY(-3px);
  border-color: transparent;
}

/* نمط الخريطة — أسلوب quiz.com: بلا إطار، مندمجة مع خلفية الموقع */
.quiz-wrap.wide { max-width: 1160px; }
.map-area { display: grid; gap: 14px; width: 100%; justify-items: center; }
.map-frame { position: relative; width: 100%; }
.map-wrap {
  width: 100%;
  background: #23b3c7; /* محيط فيروزي فاتح بأسلوب quiz.com */
  border-radius: 22px;
  overflow: hidden;
}
.map-wrap svg {
  width: 100%;
  height: auto;
  max-height: 62vh;
  display: block;
  touch-action: none;
}
.map-wrap svg path {
  fill: #ddf3e8; /* يابسة بلون النعناع الفاتح */
  stroke: #8fc9b4;
  stroke-width: 0.5;
  cursor: pointer;
  transition: fill 0.1s;
}
.map-wrap svg path:hover { fill: #b5e7d1; }
.map-wrap svg path.map-selected {
  fill: #ffb020 !important;
  stroke: #b45309 !important;
  stroke-width: 1 !important;
}
.map-wrap svg path.map-correct { fill: #22c55e !important; stroke: #14532d !important; }
.map-wrap svg path.map-wrong { fill: #ef4444 !important; stroke: #7f1d1d !important; }
/* الدول المدموجة (المغرب + صحراؤه، وفلسطين كاملة): تحتفظ بحدودها الطبيعية
   مثل بقية الدول حتى لا تندمج مع الجيران، وتتوحّد في اللون عند التفاعل
   لتُعامَل كقطعة واحدة (ضغطة واحدة تحدّدها كلها) */
.map-wrap svg path.map-merged.map-hovergroup { fill: #b5e7d1 !important; }
.map-wrap svg path.map-merged.map-selected { fill: #ffb020 !important; stroke: #b45309 !important; }
.map-wrap svg path.map-merged.map-correct { fill: #22c55e !important; stroke: #14532d !important; }
.map-wrap svg path.map-merged.map-wrong { fill: #ef4444 !important; stroke: #7f1d1d !important; }
.map-next {
  background: linear-gradient(135deg, #23b3c7, #0e8ca0);
  color: #fff;
}
.map-controls {
  position: absolute;
  top: 8px; inset-inline-end: 8px;
  display: grid; gap: 8px;
}
.map-zoom-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  font-size: 18px;
  background: rgba(34, 45, 85, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  backdrop-filter: blur(4px);
  transition: 0.15s;
}
.map-zoom-btn:hover { background: rgba(53, 66, 116, 0.95); transform: scale(1.08); }
.map-confirm { padding: 13px 36px; }
.map-confirm:disabled { opacity: 0.45; cursor: default; }
.map-loading { padding: 60px 20px; color: var(--muted); font-weight: 700; font-size: 16px; text-align: center; }

/* من الأكبر؟ — خياران كبيران متقابلان */
.answers-grid.cmp-grid { grid-template-columns: 1fr 1fr; max-width: 560px; margin: 0 auto; }
.answers-grid.cmp-grid .answer-btn {
  min-height: 96px;
  font-size: 18px;
  font-family: var(--font-display);
  line-height: 1.5;
}

/* اكشف الكذبة: ثلاث عبارات طويلة بعمود واحد */
.answers-grid.lie-grid { grid-template-columns: 1fr; max-width: 560px; margin: 0 auto; }
.answers-grid.lie-grid .answer-btn {
  font-size: 15.5px;
  min-height: 62px;
  line-height: 1.7;
  padding: 14px 18px;
}

/* صح أم خطأ: أخضر وأحمر كبيران */
.answers-grid.tf-grid .answer-btn { border: none; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.answers-grid.tf-grid .answer-btn:nth-child(1) { background: #23a873; }
.answers-grid.tf-grid .answer-btn:nth-child(2) { background: #f05252; }
.answers-grid.tf-grid .answer-btn:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-3px); }

/* حالات الإجابة فوق الألوان الجديدة */
.answers-grid .answer-btn.correct {
  background: #31c48d !important;
  color: #06281c !important;
  text-shadow: none;
  box-shadow: 0 0 0 4px rgba(49, 196, 141, 0.35);
}
.answers-grid .answer-btn.wrong {
  background: #b91c1c !important;
  color: #fff !important;
}
.answers-grid .answer-btn.faded { opacity: 0.35; filter: grayscale(0.5); }

/* حروف الترتيب بطابع مكعبات اللعب */
.scramble-tile {
  background: linear-gradient(160deg, #9061f9, #7c4ce0);
  border: none;
  color: #fff;
}
.scramble-tile:disabled { opacity: 0.2; }

/* بطاقات التحديات والتصنيفات: ميلان مرح عند التمرير */
.mode-card:hover { transform: translateY(-6px) rotate(-1.2deg) scale(1.03); }
.cat-card:hover { transform: translateY(-6px) rotate(1deg); }

/* ---------- المستوى والخبرة ---------- */
.level-card {
  max-width: 900px; margin: 30px auto 0;
  display: flex; align-items: center; gap: 20px;
  padding: 22px 26px;
  background: linear-gradient(135deg, rgba(255, 176, 32, 0.12), rgba(144, 97, 249, 0.12));
  border: 1px solid rgba(255, 176, 32, 0.3);
  border-radius: 22px;
}
.level-icon {
  font-size: 46px;
  width: 76px; height: 76px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 2px dashed rgba(255, 176, 32, 0.4);
  border-radius: 20px;
  flex-shrink: 0;
}
.level-info { flex: 1; display: grid; gap: 8px; }
.level-name { font-family: var(--font-display); font-size: 21px; font-weight: 800; color: var(--yellow); }
.level-bar {
  height: 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.level-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--yellow), #ff8a3d);
  border-radius: 999px;
  transition: width 0.6s ease;
}
.level-xp { color: var(--muted); font-size: 13.5px; }

/* ---------- الشارات ---------- */
.badges-title {
  max-width: 900px; margin: 40px auto 0;
  font-family: var(--font-display); font-size: 22px; font-weight: 800;
  text-align: center;
}
.badge-count {
  color: var(--yellow); font-size: 14px; font-weight: 700;
  background: rgba(255, 176, 32, 0.12);
  padding: 3px 12px; border-radius: 999px;
}
.badges-progress {
  max-width: 520px; margin: 16px auto 0;
  height: 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08); overflow: hidden;
}
.badges-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--yellow), #ff8a3d);
  border-radius: 999px; transition: width 0.7s ease;
}
.badges-grid {
  max-width: 940px; margin: 26px auto 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 16px;
}
.badge-medal {
  padding: 18px 12px 14px; text-align: center;
  border-radius: 18px;
  display: grid; gap: 8px; justify-items: center;
  transition: transform 0.18s;
}
.badge-medal.earned { background: rgba(255, 176, 32, 0.07); border: 1px solid rgba(255, 176, 32, 0.28); }
.badge-medal.locked { background: rgba(255, 255, 255, 0.02); border: 1px solid var(--line); }
.badge-medal.earned:hover { transform: translateY(-4px) scale(1.03); }
/* القرص الدائري: ميدالية ذهبية للمكتسبة، قرص باهت للمقفلة */
.badge-disc {
  width: 68px; height: 68px; border-radius: 50%;
  display: grid; place-items: center;
  position: relative;
}
.badge-medal.earned .badge-disc {
  background: radial-gradient(circle at 35% 30%, #ffe08a, #ffb020 55%, #e07f1c);
  box-shadow: 0 6px 16px rgba(255, 176, 32, 0.4), inset 0 -3px 6px rgba(160, 80, 0, 0.35), inset 0 3px 6px rgba(255, 255, 255, 0.5);
  border: 3px solid #ffd76a;
}
.badge-medal.earned .badge-disc::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px dashed rgba(255, 215, 106, 0.5);
}
.badge-medal.locked .badge-disc {
  background: rgba(255, 255, 255, 0.05);
  border: 3px solid rgba(255, 255, 255, 0.1);
}
.badge-glyph { font-size: 30px; }
.badge-medal.earned .badge-glyph { filter: drop-shadow(0 1px 1px rgba(120, 60, 0, 0.4)); }
.badge-medal.locked .badge-glyph { opacity: 0.4; filter: grayscale(1); font-size: 24px; }
.badge-name { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; }
.badge-medal.earned .badge-name { color: var(--yellow); }
.badge-medal.locked .badge-name { color: var(--muted); }
.badge-desc { color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.badge-medal.locked .badge-desc { opacity: 0.75; }

/* مكافآت شاشة النتيجة */
.xp-gain {
  font-family: var(--font-display); font-weight: 800; font-size: 18px;
  color: var(--yellow);
  min-height: 24px;
}
.level-up {
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--yellow), #ff8a3d);
  color: #10162f;
  font-family: var(--font-display); font-weight: 800; font-size: 17px;
  border-radius: 999px;
  animation: popIn 0.5s;
  box-shadow: 0 8px 24px rgba(255, 176, 32, 0.4);
}
.new-badges { display: grid; gap: 8px; justify-items: center; }
.new-badge-chip {
  padding: 9px 20px;
  background: rgba(144, 97, 249, 0.15);
  border: 1px solid rgba(144, 97, 249, 0.45);
  border-radius: 999px;
  font-size: 15px;
  animation: popIn 0.45s;
}
.new-badge-chip strong { color: #c9adff; }

/* ---------- قميص النادي ---------- */
.jersey-box {
  width: min(230px, 62vw);
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.jersey-svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45)); }

/* ---------- بوابة كرة القدم ---------- */
.fc-modal { max-width: 460px; }
.fc-grid { display: grid; gap: 14px; width: 100%; }
.fc-btn {
  padding: 20px 18px;
  border-radius: 20px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 20px; font-weight: 800;
  display: grid; gap: 6px; justify-items: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  border-bottom: 5px solid rgba(0, 0, 0, 0.35);
  transition: transform 0.15s, filter 0.15s;
}
.fc-btn:hover { transform: translateY(-3px) scale(1.02); filter: brightness(1.12); }
.fc-btn:active { transform: translateY(3px); border-bottom-width: 2px; }
.fc-btn small { font-size: 12.5px; opacity: 0.92; font-family: var(--font-body); font-weight: 600; }
.fc-jersey { background: linear-gradient(150deg, #16a34a, #0f7a37); }
.fc-player { background: linear-gradient(150deg, #f59e0b, #d97d06); }
.fc-quiz   { background: linear-gradient(150deg, #3b82f6, #2563c9); }

/* ---------- نافذة اختيار الصعوبة ---------- */
.diff-modal { max-width: 460px; }
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
.diff-btn {
  padding: 20px 14px;
  border-radius: 20px;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  display: grid; gap: 6px; justify-items: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s, filter 0.15s;
}
.diff-btn:hover { transform: translateY(-3px) scale(1.03); filter: brightness(1.12); }
.diff-btn small { font-size: 12px; opacity: 0.9; font-family: var(--font-body); font-weight: 600; }
.diff-easy { background: linear-gradient(150deg, #31c48d, #23a873); }
.diff-mid  { background: linear-gradient(150deg, #3f83f8, #2f6ad0); }
.diff-hard { background: linear-gradient(150deg, #f05252, #d03030); }
.diff-mix  { background: linear-gradient(150deg, #9061f9, #7c4ce0); }

@media (max-width: 420px) {
  .diff-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   استجابة الجوال
   ============================================================ */
@media (max-width: 640px) {
  .topnav { display: none; }
  /* عمودان بدل عمود واحد: تصفح أسرع وتمرير أقل بكثير */
  .cats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .modes-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cat-card, .mode-card { padding: 16px 12px; }
  .cat-icon { width: 52px; height: 52px; }
  .mode-icon { width: 58px; height: 58px; }
  .cat-name, .mode-name { font-size: 16px; }
  .cat-desc, .mode-desc { font-size: 11.5px; min-height: 0; }
  .icon-btn { width: 44px; height: 44px; }
  /* الخريطة تمتد لكامل عرض الشاشة لتكبر مساحة اللمس */
  .map-wrap { border-radius: 14px; }
  .quiz-wrap.wide { padding-inline: 8px; }
  .map-zoom-btn { width: 46px; height: 46px; }
  .hero { padding-top: 34px; }
  .hero-ctas { flex-direction: column; align-items: stretch; }
  .btn-daily { justify-content: center; }
  .daily-card { flex-direction: column; text-align: center; }
  .daily-right { flex-direction: column; }
  .daily-left { width: 100%; justify-content: center; }
  .answers-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 26px; }

  /* ===== شاشة اللعب على الجوال: السؤال والإجابات في شاشة واحدة بلا تمرير ===== */
  /* رأس الصفحة نفسه، مصغّرًا: نفس عناصر الحاسوب بارتفاع أقل ثلثًا */
  .topbar { padding: 7px 12px; gap: 10px; }
  .brand-mark { width: 32px; height: 32px; font-size: 20px; border-radius: 10px; }
  .brand-name { font-size: 20px; }
  .icon-btn { width: 38px; height: 38px; font-size: 16px; border-radius: 11px; }
  /* الأزرار تُدفع إلى الطرف المقابل للشعار (يسار الشاشة في العربية) */
  .profile-btn { padding: 0; margin-inline-start: auto; }
  .quiz-wrap { padding: 8px 12px 20px; gap: 8px; }
  .quiz-top { padding-top: 0; gap: 10px; }
  .quiz-meta { gap: 8px; font-size: 13px; }
  .quiz-cat { padding: 4px 10px; font-size: 12.5px; }
  .quiz-counter, .quiz-streak { font-size: 12.5px; }
  .timer-ring { width: 64px; height: 64px; }        /* بدل 108 */
  .timer-num { font-size: 24px; }
  .question-text { min-height: 0; font-size: 19px; line-height: 1.5; }
  .q-media img.flag-img { width: min(165px, 46vw); }
  .q-media .q-emoji { font-size: 42px; letter-spacing: 4px; }
  .answers-grid { gap: 9px; }
  .answer-btn { min-height: 48px; padding: 10px 14px; font-size: 16px; }
  .answers-grid.tf-grid .answer-btn { min-height: 62px; font-size: 19px; }
  .answers-grid.cmp-grid .answer-btn { min-height: 68px; font-size: 16px; }
  .answers-grid.lie-grid .answer-btn { min-height: 54px; font-size: 14px; padding: 10px 12px; }
  .speed-bonus { min-height: 20px; font-size: 15px; }
  .jersey-box { width: min(160px, 46vw); padding: 6px; }
  .scramble-slot, .scramble-tile { width: 46px; height: 50px; font-size: 22px; }
  .map-wrap svg { max-height: 46vh; }
}

/* ============================================================
   اللعب مع الأصدقاء — الغرف المباشرة
   ============================================================ */
.btn-friends {
  padding: 16px 30px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  border-radius: 18px;
  font-family: var(--font-display); font-size: 19px; font-weight: 800;
  border-bottom: 5px solid rgba(0,0,0,0.35);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
  transition: transform 0.15s;
}
.btn-friends:hover { transform: translateY(-3px); }
.btn-friends:active { transform: translateY(3px); border-bottom-width: 2px; }

.room-wrap {
  position: relative;
  max-width: 620px; margin: 0 auto;
  padding: 20px clamp(14px, 4vw, 28px) 60px;
  display: grid; gap: 14px;
}
.room-wrap section { display: grid; gap: 14px; justify-items: center; }
.room-back { justify-self: start; background: none; color: var(--muted); font-size: 15px; padding: 6px 0; }
.room-title { font-family: var(--font-display); font-size: clamp(24px, 5vw, 32px); font-weight: 800; text-align: center; }
.room-sub { color: var(--muted); text-align: center; line-height: 1.8; max-width: 420px; }
.room-h3 { font-family: var(--font-display); font-size: 19px; }
.room-note { color: var(--muted); font-size: 14.5px; text-align: center; min-height: 20px; }
.room-big { width: 100%; max-width: 360px; }
.room-label { color: var(--muted); font-size: 14px; }

.room-or { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 360px; color: var(--muted); }
.room-or::before, .room-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.code-input {
  width: 100%; max-width: 300px;
  padding: 16px; text-align: center;
  font-family: var(--font-display); font-size: 34px; font-weight: 800;
  letter-spacing: 10px; direction: ltr;
  color: var(--text); background: var(--card);
  border: 2px solid var(--line); border-radius: 18px; outline: none;
}
.code-input:focus { border-color: var(--violet); }
.code-display {
  font-family: var(--font-display); font-size: clamp(40px, 11vw, 58px); font-weight: 800;
  letter-spacing: 6px; direction: ltr; color: var(--yellow);
  background: rgba(255,176,32,0.1);
  border: 2px dashed rgba(255,176,32,0.45);
  border-radius: 20px; padding: 12px 26px;
}
.room-share { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.room-share .btn-share, .room-share .btn-secondary { padding: 12px 22px; font-size: 15px; }

.lobby-players {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px; width: 100%;
}
.lobby-player {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  animation: popIn 0.3s;
}
.lobby-player.host { border-color: rgba(255,176,32,0.5); background: rgba(255,176,32,0.08); }
.lp-avatar { width: 32px; height: 32px; border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.lp-avatar svg { width: 100%; height: 100%; display: block; }
.lp-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-crown { margin-inline-start: auto; }

.room-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-bottom: 12px; }
.room-settings label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
.room-settings select {
  padding: 11px; font-family: var(--font-body); font-size: 14.5px;
  color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; outline: none;
}

.rp-top { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.rp-counter { color: var(--muted); font-size: 14.5px; }
.rp-timer {
  font-family: var(--font-display); font-size: 30px; font-weight: 800; color: var(--teal);
  min-width: 58px; text-align: center;
  background: rgba(49,196,141,0.12); border-radius: 12px; padding: 2px 12px;
}
.rp-timer.danger { color: var(--coral); background: rgba(240,82,82,0.14); animation: tickPulse 1s infinite; }
#rpAnswers { width: 100%; }
.answer-btn.chosen { outline: 3px solid var(--yellow); outline-offset: 2px; }

.rv-title { font-family: var(--font-display); font-size: 26px; font-weight: 800; text-align: center; }
.rv-points { font-family: var(--font-display); font-size: 19px; color: var(--yellow); text-align: center; }
.rv-explain { color: var(--muted); font-size: 14.5px; text-align: center; }
.rv-list { display: grid; gap: 7px; width: 100%; }
.rv-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 13px;
}
.rv-row.me { border-color: var(--yellow); background: rgba(255,176,32,0.1); }
.rv-rank { font-family: var(--font-display); font-weight: 800; min-width: 26px; }
.rv-avatar { width: 30px; height: 30px; border-radius: 9px; overflow: hidden; flex-shrink: 0; }
.rv-avatar svg { width: 100%; height: 100%; display: block; }
.rv-name { font-weight: 700; font-size: 14.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-score { font-family: var(--font-display); font-weight: 800; color: var(--yellow); }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; width: 100%; }
.podium-slot {
  display: grid; justify-items: center; gap: 5px;
  padding: 14px 10px; border-radius: 16px; flex: 1; max-width: 150px;
  background: var(--card); border: 1px solid var(--line);
  animation: popIn 0.5s;
}
.podium-slot.p1 { background: linear-gradient(160deg, rgba(255,176,32,0.25), rgba(255,138,61,0.12)); border-color: rgba(255,176,32,0.6); padding-block: 24px; }
.pd-medal { font-size: 26px; }
.pd-avatar { width: 46px; height: 46px; border-radius: 13px; overflow: hidden; }
.pd-avatar svg { width: 100%; height: 100%; display: block; }
.pd-name { font-family: var(--font-display); font-weight: 700; font-size: 14px; text-align: center; }
.pd-score { font-family: var(--font-display); font-weight: 800; color: var(--yellow); font-size: 17px; }

.room-toast {
  position: fixed; bottom: 20px; inset-inline: 20px;
  margin: 0 auto; max-width: 380px;
  padding: 13px 18px; border-radius: 14px;
  background: rgba(49,196,141,0.95); color: #06281c;
  font-weight: 700; text-align: center;
  opacity: 0; pointer-events: none; transform: translateY(12px);
  transition: 0.25s; z-index: 300;
}
.room-toast.show { opacity: 1; transform: translateY(0); }
.room-toast.bad { background: rgba(240,82,82,0.95); color: #fff; }

@media (max-width: 640px) {
  .room-wrap { padding: 12px 12px 40px; gap: 11px; }
  .room-settings { grid-template-columns: 1fr; }
  .lobby-players { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .rp-timer { font-size: 24px; }
}
