/* ============================================================
 * مسابقات ماما حجية هناء — التنسيق
 * ============================================================ */

:root {
  --ink:        #0E1116;
  --ink-soft:   #2A2F36;
  --paper:      #F4EFE6;
  --paper-2:    #EBE4D5;
  --line:       #1A1D22;
  --accent:     #FF4D2E;
  --accent-2:   #FF8C5A;
  --accent-soft:#FFE6E0;
  --success:    #16B364;
  --success-soft:#DDF5E5;
  --danger:     #E5484D;
  --danger-soft:#FFE0DA;
  --warn:       #F5A524;
  --gold:       #E5B73B;
  --silver:     #C2C7CE;
  --bronze:     #C77B45;
  --team1:      #E5484D;
  --team1-soft: #FFE0DA;
  --team2:      #2658B5;
  --team2-soft: #DBE7FF;

  --font-display: "Reem Kufi", "Tajawal", system-ui, sans-serif;
  --font-body:    "Tajawal", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;

  --shadow-soft:  0 1px 0 rgba(14,17,22,.05), 0 8px 24px rgba(14,17,22,.06);
  --shadow-deep:  0 1px 0 rgba(14,17,22,.06), 0 24px 60px rgba(14,17,22,.12);
}

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

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  font-weight: 500;
}

.hidden { display: none !important; }

/* =========== خلفية =========== */
.bg-grid {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(14,17,22,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14,17,22,.045) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at 50% 30%, black 30%, transparent 80%);
}
.bg-grid--player {
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 20%, transparent 80%);
}
.bg-blob {
  position: fixed;
  width: 600px; height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: .5;
}
.bg-blob--1 { background: var(--accent); top: -200px; left: -200px; }
.bg-blob--2 { background: var(--gold); bottom: -200px; right: -200px; opacity: .3; }

/* =========== مساعدات =========== */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--ink-soft);
  margin: 0 0 18px;
  font-weight: 700;
}
em {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 700;
  color: var(--accent);
}

/* =========== شريط علوي =========== */
.topbar {
  position: relative; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 40px;
  border-bottom: 1px solid rgba(14,17,22,.08);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font-weight: 800; font-size: 22px;
  font-family: var(--font-display);
}
.brand__mark { font-size: 24px; }
.topbar__meta { display: flex; align-items: center; gap: 10px; }
.topbar__label { font-size: 12px; color: var(--ink-soft); font-weight: 500; }
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-soft);
}
.dot--live {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(255,77,46,.6);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,77,46,.6); }
  70%      { box-shadow: 0 0 0 14px rgba(255,77,46,0); }
}

/* =========== الصفحة الرئيسية =========== */
.landing {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 60px;
  padding: 80px 40px 60px;
  max-width: 1400px;
  margin: 0 auto;
}
.headline {
  font-family: var(--font-display);
  font-size: clamp(44px, 6.5vw, 96px);
  line-height: 1.05;
  font-weight: 700;
  margin: 0 0 28px;
}
.lede {
  font-size: 19px;
  line-height: 1.8;
  color: var(--ink-soft);
  max-width: 540px;
  margin: 0 0 36px;
  font-weight: 500;
}
.cta-row {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-bottom: 56px;
}
.panel-card {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-deep);
  position: relative;
  overflow: hidden;
}
.panel-card::after {
  content: "";
  position: absolute; top: -40px; left: -40px;
  width: 160px; height: 160px;
  background: var(--accent);
  border-radius: 50%; filter: blur(60px); opacity: .5;
}
.panel-card__head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
  font-size: 13px; font-weight: 700;
}
.panel-card__tag { color: var(--accent-2); }
.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 18px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.step__num {
  flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700; font-size: 16px;
  display: grid; place-items: center;
}
.steps h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600;
}
.steps p { margin: 0; font-size: 14px; color: rgba(244,239,230,.65); line-height: 1.7; }

.footer {
  position: relative; z-index: 2;
  display: flex; justify-content: center;
  padding: 24px 40px;
  border-top: 1px solid rgba(14,17,22,.08);
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 500;
}

