/* Jema frame (Session 1): fixed top circle + profile circle in the same document. No iframe.
   Screen state lives on <html data-jema-screen="lobby|picker|ongame|watching|winner">.
   Segment colours arrive as --jf-* variables (set by js/jema-frame.js). */
:root{
  /* Layout session (10 Nov 2026): reserved bottom zone. Nothing is drawn below Y 94.5% (older Android nav bars).
     --jema-pad-bot = the empty strip (5.5%), --jema-band = the 3.3% strip above it (91.2% to 94.5%) used by the bottom row. */
  --jema-vh:1vh;
  --jema-pad-bot:max(calc(var(--jema-vh)*5.5),env(safe-area-inset-bottom,0px));
  --jema-band:calc(var(--jema-vh)*3.3);
  --jema-scrim:.20;               /* locked: sky shows through (was .70) */
  --jf-top:9,13,26; --jf-bottom:22,28,42; --jf-text:200,212,232; --jf-surface:23,27,40;
  --jf-mark:#fff;                 /* logo-bar colour on the lobby (white or navy, set by js/jema-frame.js) */
  --jf-dy:28px;                   /* Lobby session D1: the circle sits 28px lower on EVERY screen (top = safe-area + 34px). Screens add this to their own top offsets. */
}
@supports (height:1dvh){:root{--jema-vh:1dvh}}
#jemaFrame{position:fixed;inset:0;z-index:99990;pointer-events:none}
/* TOP CIRCLE: 92px, safe-area + 34px (6px + --jf-dy) on every screen */
#jemaTopCircle{position:fixed;top:calc(env(safe-area-inset-top,0px) + 6px + var(--jf-dy));left:50%;transform:translateX(-50%);
  width:92px;height:92px;border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center;
  background:radial-gradient(circle at 35% 30%,rgb(var(--jf-surface)),rgb(var(--jf-top)) 75%);
  border:2px solid rgba(var(--jf-bottom),.45);box-shadow:0 0 0 6px rgba(0,0,0,.55),0 6px 20px rgba(0,0,0,.5);
  color:rgb(var(--jf-text));font-size:30px;font-weight:900;line-height:1;font-variant-numeric:tabular-nums;
  transition:background .4s,border-color .4s,color .4s}
#jemaTopCircle .jf-main{font-size:30px;font-weight:900;line-height:1}
#jemaTopCircle .jf-main.sm{font-size:22px}
#jemaTopCircle .jf-label{font-size:8px;letter-spacing:.5px;margin-top:2px;color:rgba(var(--jf-text),.72);font-weight:700}
#jemaTopCircle .jf-main.emoji{font-size:38px}
/* PROFILE CIRCLE: bottom-centre, same recipe as the picker avatar, shown on picker/ongame/watching only */
#jemaProfileCircle{position:fixed;bottom:var(--jema-pad-bot);left:50%;transform:translateX(-50%);
  width:clamp(40px,6.4vh,48px);height:clamp(40px,6.4vh,48px);border-radius:50%;display:none;align-items:center;justify-content:center;
  background:radial-gradient(circle at 35% 30%,rgb(var(--jf-surface)),rgb(var(--jf-top)) 75%);
  border:2px solid rgba(var(--jf-bottom),.45);box-shadow:0 0 0 2px rgba(0,0,0,.45);
  font-size:13px;font-weight:800;color:rgb(var(--jf-text));overflow:hidden;pointer-events:auto;cursor:pointer}
html[data-jema-screen="picker"] #jemaProfileCircle,
html[data-jema-screen="ongame"] #jemaProfileCircle,
html[data-jema-screen="watching"] #jemaProfileCircle{display:flex}
/* MUTE BUTTON (Session 12c): sits on the upper-right of the profile circle, ~40 degrees, white ring like the circle's neighbour in the design */
#jemaMuteBtn{--pc:clamp(40px,6.4vh,48px);position:fixed;display:none;width:calc(var(--pc)*.62);height:calc(var(--pc)*.62);min-width:28px;min-height:28px;padding:0;margin:0;border-radius:50%;
  left:calc(50% + var(--pc)*.75);bottom:calc(var(--jema-pad-bot) + var(--pc)*.93);transform:translate(-50%,50%);
  background:rgba(20,28,40,.55);border:2px solid #fff;align-items:center;justify-content:center;pointer-events:auto;cursor:pointer;z-index:99990;-webkit-tap-highlight-color:transparent}
