:root {
  --slate: #313944;
  --red: #B73335;
  --white: #FFFFFF;
  --light: #F4F5F7;
  --border: #D5D9E0;
  --text: #3E4753;
  --text-2: #5A6472;
  --green: #2F7D5B;
  --amber: #E3A93B;
  --radius: 16px;
  --font: "Cairo", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--light);
  color: var(--text);
  font-size: 18px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }

body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
#app { flex: 1; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 640px; margin: 0 auto; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.screen.center { justify-content: center; align-items: center; text-align: center; }

/* Dark screens: idle, get ready */
body.dark { background: var(--slate); color: var(--white); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--red); }
.idle-name { font-size: 26px; font-weight: 700; margin: 16px 0 32px; word-break: break-word; }
.score-label { font-size: 18px; color: #C9CED6; margin: 0; }
.score { font-size: 72px; font-weight: 800; line-height: 1.1; margin: 4px 0 40px; font-variant-numeric: tabular-nums; }
.waiting { font-size: 17px; color: #C9CED6; display: flex; align-items: center; gap: 10px; justify-content: center; }
.waiting .dot { width: 8px; height: 8px; }
.idle-body { margin-block: auto; padding-top: 32px; }
.signout { padding-top: 32px; }
.link-btn { background: none; border: 0; color: inherit; text-decoration: underline; opacity: .75; min-height: 48px; padding: 8px 16px; cursor: pointer; }
/* Released course files on the waiting screen */
.materials { width: 100%; max-width: 420px; margin: 24px auto 0; text-align: right; }
.materials-title { font-weight: 700; color: #C9CED6; margin: 0 0 8px; font-size: 16px; }
.mday { border: 1px solid #56606D; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.mday-name { margin: 0 0 8px; font-weight: 700; }
.mlinks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mbtn { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 12px; background: var(--white); color: var(--slate); font-weight: 700; text-decoration: none; padding: 6px 10px; font-size: 16px; }
.mbtn:active { transform: scale(.99); }
.cert-btn { width: 100%; border: 0; background: var(--red); color: var(--white); font-family: inherit; cursor: pointer; }
.cert-btn:disabled { opacity: .7; }
.contact { width: 100%; max-width: 420px; margin: 16px auto 0; }
.contact-hint { margin: 0 0 6px; color: #C9CED6; font-size: 15px; }
.ready-title { font-size: 22px; color: #C9CED6; margin: 0 0 8px; }
.ready-big { font-size: 48px; font-weight: 800; margin: 0; }

/* Cards and forms */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 16px; }
h1 { font-size: 24px; color: var(--slate); margin: 8px 0 20px; line-height: 1.4; }
label { display: block; font-weight: 700; color: var(--slate); margin: 0 0 6px; }
.field { margin-bottom: 18px; }
input[type=text], textarea, select {
  width: 100%; border: 1px solid var(--border); border-radius: 12px; background: var(--white);
  padding: 12px 14px; min-height: 52px; font-size: 18px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 3px solid rgba(183, 51, 53, .35); outline-offset: 1px; border-color: var(--red); }
.hint { color: var(--text-2); font-size: 15px; margin: 4px 0 0; }
.counter { color: var(--text-2); font-size: 14px; text-align: left; margin-top: 4px; direction: ltr; }
.btn {
  display: block; width: 100%; min-height: 56px; border: 0; border-radius: 12px;
  background: var(--red); color: var(--white); font-size: 20px; font-weight: 700; cursor: pointer; padding: 10px 16px;
}
.btn:disabled { opacity: .55; cursor: default; }
.error { color: var(--red); font-weight: 600; margin: 12px 0 0; }
.error a, .switch a { color: var(--red); font-weight: 700; }
.switch { text-align: center; margin: 20px 0 0; }
.switch a { display: inline-block; min-height: 48px; padding: 10px 8px; }
.privacy { font-size: 15px; color: var(--text-2); margin: 16px 0 0; display: flex; gap: 8px; }
.privacy .dot { flex: none; width: 8px; height: 8px; margin-top: 9px; }

/* Quiz */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--text-2); font-size: 15px; margin-bottom: 10px; }
.chip { flex: none; background: var(--white); border: 1px solid var(--border); border-radius: 999px; padding: 2px 12px; color: var(--slate); font-size: 15px; }
.chip strong { color: var(--red); font-variant-numeric: tabular-nums; }

/* "Powered by" bar at the top of every participant screen */
/* Slate bar: the logo is white on the same slate, so it sits seamlessly. */
.powered { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--slate); padding: 6px 16px; padding-top: calc(6px + env(safe-area-inset-top)); direction: ltr; }
.powered span { font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif; font-size: 12px; color: #C9CED6; letter-spacing: .02em; }
.powered img { height: 56px; width: auto; display: block; }
.powered strong { font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif; font-size: 14px; color: var(--white); }
.timer { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.timer-bar { flex: 1; height: 10px; border-radius: 6px; background: var(--border); overflow: hidden; }
.timer-fill { height: 100%; background: var(--red); width: 100%; transform-origin: right center; }
.timer-num { font-weight: 800; font-size: 26px; color: var(--red); min-width: 2.2em; text-align: center; font-variant-numeric: tabular-nums; }
.question { font-size: 21px; font-weight: 700; color: var(--slate); margin: 0 0 18px; line-height: 1.55; }
.instruction { color: var(--text-2); font-size: 15px; margin: 0 0 8px; }
.options { display: grid; gap: 12px; }
.opt {
  width: 100%; min-height: 64px; text-align: right; background: var(--white); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; font-size: 18px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 12px; line-height: 1.45;
}
.opt .mark { flex: none; margin-inline-start: auto; font-weight: 800; }
.opt:disabled { cursor: default; }
.opt.chosen { border-color: var(--slate); background: var(--slate); color: var(--white); }
.opt.is-correct { border-color: var(--green); background: #E7F2EC; color: #1F5A40; }
.opt.chosen.is-wrong { border-color: var(--red); background: #F8E6E6; color: #7E2224; }
.opt:not(:disabled):active { transform: scale(.99); }
.status { margin: 18px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--white); border: 1px solid var(--border); font-weight: 700; text-align: center; }
.status.ok { border-color: var(--green); color: var(--green); }
.status.bad { border-color: var(--red); color: var(--red); }
.result { text-align: center; }
.result .big { font-size: 30px; font-weight: 800; margin: 8px 0; }
.result.ok .big { color: var(--green); }
.result.bad .big { color: var(--red); }

/* Activity */
.task { white-space: pre-line; font-size: 17px; line-height: 1.75; margin: 0; }
.activity textarea { min-height: 220px; }
.saved { color: var(--green); font-weight: 700; text-align: center; margin: 12px 0 0; }

.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--red); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.net { position: fixed; inset-inline: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 420px;
  background: var(--amber); color: #2B2100; border-radius: 12px; padding: 10px 16px; text-align: center; font-weight: 700; z-index: 10; }

.fade-in { animation: fade .2s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 700px) {
  .screen { padding-top: 48px; }
}
