/* الرسام — the lobby's look, shared by /alrasam/lobby.php and /mobile/alrasam/lobby.php.
   It is kalmaw's إعداد اللعبة screen (white cards, violet steppers, gold radios and the
   gold ابدأ اللعبة) over الرسام's scene, /images/design/web/alrasam/background.png,
   which carries the logo itself. Each page sets the scale: everything is in em
   off the .setup font-size. */
:root {
  --d-card:   #f8f6fe;   --d-ink:    #2b1a5e;   --d-mute:  #8d81b3;
  --d-violet: #7b3fe4;   --d-violet-d: #5f27c9; --d-violet-l: #9a67f0;
  --d-lav:    #e9e2fb;   --d-gold:   #ffd84d;   --d-gold-d: #f0b400;
  --d-gold-l: #ffe98a;
  --d-blue-bg:#d7e9fc;   --d-blue:   #1e6fd0;
  --d-pur-bg: #fbe0f1;   --d-pur:    #c2319a;
  --d-chip:   #3a1a7a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  min-height: 100vh; min-height: 100dvh;
  font-family: 'Cairo', sans-serif; color: #fff;
  background: #2a1560;
}
/* The scene — /images/design/web/alrasam/background.png (served as the .webp cut
   from it) — fills the screen: cover, anchored at the top so the painted logo is
   never cropped off. A fixed layer rather than background-attachment: fixed, which
   iOS ignores (it would scale the picture to the whole scrolling page instead). */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url('/images/design/web/alrasam/background.webp') center top / cover no-repeat;
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The phone pages (body.phone, the /mobile tree) have their own portrait scene,
   /images/design/mobile/alrasam/background.png (served as the .webp cut from it):
   cover, anchored at the top, so it is max(100vh, 177.7vw) tall (9:16) and its
   logo ribbon ends 31.2% of the way down it. */
body.phone::before { background-image: url('/images/design/mobile/alrasam/background.webp'); }

/* body.fit (index.php): the whole picture, stretched to exactly the screen — nothing
   cropped. Its logo then always ends 32% of the way down the screen (the padding on
   the page follows that). */
body.fit::before { background-size: 100% 100%; background-position: center; }

/* The logo, /images/logo/alrasam.png, in the room each page leaves above its column
   (the page sets --logo-room to the same height as its padding-top). Sized to fit
   that room whatever the picture's shape; it hides itself if the file is missing. */
.top-logo {
  position: absolute; z-index: 1; left: 50%; transform: translateX(-50%);
  top: calc(8px + env(safe-area-inset-top));
  height: calc(var(--logo-room) - 18px - env(safe-area-inset-top));
  max-width: min(64vw, 820px); object-fit: contain; pointer-events: none;
  filter: drop-shadow(0 .5em 1em rgba(10, 4, 40, .45));
  animation: ar-rise .5s ease backwards;
}
body.phone .top-logo { max-width: 86vw; top: calc(62px + env(safe-area-inset-top));
                       height: calc(var(--logo-room) - 70px - env(safe-area-inset-top)); }

/* ── the column ── */
.setup { width: 100%; margin: 0 auto; display: flex; flex-direction: column; align-items: stretch; }
.logo  { align-self: center; display: block; object-fit: cover;
         border-radius: 22%; box-shadow: 0 .5em 1.4em rgba(20, 6, 60, .45), 0 0 0 .18em rgba(255, 255, 255, .85); }
.banner {
  align-self: center; padding: .15em 1.3em; border-radius: .38em; white-space: nowrap;
  font-weight: 900; color: var(--d-ink);
  background: linear-gradient(180deg, var(--d-gold-l), var(--d-gold));
  box-shadow: 0 .2em .5em rgba(8, 2, 30, .35), inset 0 .1em 0 rgba(255, 255, 255, .55);
}