#jemaMuteBtn::after{content:"";position:absolute;inset:-8px}
#jemaMuteBtn svg{width:78%;height:78%;overflow:visible}
#jemaMuteBtn .sp{fill:#2f80ed}
#jemaMuteBtn .wv{fill:none;stroke:#2f80ed;stroke-width:2.2;stroke-linecap:round}
#jemaMuteBtn .sl{fill:none;stroke:#e5252a;stroke-width:2.6;stroke-linecap:round}
html[data-jema-screen="picker"] #jemaMuteBtn:not(.na),
html[data-jema-screen="ongame"] #jemaMuteBtn:not(.na),
html[data-jema-screen="watching"] #jemaMuteBtn:not(.na){display:flex}
/* tiny dev switcher (hidden unless ?frame=1 or JemaFrame.devBar(true)) */
#jemaDevBar{position:fixed;top:calc(env(safe-area-inset-top,0px) + 6px);right:6px;display:none;gap:4px;pointer-events:auto;z-index:99991}
#jemaDevBar.on{display:flex}
#jemaDevBar button{font:700 10px Arial,sans-serif;padding:6px 7px;border-radius:8px;border:1px solid rgba(255,255,255,.25);background:rgba(13,13,13,.8);color:#fff}
#jemaDevBar button[aria-pressed="true"]{background:rgb(var(--jf-bottom));color:#0d0d0d}
@media(prefers-reduced-motion:reduce){#jemaTopCircle{transition:none}}

/* dial (picker countdown): arc + hand, advance only on real ticks; numeral appears in the final 10s */
#jemaTopCircle .jf-hand{display:none}
#jemaTopCircle[data-dial]::before{content:"";position:absolute;inset:-7px;border-radius:50%;pointer-events:none;
  background:conic-gradient(rgb(var(--jf-bottom)) calc(var(--jf-progress,100)*1%),transparent 0);
  -webkit-mask:radial-gradient(circle,transparent 63%,#000 64%);mask:radial-gradient(circle,transparent 63%,#000 64%);transition:background .35s linear}
#jemaTopCircle[data-dial] .jf-hand{display:block;position:absolute;left:50%;top:50%;width:2px;height:38%;margin-left:-1px;margin-top:-38%;
  background:rgb(var(--jf-bottom));border-radius:2px;transform-origin:bottom center;
  transform:rotate(calc(var(--jf-progress,100)*3.6deg - 180deg));transition:transform .35s cubic-bezier(.25,.85,.3,1);box-shadow:0 0 4px rgba(0,0,0,.4)}
#jemaTopCircle[data-dial].jf-late .jf-main{opacity:0}
#jemaTopCircle .jf-main{transition:opacity .25s}
#jemaTopCircle.jf-urgent{animation:jfUrgent 1s ease-out infinite}
@keyframes jfUrgent{0%{transform:translateX(-50%) scale(1.06)}100%{transform:translateX(-50%) scale(1)}}
@media(prefers-reduced-motion:reduce){#jemaTopCircle.jf-urgent{animation:none}}

/* LOBBY ONLY: the logo's two bars drawn around the circle (mark geometry, manifesto §14: bars 100x14 rx3, circle r42, gap 6;
   scaled 1.095 -> 109.5 x 15.33 px, 6.57 px from the circle). The circle IS the sun of the orbit menu. No motion on the bars. */
html[data-jema-screen="lobby"] #jemaTopCircle::before,
html[data-jema-screen="lobby"] #jemaTopCircle::after{content:"";position:absolute;left:50%;width:109.5px;height:15.33px;margin-left:-54.75px;
  border-radius:3.3px;background:var(--jf-mark,#fff);pointer-events:none;transition:background .4s}
html[data-jema-screen="lobby"] #jemaTopCircle::before{top:-23.9px}
html[data-jema-screen="lobby"] #jemaTopCircle::after{top:calc(100% + 8.57px)}

/* Session 6: the Telegram photo fills the circle as a whole picture (it was drawn at its own size, so only the middle showed = zoomed) */
#jemaProfileCircle #jfAvatar{display:flex;align-items:center;justify-content:center;width:100%;height:100%;line-height:1}
#jemaProfileCircle #jfAvatar img{display:block;width:100%;height:100%;object-fit:contain;border-radius:50%}
/* Session 6: "Leave this game?" while a round is being played */
#jemaLeaveAsk{position:fixed;inset:0;z-index:100001;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(0,0,0,.62)}
#jemaLeaveAsk .jla-box{width:100%;max-width:320px;padding:20px 18px 16px;border-radius:16px;text-align:center;background:rgb(var(--jf-surface));color:rgb(var(--jf-text));border:1px solid rgba(var(--jf-text),.25);box-shadow:0 12px 40px rgba(0,0,0,.5)}
#jemaLeaveAsk .jla-title{font-size:18px;font-weight:800;margin-bottom:6px}
#jemaLeaveAsk .jla-text{font-size:13px;line-height:1.4;opacity:.85;margin-bottom:16px}
#jemaLeaveAsk .jla-btns{display:flex;gap:10px}
#jemaLeaveAsk button{flex:1;padding:11px 0;border-radius:12px;font-size:14px;font-weight:800;cursor:pointer;border:1px solid rgba(var(--jf-text),.35);background:transparent;color:rgb(var(--jf-text))}
#jemaLeaveAsk .jla-stay{background:rgb(var(--jf-text));color:rgb(var(--jf-top));border-color:transparent}

/* Dock (voice + text language): two small circles either side of the bottom-centre profile circle. Same screens as the profile circle. */
:root{--jd-pw:clamp(40px,6.4vh,48px);--jd-s:34px;--jd-gap:12px}
#jemaDock{position:fixed;inset:0;display:none;pointer-events:none}
html[data-jema-screen="picker"] #jemaDock,
html[data-jema-screen="ongame"] #jemaDock,
html[data-jema-screen="watching"] #jemaDock{display:block}
#jemaDock .jd-mini{position:fixed;width:var(--jd-s);height:var(--jd-s);padding:0;border-radius:50%;pointer-events:auto;cursor:pointer;
  bottom:calc(env(safe-area-inset-bottom,0px) + 1.2vh + (var(--jd-pw) - var(--jd-s))/2);
  display:flex;align-items:center;justify-content:center;font:800 12px/1 -apple-system,"Noto Sans Ethiopic",Roboto,Arial,sans-serif;
  color:rgb(var(--jf-text));background:radial-gradient(circle at 35% 30%,rgb(var(--jf-surface)),rgb(var(--jf-top)) 75%);
  border:2px solid rgba(var(--jf-bottom),.45);box-shadow:0 0 0 2px rgba(0,0,0,.45);-webkit-tap-highlight-color:transparent}
#jemaDock .jd-left{right:calc(50% + var(--jd-pw)/2 + var(--jd-gap));font-size:19px}
#jemaDock .jd-right{left:calc(50% + var(--jd-pw)/2 + var(--jd-gap))}
#jemaDock .jd-mini:active{transform:scale(.94)}
#jemaDock .jd-mini:focus-visible,#jdLangMenu button:focus-visible{outline:2px solid rgb(var(--jf-text));outline-offset:2px}
#jdLangMenu{position:fixed;right:10px;pointer-events:auto;min-width:176px;padding:6px;border-radius:14px;
  bottom:calc(env(safe-area-inset-bottom,0px) + 1.2vh + (var(--jd-pw) + var(--jd-s))/2 + 12px);
  background:rgb(var(--jf-surface));color:rgb(var(--jf-text));border:1px solid rgba(var(--jf-text),.25);box-shadow:0 12px 40px rgba(0,0,0,.5)}
#jdLangMenu[hidden]{display:none}
#jdLangMenu button{display:flex;align-items:center;justify-content:space-between;width:100%;padding:10px 12px;border:0;border-radius:10px;
  background:transparent;color:inherit;font:700 14px/1.1 -apple-system,"Noto Sans Ethiopic",Roboto,Arial,sans-serif;cursor:pointer;text-align:left}