/* =========== الأزرار =========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 26px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .2s, background .2s, color .2s;
  user-select: none;
  white-space: nowrap;
}
.btn__arrow { transition: transform .2s; }
.btn:hover .btn__arrow { transform: translateX(-4px); }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--accent); color: var(--ink); }
.btn--ghost {
  background: var(--paper-2);
  color: var(--ink);
  border: 1px solid rgba(14,17,22,.1);
}
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--lg { padding: 20px 32px; font-size: 18px; }
.btn--sm { padding: 10px 18px; font-size: 13px; }
.btn--full { width: 100%; }
.btn:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* ============================================================
 * الشاشة الرئيسية
 * ============================================================ */
.page-host {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(255,77,46,.08), transparent 60%),
    var(--paper);
}
.screen {
  position: relative; z-index: 2;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ---- قاعة الانتظار ---- */
.host-top {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  padding: 22px 36px;
  border-bottom: 1px solid rgba(14,17,22,.08);
  background: rgba(244,239,230,.7);
  backdrop-filter: blur(8px);
}
.host-top__back {
  font-size: 13px; color: var(--ink-soft);
  text-decoration: none; font-weight: 600;
}
.host-top__back:hover { color: var(--accent); }
.host-top__title {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 20px;
}
.host-top__round {
  font-size: 12px; color: var(--accent);
  font-weight: 700; text-align: left;
}

.lobby-banner {
  text-align: center;
  padding: 50px 40px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}
.lobby-banner::before,
.lobby-banner::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(700px, 70%);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ink-soft, rgba(0,0,0,.25)), transparent);
}
.lobby-banner::before { top: 24px; }
.lobby-banner::after  { bottom: 14px; }
.lobby-banner__eyebrow {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 8px;
  color: var(--accent);
  font-weight: 700;
}
.lobby-banner__title {
  font-family: var(--font-display);
  font-size: clamp(56px, 8vw, 110px);
  line-height: 1;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  letter-spacing: -1px;
}
.lobby-banner__name {
  font-family: var(--font-display);
  font-size: clamp(80px, 12vw, 180px);
  line-height: 1;
  font-weight: 900;
  margin: 0;
  background: linear-gradient(135deg, var(--accent), #c93a1f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 4px 20px rgba(255,77,46,.18);
  letter-spacing: -2px;
}

.lobby-wrap {
  flex: 1;
  display: grid; grid-template-columns: 1.3fr 1fr;
  gap: 60px;
  padding: 30px 60px 60px;
  max-width: 1400px; margin: 0 auto; width: 100%;
  align-items: center;
}
.lobby-headline {
  font-family: var(--font-display);
  font-size: clamp(36px, 4.5vw, 56px);
  line-height: 1; font-weight: 700;
  margin: 0 0 30px;
}
.code-display {
  background: var(--ink); color: var(--paper);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-deep);
  position: relative; overflow: hidden;
  text-align: center;
}
.code-display::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255,77,46,.4), transparent 50%);
}
.code-display__digits {
  position: relative;
  font-family: var(--font-mono);
  font-size: clamp(54px, 8vw, 96px);
  font-weight: 700; letter-spacing: 0.1em;
  line-height: 1;
  direction: ltr;
}
.link-row { display: flex; gap: 10px; flex-wrap: wrap; }

.status-card {
  background: var(--paper-2);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 14px;
}
.status-pill {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  border: 2px solid rgba(14,17,22,.08);
  transition: border-color .3s, background .3s;
}
.status-pill__icon { font-size: 28px; }
.status-pill > div { display: flex; flex-direction: column; gap: 2px; }
.status-pill strong { font-family: var(--font-display); font-size: 17px; }
.status-pill span { font-size: 13px; color: var(--ink-soft); }
.status-pill--ok {
  border-color: var(--success);
  background: var(--success-soft);
}
.status-pill--ok span { color: var(--success); font-weight: 600; }

/* ---- لوحة الفئات ---- */
.board-utility-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 36px;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 1px solid rgba(14,17,22,.08);
}
.board-utility-bar__code {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
}
.board-utility-bar__lbl {
  font-size: 13px;
  opacity: .65;
  font-weight: 500;
}
.board-utility-bar__val {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--accent-2);
}
.board-utility-bar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-icon {
  background: rgba(255,255,255,.08);
  color: var(--paper);
  border: 1px solid rgba(255,255,255,.15);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: all .15s ease;
  line-height: 1;
}
.btn-icon:hover {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.3);
}
.btn--danger {
  background: rgba(255,77,46,.15);
  color: #FF6B4F;
  border-color: rgba(255,77,46,.4);
}
.btn--danger:hover {
  background: rgba(255,77,46,.25);
  border-color: var(--accent);
  color: white;
}

