/* ── حروف وكنوز · design tokens ── */
:root {
  --bg:          #0b0f19;
  --bg-2:        #101728;
  --bg-3:        #16203a;
  --panel:       rgba(255, 255, 255, .045);
  --panel-hi:    rgba(255, 255, 255, .08);
  --border:      rgba(217, 180, 94, .20);
  --border-soft: rgba(255, 255, 255, .09);

  --text:        #f6f1e6;
  --text-muted:  #9ba4b6;
  --text-dim:    #6d778c;

  --gold:        #d9b45e;
  --gold-2:      #e8c878;
  --gold-deep:   #8d6a17;
  --gold-grad:   linear-gradient(135deg, #e8c878 0%, #d9b45e 45%, #b8933c 100%);

  --emerald:     #17b48b;
  --emerald-dim: rgba(23, 180, 139, .16);
  --danger:      #f2705f;
  --danger-dim:  rgba(242, 112, 95, .15);

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;
  --shadow:    0 6px 28px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 56px rgba(0, 0, 0, .55);

  --font-display: 'Reem Kufi', 'Cairo', system-ui, sans-serif;
  --font-ui:      'Cairo', 'Noto Sans Arabic', system-ui, sans-serif;
  --font-word:    'Noto Naskh Arabic', 'Cairo', serif;

  --icon-sm: 16px;
  --icon-md: 20px;
  --icon-lg: 24px;

  color-scheme: dark;
  font-family: var(--font-ui);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

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

html { scroll-behavior: smooth; }

body {
  min-height: 100dvh;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden { display: none !important; }
/* ── Background layers ── */
.bg-pattern {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .13;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23d9b45e' stroke-width='1.1'%3E%3Crect x='22' y='22' width='44' height='44'/%3E%3Crect x='22' y='22' width='44' height='44' transform='rotate(45 44 44)'/%3E%3Ccircle cx='44' cy='44' r='5.5'/%3E%3Cpath d='M44 0v22M44 66v22M0 44h22M66 44h22'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 88px 88px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
}
.bg-glow {
  position: fixed; inset: -30% -15% auto -15%; height: 68vh; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 55% 60% at 50% 8%, rgba(217, 180, 94, .22), transparent 62%),
    radial-gradient(ellipse 45% 50% at 82% 20%, rgba(23, 180, 139, .14), transparent 65%),
    radial-gradient(ellipse 45% 50% at 15% 25%, rgba(120, 90, 200, .12), transparent 65%);
}
.bg-arch {
  position: fixed; left: 50%; top: 0; width: min(920px, 130vw); height: 320px; z-index: 0;
  transform: translateX(-50%); pointer-events: none; opacity: .5;
  border-bottom: 1px solid rgba(217, 180, 94, .16);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  box-shadow: inset 0 -60px 90px -60px rgba(217, 180, 94, .35);
}

.skip-link {
  position: absolute; right: 1rem; top: -60px; z-index: 200;
  background: var(--gold); color: #131313; padding: .5rem 1rem;
  border-radius: var(--r-sm); font-weight: 700; text-decoration: none;
  transition: top .2s ease;
}
.skip-link:focus { top: .75rem; }

/* ── Navbar ── */
.navbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 clamp(1rem, 4vw, 2.25rem); height: 66px;
  background: rgba(11, 15, 25, .78);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-soft);
}
.nav-brand {
  display: flex; align-items: center; gap: .6rem;
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  color: var(--text); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.nav-brand:hover .star-mark { transform: rotate(45deg) scale(1.08); }
.star-mark {
  width: 22px; height: 22px; display: inline-block; flex: none;
  background: var(--gold-grad);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  transition: transform .35s cubic-bezier(.16, 1, .3, 1);
}
.nav-links { display: flex; align-items: center; gap: .35rem; }
.nav-link {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .85rem; border-radius: 999px; border: 1px solid transparent;
  background: none; color: var(--text-muted); font-family: var(--font-ui);
  font-size: .92rem; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: color .2s, background .2s, border-color .2s, transform .15s;
}
.nav-link:hover { color: var(--text); background: var(--panel-hi); }
.nav-link.active { color: var(--gold-2); border-color: var(--border); background: rgba(217, 180, 94, .09); }
.nav-link:active { transform: scale(.97); }
.nav-cta {
  background: var(--gold-grad); color: #14100a; font-weight: 700;
  border: none; padding: .55rem 1.1rem; box-shadow: 0 6px 22px rgba(217, 180, 94, .25);
}
.nav-cta:hover { color: #14100a; transform: translateY(-1px); box-shadow: 0 10px 30px rgba(217, 180, 94, .4); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 999px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border-soft); color: var(--text-muted);
  transition: color .2s, background .2s, transform .15s;
}
.icon-btn:hover { color: var(--gold-2); background: var(--panel-hi); transform: translateY(-1px); }

/* ── Layout ── */
.view { position: relative; z-index: 1; outline: none; }
.section { max-width: 1120px; margin: 0 auto; padding: clamp(2rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2rem); }
.section-title { font-family: var(--font-display); font-size: clamp(1.5rem, 3.6vw, 2.1rem); font-weight: 700; line-height: 1.3; }
.section-sub { color: var(--text-muted); margin-top: .5rem; max-width: 62ch; }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }

/* ── Card ── */
.card {
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow); padding: 1.5rem;
  transition: transform .25s cubic-bezier(.16, 1, .3, 1), box-shadow .25s, border-color .25s;
}
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .7rem 1.5rem; border-radius: 999px;
  font-family: var(--font-ui); font-size: .96rem; font-weight: 700;
  cursor: pointer; border: none; text-decoration: none; white-space: nowrap;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s, background .2s, color .2s;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--gold-grad); color: #14100a; box-shadow: 0 8px 26px rgba(217, 180, 94, .28); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 38px rgba(217, 180, 94, .42); }
.btn-ghost { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-hi); transform: translateY(-2px); }
.btn-soft { background: var(--panel); border: 1px solid var(--border-soft); color: var(--text); }
.btn-soft:hover:not(:disabled) { background: var(--panel-hi); transform: translateY(-2px); color: var(--gold-2); }
.btn-emerald { background: linear-gradient(135deg, #22c9a0, #12a37c); color: #04160f; box-shadow: 0 8px 26px rgba(23, 180, 139, .28); }
.btn-emerald:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 38px rgba(23, 180, 139, .4); }
.btn-sm { min-height: 40px; padding: .5rem 1rem; font-size: .88rem; }
.btn:focus-visible, .nav-link:focus-visible, .icon-btn:focus-visible, .tile:focus-visible,
.level-card:focus-visible, .slot:focus-visible {
  outline: 2px solid var(--gold-2); outline-offset: 3px;
}

/* ── Chips ── */
.chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem;
  border-radius: 999px; font-size: .8rem; font-weight: 700;
  background: rgba(217, 180, 94, .12); color: var(--gold-2); border: 1px solid var(--border);
}
.chip.emerald { background: var(--emerald-dim); color: #47dcb4; border-color: rgba(23, 180, 139, .3); }
.chip.plain { background: var(--panel); color: var(--text-muted); border-color: var(--border-soft); }
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ── Hero ── */
.hero { position: relative; text-align: center; padding: clamp(2.5rem, 7vw, 5rem) 1rem clamp(1.5rem, 4vw, 2.5rem); }
.hero-badge {
  display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .95rem;
  border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .04em;
  color: var(--gold-2); background: rgba(217, 180, 94, .1); border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.hero h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.4rem, 8vw, 4.2rem); line-height: 1.15; letter-spacing: -.01em;
  background: linear-gradient(180deg, #fffaf0 10%, var(--gold-2) 55%, #b8933c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 20px 60px rgba(217, 180, 94, .18);
}
.hero-lead { color: var(--text-muted); font-size: clamp(1rem, 2.4vw, 1.15rem); max-width: 58ch; margin: 1rem auto 0; }
.hero-actions { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; margin-top: 1.9rem; }
.hero-stats { display: flex; justify-content: center; gap: clamp(1rem, 5vw, 3.25rem); flex-wrap: wrap; margin-top: 2.4rem; }
.stat { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.stat b { font-family: var(--font-display); font-size: clamp(1.4rem, 4vw, 2rem); color: var(--gold-2); }
.stat span { font-size: .8rem; color: var(--text-dim); letter-spacing: .04em; }

/* ── Resume strip ── */
.resume {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; justify-content: space-between;
  border-color: var(--border); background: linear-gradient(120deg, rgba(217, 180, 94, .1), rgba(255, 255, 255, .03) 55%);
}
.resume-main { display: flex; align-items: center; gap: 1rem; }
.resume-ring {
  width: 58px; height: 58px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-display); font-size: 1.3rem;
  color: var(--gold-2); background: rgba(217, 180, 94, .1); border: 1.5px dashed var(--border);
}

/* ── Level grid ── */
.levels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
.level-card {
  position: relative; text-align: right; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--r);
  padding: 1.1rem 1.15rem; color: var(--text); font-family: var(--font-ui);
  transition: transform .25s cubic-bezier(.16, 1, .3, 1), box-shadow .25s, border-color .25s, background .25s;
}
.level-card:hover:not(.locked) { transform: translateY(-4px); border-color: var(--border); box-shadow: var(--shadow-lg); background: var(--panel-hi); }
.level-card.locked { cursor: not-allowed; opacity: .55; }
.level-card.current { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 14px 40px rgba(217, 180, 94, .18); }
.level-card.done { background: linear-gradient(140deg, rgba(23, 180, 139, .12), var(--panel) 60%); border-color: rgba(23, 180, 139, .3); }
.level-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.level-no {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(217, 180, 94, .12); color: var(--gold-2); border: 1px solid var(--border);
}
.level-card.done .level-no { background: var(--emerald-dim); color: #47dcb4; border-color: rgba(23, 180, 139, .3); }
.level-name { font-weight: 700; font-size: 1rem; margin-bottom: .2rem; }
.level-meta { font-size: .78rem; color: var(--text-dim); }
.level-stars { display: flex; gap: .15rem; }
.progress { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; margin-top: .8rem; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--gold-grad); transition: width .5s cubic-bezier(.16, 1, .3, 1); }
.level-card.done .progress > i { background: linear-gradient(135deg, #47dcb4, #12a37c); }

/* ── Game board ── */
.game-shell { max-width: 1120px; margin: 0 auto; padding: clamp(1rem, 3vw, 1.75rem) clamp(.85rem, 4vw, 2rem) 3rem; }
.game-bar {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
  padding: .85rem 1.1rem; border-radius: var(--r-lg); margin-bottom: 1.1rem;
  background: var(--panel); border: 1px solid var(--border-soft);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.game-bar-group { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.game-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; }
.meter { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 700; color: var(--text-muted); }
.meter b { color: var(--gold-2); font-size: 1rem; }
.meter.emerald b { color: #47dcb4; }

.board { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .95fr); gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .board { grid-template-columns: 1fr; } }

.stage {
  display: flex; flex-direction: column; align-items: center; gap: 1.15rem;
  padding: clamp(1.25rem, 4vw, 2rem) 1rem;
  background: radial-gradient(ellipse 80% 70% at 50% 0%, rgba(217, 180, 94, .09), transparent 70%), var(--panel);
  border: 1px solid var(--border-soft); border-radius: var(--r-lg); box-shadow: var(--shadow);
}

/* the built word */
.word-display {
  position: relative; width: 100%; min-height: 92px;
  display: flex; align-items: center; justify-content: center; padding: .35rem 1rem;
  border-radius: var(--r); border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(217, 180, 94, .08), rgba(255, 255, 255, .02));
}
.word-display .word {
  font-family: var(--font-word); font-weight: 600;
  font-size: clamp(2rem, 7vw, 3.1rem); line-height: 1.35; color: var(--gold-2);
  text-shadow: 0 6px 30px rgba(217, 180, 94, .32);
  animation: pop .18s ease;
}
.word-display .placeholder { color: var(--text-dim); font-size: .95rem; font-weight: 400; }
.word-display.shake { animation: shake .38s ease; border-color: rgba(242, 112, 95, .55); }
.word-display.accept { animation: accept .45s ease; border-color: rgba(23, 180, 139, .6); }
@keyframes pop { from { transform: scale(.86); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes shake {
  0%, 100% { transform: translateX(0) } 20% { transform: translateX(-9px) }
  40% { transform: translateX(8px) } 60% { transform: translateX(-5px) } 80% { transform: translateX(3px) }
}
@keyframes accept {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(23, 180, 139, .5) }
  60% { transform: scale(1.03); box-shadow: 0 0 0 14px rgba(23, 180, 139, 0) }
  100% { transform: scale(1) }
}

/* ── Letter tiles ── */
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(.4rem, 1.6vw, .7rem); }
.tile {
  position: relative; display: grid; place-items: center;
  width: clamp(52px, 11.5vw, 74px); height: clamp(58px, 12.5vw, 82px);
  border-radius: 16px; cursor: pointer;
  font-family: var(--font-word); font-size: clamp(1.6rem, 5vw, 2.35rem); font-weight: 700;
  color: #fdf7e8; background: linear-gradient(160deg, #262f47 0%, #161d31 70%);
  border: 1px solid rgba(217, 180, 94, .28);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: transform .16s cubic-bezier(.16, 1, .3, 1), box-shadow .2s, opacity .2s, background .2s, border-color .2s;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.tile:hover:not(.used) { transform: translateY(-4px) scale(1.03); border-color: var(--gold); box-shadow: 0 14px 28px rgba(217, 180, 94, .25); }
.tile:active:not(.used) { transform: translateY(-1px) scale(.98); }
.tile.used { opacity: .3; cursor: default; transform: scale(.94); border-color: var(--border-soft); }
.tile .key {
  position: absolute; bottom: 4px; left: 6px; font-family: var(--font-ui);
  font-size: .62rem; color: rgba(255, 255, 255, .35);
}
.tile.just-used { animation: tap .28s ease; }
@keyframes tap { 50% { transform: scale(1.14) } }

/* ── Controls ── */
.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem; }
.controls .btn { min-width: 104px; }

/* ── Words panel ── */
.panel {
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  padding: 1.15rem; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .9rem; }
.panel-head h2 { font-family: var(--font-display); font-size: 1.02rem; font-weight: 700; }
.group { margin-bottom: 1rem; }
.group-label { display: flex; align-items: center; gap: .5rem; font-size: .78rem; color: var(--text-dim); margin-bottom: .5rem; }
.group-label::after { content: ''; flex: 1; height: 1px; background: var(--border-soft); }
.slots { display: flex; flex-wrap: wrap; gap: .4rem; }
.slot {
  font-family: var(--font-word); font-size: .92rem; font-weight: 600;
  padding: .3rem .6rem; border-radius: 8px; min-height: 32px; min-width: 44px;
  display: inline-flex; align-items: center; justify-content: center; letter-spacing: .06em;
  background: rgba(255, 255, 255, .03); border: 1px dashed rgba(255, 255, 255, .16); color: var(--text-dim);
}
.slot.found {
  background: rgba(217, 180, 94, .13); border: 1px solid var(--border); color: var(--gold-2);
  animation: pop .3s ease; letter-spacing: 0;
}
.slot.revealed { background: var(--emerald-dim); border: 1px solid rgba(23, 180, 139, .35); color: #47dcb4; }
.word-row { font-family: var(--font-word); }
.empty-note { color: var(--text-dim); font-size: .85rem; }

/* ── How to play ── */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.step { display: flex; flex-direction: column; gap: .55rem; }
.step-icon {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: rgba(217, 180, 94, .12); border: 1px solid var(--border); color: var(--gold-2);
}
.step h3 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; }
.step p { color: var(--text-muted); font-size: .89rem; }

/* ── Proverb strip ── */
.proverb {
  display: flex; align-items: flex-start; gap: .9rem;
  border-color: var(--border); background: linear-gradient(120deg, rgba(23, 180, 139, .08), rgba(255, 255, 255, .03));
}
.proverb q { font-family: var(--font-word); font-size: 1.08rem; color: var(--gold-2); }

/* ── Leaderboard ── */
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--border-soft); }
table.board-table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 520px; }
.board-table th, .board-table td { padding: .8rem 1rem; text-align: right; border-bottom: 1px solid var(--border-soft); }
.board-table th { font-size: .78rem; color: var(--text-dim); font-weight: 700; background: rgba(255, 255, 255, .03); }
.board-table tr:last-child td { border-bottom: none; }
.board-table tbody tr { transition: background .2s; }
.board-table tbody tr:hover { background: var(--panel-hi); }
.rank-badge {
  width: 28px; height: 28px; border-radius: 8px; display: inline-grid; place-items: center;
  font-weight: 700; font-size: .82rem; background: var(--panel); border: 1px solid var(--border-soft); color: var(--text-muted);
}
.rank-badge.top { background: var(--gold-grad); color: #14100a; border: none; }
.score-cell { font-family: var(--font-display); color: var(--gold-2); font-weight: 700; }

/* ── Nick form ── */
.nick-row { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; }
input[type="text"] {
  flex: 1; min-width: 180px; padding: .65rem 1rem; background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border-soft); border-radius: var(--r-sm); color: var(--text);
  font-family: var(--font-ui); font-size: .95rem; outline: none; transition: border-color .2s, box-shadow .2s;
}
input[type="text"]:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 180, 94, .18); }
input[type="text"].error { border-color: var(--danger); }