#jdLangMenu button[aria-checked="true"]{background:rgba(var(--jf-text),.14)}
#jdLangMenu button i{font-style:normal;opacity:0}
#jdLangMenu button[aria-checked="true"] i{opacity:1}
#jdLangMenu button:disabled{opacity:.45;cursor:default}
#jdLangMenu button em{font:600 10px/1 -apple-system,Roboto,Arial,sans-serif;font-style:normal;opacity:.8}

/* ───── LOBBY WINNER CIRCLE (lobby-winner session): own Telegram picture all the time, winner card(s) while someone wins ───── */
#jemaTopCircle #lbSunPic,#jemaTopCircle #lbSunWin{position:absolute;inset:0;border-radius:50%;display:none;pointer-events:none}
#jemaTopCircle #lbSunPic{overflow:hidden;align-items:center;justify-content:center;font-size:30px;font-weight:900;color:rgb(var(--jf-text))}
#jemaTopCircle #lbSunPic img{display:block;width:100%;height:100%;object-fit:contain;border-radius:50%}
html[data-jema-screen="lobby"] #jemaTopCircle.lb-pic #lbSunPic{display:flex}
#jemaTopCircle #lbSunWin{flex-direction:column;align-items:center;justify-content:center;gap:1px;text-align:center;line-height:1.05}
html[data-jema-screen="lobby"] #jemaTopCircle.lb-win #lbSunWin{display:flex}
html[data-jema-screen="lobby"] #jemaTopCircle.lb-win .jf-main,html[data-jema-screen="lobby"] #jemaTopCircle.lb-win .jf-label{opacity:0}
#lbSunWin .lbw-grid{display:grid;grid-template-columns:repeat(5,7px);grid-auto-rows:7px;gap:1px;padding:2px;border-radius:4px;background:rgba(0,0,0,.35);margin-bottom:1px}
#lbSunWin .lbw-grid i{display:block;border-radius:1.5px;background:rgba(var(--jf-text),.16)}
#lbSunWin .lbw-grid i.m{background:rgba(var(--jf-text),.42)}
#lbSunWin .lbw-grid i.w{background:#FFC93C;box-shadow:0 0 3px rgba(255,201,60,.8)}
#lbSunWin .lbw-grid i.f{background:rgba(255,201,60,.55)}
#lbSunWin .lbw-n{max-width:62px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:8px;font-weight:800;letter-spacing:.2px;color:rgba(var(--jf-text),.85)}
#lbSunWin .lbw-z{font-size:9.5px;font-weight:900;color:#FFC93C;white-space:nowrap;font-variant-numeric:tabular-nums}
/* the two pills push out sideways from the circle, level with its middle: derash (money notes) on the left, players on the right */
#jemaTopCircle #lbWinPills{position:absolute;left:50%;top:50%;margin-top:-17px;width:0;height:34px;pointer-events:none;display:none}
html[data-jema-screen="lobby"] #jemaTopCircle #lbWinPills.on{display:block}
#lbWinPills .lbw-pill{position:absolute;top:0;height:34px;display:flex;align-items:center;gap:6px;padding:0 13px;white-space:nowrap;
  background:linear-gradient(150deg,rgb(var(--jf-surface)),rgb(var(--jf-top)));border:1px solid rgba(var(--jf-bottom),.5);
  box-shadow:0 2px 0 rgba(0,0,0,.4),0 4px 14px rgba(0,0,0,.35);color:rgb(var(--jf-text));
  -webkit-backdrop-filter:blur(10px) saturate(1.15);backdrop-filter:blur(10px) saturate(1.15);animation:lbwPush .42s cubic-bezier(.25,1,.5,1) both}
