/* ============ الأساس ============ */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --paper: #f4f7f6;
  --surface: #ffffff;
  --ink: #0f2130;
  --ink-2: #485c6b;
  --ink-3: #7d8f9c;
  --line: #e2e9e7;
  --accent: #0d7a6f;
  --accent-dark: #0a6157;
  --accent-soft: #e2f3f0;
  --amber: #b87814;
  --amber-soft: #fdf2e2;
  --danger: #bf3f3d;
  --danger-soft: #fdecea;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15, 33, 48, .05), 0 14px 30px -20px rgba(15, 33, 48, .45);
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Tajawal', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(900px 420px at 88% -8%, rgba(13, 122, 111, .13), transparent 68%),
    radial-gradient(700px 380px at 6% 2%, rgba(184, 120, 20, .10), transparent 68%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
p { margin: 0; }
button, input, select { font: inherit; }
button { -webkit-user-select: none; user-select: none; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }

:focus-visible {
  outline: 3px solid rgba(13, 122, 111, .45);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: 940px;
  margin-inline: auto;
  padding-inline: 16px;
}

/* ============ الشريط العلوي ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 247, 246, .88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-block: 10px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: linear-gradient(150deg, #123b46, #0d7a6f);
  font-size: 20px;
  box-shadow: 0 8px 18px -12px rgba(13, 122, 111, .9);
}

.brand-txt { min-width: 0; }
.brand-title { font-size: 17px; font-weight: 800; letter-spacing: 0; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.progress-chip {
  display: flex; align-items: center; gap: 7px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--ink-2);
  flex: 0 0 auto;
}
.pc-label { color: var(--ink-3); }
.mini-bar { width: 46px; height: 6px; border-radius: 99px; background: #e8eeec; overflow: hidden; display: block; }
.mini-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .35s ease; }
.progress-chip strong { font-size: 12px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ============ التبويبات ============ */
.tabs-wrap { border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .55); }

