/* Fazoura — mobile-first. Every screen assumes a thumb, a phone, and no patience. */

:root {
  --bg: #0e0d12;
  --surface: #191822;
  --surface-2: #232231;
  --line: #302f40;
  --ink: #f5f2ea;
  --ink-dim: #a4a0b5;
  --accent: #ffb443;
  --accent-2: #7c5cff;
  --ok: #3ecf8e;
  --bad: #ff5c5c;
  --r: 18px;
  --pad: 20px;
  --font-en: 'Space Grotesk', system-ui, sans-serif;
  --font-ar: 'Tajawal', system-ui, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-en);
  overscroll-behavior-y: none;
}

body[dir='rtl'] { font-family: var(--font-ar); }

/* A warm glow so the page doesn't read as a flat dark form. */
body::before {
  content: '';
  position: fixed;
  inset: -30% -30% auto -30%;
  height: 60vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 180, 67, .16), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: var(--pad);
  padding-bottom: 120px;
  min-height: 100vh;
}

/* --- header --- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0 22px;
}
.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand span { color: var(--accent); }
.langbtn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.langbtn:active { transform: scale(.96); }

/* --- type --- */
h1 {
  font-size: clamp(30px, 8.5vw, 42px);
  line-height: 1.12;
  letter-spacing: -.03em;
  margin: 0 0 14px;
  font-weight: 700;
}
h2 { font-size: 20px; margin: 0 0 10px; letter-spacing: -.02em; }
.lede { color: var(--ink-dim); font-size: 16px; line-height: 1.6; margin: 0 0 28px; }
.eyebrow {
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
  font-weight: 600;
}
body[dir='rtl'] .eyebrow { letter-spacing: 0; }

/* --- cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 14px;
}

/* --- buttons --- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 17px 20px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #1a1206;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s ease, opacity .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn.violet { background: var(--accent-2); color: #fff; }
.btn.wa { background: #25d366; color: #06301a; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* --- choice grids --- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: border-color .15s, background .15s, transform .1s;
}
.tile:active { transform: scale(.96); }
.tile.sel { border-color: var(--accent); background: rgba(255, 180, 67, .1); }
.tile.right { border-color: var(--ok); background: rgba(62, 207, 142, .14); }
.tile.wrong { border-color: var(--bad); background: rgba(255, 92, 92, .12); opacity: .6; }
.tile .em { display: block; font-size: 26px; margin-bottom: 6px; }
.tile .tx { font-size: 14px; font-weight: 600; }

/* --- inputs --- */
label { display: block; font-size: 14px; color: var(--ink-dim); margin: 0 0 8px; }
input[type='text'], input[type='number'] {
  width: 100%;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
}
textarea {
  width: 100%;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  line-height: 1.6;
  resize: vertical;
  min-height: 120px;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #5d5a70; }

/* --- the riddle itself --- */
.riddle {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 26px 22px;
  font-size: 19px;
  line-height: 1.72;
  white-space: pre-line;
  margin-bottom: 18px;
}
.riddle.pick { cursor: pointer; }
.riddle.pick.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 180, 67, .25); }

/* --- timer --- */
.timer { margin-bottom: 16px; }
.timer .bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}
.timer .fill {
  height: 100%;
  width: 100%;
  background: var(--ok);
  transition: width 1s linear, background .4s;
}
.timer.warn .fill { background: var(--accent); }
.timer.danger .fill { background: var(--bad); }
.timer .num {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-dim);
  margin-bottom: 7px;
}

/* --- misc --- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.chip.sel { border-color: var(--accent); background: rgba(255, 180, 67, .12); color: var(--accent); }

.hint {
  background: rgba(124, 92, 255, .12);
  border: 1px solid rgba(124, 92, 255, .4);
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 15px;
  margin-bottom: 12px;
}

.result-big { font-size: 54px; text-align: center; margin: 10px 0 4px; }
.stat-row { display: flex; gap: 10px; margin: 18px 0; }
.stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
}
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--ink-dim); }

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

.step { animation: rise .35s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 13px 20px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 50;
}

.footnote {
  margin-top: 30px;
  font-size: 12px;
  color: #5d5a70;
  line-height: 1.7;
  text-align: center;
}

/* --- the competition block --- */
.sect {
  margin: 34px 0 14px;
  font-size: 19px;
  letter-spacing: -.02em;
}

.season {
  margin-top: 34px;
  background: linear-gradient(150deg, rgba(255, 180, 67, .16), rgba(124, 92, 255, .12));
  border: 1px solid rgba(255, 180, 67, .35);
  border-radius: var(--r);
  padding: 18px;
}
.season-top { display: flex; align-items: center; gap: 13px; }
.season-top .trophy { font-size: 30px; }
.season-top b { display: block; font-size: 17px; }
.season-top span { font-size: 13px; color: var(--ink-dim); }
.season-live {
  display: flex;
  gap: 18px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 180, 67, .22);
  font-size: 13px;
  color: var(--ink-dim);
  flex-wrap: wrap;
}
.season-live b { color: var(--ink); font-size: 15px; }

/* numbered steps — counter lives in an ::before so RTL flips cleanly */
ol.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
ol.steps li {
  counter-increment: s;
  position: relative;
  padding: 0 54px 20px;
  min-height: 44px;
}
body[dir='ltr'] ol.steps li { padding-left: 54px; padding-right: 0; }
body[dir='rtl'] ol.steps li { padding-right: 54px; padding-left: 0; }
ol.steps li::before {
  content: counter(s);
  position: absolute;
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
body[dir='ltr'] ol.steps li::before { left: 0; }
body[dir='rtl'] ol.steps li::before { right: 0; }
ol.steps li b { display: block; font-size: 16px; margin-bottom: 4px; }
ol.steps li span { color: var(--ink-dim); font-size: 14px; line-height: 1.6; }

table.scoring td:first-child { color: var(--ink-dim); }
table.scoring td:last-child { white-space: nowrap; }
table.scoring td.minus { color: var(--bad); }

.rank { width: 34px; font-weight: 700; color: var(--ink-dim); }
.rank.gold { color: #ffd166; }
.rank.silver { color: #cfd3dc; }
.rank.bronze { color: #d0906a; }

table.board { width: 100%; border-collapse: collapse; font-size: 15px; }
table.board td { padding: 11px 4px; border-bottom: 1px solid var(--line); }
table.board td:last-child { text-align: end; font-weight: 700; color: var(--accent); }