/* ---- زر الرجوع للعبة السابقة ---- */
.restore-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #16B364, #129F58);
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: all .15s ease;
  margin-top: 8px;
}
.restore-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22,179,100,.3);
}
.restore-btn strong {
  font-family: var(--font-mono);
  letter-spacing: 2px;
}

.board-top {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  padding: 24px 36px;
  border-bottom: 1px solid rgba(14,17,22,.08);
  background: rgba(244,239,230,.7);
  backdrop-filter: blur(8px);
}
.board-title { text-align: center; }
.board-title__main {
  display: block;
  font-family: var(--font-display);
  font-weight: 700; font-size: 22px;
}
.board-title__turn {
  display: inline-block;
  margin-top: 8px;
  background: var(--accent);
  color: var(--ink);
  padding: 6px 16px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
}
.team-card {
  background: var(--team1-soft);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  border: 3px solid transparent;
  transition: border-color .3s, transform .3s;
}
.team-card--alt {
  background: var(--team2-soft);
  align-items: flex-end;
}
.team-card--active { border-color: var(--accent); transform: scale(1.05); }
.team-card__lbl {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 600;
  color: var(--ink-soft);
}
.team-card__score {
  font-family: var(--font-display);
  font-size: 40px; font-weight: 700;
  color: var(--team1);
  line-height: 1;
}
.team-card--alt .team-card__score { color: var(--team2); }

.board-stage {
  flex: 1;
  padding: 40px 60px;
  max-width: 1500px; margin: 0 auto; width: 100%;
  display: flex; flex-direction: column;
}
.board-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.cat-col {
  background: var(--paper-2);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.cat-col__head {
  text-align: center;
  padding-bottom: 12px;
  margin-bottom: 2px;
  border-bottom: 2px dashed rgba(14,17,22,.1);
}
.cat-col__emoji { font-size: 32px; margin-bottom: 6px; }
.cat-col__name {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  line-height: 1.3;
}
.cat-tile {
  background: var(--ink);
  color: var(--accent-2);
  border-radius: var(--radius);
  padding: 14px 10px;
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700;
  text-align: center;
  transition: transform .2s, opacity .3s;
  position: relative;
  overflow: hidden;
}
.cat-tile::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255,140,90,.2), transparent 60%);
}
.cat-tile--used {
  background: var(--paper-2);
  color: var(--ink-soft);
  opacity: .35;
  font-size: 28px;
}
.cat-tile--used::before { display: none; }
.board-hint {
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
  font-weight: 500;
}

/* ---- السؤال ---- */
.question-top {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  padding: 24px 36px;
  border-bottom: 1px solid rgba(14,17,22,.08);
  background: rgba(244,239,230,.7);
  backdrop-filter: blur(8px);
}
.qcategory {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700;
}
.qpoints {
  text-align: center;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink-soft);
  font-weight: 600;
}
.qpoints span {
  display: inline-block;
  background: var(--accent);
  color: var(--ink);
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 24px;
  margin-left: 8px;
  font-weight: 700;
}
.qteam {
  text-align: left;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-soft);
}
.qteam span {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
}

.question-stage {
  flex: 1;
  padding: 60px 80px;
  max-width: 1400px; margin: 0 auto; width: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 50px;
  text-align: center;
}
.question-text {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 76px);
  line-height: 1.3;
  font-weight: 700;
  margin: 0;
  max-width: 1100px;
}
.timer-big {
  position: relative; width: 180px; height: 180px;
  display: grid; place-items: center;
}
.timer__ring { width: 180px; height: 180px; transform: rotate(-90deg); }
.timer__ring-bg { fill: none; stroke: rgba(14,17,22,.08); stroke-width: 6; }
.timer__ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset .1s linear;
}
.timer__num {
  position: absolute;
  font-family: var(--font-display);
  font-size: 72px; font-weight: 700;
}
.timer-big .timer__num { font-size: 72px; }

.question-hint {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0;
  font-weight: 600;
}

