:root {
  --night: #0b1020;
  --glass: rgba(13, 18, 34, .68);
  --glass-strong: rgba(13, 18, 34, .86);
  --glass-2: rgba(255, 255, 255, .06);
  --glass-3: rgba(255, 255, 255, .1);
  --line: rgba(255, 255, 255, .12);
  --line-2: rgba(255, 255, 255, .2);
  --text: #f6f3ee;
  --muted: #a7afc4;
  --dim: #7c849b;
  --saffron: #ffb547;
  --saffron-2: #ffcf7a;
  --teal: #2ec4b6;
  --green: #5bd38a;
  --rose: #ff6b6b;
  --indigo: #8b9cf6;
  --s1: #f59e5b; --s2: #8b9cf6; --s3: #4fc48a; --s4: #f4c14e;
  --r-xl: 22px; --r-lg: 16px; --r-md: 12px; --r-sm: 9px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06) inset;
  --blur: saturate(150%) blur(18px);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  font-size: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: Inter, "Noto Sans", system-ui, sans-serif;
  color: var(--text); background: var(--night); line-height: 1.5;
  -webkit-font-smoothing: antialiased; font-feature-settings: "ss01", "cv11";
}
[lang="ar"] { font-family: "Reem Kufi", "Amiri", serif; direction: rtl; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; border-radius: 8px; }

#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(5, 8, 18, .55) 100%); }

.glass { background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); }

/* loading */
.loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--night); z-index: 90; transition: opacity .8s var(--ease-out); color: var(--muted); }
.loading.done { opacity: 0; pointer-events: none; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--saffron); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- top bar ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; z-index: 20; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; flex-direction: column; line-height: 1.05; text-shadow: 0 2px 14px rgba(0, 0, 0, .6); }
.brand-ar { font-size: 30px; color: var(--saffron); font-weight: 700; }
.brand-en { font-size: 12.5px; color: var(--text); letter-spacing: .04em; opacity: .9; }
.stage-pill { position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; border-radius: 999px; background: var(--glass); backdrop-filter: var(--blur); border: 1px solid var(--line); font-size: 14px; white-space: nowrap; }
.stage-pill .dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 12px currentColor; }
.stage-pill .sep { width: 1px; height: 16px; background: var(--line-2); }
.stage-pill .muted { color: var(--muted); }
.tools { display: flex; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: var(--glass); backdrop-filter: var(--blur); border: 1px solid var(--line); font-size: 13.5px; }
.chip b { letter-spacing: .18em; font-weight: 700; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: var(--blur); transition: transform .15s var(--ease-out), background .15s; }
.icon-btn:hover { background: var(--glass-strong); transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--r-md); padding: 11px 18px; font-weight: 600; font-size: 15px; transition: transform .15s var(--ease-out), box-shadow .2s, background .2s, opacity .2s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn.primary { background: linear-gradient(180deg, var(--saffron-2), var(--saffron)); color: #2a1a05; box-shadow: 0 8px 24px -8px rgba(255, 181, 71, .65); }
.btn.teal { background: linear-gradient(180deg, #5fe0d3, var(--teal)); color: #05201d; box-shadow: 0 8px 24px -8px rgba(46, 196, 182, .6); }
.btn.ghost { background: var(--glass-2); border-color: var(--line); color: var(--text); }
.btn.ghost:hover:not(:disabled) { background: var(--glass-3); }
.btn.small { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }
input[type=text] { width: 100%; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--text); outline: none; transition: border .15s, background .15s; }
input[type=text]:focus { border-color: var(--saffron); background: rgba(255, 255, 255, .09); }
input.code { font-size: 26px; letter-spacing: .4em; text-transform: uppercase; text-align: center; font-weight: 700; padding: 10px; }
.label { font-size: 13px; color: var(--muted); margin: 0 0 6px; display: block; }
.muted { color: var(--muted); } .small { font-size: 13.5px; } .tiny { font-size: 12px; }
.err { color: var(--rose); font-size: 13.5px; min-height: 1.4em; margin-top: 8px; }
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); gap: 4px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); transition: background .2s, color .2s; }
.seg button[aria-pressed=true] { background: var(--text); color: var(--night); }
.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: 999px; background: rgba(255, 255, 255, .15); position: relative; flex: none; transition: background .2s; cursor: pointer; margin-top: 2px; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease-out); }
.switch input:checked { background: var(--teal); } .switch input:checked::after { transform: translateX(16px); }