/* ── Toast ── */
.toast-wrap {
  position: fixed; bottom: 1.5rem; left: 1.5rem; z-index: 200;
  display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: .55rem;
  padding: .75rem 1.15rem; border-radius: var(--r); font-size: .9rem; font-weight: 600;
  background: rgba(16, 23, 40, .95); border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-lg); animation: slideIn .28s cubic-bezier(.16, 1, .3, 1);
  backdrop-filter: blur(10px); max-width: 340px;
}
.toast.success { border-color: rgba(23, 180, 139, .45); color: #6ee7c4; }
.toast.error { border-color: rgba(242, 112, 95, .45); color: #ffb3a7; }
.toast.info { border-color: var(--border); color: var(--gold-2); }
.toast.out { animation: slideOut .2s ease forwards; }
@keyframes slideIn { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
@keyframes slideOut { to { opacity: 0; transform: translateX(-16px) } }

/* ── Modal ── */
.overlay {
  position: fixed; inset: 0; z-index: 150; padding: 1rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 7, 14, .72); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  animation: fadeIn .22s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%; max-width: 460px; padding: clamp(1.5rem, 5vw, 2.25rem); text-align: center;
  background: linear-gradient(180deg, #141c2f, #0d1322);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: riseUp .3s cubic-bezier(.16, 1, .3, 1);
}
@keyframes riseUp { from { opacity: 0; transform: translateY(22px) scale(.97) } to { opacity: 1; transform: none } }
.modal-crest {
  width: 66px; height: 66px; margin: 0 auto .9rem; display: grid; place-items: center;
  background: var(--gold-grad); color: #14100a;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.modal h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.modal p.lead { color: var(--text-muted); font-size: .93rem; margin-top: .35rem; }
.modal-stats { display: flex; justify-content: center; gap: 1.75rem; margin: 1.35rem 0 1rem; }
.modal-stats div { display: flex; flex-direction: column; gap: .1rem; }
.modal-stats b { font-family: var(--font-display); font-size: 1.4rem; color: var(--gold-2); }
.modal-stats span { font-size: .76rem; color: var(--text-dim); }
.stars-lg { display: flex; justify-content: center; gap: .35rem; margin-bottom: .35rem; }
.modal-proverb {
  font-family: var(--font-word); font-size: 1rem; color: var(--gold-2);
  padding: .8rem 1rem; border-radius: var(--r); margin: 1rem 0;
  background: rgba(217, 180, 94, .07); border: 1px dashed var(--border);
}
.modal-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: 1.1rem; }
.modal-actions .btn { flex: 1 1 130px; }

/* ── Footer ── */
.footer { position: relative; z-index: 1; border-top: 1px solid var(--border-soft); margin-top: 2rem; }
.footer-inner {
  max-width: 1120px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2rem);
  display: flex; flex-direction: column; gap: .6rem; align-items: center; text-align: center;
}
.footer-mark { display: flex; align-items: center; gap: .55rem; font-family: var(--font-display); }
.footer-mark > span:first-child { width: 16px; height: 16px; }
.footer-dot { color: var(--text-dim); }
.footer-mark span:last-child { color: var(--text-muted); font-size: .88rem; }
.footer-note { color: var(--text-dim); font-size: .82rem; max-width: 60ch; }
.footer-note a { color: var(--gold-2); text-decoration: none; border-bottom: 1px dotted var(--border); }
.footer-note a:hover { color: var(--gold); }

/* ── Entrance animations ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px) } to { opacity: 1; transform: none } }
.fade-up { animation: fadeUp .5s cubic-bezier(.16, 1, .3, 1) both; }
.d1 { animation-delay: .06s } .d2 { animation-delay: .12s }
.d3 { animation-delay: .18s } .d4 { animation-delay: .24s }
.d5 { animation-delay: .3s }  .d6 { animation-delay: .36s }

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, .04) 25%, rgba(255, 255, 255, .09) 50%, rgba(255, 255, 255, .04) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm);
}
@keyframes shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

/* ── Responsive ── */
@media (max-width: 760px) {
  .navbar { height: 60px; padding: 0 .85rem; }
  .nav-link .lbl { display: none; }
  .nav-link { padding: .5rem .6rem; }
  .nav-cta .lbl { display: inline; }
  .nav-brand span.brand-text { font-size: 1rem; }
  .hero-stats { gap: 1.25rem; }
  .toast-wrap { left: .75rem; right: .75rem; bottom: .75rem; }
  .toast { max-width: none; }
  .controls .btn { min-width: 92px; flex: 1 1 92px; }
}
@media (max-width: 420px) {
  .tiles { gap: .35rem; }
  .word-display { min-height: 78px; }
  .modal-stats { gap: 1.15rem; }
}

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

/* ── أيقونات Lucide (تُستبدَل بـ SVG يحمل data-lucide) ── */
svg[data-lucide] {
  width: 1.15em; height: 1.15em; flex: none;
  vertical-align: -.18em; stroke-width: 1.75;
}
.ic-sm { font-size: .82em; }
.btn svg[data-lucide], .chip svg[data-lucide], .nav-link svg[data-lucide] { width: 1.05em; height: 1.05em; }
.icon-btn svg[data-lucide] { width: 20px; height: 20px; }
.hero-badge svg[data-lucide] { width: 15px; height: 15px; }
.step-icon svg[data-lucide] { width: 21px; height: 21px; }
.modal-crest svg[data-lucide] { width: 32px; height: 32px; color: #14100a; }
.toast svg[data-lucide] { width: 18px; height: 18px; }
.stars-lg svg[data-lucide] { width: 28px; height: 28px; }
.stars-lg span { display: inline-flex; }
.level-meta svg[data-lucide] { width: 13px; height: 13px; }
.footer-mark svg[data-lucide] { width: 16px; height: 16px; }
.proverb svg[data-lucide] { width: 28px; height: 28px; color: var(--emerald); flex: none; }