/* ---- النتيجة ---- */
.result-wrap {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px;
  gap: 40px;
}
.result-box {
  background: var(--paper-2);
  border-radius: var(--radius-lg);
  padding: 60px 80px;
  text-align: center;
  animation: revealPop .6s cubic-bezier(.34,1.56,.64,1);
  min-width: 500px;
}
@keyframes revealPop {
  from { opacity: 0; transform: scale(.7); }
  to   { opacity: 1; transform: scale(1); }
}
.result-box--correct { background: var(--success-soft); }
.result-box--wrong   { background: var(--danger-soft); }
.result-icon {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--ink-soft); color: white;
  display: grid; place-items: center;
  font-size: 80px; font-weight: 700;
  margin: 0 auto 24px;
}
.result-box--correct .result-icon { background: var(--success); }
.result-box--wrong .result-icon   { background: var(--danger); }
.result-verdict {
  font-family: var(--font-display);
  font-size: 56px; font-weight: 700;
  margin: 0 0 12px;
}
.result-points {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 600;
  margin: 0; color: var(--ink-soft);
}
.correct-answer-box {
  background: var(--ink); color: var(--paper);
  border-radius: var(--radius-lg);
  padding: 30px 50px;
  text-align: center;
  min-width: 500px;
}
.correct-answer-label {
  font-size: 14px; font-weight: 600;
  color: var(--accent-2);
  display: block; margin-bottom: 10px;
}
.correct-answer-text {
  font-family: var(--font-display);
  font-size: 38px; font-weight: 700;
  margin: 0; line-height: 1.3;
}

/* ---- النهاية ---- */
.final-stage {
  flex: 1;
  padding: 60px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.final-label {
  font-family: var(--font-display);
  font-size: 28px; color: var(--ink-soft);
  margin: 0 0 12px;
}
.champion-name {
  font-family: var(--font-display);
  font-size: clamp(60px, 10vw, 140px);
  font-weight: 700;
  line-height: 1.05; margin: 0 0 50px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: revealPop .9s cubic-bezier(.34,1.56,.64,1);
}
.final-scores {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 50px;
  min-width: 480px;
}
.final-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--paper-2);
  border-radius: var(--radius);
  padding: 18px 28px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
}
.final-row--winner {
  background: var(--ink);
  color: var(--paper);
}
.final-row--winner strong { color: var(--gold); font-size: 32px; }
.final-row strong { font-size: 28px; color: var(--accent); }

.host-controls {
  display: flex; gap: 14px;
  margin-top: 30px;
}

/* ============================================================
 * شاشة التلفون (الحكم + اللاعب)
 * ============================================================ */
.page-judge, .page-player {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
}
.pscreen {
  position: relative; z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  display: flex; flex-direction: column;
}
.player-back {
  position: absolute; top: 18px; right: 20px;
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
}

/* ---- الانضمام ---- */
.pjoin {
  margin: auto 0;
  width: 100%;
  max-width: 420px;
  align-self: center;
  padding: 20px 0;
}
.pbrand {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  color: var(--accent);
  margin-bottom: 24px; display: block;
}
.pjoin__title {
  font-family: var(--font-display);
  font-size: 44px; font-weight: 700;
  line-height: 1.1; margin: 0 0 32px;
}
.pinput { margin-bottom: 18px; }
.pinput label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  font-weight: 600;
}
.pinput input {
  width: 100%;
  background: var(--paper-2);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 18px 20px;
  font-family: var(--font-body);
  font-size: 22px; font-weight: 600;
  color: var(--ink);
  outline: none;
  transition: border-color .2s, background .2s;
}
.pinput input:focus {
  border-color: var(--ink);
  background: var(--paper);
}
#judgeCodeInput, #playerCodeInput {
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 28px;
  text-align: center;
}
.pjoin__hint {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  min-height: 18px;
  font-weight: 500;
}
.hint--err, .pjoin__hint--err { color: var(--accent); }

/* ---- الانتظار ---- */
.pwait {
  margin: auto;
  text-align: center;
  max-width: 360px;
}
.pwait__pulse {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 auto 30px;
  animation: bigPulse 1.6s ease-in-out infinite;
}
@keyframes bigPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.2); opacity: .6; }
}
.pwait__name {
  font-family: var(--font-display);
  font-size: 44px; font-weight: 700;
  margin: 0 0 12px;
}
.pwait__msg {
  color: var(--ink-soft); font-size: 16px;
  margin: 0 0 24px; line-height: 1.7;
  font-weight: 500;
}
.pwait__dots {
  display: flex; gap: 8px; justify-content: center;
}
.pwait__dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-soft);
  animation: dotJump 1.2s infinite;
}
.pwait__dots span:nth-child(2) { animation-delay: .2s; }
.pwait__dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotJump {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}
.answering-icon {
  font-size: 80px;
  margin-bottom: 20px;
  animation: bigPulse 2s ease-in-out infinite;
}