.tabs {
  display: flex;
  gap: 8px;
  padding-block: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .12s ease;
}
.tab:hover { border-color: #c6d8d4; color: var(--ink); }
.tab:active { transform: scale(.97); }
.tab.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ============ الأقسام ============ */
.main { padding-block: 16px 8px; }
.view { animation: fadeUp .28s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.sec-head { margin: 18px 0 12px; }
.sec-title { font-size: 22px; font-weight: 800; }
.sec-sub { font-size: 13.5px; color: var(--ink-3); margin-top: 3px; }

/* ============ البطل ============ */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 24px 20px;
  margin-top: 16px;
  color: #dff0ed;
  background: linear-gradient(150deg, #0f2a3a, #123b46 55%, #0d524a);
  box-shadow: 0 22px 44px -30px rgba(15, 42, 58, .95);
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(120% 95% at 85% 0%, #000, transparent 72%);
  mask-image: radial-gradient(120% 95% at 85% 0%, #000, transparent 72%);
}
.hero-eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #a7e0d7;
  background: rgba(167, 224, 215, .14);
  border: 1px solid rgba(167, 224, 215, .25);
  border-radius: 999px;
  padding: 4px 11px;
  margin-bottom: 12px;
  position: relative;
}
.hero-title {
  font-size: clamp(24px, 6.4vw, 34px);
  font-weight: 800;
  color: #ffffff;
  position: relative;
}
.hero-text {
  margin-top: 8px;
  font-size: 14.5px;
  color: rgba(223, 240, 237, .82);
  max-width: 46ch;
  position: relative;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; position: relative; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 20px;
  position: relative;
}
.hero-stats > div {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  padding: 9px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.hero-stats strong { font-size: 18px; color: #fff; font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: 10.5px; line-height: 1.3; color: rgba(223, 240, 237, .72); }

/* ============ أزرار ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  -webkit-user-select: none; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 12px 22px -16px rgba(13, 122, 111, 1); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: rgba(255, 255, 255, .13); color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn-ghost:hover { background: rgba(255, 255, 255, .22); }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { background: #f7faf9; border-color: #c6d8d4; }
.btn-outline.danger { color: var(--danger); border-color: #f0d3d2; }
.btn-outline.danger:hover { background: var(--danger-soft); }

.icon-btn {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .16s ease, transform .12s ease, color .16s ease;
  -webkit-user-select: none; user-select: none;
}
.icon-btn:hover { background: #f7faf9; color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.danger { color: var(--danger); }

/* ============ البطاقات ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-top: 14px;
}
.card-title { font-size: 16px; font-weight: 800; margin-bottom: 10px; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.nav-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: start;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-card:hover { transform: translateY(-2px); border-color: #c6d8d4; }
.nav-card:active { transform: translateY(0) scale(.99); }
.nav-card-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  font-size: 21px;
  margin-bottom: 6px;
}
.nav-card h3 { font-size: 15.5px; font-weight: 800; }
.nav-card p { font-size: 13px; color: var(--ink-3); }

.tip-card { display: flex; gap: 12px; align-items: flex-start; background: var(--amber-soft); border-color: #f2e0c4; }
.tip-card p { font-size: 13.5px; color: #6b4a0f; }
.tip-badge { font-size: 20px; flex: 0 0 auto; line-height: 1.4; }

.cycle-card { margin-top: 14px; }
.cycle {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-wrap: wrap;
}
.cycle-step {
  flex: 1 1 92px;
  background: #f6faf9;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cycle-step span {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.cycle-step b { font-size: 13.5px; }
.cycle-step small { font-size: 10.5px; color: var(--ink-3); line-height: 1.3; }
.cycle-arrow {
  align-self: center;
  width: 0; height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 7px solid #c3d3d0;
  flex: 0 0 auto;
}

/* ============ الأكورديون ============ */
.acc-list { display: flex; flex-direction: column; gap: 10px; }

.acc-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.acc-item.read { border-color: #cbe5e0; }

.acc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  background: none;
  border: 0;
  color: inherit;
  text-align: start;
  cursor: pointer;
}
.acc-emoji {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  font-size: 21px;
}
.acc-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acc-name { font-size: 15.5px; font-weight: 800; }
.acc-en { font-size: 11.5px; color: var(--ink-3); }
.acc-chev { color: var(--ink-3); flex: 0 0 auto; transition: transform .25s ease; }
.acc-item.open .acc-chev { transform: rotate(180deg); }

.acc-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.acc-body > div { overflow: hidden; }
.acc-item.open .acc-body { grid-template-rows: 1fr; }
.acc-inner { padding: 0 14px 14px; }
.acc-role { font-size: 14px; color: var(--ink-2); }
.acc-tip {
  margin-top: 10px;
  background: var(--amber-soft);
  border-radius: 12px;
  padding: 9px 11px;
  font-size: 13px;
  color: #6b4a0f;
  display: flex;
  gap: 7px;
  align-items: flex-start;
}

/* ============ المقارنة ============ */
.compare { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.compare-col { background: #f7faf9; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.compare-col h4 { font-size: 14px; font-weight: 800; color: var(--accent-dark); margin-bottom: 6px; }
.compare-col ul { margin: 0; padding-inline-start: 18px; font-size: 13px; color: var(--ink-2); }
.compare-col li { margin-bottom: 3px; }

/* ============ خطوات التجميع ============ */
.build-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 13px;
  font-size: 12.5px;
  color: var(--ink-3);
  box-shadow: var(--shadow);
}
.bp-label { white-space: nowrap; }
.bp-bar { flex: 1; height: 8px; border-radius: 99px; background: #e8eeec; overflow: hidden; }
.bp-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.build-progress strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.step-list { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }

.step-item {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background .2s ease, border-color .2s ease, transform .12s ease;
}
.step-item:active { transform: scale(.995); }
.step-item.done { background: #f2f8f6; border-color: #cbe5e0; }

.step-num {
  width: 30px; height: 30px; flex: 0 0 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}
.step-item.done .step-num { background: var(--accent); color: #fff; }

.step-body { flex: 1; min-width: 0; }
.step-title { font-size: 14.5px; font-weight: 800; }
.step-text { font-size: 12.8px; color: var(--ink-3); margin-top: 2px; }
.step-item.done .step-title { color: var(--ink-3); text-decoration: line-through; }

.step-check {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 800;
  font-size: 15px;
  opacity: 0;
  transition: opacity .2s ease;
}
.step-item.done .step-check { opacity: 1; }
.step-list.static .step-item { cursor: default; }
.step-list.static .step-item:active { transform: none; }

.cta-card { text-align: center; background: linear-gradient(160deg, #ffffff, #f3faf8); }
.cta-card h3 { font-size: 17px; font-weight: 800; }
.cta-card p { font-size: 13.5px; color: var(--ink-3); margin: 4px 0 14px; }

/* ============ التخزين ============ */
.unit-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.unit-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f7faf9;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13.5px;
}
.unit-list li span { color: var(--ink-2); }
.unit-list li strong { color: var(--accent-dark); font-variant-numeric: tabular-nums; }

.conv-form { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }

.field {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  transition: border-color .16s ease;
}
.field:focus { border-color: var(--accent); outline: none; }
.field.narrow { max-width: 100px; }

.conv-results { display: flex; flex-direction: column; gap: 6px; }
.conv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: #f7faf9;
  font-size: 13.5px;
}
.conv-item.is-src { background: var(--accent-soft); }
.ci-label { color: var(--ink-2); }
.ci-val { color: var(--ink); font-variant-numeric: tabular-nums; }

.storage-type {
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.storage-type b { display: block; font-size: 14px; margin-bottom: 2px; }
.storage-type span { font-size: 12.5px; color: var(--ink-3); }
.storage-type em { font-style: normal; font-size: 18px; display: block; margin-bottom: 4px; }

/* ============ مخطط الفيديو ============ */
.plan-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.plan-form .field { flex: 1 1 160px; }

.plan-list { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }

.plan-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 11px;
}
.plan-idx {
  width: 26px; height: 26px; flex: 0 0 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}
.plan-info { flex: 1; min-width: 0; }
.plan-title { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-dur { font-size: 11.5px; color: var(--ink-3); }
.plan-tools { display: flex; gap: 5px; flex: 0 0 auto; }
.plan-tools .icon-btn { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; font-size: 13px; }

.plan-total {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--ink-3);
}
.plan-total strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ============ الألعاب ============ */
.game-tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.game-tile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.game-badge {
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 3px 9px;
}
.game-best { font-size: 11.5px; color: var(--ink-3); }
.game-best strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.game-tile h3 { font-size: 17px; font-weight: 800; margin-top: 2px; }
.game-tile p { font-size: 13px; color: var(--ink-3); margin-bottom: 10px; }
.game-tile .btn { align-self: flex-start; }

.leader-card { margin-top: 14px; }
.leader-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.leader-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: #f7faf9;
  font-size: 13.5px;
}
.leader-list li.is-you { background: var(--accent-soft); font-weight: 700; }
.lb-rank { min-width: 32px; font-weight: 800; color: var(--ink-3); }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-variant-numeric: tabular-nums; }
#leaderBody .btn { margin-top: 10px; }

/* ============ شاشة اللعب ============ */
.game-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 15px;
  box-shadow: var(--shadow);
  margin-top: 14px;
}
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.game-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; min-width: 0; }
.gm-pill {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.gm-pill.hearts { background: var(--danger-soft); color: var(--danger); letter-spacing: 2px; }
.game-score { display: flex; flex-direction: column; align-items: center; line-height: 1.15; flex: 0 0 auto; }
.game-score span { font-size: 10.5px; color: var(--ink-3); }
.game-score strong { font-size: 19px; font-variant-numeric: tabular-nums; }

.timer-row { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.timerbar { flex: 1; height: 9px; border-radius: 99px; background: #e9efed; overflow: hidden; }
.timerbar > span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #14a795, #0d7a6f);
}
.timerbar > span.low { background: linear-gradient(90deg, #e0693c, #bf3f3d); }
.timer-num {
  min-width: 28px;
  text-align: center;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.quiz-q { font-size: 18px; font-weight: 700; line-height: 1.55; margin: 4px 0 14px; min-height: 3.1em; }
.quiz-options { display: grid; gap: 9px; }

.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .12s ease, opacity .2s ease;
}
.opt:hover { border-color: #b9d6d1; background: #fbfdfc; }
.opt:active { transform: scale(.995); }
.opt-letter {
  width: 26px; height: 26px; flex: 0 0 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: #f0f5f4;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 800;
}
.opt-text { flex: 1; min-width: 0; }
.opt.is-correct { border-color: var(--accent); background: var(--accent-soft); color: #0a5a52; }
.opt.is-correct .opt-letter { background: var(--accent); color: #fff; }
.opt.is-wrong { border-color: var(--danger); background: var(--danger-soft); color: #8e2f2d; }
.opt.is-wrong .opt-letter { background: var(--danger); color: #fff; }
.opt.is-dim { opacity: .5; }
.opt:disabled { cursor: default; }

.quiz-feedback {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  background: #f2f6f5;
  color: var(--ink-2);
  animation: pop .25s ease both;
}
.quiz-feedback strong { font-size: 14.5px; }
.quiz-feedback.ok { background: var(--accent-soft); color: #0a5a52; }
.quiz-feedback.bad { background: var(--danger-soft); color: #8e2f2d; }

@keyframes pop {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.game-hint { font-size: 13px; color: var(--ink-3); margin-bottom: 10px; }

.slots { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.slot {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 8px 12px;
  border: 1.5px dashed #cddad7;
  border-radius: 14px;
  background: #fafcfb;
  color: var(--ink-3);
  font-size: 13.5px;
  transition: background .2s ease, border-color .2s ease;
}
.slot.filled { border-style: solid; border-color: #b6e0d9; background: #eef8f6; color: var(--ink); font-weight: 700; }
.slot-num {
  width: 26px; height: 26px; flex: 0 0 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #e8efee;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 800;
}
.slot.filled .slot-num { background: var(--accent); color: #fff; }

.chips { display: grid; gap: 8px; }
.chip {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .12s ease, opacity .2s ease;
}
.chip:hover { border-color: #b9d6d1; background: #fbfdfc; }
.chip:active { transform: scale(.995); }
.chip.placed { opacity: .3; pointer-events: none; border-style: dashed; }
.chip.shake { animation: shake .4s ease; border-color: var(--danger); background: var(--danger-soft); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ============ نتيجة اللعبة ============ */
.result-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-top: 14px;
  animation: pop .3s ease both;
}
.result-emoji { font-size: 38px; margin-bottom: 4px; }
.result-card h2 { font-size: 21px; font-weight: 800; margin-bottom: 16px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.result-stats > div {
  background: #f5f9f8;
  border-radius: 14px;
  padding: 10px 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.result-stats strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.result-stats span { font-size: 10.5px; color: var(--ink-3); line-height: 1.3; }
.result-actions { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* ============ التذييل والتوست ============ */
.site-footer {
  padding: 26px 16px 34px;
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
}
.site-footer p + p { margin-top: 2px; }

.toast {
  position: fixed;
  inset-inline: 0;
  bottom: 20px;
  margin-inline: auto;
  width: max-content;
  max-width: calc(100vw - 32px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  z-index: 90;
  box-shadow: 0 18px 34px -20px rgba(15, 33, 48, .95);
  animation: pop .22s ease both;
}

/* ============ بطاقة التلميذ ============ */
.profile-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  padding-inline-start: 19px;
  background: #ffffff;
  border: 1px solid #cfe7e2;
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s ease, border-color .18s ease;
}
.profile-card:active { transform: scale(.995); }
.profile-card::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 5px;
  background: linear-gradient(180deg, #14a795, #0d7a6f);
}
.profile-avatar {
  width: 52px; height: 52px; flex: 0 0 52px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(150deg, #123b46, #0d7a6f);
  color: #fff;
  font-size: 21px;
  font-weight: 800;
  box-shadow: 0 10px 20px -14px rgba(13, 122, 111, .95);
}
.profile-info { flex: 1; min-width: 0; }
.profile-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.4;
}
.profile-name {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-name.is-empty {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink-3);
}
.profile-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.p-chip {
  font-size: 11.5px;
  color: var(--ink-2);
  background: #f2f8f6;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.p-chip.is-hint { background: var(--amber-soft); border-color: #f2e0c4; color: #6b4a0f; }
.profile-edit { flex: 0 0 auto; }

.edit-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-top: 12px;
  animation: pop .22s ease both;
}
.edit-grid { display: grid; gap: 0 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  margin: 10px 0 5px;
}
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ============ الشاشات الصغيرة ============ */
@media (max-width: 430px) {
  .hero { padding: 20px 16px; }
  .hero-stats strong { font-size: 16px; }
  .hero-stats span { font-size: 10px; }
  .pc-label { display: none; }
  .mini-bar { width: 36px; }
  .conv-form { grid-template-columns: 1fr 1fr; }
  .quiz-q { font-size: 17px; }
  .result-stats strong { font-size: 16px; }
  .brand-title { font-size: 16px; }
  .profile-name { font-size: 17px; }
  .profile-avatar { width: 46px; height: 46px; flex: 0 0 46px; font-size: 18px; }
  .p-chip { font-size: 11px; }
}

@media (max-width: 340px) {
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .cycle-arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}