/* مولَّدٌ من frontend/js/games بـ scripts/build-play-games.js — لا يُحرَّر يدوياً. نسخةُ الزوّار المستقلّة. */
/* رتّل — ألعاب التأسيس: الهيكلُ والتصميمُ المشتركان (rg-*) لكلّ الألعاب.
   يُحمَّل مع أيّ لعبةٍ فقط (frontend/js/games/journey-hook.js)، ولكلّ لعبةٍ ملفُّها: css/games/<id>.css. */
.rg-game {
  --rg-primary: #1F4A44; --rg-deep: #134E4A; --rg-second: #2A9D8F; --rg-soft: #E6F4F1;
  --rg-border: #EEF2F0; --rg-muted: #5E7F79; --rg-faint: #8AA9A2; --rg-teal: #0E9F6E; --rg-lime: #00D68F;
  position: fixed; inset: 0; z-index: 60; overflow: hidden auto;
  display: flex; flex-direction: column; align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
  background: radial-gradient(120% 70% at 15% 5%, #E8F5ED 0%, #F6FFF8 38%, #FFF9E6 92%);
  font-family: 'Tajawal', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--rg-primary); user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}
.rg-game *, .rg-game *::before, .rg-game *::after { box-sizing: border-box; }
.rg-head { display: flex; flex-direction: column; align-items: center; padding: 10px 0 12px; }
.rg-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rg-logo {
  width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--rg-lime), var(--rg-teal)); color: #fff; font-weight: 900; font-size: 14px;
  box-shadow: 0 4px 12px rgba(14, 159, 110, .28);
}
.rg-brand-en { font-size: 11px; font-weight: 700; letter-spacing: .2em; color: var(--rg-muted); }
.rg-title { margin: 0; font-size: clamp(26px, 7vw, 36px); font-weight: 900; line-height: 1; color: var(--rg-deep); }
.rg-sub { margin: 8px 0 0; font-size: 14px; font-weight: 500; color: var(--rg-muted); }
.rg-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 12px; }
.rg-pill {
  height: 36px; padding: 0 14px; border-radius: 999px; display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--rg-border); box-shadow: 0 2px 10px rgba(31, 74, 68, .06);
  font-size: 12px; font-weight: 700;
}
.rg-pill-level { background: var(--rg-primary); border-color: var(--rg-primary); color: #fff; box-shadow: 0 4px 12px rgba(31, 74, 68, .18); }
.rg-pill-num { width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, .15); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
.rg-pill-hearts { gap: 6px; }
.rg-heart path { fill: none; stroke: #D7E6E2; stroke-width: 1.7; transition: fill .2s, stroke .2s; }
.rg-heart-on path { fill: var(--rg-second); stroke: var(--rg-second); }
.rg-pill-label { font-size: 11px; font-weight: 600; color: var(--rg-muted); }
.rg-pill-val { font-size: 14px; font-weight: 800; color: var(--rg-primary); }
.rg-board {
  position: relative; width: 100%; max-width: 420px; flex: 0 0 auto;
  height: clamp(340px, calc(100dvh - 250px), 520px);
  border-radius: 32px; background: #fff; border: 1px solid var(--rg-border); overflow: hidden;
  box-shadow: 0 20px 60px rgba(31, 74, 68, .08), 0 2px 12px rgba(31, 74, 68, .04);
  touch-action: none; cursor: grab;
}
.rg-playing .rg-board { cursor: grabbing; }
.rg-time { position: absolute; top: 0; left: 28px; right: 28px; height: 4px; border-radius: 0 0 4px 4px; overflow: hidden; background: #EEF5F3; z-index: 21; }
.rg-time-fill { height: 100%; width: 100%; background: var(--rg-second); transition: background .3s; }
.rg-time-low .rg-time-fill { background: #E8A13A; }
.rg-chip {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 20; pointer-events: none;
  display: none; align-items: center; gap: 12px; padding: 8px 16px; border-radius: 999px;
  background: #fff; border: 1px solid var(--rg-border); box-shadow: 0 4px 16px rgba(31, 74, 68, .06);
}
.rg-playing .rg-chip { display: flex; }
.rg-chip-text { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.rg-chip-label { font-size: 10px; font-weight: 600; color: var(--rg-muted); }
.rg-chip-count { font-size: 11px; font-weight: 800; color: var(--rg-second); }
.rg-chip-letter { width: 38px; height: 38px; border-radius: 50%; background: var(--rg-soft); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; }
.rg-toast {
  position: absolute; top: 70px; left: 50%; transform: translate(-50%, 6px); z-index: 30; pointer-events: none;
  padding: 6px 16px; border-radius: 999px; font-size: 13px; font-weight: 700; border: 1px solid transparent;
  opacity: 0; transition: opacity .28s, transform .28s; white-space: nowrap;
}
.rg-toast-on { opacity: 1; transform: translate(-50%, 0); }
.rg-toast-good { background: var(--rg-soft); color: var(--rg-primary); border-color: #C5E8E0; }
.rg-toast-try { background: #FFF2E0; color: #8A5A2B; border-color: #FFE2B8; }
.rg-layer { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.rg-drop { position: absolute; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; will-change: top; }
.rg-tile {
  width: 56px; height: 56px; border-radius: 18px; background: #fff; border: 1px solid var(--rg-border);
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; line-height: 1;
  box-shadow: 0 10px 24px rgba(31, 74, 68, .10), 0 1px 0 rgba(255, 255, 255, .9) inset;
}
.rg-string { width: 1.5px; height: 26px; margin-top: 4px; border-radius: 2px; background: linear-gradient(to bottom, #CBD8D5, transparent); }
.rg-pop .rg-tile { animation: rg-pop .45s ease-out forwards; border-color: var(--rg-second); }
.rg-pop .rg-string, .rg-fade .rg-string { opacity: 0; }
.rg-fade { animation: rg-fade .5s ease-out forwards; }
@keyframes rg-pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); background: var(--rg-soft); } 100% { transform: scale(.6); opacity: 0; } }
@keyframes rg-fade { to { opacity: 0; transform: translate(-50%, -8px); } }
.rg-basket { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 20; transition: left .13s ease-out; display: flex; flex-direction: column; align-items: center; }
.rg-basket-drag { transition: none; }
.rg-basket svg { overflow: visible; display: block; }
.rg-basket-shadow { fill: #1F4A44; opacity: .07; }
.rg-basket-body { fill: #fff; stroke: var(--rg-primary); stroke-width: 2; stroke-linejoin: round; }
.rg-basket-weave { fill: none; stroke: var(--rg-primary); stroke-width: .8; opacity: .13; }
.rg-basket-rim { fill: none; stroke: var(--rg-primary); stroke-width: 2.4; stroke-linecap: round; }
.rg-shake { animation: rg-shake .34s ease; }
@keyframes rg-shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.rg-overlay { position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.rg-overlay[hidden] { display: none; }
.rg-intro { background: rgba(255, 255, 255, .55); }
.rg-intro-circle { position: relative; width: 96px; height: 96px; border-radius: 50%; background: var(--rg-soft); border: 1px solid #D9EEE9; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(31, 74, 68, .06); }
.rg-intro-badge { position: absolute; bottom: -4px; right: -4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 1px solid var(--rg-border); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: var(--rg-second); }
.rg-intro-title { margin: 26px 0 0; font-size: 20px; font-weight: 800; }
.rg-intro-text { margin: 8px 0 0; max-width: 260px; font-size: 13px; line-height: 1.8; font-weight: 500; color: var(--rg-muted); }
.rg-btn {
  margin-top: 22px; min-height: 48px; padding: 0 32px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--rg-primary); color: #fff; font: inherit; font-size: 15px; font-weight: 800;
  box-shadow: 0 10px 24px rgba(31, 74, 68, .24); transition: transform .15s;
}
.rg-btn:active { transform: scale(.98); }
.rg-btn:focus-visible { outline: 3px solid var(--rg-lime); outline-offset: 3px; }
.rg-end { background: rgba(255, 255, 255, .93); }
.rg-end-letters { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 14px; }
.rg-end-letter { width: 32px; height: 32px; border-radius: 50%; background: var(--rg-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; }
.rg-end-title { margin: 0; font-size: 19px; font-weight: 900; line-height: 1.5; color: var(--rg-deep); }
.rg-end-score { margin: 8px 0 0; font-size: 13px; color: var(--rg-muted); }
.rg-hint { margin: 12px 0 0; font-size: 12px; font-weight: 500; color: var(--rg-faint); text-align: center; }
@media (max-height: 640px) {
  .rg-head { padding: 4px 0 8px; }
  .rg-brand { margin-bottom: 6px; }
  .rg-sub { display: none; }
  .rg-board { height: clamp(300px, calc(100dvh - 190px), 520px); }
}
@media (prefers-reduced-motion: reduce) {
  .rg-basket, .rg-toast { transition: none; }
  .rg-pop .rg-tile, .rg-fade, .rg-shake { animation-duration: .01s; }
}
/* ‏العنصرُ المطلوب نصّاً (حرفٌ أو رقم) على السلّة وفي بطاقة البدء — لعبتا «الاصطياد» المشتركتان. */
.rg-basket-letter { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); font-size: 20px; font-weight: 900; color: var(--rg-deep); line-height: 1; }
.rg-intro-letter { font-size: 48px; font-weight: 900; line-height: 1; color: var(--rg-deep); }

/* رتّل — «اصطياد الحركات»: ألوانُ الحركات (الفتحة حمراء، الضمّة زرقاء، الكسرة خضراء) وشاراتُها.
   المشتركُ في engine.css. */
.rg-harakat-catch { --hc-fatha: #E03E3E; --hc-damma: #2F6FE0; --hc-kasra: #0E9F6E; }
.hc-mark { position: relative; display: inline-block; width: 1em; height: 1.5em; font-size: 24px; line-height: 1; vertical-align: middle; }
.hc-slot { position: absolute; left: 15%; right: 15%; top: 30%; bottom: 30%; border: 2px dashed #C9D6D3; border-radius: 6px; }
.hc-sign { position: absolute; left: 50%; font-weight: 900; }
.hc-fatha .hc-sign, .hc-kasra .hc-sign { width: 70%; height: 0.14em; border-radius: 0.1em; background: currentColor; transform: translateX(-50%) rotate(-24deg); }
.hc-up .hc-sign { top: 6%; }
.hc-kasra .hc-sign { top: auto; bottom: 8%; }
.hc-damma .hc-sign { top: -12%; font-size: 0.62em; transform: translateX(-50%); }
.hc-fatha { color: var(--hc-fatha); }
.hc-damma { color: var(--hc-damma); }
.hc-kasra { color: var(--hc-kasra); }
.hc-chip .hc-mark { font-size: 27px; }
.hc-mark.hc-big { font-size: 46px; }
.hc-basket { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); }
.hc-basket .hc-mark { font-size: 25px; }
.hc-tile { font-size: 28px; }
.hc-tile.hc-fatha { border-color: #FFD4D4; background: #FFF6F6; }
.hc-tile.hc-damma { border-color: #BFD5FB; background: #F4F8FF; }
.hc-tile.hc-kasra { border-color: #A7F3D0; background: #F2FDF8; }
.hc-mark.hc-end { font-size: 26px; margin: 0 4px; }