/* ---- شاشة الحكم ---- */
.judge-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 4px;
  margin-bottom: 16px;
}
.judge-header__cat {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700;
}
.judge-header__pts {
  background: var(--accent);
  color: var(--ink);
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
}
.judge-turn {
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: var(--radius);
  text-align: center;
  font-size: 14px; font-weight: 600;
  margin-bottom: 18px;
}
.judge-turn strong {
  font-family: var(--font-display);
  color: var(--accent-2);
  font-size: 17px;
}
.judge-question-card {
  background: var(--paper-2);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}
.judge-answer-card {
  background: var(--success-soft);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  border: 2px solid var(--success);
}
.judge-label {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
}
.judge-label--green { color: var(--success); }
.judge-question-text {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600;
  line-height: 1.5;
  margin: 0;
}
.judge-answer-text {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700;
  line-height: 1.4;
  margin: 0;
  color: var(--success);
}
.judge-hint-row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(22,179,100,.3);
  font-size: 14px;
  color: var(--ink-soft);
}
.judge-hint-row .judge-label {
  display: inline-block;
  margin-bottom: 0;
  margin-left: 6px;
}

.judge-decision {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
}
.judge-btn {
  border: none;
  border-radius: var(--radius);
  padding: 26px 16px;
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: transform .15s;
  color: white;
}
.judge-btn:active { transform: scale(.95); }
.judge-btn__icon { font-size: 40px; line-height: 1; }
.judge-btn__lbl { font-size: 16px; }
.judge-btn--correct { background: var(--success); }
.judge-btn--wrong { background: var(--danger); }

/* ---- شاشة اللاعب: لوحة النتائج ---- */
.player-scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  gap: 12px;
}
.player-team {
  display: flex; flex-direction: column;
  font-size: 13px;
  font-weight: 600;
  color: rgba(244,239,230,.7);
}
.player-team strong {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--accent-2);
  font-weight: 700;
  line-height: 1;
  margin-top: 4px;
}
.player-team:first-child { text-align: right; }
.player-team:first-child strong { color: var(--team1); }
.player-team:last-child { text-align: left; align-items: flex-end; }
.player-team:last-child strong { color: var(--team2-soft); }
.player-vs {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 700;
  background: var(--paper-2);
  color: var(--ink);
  padding: 4px 10px;
  border-radius: 6px;
}

/* ---- خطوة الاختيار ---- */
.player-step-info {
  text-align: center;
  margin-bottom: 24px;
}
.step-tag {
  display: inline-block;
  background: var(--accent);
  color: var(--ink);
  padding: 6px 16px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700;
  margin-bottom: 14px;
}
.player-step-info h2 {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 700;
  margin: 0;
}
.cat-header {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  margin: 0 0 8px;
}
.cat-emoji-big { font-size: 30px; margin-left: 6px; }
.back-link {
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 14px;
  padding: 4px 0;
}
.back-link:hover { color: var(--accent); }

/* ---- شبكة الفئات ---- */
.picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex: 1;
}
.picker-tile {
  background: var(--paper-2);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 24px 16px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-family: var(--font-display);
  transition: transform .15s, border-color .2s;
  min-height: 130px;
}
.picker-tile:active { transform: scale(.97); }
.picker-tile:hover { border-color: var(--accent); }
.picker-tile__emoji { font-size: 38px; line-height: 1; }
.picker-tile__name {
  font-size: 16px; font-weight: 700;
  text-align: center;
  line-height: 1.3;
}
.picker-tile__count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: var(--ink);
  color: var(--accent-2);
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 4px;
}
.picker-tile--used .picker-tile__count {
  background: var(--success);
  color: white;
}
.picker-tile--used {
  opacity: .55;
  cursor: not-allowed;
}
/* ---- اختيار الفريق في صفحة الانضمام ---- */
.team-choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.team-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  border: 2px solid var(--ink-soft);
  background: var(--paper);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s ease;
  font-family: var(--font-display);
}
.team-choice:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.team-choice__icon { font-size: 28px; line-height: 1; }
.team-choice__lbl { font-size: 16px; font-weight: 700; color: var(--ink); }
.team-choice__status {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--ink-soft);
  background: var(--paper-2);
  padding: 2px 8px;
  border-radius: 999px;
}
.team-choice--selected {
  border-color: var(--accent);
  background: var(--accent);
}
.team-choice--selected .team-choice__lbl { color: var(--paper); }
.team-choice--selected .team-choice__status {
  background: rgba(255,255,255,.25);
  color: var(--paper);
}
.team-choice--taken {
  opacity: .45;
  cursor: not-allowed;
}
.team-choice--taken .team-choice__status {
  background: var(--ink);
  color: var(--paper);
}
.team-choice:disabled { cursor: not-allowed; }

