/* ============================================================
   تحدّي المشي — التنسيق
   الهوية: ملعب نهاري، لون برتقالي مميّز، أخضر للبطل،
   والعنصر المميّز: لوحة ترتيب على شكل مسارات سباق.
   ============================================================ */

:root {
  --bg:          #F2F5F0;
  --surface:     #FFFFFF;
  --ink:         #15201B;
  --muted:       #6B756F;
  --line:        #E3E7E0;
  --orange:      #FF5A1F;
  --orange-soft: #FFE9DF;
  --green:       #0E9F6E;
  --green-soft:  #E0F4EB;
  --lane:        #EBEFE9;
  --gold:        #E8B33D;

  --font: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --num:  "Archivo", system-ui, sans-serif;

  --r:    18px;
  --r-sm: 12px;
  --shadow: 0 1px 2px rgba(21,32,27,.04), 0 8px 24px rgba(21,32,27,.06);
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* خلفية بخطوط مسار خفيفة جداً */
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 119px, rgba(21,32,27,.025) 119px, rgba(21,32,27,.025) 120px);
}

.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 96px; }

/* ---------- العناوين والنصوص ---------- */
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--orange);
}
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.muted { color: var(--muted); font-size: 14px; }

.num { font-family: var(--num); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- الرأس ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--ink); display: grid; place-items: center;
  position: relative; overflow: hidden;
}
.brand .mark::before { content: ""; width: 13px; height: 18px; border-radius: 60% 60% 50% 50%; background: var(--orange); transform: translate(-3px,-2px) rotate(-12deg); position: absolute; }
.brand .mark::after  { content: ""; width: 13px; height: 18px; border-radius: 60% 60% 50% 50%; background: var(--green);  transform: translate(4px,3px) rotate(-12deg); position: absolute; }
.brand b { font-size: 16px; font-weight: 700; }
.brand small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }

.iconbtn {
  border: 1px solid var(--line); background: var(--surface);
  width: 38px; height: 38px; border-radius: 11px; cursor: pointer;
  display: grid; place-items: center; font-size: 17px; color: var(--ink);
}
.iconbtn:hover { background: var(--bg); }

/* ---------- البطاقات ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px; box-shadow: var(--shadow);
  margin-bottom: 16px;
}

/* ---------- بانر بطل الأسبوع الماضي ---------- */
.champion {
  background: linear-gradient(135deg, #11261D, #1C3A2C);
  color: #fff; border: none; position: relative; overflow: hidden;
}
.champion .eyebrow { color: var(--gold); }
.champion .who { font-size: 22px; font-weight: 700; margin: 4px 0 2px; }
.champion .score { font-family: var(--num); font-weight: 800; font-size: 15px; color: #BFE8D4; }
.champion .trophy {
  position: absolute; inset-inline-start: 18px; top: 50%; transform: translateY(-50%);
  font-size: 42px; opacity: .9;
}
.champion .body { padding-inline-start: 64px; }

/* ---------- لوحة المسارات (العنصر المميّز) ---------- */
.lanes { display: flex; flex-direction: column; gap: 10px; }
.lane {
  position: relative; background: var(--lane); border-radius: 14px;
  padding: 12px 14px; overflow: hidden;
  border: 1px solid transparent;
}
.lane .fill {
  position: absolute; inset-block: 0; inset-inline-start: 0;
  background: linear-gradient(90deg, rgba(255,90,31,.16), rgba(255,90,31,.30));
  border-inline-end: 3px solid var(--orange);
  border-radius: 14px 0 0 14px;
  transition: width .9s cubic-bezier(.2,.8,.2,1);
}
.lane.leader { border-color: var(--green); background: var(--green-soft); }
.lane.leader .fill {
  background: linear-gradient(90deg, rgba(14,159,110,.16), rgba(14,159,110,.34));
  border-inline-end-color: var(--green);
}
.lane .content {
  position: relative; display: flex; align-items: center; gap: 12px;
}
.lane .rank {
  font-family: var(--num); font-weight: 800; font-size: 15px;
  color: var(--muted); width: 18px; text-align: center; flex: none;
}
.lane.leader .rank { color: var(--green); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--ink); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
}
.lane.leader .avatar { background: var(--green); }
.lane .name { font-weight: 600; font-size: 15px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane .crown { font-size: 16px; }
.lane .steps { font-family: var(--num); font-weight: 800; font-size: 17px; flex: none; }
.lane .steps small { font-family: var(--font); font-weight: 500; font-size: 11px; color: var(--muted); }

/* ---------- نموذج تسجيل الخطوات ---------- */
.field { margin-bottom: 14px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
input[type="number"], input[type="email"], input[type="password"], input[type="text"] {
  width: 100%; padding: 13px 14px; border: 1px solid var(--line);
  border-radius: var(--r-sm); font-family: var(--font); font-size: 16px;
  background: var(--bg); color: var(--ink); outline: none;
}
input:focus { border-color: var(--orange); background: var(--surface); }
input[type="number"] { font-family: var(--num); font-weight: 700; font-size: 22px; }

.uploader {
  border: 1.5px dashed var(--line); border-radius: var(--r-sm);
  padding: 16px; text-align: center; cursor: pointer; color: var(--muted);
  font-size: 14px; background: var(--bg);
}
.uploader:hover { border-color: var(--orange); color: var(--orange); }
.uploader.has-img { padding: 0; border-style: solid; overflow: hidden; }
.uploader img { width: 100%; max-height: 260px; object-fit: contain; display: block; background: #000; }
input[type="file"] { display: none; }

.btn {
  width: 100%; padding: 14px; border: none; border-radius: var(--r-sm);
  background: var(--orange); color: #fff; font-family: var(--font);
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.btn:hover { filter: brightness(.95); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.dark { background: var(--ink); }

/* ---------- سجل أيامي ---------- */
.days { display: flex; flex-direction: column; gap: 8px; }
.day-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
}
.day-row .thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; flex: none; background: var(--lane); }
.day-row .dlabel { flex: 1; font-size: 14px; font-weight: 600; }
.day-row .dlabel small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.day-row .dsteps { font-family: var(--num); font-weight: 800; font-size: 16px; }

/* ---------- شاشة الدخول ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 380px; margin: 0; }
.auth h1 { margin: 14px 0 4px; }
.auth p { margin-bottom: 22px; }

/* ---------- تنبيهات ---------- */
.toast {
  position: fixed; inset-block-end: 20px; inset-inline: 16px;
  max-width: 528px; margin: 0 auto; background: var(--ink); color: #fff;
  padding: 13px 16px; border-radius: var(--r-sm); font-size: 14px;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(10px);
  transition: .25s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok  { background: var(--green); }
.toast.err { background: #C0392B; }

.notice {
  display: flex; align-items: center; gap: 10px; font-size: 13px;
  background: var(--orange-soft); color: #9A3412; padding: 11px 14px;
  border-radius: var(--r-sm); margin-bottom: 16px; cursor: pointer;
}
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .lane .fill { transition: none; }
  .toast { transition: none; }
}
