.eam-ludo { box-sizing:border-box; margin:14px auto; padding:clamp(12px,3.4vw,25px); max-width:800px;
  color:#59366b; direction:rtl; text-align:center; border-radius:27px;
  font-family:Tahoma,Arial,sans-serif; border:2px solid #f5d6ee;
  background:radial-gradient(circle at 8% 10%,#fff2c7 0,transparent 29%),
    radial-gradient(circle at 92% 12%,#e7d8ff 0,transparent 32%),
    linear-gradient(145deg,#fff5fc,#f7f1ff 65%,#fffafd);
  box-shadow:0 10px 32px #b774c622; }
.eam-ludo * { box-sizing:border-box; }
.eam-ludo [hidden] { display:none !important; }
.eam-ludo-heading { display:flex; align-items:center; justify-content:center; gap:12px; margin:2px 0 16px; }
.eam-ludo { position:relative; isolation:isolate; }
.eam-ludo-glimmer { pointer-events:none; font-size:24px; letter-spacing:17px; color:#f9bdda;
  text-shadow:0 3px 10px #e17bad55; animation:eam-ludo-glimmer 5s ease-in-out infinite; }
.eam-ludo-exit { position:sticky; top:max(8px,env(safe-area-inset-top)); z-index:30;
  display:block; width:max-content; margin-right:auto; margin-left:0; }
.eam-ludo button.eam-ludo-exit { color:#9a458b; background:#fff; border:2px solid #ffdbef;
  border-radius:99px; box-shadow:0 3px 14px #ab77aa30; font-size:14px; }
.eam-ludo-effects { position:fixed; inset:0; z-index:1000000; overflow:hidden;
  pointer-events:none; font-family:Tahoma,Arial,sans-serif; }
.eam-ludo-flying-emoji { position:absolute; display:flex; flex-direction:column;
  align-items:center; gap:3px; white-space:nowrap; padding:14px 24px;
  border-radius:26px; background:#ffffffea; border:2px solid #ffb8e0;
  box-shadow:0 15px 60px #c56eae4a,0 0 0 9px #ffffff35;
  animation:eam-ludo-emoji-float 3.8s cubic-bezier(.15,.66,.2,1) forwards; }
.eam-ludo-flying-emoji strong { font-size:clamp(70px,14vw,120px); line-height:1.1;
  filter:drop-shadow(0 5px 12px #ea93b999); }
.eam-ludo-flying-emoji small { font-size:16px; font-weight:bold; color:#a05297;
  text-shadow:0 1px #fff; }
.eam-ludo-fx-friend { background:#faf2ffec; border-color:#bb96e9; }
.eam-ludo-fx-friend small { color:#7951af; }
@keyframes eam-ludo-emoji-float {
  0% { transform:translate(-50%,70px) rotate(-12deg) scale(.45); opacity:0; }
  13% { transform:translate(-50%,0) rotate(8deg) scale(1.12); opacity:1; }
  38% { transform:translate(-50%,-20px) rotate(-5deg) scale(1); opacity:1; }
  70% { transform:translate(-50%,-80px) rotate(5deg) scale(1.08); opacity:.94; }
  100% { transform:translate(-50%,-180px) rotate(8deg) scale(1.32); opacity:0; }
}
@keyframes eam-ludo-glimmer { 0%,100%{opacity:.35;transform:translateY(2px)} 50%{opacity:1;transform:translateY(-4px)} }
.eam-ludo-heading h3 { color:#943e91; font-size:clamp(18px,4vw,27px); margin:0 0 4px; }
.eam-ludo-heading p { color:#9f709a; margin:0; font-size:13px; }
.eam-ludo-mascot { font-size:clamp(25px,6vw,42px); filter:drop-shadow(0 5px 6px #b177a844); }
.eam-ludo-alert { background:#fff; border:1px solid #f3d3e9; border-radius:16px;
  padding:12px; color:#8b4794; font-size:15px; font-weight:700; margin:14px 0;
  min-height:50px; }
.eam-ludo-alert.eam-ludo-error { background:#fff0ef; border-color:#f1b3b3; color:#ab434f; }
.eam-ludo-players { display:flex; justify-content:space-between; flex-wrap:wrap; gap:9px; margin:13px 0; }
.eam-ludo-players span { background:white; border:2px solid #f2d9ea; border-radius:99px;
  padding:8px 13px; font-weight:bold; font-size:13px; color:#914880; }
.eam-ludo-players span:last-child { border-color:#e1d1fb; color:#7052a3; }
.eam-ludo-players b { font-size:12px; font-weight:normal; margin-right:5px; }
.eam-ludo-board { width:min(100%,560px); margin:16px auto 13px; aspect-ratio:1; overflow:hidden;
  border:6px solid #ffffff; border-radius:22px; background:white;
  box-shadow:0 7px 24px #9d6bab30,0 0 0 1px #edd8eb; }
.eam-ludo-board svg { width:100%; height:100%; display:block; }
.eam-ludo-token { filter:drop-shadow(0 2px 2px #8f689d55); }
.eam-ludo-token-legal { cursor:pointer; filter:drop-shadow(0 0 7px #ffbc38); animation:eam-ludo-pulse 1.2s ease-in-out infinite; }
.eam-ludo-token-legal:focus { outline:4px solid #ffd476; outline-offset:3px; }
@keyframes eam-ludo-pulse { 0%,100% {opacity:1} 50% {opacity:.69} }
.eam-ludo-controls { display:flex; align-items:center; justify-content:center; gap:19px;
  background:#ffffffb9; padding:12px; border-radius:19px; border:1px solid #f4e1f0; margin-top:13px; }
.eam-ludo-die-holder { flex:none; display:flex; flex-direction:column; align-items:center; gap:7px;
  min-width:100px; perspective:500px; }
.eam-ludo-die { display:block; position:relative; width:91px; height:91px; flex:none;
  border:3px solid #fff; border-radius:19px;
  background:linear-gradient(140deg,#fff,#fffbff 55%,#e7d9ef);
  box-shadow:inset -8px -9px 12px #d1bbdc7d,inset 4px 5px 8px #fff,
    0 6px 0 #bba1cf,0 13px 18px #8a589d55;
  transform:rotate(-7deg); transform-style:preserve-3d;
  transition:transform .23s ease; }
.eam-ludo-die:before { content:''; position:absolute; inset:3px; border-radius:14px;
  border:1px solid #ffffffcc; pointer-events:none; }
.eam-ludo-die-face { display:grid; grid-template-columns:repeat(3,1fr);
  grid-template-rows:repeat(3,1fr); width:100%; height:100%; padding:10px; }
.eam-ludo-pip { display:block; visibility:hidden; width:15px; height:15px; margin:auto;
  border-radius:50%; background:radial-gradient(circle at 30% 27%,#654975,#251b34 76%);
  box-shadow:inset 1px 2px 2px #1b112c88,0 1px 1px #fff; }
.eam-ludo-pip-on { visibility:visible; }
.eam-ludo-die-question { position:absolute; inset:0; display:grid; place-items:center;
  font-size:43px; font-weight:bold; color:#ac83c4; }
.eam-ludo-roll-info { font-size:11px; color:#86599a; font-weight:bold;
  white-space:nowrap; direction:rtl; }
.eam-ludo-die.eam-ludo-die-rolling { animation:eam-ludo-physical-roll .85s cubic-bezier(.35,.11,.25,1) both; }
@keyframes eam-ludo-physical-roll {
  0% { transform:rotate(-7deg) rotateX(0) rotateY(0) translateY(0) scale(1); }
  20% { transform:rotate(75deg) rotateX(95deg) rotateY(60deg) translateY(-27px) scale(.88); }
  40% { transform:rotate(155deg) rotateX(190deg) rotateY(120deg) translateY(6px) scale(1.08); }
  62% { transform:rotate(248deg) rotateX(275deg) rotateY(230deg) translateY(-12px) scale(.94); }
  82% { transform:rotate(350deg) rotateX(355deg) rotateY(350deg) translateY(2px) scale(1.04); }
  100% { transform:rotate(353deg) rotateX(360deg) rotateY(360deg) translateY(0) scale(1); }
}
.eam-ludo-control-buttons { display:flex; flex-wrap:wrap; justify-content:center; gap:9px; }
.eam-ludo button { border:0; border-radius:13px; color:#fff; font-weight:bold;
  font-family:inherit; cursor:pointer; min-height:45px; padding:10px 16px;
  background:linear-gradient(120deg,#f25fa9,#ba59cb); box-shadow:0 4px 12px #cc75be33;
  transition:transform .12s ease,opacity .12s ease; }
.eam-ludo button:hover:not(:disabled) { transform:translateY(-2px); }
.eam-ludo button:active:not(:disabled) { transform:translateY(0); }
.eam-ludo button:disabled { opacity:.46; cursor:not-allowed; box-shadow:none; }
.eam-ludo button:focus-visible { outline:3px solid #ffce64; outline-offset:3px; }
.eam-ludo button[data-ludo-join] { background:linear-gradient(130deg,#68c3e2,#7790db); }
.eam-ludo button[data-ludo-roll] { background:linear-gradient(130deg,#ae73e9,#744cb5); font-size:17px; }
.eam-ludo button.eam-ludo-reset { background:#fff; color:#916a9c; border:1px solid #e6cfed;
  box-shadow:none; font-size:12px; min-height:37px; }
.eam-ludo-hint { color:#8c638d; font-size:13px; margin:12px 5px; }
.eam-ludo-moves { display:flex; flex-wrap:wrap; gap:9px; justify-content:center; margin:7px 0; }
.eam-ludo button.eam-ludo-piece-button { min-height:44px; background:#f64fa0; border:2px solid #fff;
  box-shadow:0 3px 10px #e495c366; }
.eam-ludo-emotions { margin:20px auto 6px; padding:17px 12px; max-width:620px;
  background:linear-gradient(125deg,#ffffffdd,#fff4faee); border-radius:20px;
  border:1px solid #efddf2; }
.eam-ludo-emotions h4 { color:#a54c93; margin:0 0 12px; font-size:16px; }
.eam-ludo-emoji-buttons { display:flex; flex-wrap:wrap; gap:7px; justify-content:center; }
.eam-ludo-emoji-tip { font-size:12px; color:#aa82a3; margin:0 0 12px; }
.eam-ludo-delivery { min-height:25px; margin:10px 0 0; padding:3px 5px;
  font-size:12px; font-weight:bold; color:#8b5a98; }
.eam-ludo button[aria-label^="فرستادن"] { min-width:45px; min-height:45px; padding:6px;
  background:#fff; border:1px solid #f6dce8; box-shadow:0 2px 8px #c98eb01b;
  font-size:24px; }
.eam-ludo-messages { max-height:170px; min-height:55px; overflow:auto; display:flex;
  flex-direction:column; align-items:stretch; gap:5px; text-align:right; margin-top:15px;
  padding:10px; border-radius:13px; background:#fff8fd; border:1px solid #f6e3f1; }
.eam-ludo-messages p { text-align:center; color:#ad91a9; font-size:12px; margin:6px 0; }
.eam-ludo-bubble { display:inline-block; width:max-content; max-width:95%; padding:6px 11px;
  color:#78476a; background:#f8e3f2; border-radius:14px; font-size:14px; }
.eam-ludo-bubble.eam-ludo-them { align-self:flex-start; background:#ede1ff; color:#7754a3; }
.eam-ludo-bubble.eam-ludo-me { align-self:flex-end; }
.eam-ludo-rules { color:#957b98; font-size:12px; line-height:2.05; margin:19px 5px 0; }
/* A dedicated child game room fills the viewport, separate from the normal app. */
body.eam-game-open { overflow:hidden !important; }
.eam-app .eam-screen[data-eam-screen="games"] {
  position:fixed; inset:0; width:100vw; height:100vh; height:100dvh;
  z-index:999991; display:block; overflow-x:hidden; overflow-y:auto;
  overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
  padding:0; margin:0; border:0; border-radius:0;
  background:radial-gradient(circle at 13% 20%,#ffe4f8 0,transparent 29%),
    radial-gradient(circle at 90% 75%,#ddedff 0,transparent 30%),
    linear-gradient(140deg,#fff3fc,#f3ecff 68%,#fffbea);
}
.eam-app .eam-screen[data-eam-screen="games"]:fullscreen { width:100%; height:100%; }
.eam-app .eam-screen[data-eam-screen="games"] .eam-ludo {
  width:100%; max-width:920px; min-height:100vh; min-height:100dvh;
  margin:0 auto; padding:calc(14px + env(safe-area-inset-top))
    max(12px,env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom))
    max(12px,env(safe-area-inset-left));
  border:0; border-radius:0; box-shadow:none;
  background:radial-gradient(circle at 12% 17%,#ffe2f6 0,transparent 28%),
    radial-gradient(circle at 88% 28%,#e9dcff 0,transparent 31%),
    radial-gradient(circle at 50% 90%,#fff0bd 0,transparent 27%),
    linear-gradient(150deg,#fff9fe,#faf6ff 65%,#fffafb);
}
.eam-app .eam-screen[data-eam-screen="games"] .eam-ludo-board { width:min(84vw,570px);
  border:8px solid white; box-shadow:0 10px 45px #d48cbe50,0 0 0 3px #efbde0; }
.eam-app .eam-screen[data-eam-screen="games"] .eam-ludo-heading { margin:1px 0 8px; }
.eam-app .eam-screen[data-eam-screen="games"] .eam-ludo-heading h3 { font-size:clamp(24px,6vw,35px); }
.eam-app .eam-screen[data-eam-screen="games"] .eam-ludo-players { max-width:575px; margin:10px auto; }
.eam-app .eam-screen[data-eam-screen="games"] .eam-ludo-alert { max-width:650px; margin:10px auto; }
.eam-app .eam-screen[data-eam-screen="games"] .eam-ludo-controls { max-width:660px; margin:13px auto; }
.eam-app .eam-screen[data-eam-screen="games"] .eam-ludo-emotions { max-width:660px; margin:18px auto; }
@media(max-width:520px) {
  .eam-ludo { padding:10px; border-radius:19px; }
  .eam-ludo-heading { gap:5px; }
  .eam-ludo-heading p { font-size:11px; }
  .eam-ludo-players span { padding:5px 9px; font-size:11px; }
  .eam-ludo-board { border-width:3px; border-radius:12px; }
  .eam-ludo-controls { gap:8px; padding:8px; }
  .eam-ludo-die-holder { min-width:74px; gap:5px; }
  .eam-ludo-die { width:72px; height:72px; border-radius:14px; }
  .eam-ludo-die-face { padding:8px; }
  .eam-ludo-pip { width:12px; height:12px; }
  .eam-ludo-die-question { font-size:35px; }
  .eam-ludo-roll-info { font-size:10px; }
  .eam-ludo button { min-height:40px; padding:8px 11px; font-size:12px; }
  .eam-ludo button[aria-label^="فرستادن"] { min-width:42px; min-height:42px; font-size:23px; }
  .eam-app .eam-screen[data-eam-screen="games"] .eam-ludo-board { width:min(94vw,520px); border-width:4px; }
  .eam-app .eam-screen[data-eam-screen="games"] .eam-ludo { padding:calc(7px + env(safe-area-inset-top)) 9px 22px; }
  .eam-ludo-glimmer { letter-spacing:7px; font-size:16px; }
  .eam-ludo-flying-emoji { padding:10px 16px; }
  .eam-ludo-flying-emoji small { font-size:12px; }
}
@media(prefers-reduced-motion:reduce) {
  .eam-ludo-token-legal { animation:none; }
  .eam-ludo button { transition:none; }
  .eam-ludo-glimmer { animation:none; }
  .eam-ludo-flying-emoji { animation-duration:1.8s; }
  .eam-ludo-die.eam-ludo-die-rolling { animation:none; }
}