.fairness-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 8px 0 0;
  font-weight: 500;
}

/* ---- QR Codes ---- */
.qr-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}
.qr-card {
  background: var(--paper);
  border: 2px solid var(--ink-soft);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.qr-card__title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.qr-code {
  background: var(--paper-2);
  border-radius: 8px;
  padding: 6px;
  min-width: 140px;
  min-height: 140px;
  display: grid;
  place-items: center;
}
.qr-code img {
  display: block;
  border-radius: 4px;
}

/* ---- مختار الإيموجي ---- */
.emoji-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.emoji-opt {
  background: var(--paper);
  border: 2px solid var(--ink-soft);
  border-radius: 10px;
  padding: 10px;
  font-size: 22px;
  cursor: pointer;
  transition: all .15s ease;
  line-height: 1;
}
.emoji-opt:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.emoji-opt--selected {
  border-color: var(--accent);
  background: var(--accent);
  transform: scale(1.05);
}

/* ---- مختار اللون ---- */
.color-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}
.color-opt {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
}
.color-opt:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.color-opt--selected {
  border-color: var(--ink);
  transform: scale(1.1);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink);
}

/* ---- إيموجي الفريق على اللوحة ---- */
.team-emoji {
  font-size: 1.2em;
  margin-left: 6px;
  vertical-align: middle;
}

/* ---- ألوان الفريق ديناميكية ---- */
.team-card {
  --team-color: var(--accent);
  position: relative;
}
.team-card.team-card--active {
  border-color: var(--team-color, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--team-color, var(--accent)) 30%, transparent);
}

/* ---- شاشة التصويت (الشاشة الرئيسية) ---- */
.voting-stage {
  flex: 1;
  padding: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 40px;
}
.voting-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 40px; align-items: center;
  width: 100%; max-width: 900px;
}
.voting-team {
  background: var(--paper-2);
  border-radius: var(--radius-lg);
  padding: 30px 24px;
  text-align: center;
  border: 3px solid transparent;
  transition: all .3s;
}
.voting-team--1 { background: var(--team1-soft); }
.voting-team--2 { background: var(--team2-soft); }
.voting-team__name {
  display: block;
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700;
  margin-bottom: 12px;
}
.voting-team__status {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 16px; font-weight: 600;
  background: var(--ink); color: var(--paper);
  padding: 8px 18px; border-radius: 999px;
}
.voting-status--done, .voting-team__status:has(:contains("✓")) {
  background: var(--success); color: white;
}
.voting-vs {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 700;
  color: var(--ink-soft);
}
.voting-hint {
  font-size: 16px;
  color: var(--ink-soft);
  font-weight: 500;
  text-align: center;
}

/* ---- شاشة التصويت (الفريق على التلفون) ---- */
.picker-tile--voted {
  background: var(--success-soft) !important;
  border-color: var(--success);
  opacity: 1 !important;
  position: relative;
}
.picker-tile--voted .picker-tile__name {
  color: var(--success);
}
.picker-tile__check {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--success); color: white;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 14px;
}

