/* هوية «لماذا؟ لأن» — مأخوذة من مخططات العميل: بازل قرمزي/فيروزي على خلفية ليلكية */

:root {
  --lav: #dcdcf2;          /* خلفية الصفحة */
  --field: #e8e8f8;        /* داخل الحقول والبطاقات */
  --line: #9a9ab4;         /* حدود */
  --ink: #2f3350;          /* النص الأساسي */
  --ink-soft: #5b6080;     /* نص ثانوي */
  --coral: #cf7364;        /* لماذا */
  --coral-dark: #b25a4b;
  --teal: #529c95;         /* لأن */
  --teal-dark: #3d827b;
  --purple: #6b1f9e;       /* شريط المنظم */
  --amber: #ffb300;        /* شريط القرّاء */
  --gray: #7a7a7a;         /* أزرار ثانوية */
  --gray-dark: #656565;
  --crimson: #b01030;      /* عناوين «أكمل» */
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: "Segoe UI", "Noto Kufi Arabic", Tahoma, "Dubai", system-ui, sans-serif;
  background: var(--lav);
  color: var(--ink);
  direction: rtl;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 16px;
  line-height: 1.65;
}

/* ------------------------------- شريط العنوان ------------------------------- */

.topbar {
  background: var(--purple);
  color: #fff;
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  padding: 14px 12px;
  letter-spacing: -0.3px;
}
.topbar.player { background: var(--coral); }
.topbar.reader { background: var(--amber); color: #43310a; }
.topbar.admin { background: #4a4a5e; }

/* --------------------------------- الشعار --------------------------------- */

.hero { position: relative; line-height: 0; }
.hero img { display: block; width: 100%; height: auto; }
.hero b {
  position: absolute;
  transform: translate(50%, -50%);
  color: #fff;
  font-weight: 800;
  font-size: clamp(26px, 8.6vw, 58px);
  line-height: 1;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}
.hero b.why { right: 71.5%; top: 44%; }
.hero b.because { right: 28.3%; top: 68%; }

/* -------------------------------- المحتوى -------------------------------- */

.wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 14px 18px;
  flex: 1;
}

.note { color: var(--ink-soft); font-size: 14px; text-align: center; margin: 4px 0 14px; }

.card {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.card h2 { margin: 0 0 10px; font-size: 17px; display: flex; align-items: center; gap: 8px; }

label { display: block; font-size: 14px; color: var(--ink-soft); margin: 10px 0 6px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="url"], textarea, select {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
}

input:focus, textarea:focus, select:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(207, 115, 100, 0.18); }
input::placeholder, textarea::placeholder { color: #8a8fae; text-align: center; }
textarea { min-height: 110px; resize: vertical; text-align: right; }

/* -------------------------------- الأزرار -------------------------------- */

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--gray);
  color: #fff;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
}
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.why { background: var(--coral); }
.btn.why:hover { background: var(--coral-dark); }
.btn.because { background: var(--teal); }
.btn.because:hover { background: var(--teal-dark); }
.btn.ghost { background: var(--field); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--field); color: #a8443f; border: 1px solid #c98d88; }
.btn.sm { width: auto; padding: 8px 14px; font-size: 14px; margin: 0; border-radius: 12px; }

.row { display: flex; gap: 10px; align-items: center; }
.row .btn { margin-top: 0; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ------------------------------ رمز المشاركين ------------------------------ */

.code-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.code-badge span {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--ink-soft);
  font-size: 15px;
  white-space: nowrap;
}
.code-badge b {
  flex: 1;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  font-size: 26px;
  letter-spacing: 4px;
  direction: ltr;
  color: var(--coral-dark);
}

/* ------------------------------- المشاركون ------------------------------- */

.player-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.player-row .name {
  flex: 1;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-align: center;
  font-weight: 600;
}
.player-row.off .name { opacity: 0.5; text-decoration: line-through; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: #b3b3c6; flex: none; }
.dot.on { background: var(--teal); }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(82, 156, 149, 0.18); color: var(--teal-dark); white-space: nowrap; }
.tag.wait { background: rgba(255, 179, 0, 0.22); color: #8a6100; }

.banner {
  background: var(--gray);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  text-align: center;
  padding: 12px;
  border-radius: var(--radius);
  margin: 12px 0;
}
.banner.done { background: var(--teal); }

/* ------------------------------ كتابة الأسئلة ------------------------------ */

.qblock { margin-bottom: 14px; }
.qsep {
  background: var(--gray);
  color: #fff;
  font-weight: 700;
  padding: 9px 22px;
  border-radius: var(--radius);
  display: inline-block;
  margin: 6px 0 12px;
}
.field-label { color: var(--crimson); font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.field-label i { color: var(--ink-soft); font-style: normal; font-weight: 600; }

/* -------------------------------- اللعب -------------------------------- */

.bubble {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 16px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.9;
  text-align: center;
  margin-bottom: 12px;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bubble.why { border-color: var(--coral); border-width: 2px; }
.bubble.answer { border-color: var(--teal); border-width: 2px; }

.progress { height: 7px; border-radius: 99px; background: #c6c6de; overflow: hidden; margin-bottom: 10px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--coral), var(--teal)); }

.muted { color: var(--ink-soft); font-size: 14px; }
.center { text-align: center; }
.hidden { display: none !important; }

.result-item {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.result-item .q { color: var(--coral-dark); font-weight: 700; }
.result-item .a { color: var(--teal-dark); font-weight: 600; }

/* --------------------------- الإعلان والشريط السفلي --------------------------- */

#adbox { width: 100%; }
#adbox img { display: block; width: 100%; height: auto; }

#footerbar {
  background: var(--gray);
  color: #fff;
  text-align: center;
  padding: 12px 14px;
  font-size: 13px;
}
#footerbar div { line-height: 1.8; }
#footerbar a { color: #ffe9a8; text-decoration: none; word-break: break-all; }

/* -------------------------------- متفرقات -------------------------------- */

.toast {
  position: fixed;
  bottom: 18px;
  right: 50%;
  transform: translateX(50%);
  background: #3a2030;
  color: #fff;
  padding: 11px 18px;
  border-radius: 14px;
  font-size: 14px;
  z-index: 99;
  max-width: 90%;
  text-align: center;
}

.install-hint {
  position: fixed;
  bottom: 12px;
  right: 12px;
  left: 12px;
  background: #fff;
  border: 1px solid var(--coral);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(47, 51, 80, 0.18);
}
.install-hint span { flex: 1; font-size: 14px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink-soft);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tabs button.active { background: var(--coral); color: #fff; border-color: var(--coral); }

.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex: none; }

input[type="checkbox"] {
  width: 26px;
  height: 26px;
  accent-color: var(--teal);
  flex: none;
}