/* ── the cards ── */
.card {
  position: relative; border-radius: 1.1em; color: var(--d-ink);
  background: linear-gradient(180deg, #fffefe 0%, var(--d-card) 58%, #efeafc 100%);
  box-shadow: 0 .6em 1.5em rgba(20, 6, 60, .34), inset 0 .1em 0 rgba(255, 255, 255, .9);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45em;
  padding: .8em 1em;
  animation: ar-rise .55s cubic-bezier(.2, .85, .3, 1) backwards;
}
.card .ico {
  position: absolute; left: .9em; top: 50%; transform: translateY(-50%);
  width: 3.1em; height: 3.1em; color: var(--d-violet);
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: radial-gradient(90% 90% at 50% 20%, #f3ecff, var(--d-lav));
  box-shadow: inset 0 0 0 .08em rgba(123, 63, 228, .18), 0 .15em .45em rgba(74, 32, 150, .16);
}
.card .ico svg { width: 62%; height: 62%; display: block; }
.card h2    { font-size: 1.3em; font-weight: 900; line-height: 1.25; }
.card .hint { font-size: .72em; font-weight: 700; line-height: 1.3; color: var(--d-mute); }

/* − 5 + */
.stepper { display: flex; align-items: center; gap: .55em; direction: ltr; }
.stepper button {
  width: 2.7em; height: 2.1em; border: none; border-radius: .55em; cursor: pointer; color: #fff;
  font-family: 'Cairo', sans-serif; font-size: 1.3em; font-weight: 900; line-height: 1;
  background: linear-gradient(180deg, var(--d-violet-l), var(--d-violet) 55%, var(--d-violet-d));
  box-shadow: 0 .14em 0 var(--d-violet-d), 0 .22em .5em rgba(74, 32, 150, .32), inset 0 .1em 0 rgba(255, 255, 255, .35);
  transition: transform .14s ease, filter .14s ease;
}
.stepper button:hover:not(:disabled)  { filter: brightness(1.07); transform: translateY(-.06em); }
.stepper button:active:not(:disabled) { transform: translateY(.1em); box-shadow: 0 .04em 0 var(--d-violet-d); }
.stepper button:disabled { opacity: .35; box-shadow: none; cursor: default; filter: grayscale(.4); }
.stepper .val {
  min-width: 4.6em; height: 2.3em; display: flex; align-items: center; justify-content: center;
  border-radius: .55em; color: var(--d-ink);
  background: linear-gradient(180deg, #f1ebff, var(--d-lav));
  box-shadow: inset 0 .08em .25em rgba(74, 32, 150, .18), inset 0 0 0 .06em rgba(123, 63, 228, .16);
  font-size: 1.2em; font-weight: 900; font-variant-numeric: tabular-nums;
}

/* 30 / 60 / 90 ثانية */
.radios { align-self: stretch; display: grid; grid-template-columns: repeat(3, 1fr); gap: .55em; }
.km-radio {
  display: flex; align-items: center; justify-content: center; gap: .5em;
  height: 2.5em; border: none; border-radius: .6em; cursor: pointer;
  font-family: 'Cairo', sans-serif; font-size: .92em; font-weight: 800;
  background: linear-gradient(180deg, #f2ecff, var(--d-lav)); color: var(--d-ink);
  box-shadow: inset 0 0 0 .07em rgba(123, 63, 228, .14);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.km-radio:hover  { transform: translateY(-.08em); }
.km-radio .dot   { width: 1.05em; height: 1.05em; border-radius: 50%; flex: none;
                   border: .17em solid var(--d-violet); background: #fff; transition: .16s; }
.km-radio.sel {
  background: linear-gradient(180deg, var(--d-gold-l), var(--d-gold) 55%, #ffcc2e);
  box-shadow: 0 .14em 0 var(--d-gold-d), 0 .26em .7em rgba(190, 130, 0, .3), inset 0 .1em 0 rgba(255, 255, 255, .6);
}
.km-radio.sel .dot { border-color: var(--d-ink); box-shadow: inset 0 0 0 .18em var(--d-ink); }

/* فرق / أفراد */
.radios.two { grid-template-columns: 1fr 1fr; }

/* أفراد: الرسام المحتال's settings — two steppers side by side, then الجميع محتال */
.c-muhtal .msteps { display: grid; grid-template-columns: 1fr 1fr; gap: .8em; align-self: stretch; }
.c-muhtal .mstep  { display: flex; flex-direction: column; align-items: center; gap: .35em; }
.c-muhtal .mlabel { font-size: .95em; font-weight: 900; }
.c-muhtal .stepper .val { min-width: 3em; }
.c-muhtal .stepper button { width: 2.3em; }

/* the two team cards */
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: .7em;
         animation: ar-rise .55s cubic-bezier(.2, .85, .3, 1) .18s backwards; }
.team { position: relative; display: flex; align-items: center; gap: .6em;
        padding: .75em .8em; border-radius: 1.1em;
        box-shadow: 0 .6em 1.5em rgba(20, 6, 60, .34), inset 0 .1em 0 rgba(255, 255, 255, .8); }
.team .tico { width: 2.9em; height: 2.9em; flex: none;
              display: flex; align-items: center; justify-content: center; border-radius: 50%;
              background: rgba(255, 255, 255, .72); box-shadow: 0 .15em .45em rgba(20, 6, 60, .14); }
.team .tico svg { width: 64%; height: 64%; display: block; }
.team .body { flex: 1; min-width: 0; }
.team .ttl  { font-size: .95em; font-weight: 900; margin-bottom: .3em; text-align: center; }
.team input {
  width: 100%; height: 2.3em; padding: 0 .7em; border-radius: .55em; outline: none;
  font-family: 'Cairo', sans-serif; font-size: max(16px, .85em); font-weight: 700;   /* 16px: iOS zooms on less */
  background: #fff; border: .07em solid rgba(43, 26, 94, .14); color: var(--d-ink);
  transition: box-shadow .18s ease, border-color .18s ease;
}
.team input::placeholder { color: #a99fc4; }
.t1 { background: linear-gradient(180deg, #e7f2ff, var(--d-blue-bg)); }
.t1 .tico, .t1 .ttl { color: var(--d-blue); }
.t1 input:focus { border-color: var(--d-blue); box-shadow: 0 0 0 .16em rgba(30, 111, 208, .22); }
.t2 { background: linear-gradient(180deg, #fff0f9, var(--d-pur-bg)); }
.t2 .tico, .t2 .ttl { color: var(--d-pur); }
.t2 input:focus { border-color: var(--d-pur); box-shadow: 0 0 0 .16em rgba(194, 49, 154, .22); }

/* ابدأ اللعبة */
.start-btn {
  position: relative; overflow: hidden; align-self: center;
  display: flex; align-items: center; justify-content: center; gap: .5em;
  border: none; border-radius: 999px; cursor: pointer;
  font-family: 'Cairo', sans-serif; font-weight: 900; color: var(--d-ink);
  background: linear-gradient(180deg, var(--d-gold-l) 0%, var(--d-gold) 52%, #ffc21a 100%);
  box-shadow: 0 .22em 0 var(--d-gold-d), 0 .4em .9em rgba(20, 6, 60, .35), inset 0 .12em 0 rgba(255,255,255,.55);
  transition: transform .15s, filter .15s;
  animation: ar-rise .55s cubic-bezier(.2, .85, .3, 1) .3s backwards;
}
.start-btn::after {                     /* a slow shine sweeping across the gold */
  content: ''; position: absolute; top: -50%; bottom: -50%; width: 22%;
  background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,255,255,.7), rgba(255,255,255,0));
  transform: skewX(-18deg); animation: ar-shine 3.6s ease-in-out 1.6s infinite; pointer-events: none;
}
.start-btn > * { position: relative; z-index: 1; }
.start-btn:hover  { transform: translateY(-.08em); filter: brightness(1.05); }
.start-btn:active { transform: translateY(.1em); box-shadow: 0 .06em 0 var(--d-gold-d); }
.start-btn:disabled { filter: grayscale(.35) brightness(.95); cursor: progress; }
.start-btn svg { width: 1.25em; height: 1.25em; }

/* the corner buttons: الألعاب + اقتراح (left, in .c-left), طريقة اللعب (right) */
.c-left { position: fixed; z-index: 5; left: 14px; top: calc(14px + env(safe-area-inset-top));
          display: flex; gap: 8px; }
.c-left .corner { position: static; }
.corner {
  position: fixed; z-index: 5; top: calc(14px + env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: center; gap: .5em;
  height: 46px; padding: 0 16px; border: none; border-radius: 999px; cursor: pointer; text-decoration: none;
  font-family: 'Cairo', sans-serif; font-size: 15px; font-weight: 800; color: #fff; white-space: nowrap;
  background: linear-gradient(180deg, rgba(74, 36, 148, .94), rgba(48, 20, 106, .94));
  box-shadow: 0 .25em .8em rgba(0, 0, 0, .35), inset 0 .08em 0 rgba(255, 255, 255, .22);
  transition: transform .18s ease, filter .18s ease;
}
.corner:hover { transform: translateY(-1px); filter: brightness(1.12); }
.corner svg { width: 21px; height: 21px; flex: none; }
.corner.round { width: 46px; padding: 0; }
.c-help { right: 14px; }

.corner:focus-visible, .stepper button:focus-visible, .km-radio:focus-visible, .start-btn:focus-visible {
  outline: 3px solid #fff; outline-offset: 2px;
}

/* ── rules sheet ── */
.ar-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(20, 6, 50, .72);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.ar-modal-box {
  position: relative; width: 100%; max-width: 540px; max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: 26px 24px 22px; border-radius: 22px; text-align: right;
  background: var(--d-card); color: var(--d-ink);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
}
.ar-modal-box h2 { font-size: 22px; font-weight: 900; text-align: center; margin-bottom: 12px; }
.ar-modal-box h3 { font-size: 17px; font-weight: 900; margin: 14px 0 4px; color: var(--d-violet); }
.ar-modal-box ol { padding-right: 20px; font-size: 15px; font-weight: 700; line-height: 1.95; }
.ar-modal-close {
  position: absolute; top: 10px; left: 12px; width: 36px; height: 36px; border: none; border-radius: 50%;
  background: var(--d-lav); color: var(--d-ink); font-size: 24px; line-height: 1; cursor: pointer;
}
.ar-modal-ok {
  display: block; width: 100%; margin-top: 16px; height: 50px; border: none; border-radius: 999px; cursor: pointer;
  font-family: 'Cairo', sans-serif; font-size: 18px; font-weight: 900; color: var(--d-ink);
  background: linear-gradient(180deg, var(--d-gold-l), var(--d-gold) 52%, #ffc21a);
  box-shadow: 0 3px 0 var(--d-gold-d);
}

/* ── index.php: the start page, from /images/design/web/alrasam/design.png ── */
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7em;
         animation: ar-rise .55s cubic-bezier(.2, .85, .3, 1) .05s backwards; }
.chip {
  display: flex; align-items: center; justify-content: center; gap: .55em;
  padding: .45em .8em; border-radius: 999px; color: var(--d-ink);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 .35em .9em rgba(20, 6, 60, .3), inset 0 0 0 .12em var(--chip, #7b3fe4);
}
.chip .cico { width: 2.1em; height: 2.1em; flex: none; border-radius: 50%;
              display: flex; align-items: center; justify-content: center; color: var(--chip, #7b3fe4);
              background: color-mix(in srgb, var(--chip, #7b3fe4) 14%, #fff); }
.chip .cico svg { width: 62%; height: 62%; display: block; }
.chip b     { display: block; font-size: 1em; font-weight: 900; line-height: 1.25; }
.chip small { display: block; font-size: .7em; font-weight: 700; line-height: 1.25; color: var(--d-mute); }
.chip.gold { --chip: #e0a100; } .chip.pur { --chip: #9b3fd6; } .chip.blue { --chip: #2f6fe0; }

.how {
  position: relative; border-radius: 1.2em; padding: 1.7em 1.2em 1em;
  background: linear-gradient(180deg, rgba(22, 30, 92, .9), rgba(14, 18, 64, .9));
  border: .12em solid rgba(110, 160, 255, .55);
  box-shadow: 0 0 1.4em rgba(60, 120, 255, .3), 0 .8em 1.8em rgba(10, 4, 40, .45);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: ar-rise .55s cubic-bezier(.2, .85, .3, 1) .12s backwards;
}
.how h2 {
  position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%) rotate(-2deg);
  padding: .1em 1.2em; border-radius: .3em; white-space: nowrap;
  font-size: 1.2em; font-weight: 900; color: #fff;
  background: linear-gradient(90deg, #2a6fe8, #3d8bff, #2a6fe8);
  box-shadow: 0 .25em .6em rgba(0, 0, 0, .35);
}
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2em; text-align: center; }
.step { position: relative; display: flex; flex-direction: column; align-items: center; gap: .45em; }
.step + .step::before {                 /* the dotted arrow from the step before (RTL: on the right) */
  content: '›'; position: absolute; right: -.95em; top: 1.1em;
  font-size: 1.2em; font-weight: 900; color: rgba(150, 190, 255, .8); transform: scaleX(-1);
}
.step .sico {
  position: relative; width: 3.6em; height: 3.6em; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: radial-gradient(80% 80% at 35% 25%, color-mix(in srgb, var(--st) 70%, #fff), var(--st));
  box-shadow: 0 0 0 .2em rgba(255, 255, 255, .9), 0 .4em .9em rgba(0, 0, 0, .35);
}
.step .sico svg { width: 50%; height: 50%; display: block; }
.step .num {
  position: absolute; bottom: -.35em; left: 50%; transform: translateX(-50%);
  width: 1.4em; height: 1.4em; border-radius: 50%; font-size: .78em; font-weight: 900; line-height: 1.4em;
  background: #fff; color: var(--d-ink); box-shadow: 0 .1em .3em rgba(0, 0, 0, .3);
}
.step p { font-size: .82em; font-weight: 800; line-height: 1.35; color: #fff; margin-top: .3em; }
.step.s1 { --st: #b048e0; } .step.s2 { --st: #2f86ff; } .step.s3 { --st: #ff8a1f; } .step.s4 { --st: #22b573; }
.rules-btn {
  display: flex; align-items: center; gap: .45em; margin: .9em auto 0;
  padding: .3em 1.1em; border-radius: 999px; cursor: pointer;
  font-family: 'Cairo', sans-serif; font-size: .82em; font-weight: 800; color: #fff;
  background: rgba(40, 60, 160, .75); border: .1em solid rgba(130, 170, 255, .6);
  transition: background .15s ease;
}
.rules-btn:hover { background: rgba(60, 85, 200, .9); }
.rules-btn svg { width: 1.2em; height: 1.2em; }
a.start-btn { text-decoration: none; }
.start-btn .play { width: 0; height: 0; border-top: .45em solid transparent; border-bottom: .45em solid transparent;
                   border-right: .72em solid var(--d-ink); border-radius: .08em; }   /* points left (RTL forward) */
.tagline {
  align-self: center; padding: .25em 1.2em; border-radius: .6em; text-align: center;
  font-size: .78em; font-weight: 800; line-height: 1.5; color: #fff;
  background: rgba(20, 20, 70, .72); box-shadow: 0 .2em .6em rgba(0, 0, 0, .3);
}

@keyframes ar-rise  { from { opacity: 0; transform: translateY(.9em); } to { opacity: 1; transform: none; } }
@keyframes ar-shine { 0%, 62% { right: -30%; } 100% { right: 118%; } }

@media (prefers-reduced-motion: reduce) {
  .card, .teams, .chips, .how, .game-card, .top-logo, .start-btn, .start-btn::after { animation: none !important; }
}