/* ---- شبكة الصعوبة ---- */
.diff-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.diff-tile {
  border: none;
  border-radius: var(--radius);
  padding: 24px 30px;
  cursor: pointer;
  font-family: var(--font-display);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--ink);
  color: var(--accent-2);
  transition: transform .15s;
  min-height: 80px;
}
.diff-tile:active { transform: scale(.97); }
.diff-tile__num { font-size: 38px; font-weight: 700; line-height: 1; }
.diff-tile__lbl { font-size: 14px; font-weight: 600; opacity: .7; }
.diff-tile--p200 { background: linear-gradient(135deg, #16B364, #129F58); color: white; }
.diff-tile--p400 { background: linear-gradient(135deg, #4DA3D9, #2E7BAE); color: white; }
.diff-tile--p600 { background: linear-gradient(135deg, #F5A524, #E0901B); color: white; }
.diff-tile--p800 { background: linear-gradient(135deg, #FF4D2E, #E03D1E); color: white; }
.diff-tile--p1000 { background: linear-gradient(135deg, #8B2BE5, #6B1EBE); color: white; }
.diff-tile--p1200 { background: linear-gradient(135deg, #1A1A2E, #000); color: white; }
.diff-tile--p200 .diff-tile__lbl,
.diff-tile--p400 .diff-tile__lbl,
.diff-tile--p600 .diff-tile__lbl,
.diff-tile--p800 .diff-tile__lbl,
.diff-tile--p1000 .diff-tile__lbl,
.diff-tile--p1200 .diff-tile__lbl { opacity: .85; }
.diff-tile--used {
  background: var(--paper-2) !important;
  color: var(--ink-soft) !important;
  opacity: .5;
  cursor: not-allowed;
}

/* ---- نتيجة اللاعب ---- */
.presult {
  margin: auto;
  text-align: center;
  max-width: 360px;
  padding: 40px 24px;
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  width: 100%;
  animation: revealPop .6s cubic-bezier(.34,1.56,.64,1);
}
.presult.result-box--correct { background: var(--success-soft); }
.presult.result-box--wrong   { background: var(--danger-soft); }
.presult__icon {
  width: 80px; height: 80px; border-radius: 50%;
  margin: 0 auto 20px;
  display: grid; place-items: center;
  font-size: 44px; font-weight: 700;
  color: white;
  background: var(--ink-soft);
}
.presult.result-box--correct .presult__icon { background: var(--success); }
.presult.result-box--wrong .presult__icon   { background: var(--danger); }
.presult__verdict {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 700;
  margin: 0 0 8px;
}
.presult__points {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px; margin: 0;
  color: var(--ink-soft);
}

/* =========== تجاوب =========== */
@media (max-width: 1100px) {
  .landing { grid-template-columns: 1fr; padding: 50px 24px; gap: 40px; }
  .lobby-wrap { grid-template-columns: 1fr; padding: 30px 24px; gap: 30px; }
  .topbar, .footer { padding: 18px 22px; }
  .host-top, .board-top, .question-top {
    padding: 14px 16px;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
  }
  .host-top__title, .board-title__main { font-size: 14px; }
  .board-title__turn { font-size: 11px; padding: 4px 10px; }
  .team-card { padding: 10px 12px; }
  .team-card__lbl { font-size: 11px; }
  .team-card__score { font-size: 24px; }
  .qcategory { font-size: 14px; }
  .qpoints, .qteam { font-size: 12px; }
  .qpoints span { font-size: 16px; padding: 4px 10px; }
  .board-stage { padding: 24px 16px; }
  .board-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .cat-col { padding: 10px; gap: 6px; }
  .cat-col__emoji { font-size: 24px; margin-bottom: 4px; }
  .cat-col__name { font-size: 12px; }
  .cat-tile { padding: 10px 6px; font-size: 18px; }
  .question-stage { padding: 30px 20px; gap: 30px; }
  .question-text { font-size: 28px; line-height: 1.4; }
  .timer-big, .timer__ring { width: 130px; height: 130px; }
  .timer-big .timer__num { font-size: 50px; }
  .result-wrap { padding: 30px 20px; gap: 20px; }
  .result-box, .correct-answer-box { min-width: 0; width: 100%; padding: 30px 20px; }
  .result-icon { width: 80px; height: 80px; font-size: 50px; }
  .result-verdict { font-size: 32px; }
  .correct-answer-text { font-size: 24px; }
  .final-scores { min-width: 0; width: 100%; }
  .final-row { font-size: 18px; padding: 14px 20px; }
}

@media (max-width: 600px) {
  .pscreen { padding: 18px; }
  .pjoin__title { font-size: 36px; }
  .picker-grid { grid-template-columns: 1fr 1fr; }
  .picker-tile { min-height: 110px; }
  .picker-tile__emoji { font-size: 32px; }
  .picker-tile__name { font-size: 14px; }
}