/* ---------- home & lobby ---------- */
.screen { position: fixed; inset: 76px 0 0 0; display: flex; align-items: center; padding: 20px 5vw 60px; z-index: 10; pointer-events: none; }
.screen > * { pointer-events: auto; }
.hero { max-width: 560px; position: relative; }
.hero::before { content: ""; position: absolute; inset: -60px -80px -60px -40vw; background: radial-gradient(ellipse at 30% 50%, rgba(8,12,24,.78), rgba(8,12,24,.45) 45%, transparent 72%); z-index: -1; pointer-events: none; }
.hero h1 { font-size: clamp(38px, 4.4vw, 60px); line-height: 1.02; letter-spacing: -0.025em; margin: 0 0 6px; font-weight: 800; text-shadow: 0 4px 30px rgba(0, 0, 0, .5); }
.hero .ar { display: block; font-family: "Reem Kufi", serif; font-size: clamp(44px, 5vw, 72px); color: var(--saffron); line-height: 1.25; margin-bottom: 4px; direction: rtl; text-align: left; }
.hero p { color: #e3e6ef; font-size: 17px; max-width: 34em; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 48px; width: 100%; max-width: 1180px; margin: 0 auto; align-items: center; }
.panel { padding: 26px; }
.panel h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.01em; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.features { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.features span { padding: 6px 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); font-size: 13px; backdrop-filter: var(--blur); }

.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; width: 100%; max-width: 920px; margin: 0 auto; }
.room-code { font-size: 56px; font-weight: 800; letter-spacing: .22em; margin: 6px 0 2px; background: linear-gradient(180deg, #fff, #ffd59a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.plist { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.plist li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--glass-2); border: 1px solid var(--line); animation: rise .45s var(--ease-out) both; }
.plist .avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: linear-gradient(135deg, #3a4568, #222a44); }
.plist .empty { opacity: .45; border-style: dashed; animation: none; }
.setting { padding: 14px 0; border-bottom: 1px solid var(--line); } .setting:last-of-type { border: 0; }

/* ---------- in-game HUD ---------- */
.roster { position: fixed; top: 88px; left: 18px; width: 252px; display: flex; flex-direction: column; gap: 8px; z-index: 15; }
.pchip { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; padding: 9px 12px 9px 9px; border-radius: var(--r-lg); background: var(--glass); backdrop-filter: var(--blur); border: 1px solid var(--line); position: relative; transition: transform .3s var(--ease-out), border-color .3s; }
.pchip.turn { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc) inset, 0 10px 30px -12px var(--pc); transform: translateX(6px); }
.pchip .av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; position: relative; }
.pchip .av svg.ring { position: absolute; inset: -4px; width: 52px; height: 52px; transform: rotate(-90deg); }
.pchip .av .ico { width: 22px; height: 22px; }
.pchip .nm { font-weight: 650; font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.pchip .cn { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchip .meta { display: flex; gap: 8px; font-size: 11.5px; color: var(--muted); margin-top: 2px; flex-wrap: wrap; }
.pchip .meta b { color: var(--text); font-weight: 600; }
.online { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); } .online.off { background: #666; box-shadow: none; }
.you { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: var(--glass-3); color: var(--muted); font-weight: 600; }

.feed { position: fixed; left: 18px; bottom: 18px; width: 252px; z-index: 14; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.feed p { margin: 0; padding: 7px 11px; border-radius: 10px; font-size: 12.5px; background: rgba(13, 18, 34, .55); backdrop-filter: var(--blur); border: 1px solid var(--line); color: #d9dcea; animation: rise .4s var(--ease-out) both; }
.feed p:nth-child(1) { opacity: .55; } .feed p:nth-child(2) { opacity: .75; }

/* event card dock */
.dock { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(700px, calc(100vw - 680px)); min-width: 520px; z-index: 16; transition: transform .5s var(--ease-out), opacity .4s; }
.dock.min { transform: translate(-50%, calc(100% - 58px)); }
.dock.hide { opacity: 0; pointer-events: none; transform: translate(-50%, 40px); }
.ecard { padding: 18px 22px 18px; max-height: calc(100vh - 120px); overflow: auto; position: relative; transform-origin: 50% 100%; }
.ecard::-webkit-scrollbar { width: 8px; } .ecard::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.ecard.draw { animation: drawIn .85s var(--ease-out) both; }
@keyframes drawIn { 0% { opacity: 0; transform: perspective(1400px) translateY(120px) rotateX(28deg) rotateY(-24deg) scale(.86); } 60% { opacity: 1; } 100% { opacity: 1; transform: none; } }
.ecard.twist { box-shadow: 0 0 0 1px var(--rose) inset, 0 20px 60px -20px rgba(255, 107, 107, .7); animation: drawIn .7s var(--ease-out) both, shake .5s .7s both; }
.ecard.reverse { box-shadow: 0 0 0 1px var(--green) inset, 0 20px 60px -20px rgba(91, 211, 138, .6); }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.loc { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.loc svg { width: 14px; height: 14px; color: var(--saffron); }
.minbtn { border: 0; background: var(--glass-2); border-radius: 10px; padding: 5px 10px; font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.minbtn:hover { background: var(--glass-3); color: var(--text); }
.ecard h3 { font-size: 26px; line-height: 1.15; letter-spacing: -.02em; margin: 4px 0 8px; font-weight: 750; }
.turnline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.turnline .mini { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.turnline .mini .ico { width: 13px; height: 13px; }
.ecard .text { font-size: 16.5px; color: #e9ebf2; margin: 0 0 14px; max-width: 60ch; }
.warn { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 10px; background: rgba(255, 107, 107, .12); color: #ffb4b4; font-size: 14px; margin: 0 0 12px; border: 1px solid rgba(255, 107, 107, .25); }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center; padding: 12px 14px; border-radius: var(--r-md); background: var(--glass-2); border: 1px solid var(--line); color: var(--text); font-size: 15px; transition: transform .18s var(--ease-out), background .18s, border-color .18s; animation: rise .5s var(--ease-out) both; }
.draw .opt:nth-child(1) { animation-delay: .35s; } .draw .opt:nth-child(2) { animation-delay: .42s; } .draw .opt:nth-child(3) { animation-delay: .49s; } .draw .opt:nth-child(4) { animation-delay: .56s; }
.ecard:not(.draw) .opt { animation: none; }
button.opt:hover:not(:disabled) { background: var(--glass-3); border-color: var(--line-2); transform: translateX(3px); }
.opt .tchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .07); color: var(--muted); white-space: nowrap; }
.opt .tchip b { color: var(--text); }
.opt .tchip .ok { color: var(--green); } .opt .tchip .lo { color: #ffb4a0; }
.opt.removed { opacity: .3; text-decoration: line-through; }
.opt.right { border-color: rgba(91, 211, 138, .6); background: rgba(91, 211, 138, .1); }
.opt.wrong { border-color: rgba(255, 107, 107, .55); background: rgba(255, 107, 107, .08); }
.opt.chosen { box-shadow: 0 0 0 2px var(--text) inset; }
.opt .sub { grid-column: 1 / -1; font-size: 12.5px; }
.opt .sub.twist { color: #ffb4b4; } .opt .sub.votes { color: #8fe7dc; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.helpers { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); }
.pill.gold { border-color: rgba(255, 181, 71, .45); color: var(--saffron-2); }

.revealed { margin-top: 10px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid rgba(255, 181, 71, .4); background: linear-gradient(135deg, rgba(255, 181, 71, .12), rgba(255, 181, 71, .03)); font-size: 14px; animation: rise .5s var(--ease-out) both; }
.revealed .lt { font-weight: 700; color: var(--saffron-2); }

/* result + meter */
.result { margin-top: 14px; padding: 14px 16px; border-radius: var(--r-lg); background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.result .rhead { display: flex; align-items: center; gap: 12px; }
.stamp { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 17px; flex: none; }
.success .stamp { background: rgba(91, 211, 138, .18); color: var(--green); }
.short .stamp { background: rgba(46, 196, 182, .16); color: var(--teal); }
.wrong .stamp { background: rgba(255, 107, 107, .16); color: var(--rose); }
.result.anim .stamp { animation: pop .55s 1.05s var(--ease-out) both; }
.result.anim .rtitle, .result.anim .rbody { animation: rise .5s 1.15s var(--ease-out) both; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rtitle { font-weight: 700; font-size: 17px; }
.success .rtitle { color: var(--green); } .short .rtitle { color: var(--teal); } .wrong .rtitle { color: var(--rose); }
.meter { position: relative; height: 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); margin: 14px 0 6px; overflow: visible; }
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; display: flex; overflow: hidden; width: var(--w); }
.result.anim .meter .fill { animation: grow 1s .1s var(--ease-out) both; }
@keyframes grow { from { width: 0; } to { width: var(--w); } }
.meter .seg-b { background: linear-gradient(90deg, #7f8cff, #8b9cf6); } .meter .seg-s { background: var(--saffron); } .meter .seg-x { background: var(--teal); }
.meter .need { position: absolute; top: -6px; bottom: -6px; width: 2px; background: #fff; border-radius: 2px; box-shadow: 0 0 8px #fff; }
.meter .need span { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.mlegend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.mlegend .num { font-weight: 800; color: var(--text); font-size: 14px; }
.rbody p { margin: 8px 0 0; font-size: 14.5px; }
.lesson { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--saffron); border-radius: 0 10px 10px 0; background: rgba(255, 181, 71, .07); font-size: 14.5px; }
.lesson .src { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; font-style: italic; }

/* companion drawer */
.drawer { position: fixed; top: 88px; right: 18px; width: 360px; max-height: calc(100vh - 106px); z-index: 15; display: flex; flex-direction: column; transition: transform .5s var(--ease-out), opacity .4s; }
.drawer.closed { transform: translateX(calc(100% - 66px)); }
.drawer .dhead { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.drawer .obj { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; color: #fff; box-shadow: 0 10px 24px -10px var(--pc); cursor: pointer; }
.drawer .obj .ico { width: 30px; height: 30px; }
.drawer .ar { font-family: "Reem Kufi", serif; font-size: 20px; line-height: 1.2; color: var(--saffron-2); text-align: left; direction: rtl; }
.drawer .nm { font-weight: 700; font-size: 15.5px; line-height: 1.2; }
.drawer .ttl { font-size: 12.5px; color: var(--muted); }
.tabs { display: flex; gap: 4px; padding: 10px 14px 0; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected=true] { background: var(--glass-3); color: var(--text); }
.dbody { padding: 12px 16px 16px; overflow: auto; }
.dbody::-webkit-scrollbar { width: 8px; } .dbody::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.radar { display: block; margin: 0 auto; }
.radar text { fill: var(--muted); font-size: 9.5px; font-family: Inter, "Noto Sans", sans-serif; }
.radar .grp { fill: var(--text); font-size: 10.5px; font-weight: 700; }
.radar .poly { animation: radarIn 1s var(--ease-out) both; transform-origin: center; transform-box: fill-box; }
@keyframes radarIn { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tlist { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; margin-top: 8px; }
.trow { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; border-bottom: 1px dashed rgba(255, 255, 255, .07); }
.trow b { font-weight: 700; } .trow small { color: var(--saffron); margin-left: 2px; }
.tg { font-size: 11.5px; color: var(--dim); margin-top: 8px; grid-column: 1 / -1; font-weight: 600; letter-spacing: .02em; }
.talent { padding: 12px 14px; border-radius: var(--r-md); background: var(--glass-2); border: 1px solid var(--line); margin-bottom: 10px; font-size: 14px; }
.talent .kind { font-size: 11.5px; color: var(--dim); font-weight: 600; margin-bottom: 2px; }
.talent b { font-size: 15px; }
.talent.ready { border-color: rgba(255, 181, 71, .45); background: linear-gradient(135deg, rgba(255, 181, 71, .1), transparent); }
.talent select { width: 100%; margin-top: 8px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .08); border: 1px solid var(--line); }
.talent select option { color: #111; }
.tokens { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.lcard { padding: 12px 14px; border-radius: var(--r-md); margin-bottom: 10px; background: linear-gradient(160deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02)); border: 1px solid var(--line); font-size: 13.5px; position: relative; transition: transform .2s var(--ease-out), border-color .2s; }
.lcard:hover { transform: translateY(-2px); border-color: var(--line-2); }
.lcard .lt { font-weight: 700; font-size: 14.5px; display: flex; justify-content: space-between; gap: 8px; }
.lcard .lu { color: #8fe7dc; font-size: 12.5px; margin-top: 4px; }
.lcard .ls { color: var(--dim); font-size: 12px; font-style: italic; }
.grade { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, .1); color: var(--muted); height: fit-content; }
.grade.S { color: var(--green); } .grade.H { color: #8fe7dc; } .grade.R { color: var(--saffron-2); } .grade.V { color: var(--rose); }

/* group trial overlay */
.trial { position: fixed; inset: 0; display: grid; place-items: center; z-index: 30; background: radial-gradient(ellipse at center, rgba(5, 8, 18, .35), rgba(5, 8, 18, .75)); animation: fade .5s both; }
@keyframes fade { from { opacity: 0; } }
.trial .tcard { width: min(760px, 92vw); padding: 26px 28px; animation: drawIn .8s var(--ease-out) both; }
.circle { display: flex; justify-content: center; gap: 14px; margin: 16px 0; flex-wrap: wrap; }
.circle .who { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; width: 86px; text-align: center; }
.circle .who .av { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; position: relative; transition: transform .3s; }
.circle .who .av .ico { width: 26px; height: 26px; color: #fff; }
.circle .who.done .av::after { content: "✓"; position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%; background: var(--teal); color: #05201d; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.circle .who.pass .av { box-shadow: 0 0 0 3px var(--green), 0 0 24px var(--green); animation: pop .5s var(--d) var(--ease-out) both; }
.circle .who.fail .av { box-shadow: 0 0 0 3px var(--rose); opacity: .7; animation: pop .5s var(--d) var(--ease-out) both; }
.circle .who small { color: var(--muted); }

/* cinematic */
.cine { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.cine::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(5,8,18,.72), rgba(5,8,18,.35) 40%, transparent 65%); opacity: 0; transition: opacity 1.2s; }
.cine.on::before { opacity: 1; }
.cine .bar { position: absolute; left: 0; right: 0; height: 13vh; background: #000; transition: transform 1s var(--ease-out); }
.cine .bar.top { top: 0; transform: translateY(-100%); } .cine .bar.bottom { bottom: 0; transform: translateY(100%); }
.cine.on .bar { transform: none; }
.cine-text { position: absolute; left: 6vw; bottom: calc(13vh + 4vh); max-width: 680px; text-shadow: 0 4px 30px rgba(0, 0, 0, .8); }
.cine-ar { font-family: "Reem Kufi", serif; font-size: 64px; color: var(--saffron); line-height: 1.1; opacity: 0; transform: translateY(16px); transition: all 1s .4s var(--ease-out); direction: rtl; text-align: left; }
.cine h2 { font-size: 48px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 0; opacity: 0; transform: translateY(16px); transition: all 1s .6s var(--ease-out); }
.cine-sub { font-size: 17px; color: var(--saffron-2); margin: 4px 0 14px; opacity: 0; transition: opacity 1s .8s; }
.cine.on .cine-ar, .cine.on h2 { opacity: 1; transform: none; } .cine.on .cine-sub { opacity: 1; }
.cine-lines p { margin: 0 0 8px; font-size: 19px; line-height: 1.45; color: #f1f2f6; animation: rise .9s var(--ease-out) both; }
.cine-skip { position: absolute; right: 24px; bottom: calc(13vh + 20px); pointer-events: auto; }

/* glossary */
.gl { border-bottom: 1px dotted rgba(255, 255, 255, .55); cursor: help; }
.gl:hover { background: rgba(255, 181, 71, .16); border-radius: 3px; }
.gl-inline { font-size: .86em; color: var(--muted); }
.saw { font-family: "Amiri", serif; font-size: 1.12em; border-bottom: 0; }
.gl-pop { position: absolute; z-index: 80; max-width: 290px; background: var(--glass-strong); backdrop-filter: var(--blur); color: var(--text); border: 1px solid var(--line-2); border-radius: 14px; padding: 11px 14px; font-size: 14px; box-shadow: var(--shadow); animation: rise .2s var(--ease-out) both; }
.gl-pop .term { font-weight: 700; color: var(--saffron-2); }
.gl-pop .simple { color: var(--muted); margin-top: 2px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(4, 7, 16, .6); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 60; padding: 20px; animation: fade .25s both; }
.modal-card { position: relative; width: min(760px, 100%); max-height: 86vh; overflow: auto; padding: 28px 30px; background: var(--glass-strong); backdrop-filter: var(--blur); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); animation: drawIn .5s var(--ease-out) both; }
.modal-card h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.02em; }
.modal-card h3 { margin: 20px 0 6px; font-size: 16px; color: var(--saffron-2); }
.modal-card .close { position: absolute; top: 14px; right: 14px; font-size: 22px; }
.gtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.gtable td, .gtable th { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.gtable th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.reveal { text-align: center; }
.flip { width: 150px; height: 150px; margin: 8px auto 14px; perspective: 900px; }
.flip .in { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; animation: flip 1.2s .2s var(--ease-out) both; }
.flip .face { position: absolute; inset: 0; border-radius: 32px; display: grid; place-items: center; backface-visibility: hidden; }
.flip .back { background: repeating-linear-gradient(45deg, #1f2a4a 0 10px, #26335a 10px 20px); border: 2px solid var(--saffron); }
.flip .front { transform: rotateY(180deg); color: #fff; box-shadow: 0 20px 50px -14px var(--pc); }
.flip .front .ico { width: 80px; height: 80px; }
@keyframes flip { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }

/* toasts */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 85; align-items: center; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 12px; background: var(--glass-strong); backdrop-filter: var(--blur); border: 1px solid var(--line-2); font-size: 14px; animation: rise .3s var(--ease-out) both; }
.flychip { position: fixed; z-index: 70; padding: 4px 10px; border-radius: 999px; background: var(--saffron); color: #2a1a05; font-weight: 800; font-size: 13px; pointer-events: none; box-shadow: 0 6px 20px -6px rgba(255, 181, 71, .8); }

/* over */
.over { width: min(620px, 92vw); margin: 0 auto; padding: 30px; text-align: center; animation: drawIn .8s var(--ease-out) both; }
.over .ar { font-family: "Reem Kufi", serif; font-size: 54px; color: var(--saffron); direction: rtl; }

@media (max-width: 1180px) {
  .dock { width: min(680px, calc(100vw - 340px)); min-width: 0; left: calc(50% + 130px); }
  .drawer.closed { transform: translateX(calc(100% - 66px)); }
}
@media (max-width: 900px) {
  .home-grid, .lobby-grid { grid-template-columns: 1fr; }
  .roster { width: 200px; } .feed { display: none; }
  .dock { left: 50%; width: calc(100vw - 24px); }
  .stage-pill { display: none; }
  body { overflow: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; } }

body.home .topbar .brand { opacity: 0; }
body.cinema .topbar .tools, body.cinema .stage-pill { opacity: 0; pointer-events: none; }
.topbar .brand, .topbar .tools, .stage-pill { transition: opacity .5s; }