#lbWinPills .lbw-pill i{font-style:normal;font-size:17px;line-height:1}
#lbWinPills .lbw-pill b{font-size:15px;font-weight:900;font-variant-numeric:tabular-nums}
#lbWinPills .lbw-l{right:58px;border-radius:999px 6px 6px 999px;transform-origin:100% 50%}
#lbWinPills .lbw-r{left:58px;border-radius:6px 999px 999px 6px;transform-origin:0 50%}
#lbWinPills.out .lbw-pill{animation:lbwPull .36s cubic-bezier(.5,0,.75,0) both}
@keyframes lbwPush{from{transform:scaleX(.08);opacity:0}to{transform:scaleX(1);opacity:1}}
@keyframes lbwPull{from{transform:scaleX(1);opacity:1}to{transform:scaleX(.08);opacity:0}}
@media(prefers-reduced-motion:reduce){#lbWinPills .lbw-pill,#lbWinPills.out .lbw-pill{animation:none}}

/* Layout session: on the game screens the profile circle and mute button live in the 91.2%-94.5% strip, same height as the strip, so nothing crosses the 94.5% line or the panels above it. */
html[data-jema-screen="ongame"] #jemaProfileCircle,html[data-jema-screen="watching"] #jemaProfileCircle{box-sizing:border-box;width:var(--jema-band);height:var(--jema-band);border-width:1px;font-size:min(13px,calc(var(--jema-band)*.42))}
html[data-jema-screen="ongame"] #jemaMuteBtn,html[data-jema-screen="watching"] #jemaMuteBtn{--pc:var(--jema-band);width:var(--jema-band);height:var(--jema-band);min-width:0;min-height:0;box-sizing:border-box;border-width:1.5px;
  left:calc(50% + var(--jema-band) + 6px);bottom:var(--jema-pad-bot);transform:translateX(-50%)}
