/* App shell — skinned with extracted Unity UI assets (extracted_assets/skin/* are alpha-trimmed copies). */
#app {
  --font: "JawakerBody", "Segoe UI", system-ui, sans-serif;
  --head: "JawakerHeadline", var(--font);
  --ink: #f4f1ff;
  --muted-ink: #b7b3d6;
  --panel-bg: rgba(20, 16, 44, 0.92);
  --line: rgba(255, 255, 255, 0.12);
  --gold: #ffd54a;
  --green: #22b24c;
  position: relative;
  min-height: calc(100dvh - var(--hdr, 56px));
  background: #120d2a;
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
}
#app[dir="rtl"] { --head: "Cairo", var(--font); }
#app img { user-select: none; }
#app button { font-family: inherit; color: inherit; }

/* ---------- screens ---------- */
#app .screen {
  position: relative;
  min-height: calc(100dvh - var(--hdr, 56px));
  background: #120d2a var(--bg, none) center / cover no-repeat;
  display: flex;
  flex-direction: column;
}
#app .screen::before { /* legibility scrim over artwork backgrounds */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10, 6, 30, 0.35), rgba(10, 6, 30, 0.8));
  pointer-events: none;
}
#app .screen > * { position: relative; }

/* ---------- skinned controls ---------- */
#app .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 6px 22px 12px;
  font: 700 16px/1 var(--head);
  letter-spacing: 0.02em;
  color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  background: none; border: 0 solid transparent; border-width: 16px 22px;
  border-image: url("../extracted_assets/skin/btn-green.png") 44 60 fill / 16px 22px stretch;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s;
}
#app .btn:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
#app .btn:active:not(:disabled) { transform: translateY(1px); }
#app .btn:disabled { cursor: not-allowed; opacity: 0.55; }
#app .btn-green { border-image-source: url("../extracted_assets/skin/btn-green.png"); }
#app .btn-yellow { border-image-source: url("../extracted_assets/skin/btn-yellow.png"); }
#app .btn-blue { border-image-source: url("../extracted_assets/skin/btn-blue.png"); }
#app .btn-gray { border-image-source: url("../extracted_assets/skin/btn-gray.png"); }
#app .btn .btn-icon { width: 22px; height: 22px; }

#app .icon-btn {
  display: inline-flex; align-items: center; gap: 4px;
  width: auto; height: 44px; min-width: 44px; padding: 6px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer;
}
#app .icon-btn:hover { background: rgba(255, 255, 255, 0.16); }
#app .icon-btn img { height: 28px; width: auto; }
#app .icon-btn span { font: 700 14px var(--head); padding-inline-end: 4px; }

#app .badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font: 700 11px/1.2 var(--head); letter-spacing: 0.03em; text-transform: uppercase;
  background: #444; color: #fff;
}
#app .badge.playable { background: var(--green); }
#app .badge.preview { background: #2f7fd4; }
#app .badge.locked { background: #5a5670; }
#app .muted { color: var(--muted-ink); }

/* ---------- splash ---------- */
#app .splash { align-items: center; justify-content: center; }
#app .splash-inner { display: grid; justify-items: center; gap: 22px; padding: 16px; text-align: center; }
#app .splash-logo { width: min(460px, 80vw); height: auto; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5)); }
#app .progress { width: min(360px, 70vw); height: 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.45); overflow: hidden; }
#app .progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22b24c, #7ee08a); transition: width 0.2s; }
#app .splash-start { min-width: 220px; font-size: 20px; }
#app .splash-status { margin: 0; color: var(--muted-ink); }

/* ---------- login / profile ---------- */
#app .login { align-items: center; justify-content: center; padding: 16px; }
#app .card { background: var(--panel-bg); border: 1px solid var(--line); border-radius: 22px; padding: 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
#app .login-card { width: min(460px, 100%); text-align: center; display: grid; gap: 10px; }
#app .login-logo { width: 220px; height: auto; margin: 0 auto; }
#app .login-card h1 { margin: 4px 0 0; font: 800 28px var(--head); }
#app .login-card p { margin: 0 0 8px; }
#app .profile-form { display: grid; gap: 16px; text-align: start; }
#app .field { display: grid; gap: 6px; font: 600 14px var(--font); }
#app .field input {
  font: 600 16px var(--font); color: var(--ink);
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35);
}
#app .field input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
#app .avatars { border: 0; padding: 0; margin: 0; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
#app .avatars legend { font: 600 14px var(--font); margin-bottom: 8px; width: 100%; text-align: start; }
#app .avatar-pick input { position: absolute; opacity: 0; pointer-events: none; }
#app .avatar-ring {
  display: block; width: 72px; height: 72px; border-radius: 50%; overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.35); background: #1b1f2e; cursor: pointer;
}
#app .avatar-ring img { width: 100%; height: 100%; object-fit: cover; }
#app .avatar-ring img.top { object-position: top; }
#app .avatar-pick input:checked + .avatar-ring { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 213, 74, 0.35); }
#app .avatar-pick input:focus-visible + .avatar-ring { outline: 2px solid #fff; outline-offset: 2px; }
#app .avatar-ring.small { width: 44px; height: 44px; border-width: 2px; }

/* ---------- home ---------- */
#app .topbar {
  position: relative; top: auto; z-index: 1; flex-wrap: nowrap;
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: linear-gradient(180deg, rgba(8, 5, 24, 0.85), rgba(8, 5, 24, 0.4));
  border-bottom: 1px solid var(--line);
}
#app .profile-chip {
  display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  min-width: 0;
}
#app[dir="rtl"] .profile-chip { padding: 4px 4px 4px 14px; }
#app .profile-chip .who { display: grid; text-align: start; min-width: 0; }
#app .profile-chip b { font: 700 15px var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
#app .profile-chip small { color: var(--muted-ink); font-size: 12px; }
#app .top-logo { height: 38px; width: auto; margin-inline: auto; }
#app .top-actions { display: flex; gap: 8px; }

#app .home-body { flex: 1; overflow-y: auto; padding: 16px 16px 96px; }
#app .featured h2, #app .section-title { margin: 4px 0 12px; font: 800 20px var(--head); }
#app .featured-row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
#app .cats { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 14px; scroll-margin-top: 12px; }
#app .chip {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.07);
  font: 700 14px var(--head); cursor: pointer;
}
#app .chip small { color: var(--muted-ink); font-weight: 600; }
#app .chip[aria-pressed="true"] { background: var(--gold); color: #2a1d00; border-color: var(--gold); }
#app .chip[aria-pressed="true"] small { color: #5a4300; }

#app .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; }
#app .tile {
  position: relative; display: block; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 14px; aspect-ratio: 308 / 444; overflow: visible; scroll-snap-align: start;
  transition: transform 0.12s;
}
#app .tile:hover { transform: translateY(-3px); }
#app .tile:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
#app .tile-img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45)); }
#app .tile.locked .tile-img { filter: grayscale(0.55) brightness(0.72) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45)); }
#app .tile .badge { position: absolute; top: 8px; inset-inline-start: 8px; }
#app .tile .lock { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
#app .tile .lock img { width: 34%; opacity: 0.9; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6)); }
#app .tile-name {
  position: absolute; left: 0; right: 0; bottom: -4px; transform: translateY(100%);
  font: 600 12px var(--font); color: var(--muted-ink); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#app .grid .tile { margin-bottom: 22px; }
#app .tile.big { flex: 0 0 auto; width: clamp(140px, 18vw, 200px); margin-bottom: 22px; }
#app .tile.big .tile-name { color: var(--ink); font-weight: 700; }

#app .bottom-nav {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; justify-content: center; gap: clamp(8px, 4vw, 48px);
  padding: 8px 16px 10px;
  background: linear-gradient(0deg, rgba(8, 5, 24, 0.98), rgba(8, 5, 24, 0.75));
  border-top: 1px solid var(--line);
}
#app .nav-item {
  display: grid; justify-items: center; gap: 2px; min-width: 64px; padding: 4px 8px;
  background: none; border: 0; border-radius: 12px; cursor: pointer; color: var(--muted-ink);
  font: 700 12px var(--head);
}
#app .nav-item img { height: 34px; width: auto; filter: grayscale(0.4) brightness(0.8); transition: transform 0.12s; }
#app .nav-item.active { color: var(--gold); }
#app .nav-item.active img { filter: none; transform: scale(1.12); }
#app .nav-item.disabled img { filter: grayscale(1) brightness(0.6); }
#app .nav-item:hover img { transform: scale(1.08); }

/* ---------- dialogs ---------- */
#app dialog.sheet {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  padding: 22px; border: 1px solid var(--line); border-radius: 22px;
  background: var(--panel-bg); color: var(--ink); font-family: var(--font);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
#app dialog.sheet::backdrop { background: rgba(5, 3, 18, 0.65); }
#app dialog.sheet h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font: 800 22px var(--head); }
#app .title-icon { width: 30px; height: 30px; }
#app .sheet-close { position: absolute; top: 12px; inset-inline-end: 12px; width: 40px; height: 40px; padding: 0; border: 0; background: none; cursor: pointer; }
#app .sheet-close img { width: 100%; height: 100%; }
#app dialog.sheet { position: fixed; }

#app .detail { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: start; }
#app .detail-tile { width: 100%; height: auto; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5)); }
#app .detail-body { display: grid; gap: 10px; justify-items: start; }
#app .detail-body h2 { margin: 0; }
#app .detail-body p { margin: 0; line-height: 1.5; }
#app .detail-body .btn { width: 100%; }

#app .settings { display: grid; gap: 12px; }
#app .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#app .row.col { flex-direction: column; align-items: stretch; }
#app .row.buttons { justify-content: flex-start; flex-wrap: wrap; }
#app .row-label { display: flex; align-items: center; gap: 10px; font: 700 15px var(--head); }
#app .row-label.sub { font: 600 13px var(--font); color: var(--muted-ink); padding-inline-start: 34px; }
#app .row-icon { width: 24px; height: 24px; object-fit: contain; }
#app .hint { margin: -6px 0 0; font-size: 12px; color: var(--muted-ink); }

#app .toggle {
  width: 64px; height: 35px; flex: none; padding: 0; border: 0; cursor: pointer; position: relative;
  background: url("../extracted_assets/skin/toggle-off-bg.png") center / 100% 100% no-repeat;
}
#app .toggle::after {
  content: ""; position: absolute; top: 0; left: 0; width: 35px; height: 35px;
  background: url("../extracted_assets/skin/toggle-off-knob.png") center / contain no-repeat;
  transition: transform 0.18s;
}
#app .toggle[aria-checked="true"] { background-image: url("../extracted_assets/skin/toggle-on-bg.png"); }
#app .toggle[aria-checked="true"]::after { background-image: url("../extracted_assets/skin/toggle-on-knob.png"); transform: translateX(29px); }
#app .toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 99px; }

#app .slider {
  --v: 0.5;
  position: relative; flex: 1; max-width: 260px; height: 28px;
  background:
    url("../extracted_assets/skin/slider-fill.png") left center / calc(var(--v) * 100%) 12px no-repeat,
    url("../extracted_assets/skin/slider-base.png") center / 100% 14px no-repeat;
}
#app .slider input { position: absolute; inset: 0; width: 100%; margin: 0; opacity: 1; background: none; appearance: none; -webkit-appearance: none; cursor: pointer; }
#app .slider input::-webkit-slider-runnable-track { background: none; height: 28px; }
#app .slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border: 0; background: url("../extracted_assets/skin/slider-handle.png") center / contain no-repeat; }
#app .slider input::-moz-range-thumb { width: 26px; height: 26px; border: 0; background: url("../extracted_assets/skin/slider-handle.png") center / contain no-repeat; }
#app .slider input::-moz-range-track { background: none; }
#app .slider input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 99px; }

#app .segmented { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px; background: rgba(0, 0, 0, 0.35); border-radius: 12px; }
#app .segmented button {
  flex: 1; min-width: 90px; padding: 9px 10px; border: 0; border-radius: 9px; background: none; cursor: pointer;
  font: 700 14px var(--head); color: var(--muted-ink);
}
#app .segmented button[aria-checked="true"] { background: var(--green); color: #fff; box-shadow: 0 2px 0 #137a31; }
#app .dev summary { cursor: pointer; color: var(--muted-ink); font-weight: 600; margin-top: 4px; }
#app .dev .row { margin-top: 10px; }
#app .help p { line-height: 1.6; margin: 0 0 12px; }

#app .toast {
  position: absolute; left: 50%; bottom: 96px; z-index: 5; transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 999px; background: rgba(0, 0, 0, 0.85); color: #fff; font: 600 14px var(--font);
  opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
#app .toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- game screen ---------- */
#app .game-screen { background: #0b0a14; }
#app .game-screen::before { display: none; }
/* the app's in-game bar: menu · radio | title | invite · social — same physical order in both languages */
#app .game-bar { direction: ltr; display: flex; align-items: center; gap: 14px; padding: 8px 18px; border-bottom: 2px solid #2b2a2e; background: #19181b; }
#app .game-bar .icon-btn { position: relative; background: none; border: 0; width: 44px; height: 44px; padding: 4px; }
#app .game-bar .icon-btn img { width: 100%; height: 100%; object-fit: contain; }
#app .game-bar .game-title { direction: rtl; unicode-bidi: plaintext; }
#app .bar-badge { position: absolute; inset-inline-end: -4px; bottom: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: #e0262b; color: #fff; font: 800 12px/20px var(--head); text-align: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
#app .bar-menu { position: absolute; z-index: 30; margin: 4px 0 0 12px; display: grid; min-width: 200px; padding: 6px; border-radius: 14px;
  background: #1f1e22; border: 1px solid #2f2e33; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); }
#app .bar-menu button { padding: 12px 16px; border: 0; border-radius: 10px; background: none; color: #fff; font: 700 15px var(--head); text-align: start; cursor: pointer; }
#app .bar-menu button:hover { background: rgba(255, 255, 255, 0.08); }
#app .game-screen { position: relative; }
#app .btn-back {
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08);
  font: 700 14px var(--head); cursor: pointer;
}
#app .btn-back:hover { background: rgba(255, 255, 255, 0.16); }
#app .game-title { flex: 1; font: 800 18px var(--head); text-align: center; }
#app .game-stage { flex: 1; display: grid; place-items: center; padding: 8px; min-height: 0;
  background: var(--bg, none) center / cover no-repeat, #1b1a1d; } /* extracted GameBackground behind the canvas */
#app .game-stage canvas {
  display: block; width: min(100%, calc((100dvh - var(--hdr, 56px) - 74px) * 16 / 9)); height: auto; aspect-ratio: 16 / 9;
  background: #000; border-radius: 8px; touch-action: manipulation;
}
/* portrait table (iPad / phone upright): the module switches to its 750x1000 layout */
#app .game-stage canvas[data-layout="portrait"] {
  width: min(100%, calc((100dvh - var(--hdr, 56px) - 78px) * 3 / 4)); aspect-ratio: 3 / 4; background: transparent; border-radius: 0;
}
/* wide arrangement of the same app-styled table: fills wide windows */
#app .game-stage canvas[data-layout="wide"] { background: transparent; border-radius: 0; }

@media (max-width: 640px) {
  #app .topbar {
  position: relative; top: auto; z-index: 1; flex-wrap: nowrap; padding: 8px 12px; gap: 8px; }
  #app .top-logo { display: none; }
  #app .profile-chip b { max-width: 100px; }
  #app .home-body { padding: 12px 16px 96px; }
  #app .grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
  #app .detail { grid-template-columns: 1fr; }
  #app .detail-tile { width: 150px; margin: 0 auto; }
  #app .nav-item { min-width: 56px; }
}

/* the viewer's global `main { margin: 0 auto; display: grid }` must not shrink the lobby */
#app main.home-body { max-width: none; width: 100%; margin: 0; display: block; }
/* fixed-height screens: the lobby scrolls inside, bottom nav stays pinned */
#app .home, #app .game-screen { height: calc(100dvh - var(--hdr, 56px)); min-height: 480px; }
#app .top-logo { height: 46px; }

/* ---------- Phase 4b: extracted skins replacing CSS-drawn chrome ---------- */
/* dialogs: extracted "PopupFlat" frame */
#app dialog.sheet {
  background: none; border: 0 solid transparent; border-width: 30px;
  border-image: url("../extracted_assets/skin/sheet.png") 60 fill / 30px stretch;
  padding: 0; box-shadow: none;
}
#app dialog.sheet > * { position: relative; }
#app .sheet-close { top: 0; inset-inline-end: 0; }
/* segmented controls + category chips: extracted "SegmentedButton" (selected) / "SegmentedButton_Purple" (idle) */
#app .segmented { background: none; padding: 0; gap: 8px; }
#app .segmented button, #app .chip {
  background: none; border: 0 solid transparent; border-width: 10px 16px; border-radius: 0;
  border-image: url("../extracted_assets/skin/seg-off.png") 60 fill / 10px 16px stretch;
  color: #fff; padding: 2px 6px 6px; box-shadow: none;
}
#app .segmented button[aria-checked="true"], #app .chip[aria-pressed="true"] {
  border-image-source: url("../extracted_assets/skin/seg-on.png"); color: #2a1d00; background: none; box-shadow: none;
}
#app .chip small { color: inherit; opacity: 0.75; }
/* text input: extracted "InputFieldBackground" */
#app .field input {
  background: none; color: #1d1d1f; border: 0 solid transparent; border-width: 8px; border-radius: 0;
  border-image: url("../extracted_assets/skin/input.png") 8 fill / 8px stretch; padding: 6px 8px;
}
#app .field input::placeholder { color: #7a7690; }
/* splash progress: extracted slider track + fill */
#app .progress { height: 16px; background: url("../extracted_assets/skin/slider-base.png") center / 100% 100% no-repeat; border-radius: 0; }
#app .progress span { background: url("../extracted_assets/skin/slider-fill.png") left center / 100% 100% no-repeat; border-radius: 0; }
/* thumbnail pickers (decks, card backs, tables) */
#app .picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
#app .picker button {
  display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border-radius: 12px; cursor: pointer;
  background: rgba(0, 0, 0, 0.3); border: 2px solid transparent; font: 700 12px var(--head); color: var(--muted-ink);
}
#app .picker button img { height: 74px; width: auto; max-width: 100%; object-fit: contain; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5)); }
#app .picker button[aria-checked="true"] { border-color: var(--gold); color: #fff; background: rgba(255, 213, 74, 0.12); }
#app .picker button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- Phase 5: shell completion ---------- */
/* animated nav icons (Lottie, static sprite fallback) */
#app .nav-icon { display: block; width: 44px; height: 40px; }
#app .nav-icon svg, #app .nav-icon img { width: 100% !important; height: 100% !important; object-fit: contain; }
#app .nav-item:not(.active) .nav-icon { filter: grayscale(0.4) brightness(0.8); }
#app .nav-item img { height: 100%; }
/* topbar bell with unseen dot */
#app .icon-btn.bell { position: relative; }
#app .icon-btn .dot { position: absolute; top: 4px; inset-inline-end: 4px; width: 12px; height: 12px; }
/* "New" ribbons on playable tiles */
#app .tile .ribbon { position: absolute; top: -2px; right: -2px; width: 34%; height: auto; pointer-events: none; } /* corner art: never mirror (Arabic text) */
#app .tile .badge { top: auto; bottom: 8px; }
/* search + categories */
#app .browse-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 20px 0 14px; scroll-margin-top: 12px; }
#app .browse-bar .cats { margin: 0; }
#app .search { position: relative; flex: 1 1 240px; max-width: 420px; height: 44px; background: rgba(0, 0, 0, 0.55); border: 1px solid var(--line); border-radius: 22px; display: flex; }
#app .search-icon { position: absolute; top: 10px; inset-inline-start: 14px; width: 22px; height: 22px; pointer-events: none; }
#app .search input { flex: 1; min-width: 0; border: 0; background: none; color: #fff; font: 600 15px var(--font); padding: 0 16px 0 44px; outline: none; }
#app[dir="rtl"] .search input { padding: 0 44px 0 16px; }
#app .search:focus-within { box-shadow: 0 0 0 2px var(--gold); }
#app .search input::placeholder { color: #9d99b8; }
#app .empty { grid-column: 1 / -1; color: var(--muted-ink); text-align: center; padding: 24px; }
/* coming-soon promo cards + banners */
#app .promo { display: flex; gap: 16px; align-items: center; margin: 0 0 14px; padding: 16px; border-radius: 18px; background: rgba(12, 8, 30, 0.72); border: 1px solid var(--line); }
#app .promo h3 { margin: 0 0 4px; font: 800 18px var(--head); }
#app .promo p { margin: 0 0 10px; }
#app .promo-icon, #app .promo-anim { flex: none; width: 96px; height: 96px; object-fit: contain; display: block; }
#app .promo-anim img { width: 100%; height: 100%; object-fit: contain; }
#app .banner { height: 140px; margin-bottom: 16px; border-radius: 18px; background: var(--img) center / cover no-repeat; display: flex; align-items: flex-end; padding: 16px 20px; }
#app .banner h2 { margin: 0; font: 800 28px var(--head); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); }
#app .friends-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; padding: 20px; margin-bottom: 16px; border-radius: 18px; background: rgba(12, 8, 30, 0.72); border: 1px solid var(--line); }
#app .friends-hero h2 { margin: 0 0 6px; font: 800 24px var(--head); }
#app .hero-anim { width: 200px; height: 200px; flex: none; display: block; }
#app .hero-anim img { width: 100%; height: 100%; object-fit: contain; }
/* profile page */
#app .profile-head {
  position: relative; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; min-height: 200px; padding: 20px;
  border-radius: 18px; background: linear-gradient(0deg, rgba(8, 5, 24, 0.85), rgba(8, 5, 24, 0.1) 60%), var(--cover) center / cover no-repeat;
}
#app .profile-head .who { flex: 1; min-width: 0; }
#app .profile-head h2 { margin: 0; font: 800 26px var(--head); }
#app .profile-head p { margin: 2px 0 0; }
#app .avatar-ring.big { width: 112px; height: 112px; border-width: 4px; }
#app .stat-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
#app .stat-card { display: grid; justify-items: center; gap: 2px; padding: 14px 8px; border-radius: 16px; background: rgba(12, 8, 30, 0.72); border: 1px solid var(--line); }
#app .stat-card img { width: 48px; height: 48px; object-fit: contain; }
#app .stat-card b { font: 800 26px var(--head); }
#app .stat-card span { color: var(--muted-ink); font-size: 13px; text-align: center; }
#app .stat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#app .stat-list li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 14px; background: rgba(12, 8, 30, 0.6); }
#app .stat-list b { flex: 1; font: 700 15px var(--head); }
#app .stat-list span { color: var(--muted-ink); font-size: 13px; }
#app .stat-icon { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; }
#app .covers { border: 0; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }
#app .covers legend { font: 600 14px var(--font); margin-bottom: 8px; }
#app .cover-pick input { position: absolute; opacity: 0; }
#app .cover-pick span { display: block; width: 140px; height: 64px; border-radius: 10px; overflow: hidden; border: 3px solid transparent; cursor: pointer; }
#app .cover-pick img { width: 100%; height: 100%; object-fit: cover; }
#app .cover-pick input:checked + span { border-color: var(--gold); }
#app .field select { font: 600 15px var(--font); color: #1d1d1f; border: 0 solid transparent; border-width: 8px; border-image: url("../extracted_assets/skin/input.png") 8 fill / 8px stretch; padding: 4px 6px; }
/* notifications */
#app .news { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
#app .news li { display: flex; gap: 12px; align-items: flex-start; }
#app .news p { margin: 2px 0 0; }
#app .news-dot { flex: none; width: 28px; height: 28px; display: block; }
/* game page media */
#app dialog.detail-sheet { width: min(760px, calc(100vw - 32px)); }
#app .sub { margin: 18px 0 8px; font: 800 16px var(--head); }
#app .howto { width: 100%; max-height: 320px; aspect-ratio: 25 / 12; background: rgba(0, 0, 0, 0.35); border-radius: 12px; overflow: hidden; }
#app .sound-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow: auto; }
#app .sound-chip { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.07); font: 600 12px var(--font); cursor: pointer; }
#app .sound-chip:hover { background: rgba(255, 213, 74, 0.18); }
#app .art-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
#app .art-strip img { width: 100%; aspect-ratio: 1; object-fit: contain; background: rgba(0, 0, 0, 0.3); border-radius: 10px; padding: 4px; }
#app .nudge { display: inline-block; width: 28px; height: 28px; vertical-align: middle; margin-inline-end: 6px; }
/* settings extras */
#app .row-anim { display: inline-block; width: 30px; height: 30px; }
#app .btn-yellow { color: #2a1d00; text-shadow: none; }
/* splash animation + toast animation */
#app .splash-anim { display: block; width: min(420px, 70vw); aspect-ratio: 8 / 3; }
#app .toast { display: flex; align-items: center; gap: 8px; }
#app .toast-anim { width: 28px; height: 28px; flex: none; }
/* onboarding tour */
#app .tour { position: absolute; inset: 0; z-index: 20; background: rgba(5, 3, 18, 0.62); display: flex; align-items: center; justify-content: center; padding: 16px; }
#app .tour.anchored { align-items: flex-end; padding-bottom: 110px; background: rgba(5, 3, 18, 0.45); }
#app .tour-card { display: flex; align-items: flex-end; gap: 8px; max-width: 620px; width: 100%; }
#app .tour-art { position: relative; flex: none; width: 170px; pointer-events: none; } /* decoration must never block Skip/Next */
#app .tour-char { width: 170px; height: auto; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6)); position: relative; }
#app .tour-anim { position: absolute; bottom: 60%; inset-inline-start: 40%; width: 360px; aspect-ratio: 25 / 18; display: block; }
#app .tour-bubble { flex: 1; background: #fff; color: #1d1d1f; border-radius: 18px; padding: 16px 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
#app .tour-bubble p { margin: 0 0 12px; font: 600 16px/1.5 var(--font); }
#app .tour-target { position: relative; z-index: 21; box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(255, 213, 74, 0.6); border-radius: 16px; }
/* matchmaking transition over the game stage */
#app .game-stage { position: relative; }
#app .matchmaking { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; align-content: center; gap: 10px; background: rgba(8, 5, 24, 0.94); transition: opacity 0.25s; }
#app .matchmaking.out { opacity: 0; }
#app .mm-anim { width: min(300px, 50vw); aspect-ratio: 1; display: block; }
#app .matchmaking p { margin: 0; font: 800 20px var(--head); }
@media (max-width: 640px) {
  #app .stat-cards { gap: 8px; }
  #app .stat-card b { font-size: 20px; }
  #app .tour-art, #app .tour-char { width: 110px; }
  #app .tour-anim { width: 200px; bottom: 100%; inset-inline-start: 20px; }
  #app .tour-card { flex-direction: column; align-items: flex-start; }
  #app .promo { flex-direction: column; text-align: center; }
  #app .hero-anim { width: 150px; height: 150px; }
  #app .profile-head { align-items: center; }
  #app .profile-head .who { flex: 1 1 140px; }
  #app .profile-head .btn { flex: 1 1 100%; }
  #app .avatar-ring.big { width: 88px; height: 88px; }
  #app .bottom-nav { gap: 2px; }
  #app .nav-item { min-width: 0; flex: 1; font-size: 11px; }
}

/* ---------- Phase 6: progression + economy ---------- */
#app .coins { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; white-space: nowrap; }
#app .coins .coin { width: 20px; height: 20px; }
#app .coin-chip, #app .level-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line); font: 800 15px var(--head); color: #fff;
}
#app .coin-chip:hover, #app .level-chip:hover { border-color: var(--gold); }
#app .level-chip .xp-icon { width: 30px; height: 26px; object-fit: contain; }
#app .level-chip .lvl { min-width: 16px; text-align: center; }
#app .xpbar { width: 64px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
#app .xpbar i, #app .bar i { display: block; height: 100%; background: linear-gradient(90deg, #f7b500, #ffd54a); border-radius: inherit; }
#app .bar { display: block; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; margin: 6px 0 4px; }
#app .bar.big { height: 14px; }
#app .nav-item { position: relative; }
#app .nav-dot { position: absolute; top: 2px; inset-inline-end: 14px; width: 12px !important; height: 12px !important; }
#app .panel-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px; margin-bottom: 16px; border-radius: 18px; background: rgba(12, 8, 30, 0.72); border: 1px solid var(--line); }
#app .panel-card h3 { margin: 0; font: 800 20px var(--head); }
#app .panel-card > div { flex: 1 1 220px; }
#app .level-card .lvl-anim { width: 180px; aspect-ratio: 1066 / 760; flex: none; display: block; }
#app .level-card .daily { flex: 0 0 auto; display: grid; justify-items: center; gap: 6px; }
#app .daily-chest { width: 88px; height: auto; }
#app .title-icon { width: 30px; height: 30px; object-fit: contain; vertical-align: middle; margin-inline-end: 6px; }
#app .missions { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
#app .mission { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: rgba(12, 8, 30, 0.72); border: 1px solid var(--line); }
#app .mission.ready { border-color: var(--green); box-shadow: 0 0 0 1px var(--green) inset; }
#app .mission.claimed { opacity: 0.6; }
#app .m-icon { width: 52px; height: 52px; object-fit: contain; }
#app .m-body { flex: 1; min-width: 0; }
#app .m-body small { color: var(--muted-ink); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#app .mission .btn { min-height: 40px; }
#app .mission .done { color: #7ee08a; font-weight: 800; }
#app .road { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
#app .road-step { display: grid; justify-items: center; gap: 4px; padding: 12px 6px; border-radius: 16px; border: 2px solid var(--line); background: rgba(12, 8, 30, 0.72); color: #fff; font: 700 14px var(--head); cursor: pointer; }
#app .road-step .chest { width: 76px; height: 70px; object-fit: contain; }
#app .road-step .trophy { width: 18px; height: 18px; vertical-align: -3px; }
#app .road-step.locked { opacity: 0.55; filter: grayscale(0.6); cursor: default; }
#app .road-step.ready { border-color: var(--gold); animation: pulse 1.2s infinite; }
#app .road-step.claimed { opacity: 0.5; cursor: default; }
@keyframes pulse { 50% { box-shadow: 0 0 18px rgba(255, 213, 74, 0.6); } }
#app .badges { display: grid; gap: 10px; }
#app .badge-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 16px; background: rgba(12, 8, 30, 0.6); }
#app .badge-row > b { flex: 0 0 130px; font: 700 15px var(--head); }
#app .badge-row > div { display: flex; gap: 10px; }
#app .badge-row figure { margin: 0; display: grid; justify-items: center; font-size: 12px; color: var(--muted-ink); }
#app .badge-row figure img { width: 54px; height: 54px; }
#app .badge-row figure.locked img { filter: grayscale(1) brightness(0.45); }
/* store */
#app .store-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
#app .store-head h2 { margin: 0; font: 800 26px var(--head); }
#app .store-head p { margin: 2px 0 0; }
#app .store-head > div:not(.balance) { flex: 1; }
#app .store-coins { width: 90px; height: 90px; object-fit: contain; }
#app .balance { font-size: 22px; padding: 8px 16px; border-radius: 999px; background: rgba(0, 0, 0, 0.45); }
#app .balance .coin { width: 28px; height: 28px; }
#app .pack-card .pack-anim { width: 120px; aspect-ratio: 600 / 750; display: block; flex: none; }
#app .pack-card .pack-img { width: 160px; height: auto; flex: none; }
#app .store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
#app .store-item { position: relative; display: grid; justify-items: center; gap: 8px; padding: 12px; border-radius: 16px; background: rgba(12, 8, 30, 0.72); border: 2px solid var(--line); text-align: center; }
#app .store-item.rare { border-color: #3f86e8; }
#app .store-item.epic { border-color: #a24ae8; }
#app .store-item.legendary { border-color: #f2b705; }
#app .store-item .art { height: 110px; width: 100%; display: grid; place-items: center; }
#app .store-item .art img { max-height: 110px; max-width: 100%; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)); }
#app .art.round img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; object-position: top; background: #1b1f2e; }
#app .store-item b { font: 700 14px var(--head); }
#app .store-item .btn { width: 100%; min-height: 42px; }
#app .rarity { position: absolute; top: 8px; inset-inline-start: 8px; font: 800 10px var(--head); text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 99px; background: #444; }
#app .store-item.rare .rarity, #app .rarity.rare { background: #3f86e8; }
#app .store-item.epic .rarity, #app .rarity.epic { background: #a24ae8; }
#app .store-item.legendary .rarity, #app .rarity.legendary { background: #f2b705; color: #2a1d00; }
#app .equipped { color: #7ee08a; font-weight: 800; min-height: 42px; display: grid; place-items: center; }
#app .btn.price .coin { width: 18px; height: 18px; }
/* locked pickers / avatars */
#app .picker button.locked img { filter: grayscale(0.8) brightness(0.55); }
#app .avatar-pick.locked .avatar-ring { filter: grayscale(0.8) brightness(0.55); cursor: not-allowed; }
#app .avatar-pick, #app .cover-pick { position: relative; }
#app .lock-price { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); font-size: 11px; background: rgba(0, 0, 0, 0.8); padding: 1px 6px; border-radius: 99px; }
#app .lock-price .coin { width: 12px; height: 12px; }
#app .cover-pick.locked span { filter: grayscale(0.8) brightness(0.55); }
/* rewards + pack dialogs */
#app .rewards { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
#app .rewards li { display: flex; align-items: center; gap: 12px; font: 700 18px var(--head); }
#app .rewards li.big { justify-content: center; flex-direction: column; }
#app .r-anim { width: 64px; height: 64px; display: block; flex: none; }
#app .r-anim.wide { width: 260px; height: auto; aspect-ratio: 1066 / 760; }
#app .r-img { width: 56px; height: 56px; object-fit: contain; }
#app .r-chest { width: 150px; height: auto; }
#app .rewards .coin { width: 24px; height: 24px; }
#app .pack-reveal { position: relative; display: grid; place-items: center; min-height: 320px; }
#app .pack-anim.big { width: 260px; aspect-ratio: 780 / 1028; display: block; }
#app .pack-result { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 10px; background: rgba(20, 16, 44, 0.92); border-radius: 16px; text-align: center; }
#app .pack-result .rarity { position: static; font-size: 14px; padding: 4px 14px; }
#app .pack-result .art img { max-height: 180px; max-width: 220px; object-fit: contain; }
#app .pack-result .art.round img { width: 150px; height: 150px; }
@media (max-width: 640px) {
  #app .level-chip .xpbar { display: none; }
  #app .profile-chip { padding: 2px; }
  #app .profile-chip .who { display: none; } /* name lives on the profile page; the bar needs room for coins + level */
  #app .topbar .top-actions { gap: 4px; }
  #app .topbar .icon-btn { min-width: 38px; height: 38px; }
  #app .coin-chip, #app .level-chip { height: 36px; padding: 0 8px; font-size: 13px; }
  #app .road { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #app .badge-row > b { flex-basis: 100%; }
  #app .level-card .lvl-anim { width: 120px; }
  #app .store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Phase 7: social ---------- */
/* emoji cell from the extracted 4x4 EmojiOne sheet */
#app .emoji { display: inline-block; width: 36px; height: 36px; background: var(--img) var(--x) var(--y) / 400% 400% no-repeat; vertical-align: middle; }
/* chat drawer over the game stage */
#app .chat-drawer {
  position: absolute; z-index: 4; bottom: 12px; inset-inline-end: 12px; width: min(360px, calc(100% - 24px)); max-height: calc(100% - 24px);
  display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  background: rgba(14, 10, 34, 0.97); border: 1px solid var(--line); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6);
}
#app .chat-drawer header { display: flex; align-items: center; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
#app .chat-drawer .tabs { display: flex; gap: 4px; flex: 1; }
#app .chat-drawer .tabs button { flex: 1; padding: 7px 4px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.06); font: 700 12px var(--head); cursor: pointer; color: var(--muted-ink); }
#app .chat-drawer .tabs button[aria-selected="true"] { background: var(--gold); color: #2a1d00; }
#app .chat-drawer .icon-btn { height: 36px; min-width: 36px; }
#app .chat-drawer .icon-btn img { height: 22px; }
#app .chat-body { overflow: auto; padding: 10px; }
#app .phrases { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#app .phrases button { padding: 10px 8px; border-radius: 12px; border: 0; background: #fff; color: #1d1d1f; font: 700 13px var(--font); cursor: pointer; text-align: center; }
#app .phrases button:hover { background: #ffe9a8; }
#app .emojis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#app .emojis button { padding: 6px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.06); cursor: pointer; }
#app .emojis button:hover { background: rgba(255, 213, 74, 0.2); }
#app .emojis .emoji { width: 48px; height: 48px; }
#app .gifts { display: flex; gap: 8px; flex-wrap: wrap; }
#app .gifts button { display: grid; justify-items: center; gap: 4px; padding: 8px 10px; border-radius: 14px; border: 2px solid transparent; background: rgba(255, 255, 255, 0.06); cursor: pointer; color: #fff; }
#app .gifts button.sel { border-color: var(--gold); }
#app .gifts button img { width: 56px; height: 56px; object-fit: contain; }
#app .gift-targets { display: flex; gap: 6px; flex-wrap: wrap; }
#app .gift-targets .btn { min-height: 40px; flex: 1; }
#app .chat-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 260px; overflow: auto; }
#app .chat-log li { display: grid; gap: 2px; padding: 6px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
#app .chat-log li.me { background: rgba(34, 178, 76, 0.2); }
#app .chat-log li b { font-size: 12px; color: var(--muted-ink); }
#app .chat-log .emoji { width: 30px; height: 30px; }
#app .chat-gift { width: 28px; height: 28px; vertical-align: middle; }
/* player card */
#app .player-card { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
#app .player-card h2 { margin: 0 0 4px; }
#app .player-card p { margin: 2px 0; display: flex; align-items: center; gap: 6px; }
#app .online-dot { width: 14px; height: 14px; }
#app .player-actions { margin-top: 14px; }
#app .player-actions .btn { flex: 1; min-width: 110px; }
/* radio */
#app dialog.radio-sheet { width: min(640px, calc(100vw - 32px)); }
#app .now-playing { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 12px; margin-bottom: 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); }
#app .now-playing > div { flex: 1; min-width: 0; display: grid; }
#app .now-playing p { margin: 0; }
#app .now-playing .wave { width: 120px; height: 36px; display: block; flex: none; }
#app .radio-sheet .search { max-width: none; margin-bottom: 10px; }
#app .genres { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
#app .genres .chip { padding: 2px 6px 6px; font-size: 12px; }
#app .stations { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; display: grid; gap: 4px; }
#app .stations button { width: 100%; display: grid; text-align: start; gap: 2px; padding: 8px 12px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.05); cursor: pointer; }
#app .stations button:hover { background: rgba(255, 255, 255, 0.1); }
#app .stations button.on { background: rgba(34, 178, 76, 0.3); }
#app .stations small { color: var(--muted-ink); }
/* weekly league */
#app .league { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 6px; }
#app .league li { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 14px; background: rgba(12, 8, 30, 0.65); }
#app .league li.me { background: rgba(255, 213, 74, 0.18); border: 1px solid var(--gold); }
#app .league li.gap { justify-content: center; background: none; color: var(--muted-ink); }
#app .league .rank { width: 36px; text-align: center; font: 800 16px var(--head); }
#app .league .medal { width: 32px; height: 32px; }
#app .league b { flex: 1; font: 700 15px var(--head); }
#app .league .pts { font: 800 15px var(--head); display: inline-flex; align-items: center; gap: 4px; }
#app .league .trophy { width: 18px; height: 18px; }
#app .avatar-ring.tiny { width: 34px; height: 34px; border-width: 2px; }
/* rewards winner title */
#app .winner-title { width: 220px; height: auto; }
@media (max-width: 640px) {
  #app .chat-drawer { inset-inline-end: 8px; bottom: 8px; }
  #app .emojis .emoji { width: 40px; height: 40px; }
}

/* ---------- Phase 8: emotes, spectating, report/kick, options, spine ---------- */
#app .emote-pop { position: absolute; z-index: 3; pointer-events: none; animation: emoteIn 0.25s ease-out; transition: opacity 0.3s, transform 0.3s; }
#app .emote-pop.out { opacity: 0; transform: scale(0.8); }
#app .emote-pop img { width: 100%; height: 100%; object-fit: contain; }
#app .emote-pop canvas, #app .spine-cell canvas, #app .tour-arrow canvas, #app .mm-anim canvas, #app .pack-anim canvas, #app .wave canvas, #app .abdo-win canvas, #app .toast-anim canvas { background: transparent !important; }
#app .spine-player { background: transparent !important; }
@keyframes emoteIn { from { transform: scale(0.3); opacity: 0; } }
#app .broken img { filter: grayscale(0.2) hue-rotate(-20deg) brightness(0.8); }
#app .emotes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#app .emotes button { position: relative; padding: 6px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.06); cursor: pointer; aspect-ratio: 1; }
#app .emotes button img { width: 100%; height: 100%; object-fit: contain; }
#app .emotes button.locked img { filter: grayscale(0.8) brightness(0.5); }
#app .emotes button:hover { background: rgba(255, 213, 74, 0.2); }
/* spectate / live tables */
#app .live h2 { margin: 18px 0 10px; font: 800 20px var(--head); display: flex; align-items: center; }
#app .live-row { display: flex; gap: 10px; flex-wrap: wrap; }
#app .live-card { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 44px 10px 10px; border-radius: 16px; background: rgba(12, 8, 30, 0.75); border: 1px solid var(--line); cursor: pointer; color: #fff; text-align: start; }
#app .live-card:hover { border-color: var(--gold); }
#app .live-card div { display: grid; }
#app .live-card small { display: flex; align-items: center; gap: 4px; color: var(--muted-ink); }
#app .live-icon { width: 48px; height: 48px; border-radius: 10px; }
#app .spect { width: 18px; height: 14px; object-fit: contain; }
#app .live-dot { position: absolute; top: 8px; inset-inline-end: 8px; font: 800 10px var(--head); background: #e53935; padding: 2px 6px; border-radius: 6px; animation: pulse 1.4s infinite; }
#app .btn.watch .btn-icon { width: 26px; height: 26px; }
#app .game-title .title-icon { width: 24px; height: 20px; }
/* game options on the game page */
#app .game-opts { position: relative; display: grid; gap: 6px; width: 100%; padding: 10px; border-radius: 14px; background: rgba(0, 0, 0, 0.3); }
#app .game-opts .opt-icon { position: absolute; top: 8px; inset-inline-end: 8px; width: 34px; height: 34px; }
#app .game-opts .segmented button { min-width: 0; font-size: 13px; }
#app .spine-row { display: flex; gap: 12px; flex-wrap: wrap; }
#app .spine-cell { width: 220px; height: 220px; border-radius: 12px; background: rgba(0, 0, 0, 0.35); overflow: hidden; }
/* report form */
#app .report-form { display: grid; gap: 10px; }
#app .radio-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); cursor: pointer; font-weight: 600; }
#app .radio-row input { width: 18px; height: 18px; accent-color: #22b24c; }
#app .report-form textarea { font: 500 14px var(--font); color: #1d1d1f; padding: 8px; border-radius: 10px; border: 0; resize: vertical; }
/* spine in tour / matchmaking / pack / radio / rewards */
#app .tour-arrow { position: absolute; z-index: 22; width: 60px; height: 106px; pointer-events: none; }
#app .tour-arrow.flip { transform: rotate(180deg); }
#app .mm-anim { width: min(340px, 50vw); aspect-ratio: 987 / 1224; max-height: 60%; }
#app .pack-anim.spine { width: 260px; height: 360px; display: block; }
#app .now-playing .wave { width: 180px; height: 40px; }
#app .abdo-win { display: block; width: 300px; height: 250px; margin-top: -30px; }
#app .toast-anim { width: 36px; height: 36px; }

/* spine-player 3.8 without its stylesheet (the CDN refuses the .css): canvas fills the host, no controls/logo */
#app .spine-player { position: relative; width: 100%; height: 100%; }
#app .spine-player-canvas { display: block; width: 100%; height: 100%; }
#app .spine-player-controls, #app .spine-player-error, #app .spine-player-popup { display: none !important; }

/* test mode badge */
#app .test-badge { display: inline-block; margin: 6px 0 0; padding: 4px 12px; border-radius: 99px; background: #f2b705; color: #2a1d00; font: 800 12px var(--head); }

/* ---------- Phase 9: the app's remaining shell chrome ---------- */
/* XP bar (top bar) and progress bars (missions, level) */
#app .xpbar { width: 70px; height: 14px; border-radius: 0; background: url("../extracted_assets/skin/xp-empty.png") center / 100% 100% no-repeat; overflow: hidden; }
#app .xpbar i { background: url("../extracted_assets/skin/xp-fill.png") left center / 70px 100% no-repeat; border-radius: 0; }
#app .bar { height: 14px; border-radius: 0; background: none; border: 0 solid transparent; border-width: 7px;
  border-image: url("../extracted_assets/skin/prog-empty.png") 54 fill / 7px stretch; overflow: visible; position: relative; box-sizing: border-box; }
#app .bar i { position: absolute; left: -7px; top: -7px; bottom: -7px; max-width: calc(100% + 14px); min-width: 0; border-radius: 0; background: none;
  border: 0 solid transparent; border-width: 7px; border-image: url("../extracted_assets/skin/prog-fill.png") 47 fill / 7px stretch; }
#app .bar i[style*="width:0%"] { display: none; }
#app .bar.big { height: 18px; }
/* toast: white message container */
#app .toast { background: none; color: #1d1d1f; border: 0 solid transparent; border-width: 12px 20px; border-radius: 0;
  border-image: url("../extracted_assets/skin/toast.png") 40 fill / 12px 20px stretch; font-weight: 700; padding: 2px 6px; }
/* onboarding bubble: tooltip square + triangle */
#app .tour-bubble { position: relative; background: none; border: 0 solid transparent; border-width: 18px; border-radius: 0; padding: 0; box-shadow: none;
  border-image: url("../extracted_assets/skin/tip.png") 40 fill / 18px stretch; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.5)); }
#app .tour-bubble::before { content: ""; position: absolute; left: -38px; bottom: 10px; width: 24px; height: 30px; background: url("../extracted_assets/skin/tip-arrow.png") center / contain no-repeat; }
#app[dir="rtl"] .tour-bubble::before { left: auto; right: -38px; transform: scaleX(-1); }
/* report form radios / checkbox */
#app .radio-row input[type="radio"], #app .radio-row input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 26px; height: 26px; margin: 0; flex: none;
  background: url("../extracted_assets/skin/radio-off.png") center / contain no-repeat; cursor: pointer; }
#app .radio-row input[type="radio"]:checked { background-image: url("../extracted_assets/skin/radio-on.png"); }
#app .radio-row input[type="checkbox"] { background-image: url("../extracted_assets/skin/check-box.png"); }
#app .radio-row input[type="checkbox"]:checked { background: url("../extracted_assets/skin/checkmark.png") center / 60% no-repeat, url("../extracted_assets/skin/check-fill.png") center / 100% 100% no-repeat; border-radius: 6px; }
/* chips: the app's selected / unselected chips */
#app .chip { border-image-source: url("../extracted_assets/skin/chip-off.png"); border-image-slice: 44 fill; border-width: 12px 22px; color: #fff; }
#app .chip[aria-pressed="true"] { border-image-source: url("../extracted_assets/skin/chip-on.png"); color: #2a1d00; }
/* bell: red notification bubble with count */
#app .notif-count { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center;
  background: url("../extracted_assets/skin/notif.png") center / 100% 100% no-repeat; color: #fff; font: 800 11px var(--head); border-radius: 50%; }
/* news header */
#app .news-header { margin: -4px -4px 14px; padding: 10px 14px; border-radius: 12px; background: url("../extracted_assets/skin/news-header.png") center / cover no-repeat; }
#app .news-header h2 { margin: 0; }
/* store: awning header, category tabs, price labels, legendary ribbon */
#app .store-head { position: relative; padding-top: 34px; background: url("../extracted_assets/skin/store-header.png") top center / 100% 28px no-repeat; }
#app .store-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 14px; padding-bottom: 4px; }
#app .store-tabs button { flex: none; display: grid; justify-items: center; gap: 2px; width: 92px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(12, 8, 30, 0.72); cursor: pointer; font: 700 12px var(--head); color: #fff; }
#app .store-tabs button:hover { border-color: var(--gold); }
#app .store-tabs img { height: 40px; width: auto; }
#app .section-title[id^="store-"], #app #store-pack { scroll-margin-top: 10px; }
#app .store-item .btn.price { border-image-source: url("../extracted_assets/skin/price.png"); border-image-slice: 40 60 fill; color: #2a1d00; text-shadow: none; }
#app .store-item.legendary .rarity { background: url("../extracted_assets/skin/ribbon-red.png") center / 100% 100% no-repeat; color: #fff; padding: 3px 12px; }
/* home: daily missions widget */
#app .home-missions { display: flex; align-items: center; gap: 14px; width: 100%; margin: 18px 0 4px; padding: 14px 18px; cursor: pointer; text-align: start; color: #fff;
  background: none; border: 0 solid transparent; border-width: 24px; border-image: url("../extracted_assets/skin/home-card.png") 60 fill / 24px stretch; }
#app .home-missions .hm-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
#app .home-missions b { font: 800 18px var(--head); }
#app .home-missions small { color: var(--muted-ink); }
#app .hm-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
#app .hm-icon { width: 58px; height: 58px; }
#app .hm-chest { width: 72px; height: auto; }
/* chat log bubbles */
#app .chat-log li { background: none; border: 0 solid transparent; border-width: 12px; border-radius: 0; padding: 0 4px;
  border-image: url("../extracted_assets/skin/chat-other.png") 50 fill / 12px stretch; }
#app .chat-log li.me { border-image-source: url("../extracted_assets/skin/chat-mine.png"); border-image-slice: 30 fill; color: #1d1d1f; }
#app .chat-log li.me b { color: #555; }
/* profile: avatar backdrop */
#app .profile-head .avatar-ring.big { background: url("../extracted_assets/skin/prog-empty.png") center / 100% 100% no-repeat; }
/* progress bars: the app's round progress sprites stretched into pills (9-slicing the round sprite leaves end caps) */
#app .bar { height: 12px; border: 0; border-image: none; border-radius: 99px; overflow: hidden; position: relative;
  background: url("../extracted_assets/skin/prog-empty.png") center / 100% 100% no-repeat; }
#app .bar.big { height: 16px; }
#app .bar i { position: static; display: block; height: 100%; max-width: 100%; border: 0; border-image: none; border-radius: 99px;
  background: url("../extracted_assets/skin/prog-fill.png") center / 100% 100% no-repeat; }
/* progress bars: pill shape with the app's green fill */
#app .bar { background: rgba(0, 0, 0, 0.45); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6); }
#app .bar i { background: url("../extracted_assets/skin/prog-fill.png") center / 100% 400% no-repeat, #22b24c; }

/* ---------- Phase 10: profile cosmetics + full emoji ---------- */
#app .avatar-wrap { position: relative; display: inline-grid; place-items: center; flex: none; }
#app .avatar-wrap.framed .avatar-ring { transform: scale(0.86); }
#app .avatar-frame { position: absolute; inset: -8%; width: 116% !important; height: 116% !important; pointer-events: none; max-width: none; }
#app .pname { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
#app .pname b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#app .pname.framed-name { padding: 2px 12px; background: var(--nf) center / 100% 100% no-repeat; }
#app .basha-badge, #app .vip-badge { width: 22px; height: 22px; object-fit: contain; flex: none; }
#app h2 .basha-badge, #app h2 .vip-badge { width: 32px; height: 32px; }
#app .store-item .art.frame-art img { width: 100px; height: 100px; }
#app .store-item .art.dim img { filter: grayscale(1) brightness(0.55); }
#app .swatch { display: block; width: 84px; height: 84px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.85); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); }
#app .emoji-u { display: inline-block; background-repeat: no-repeat; vertical-align: middle; }
#app .emoji-h { display: flex; align-items: center; gap: 6px; margin: 12px 0 6px; font: 800 13px var(--head); color: var(--muted-ink); }
#app .emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 2px; }
#app .emoji-grid button { padding: 4px; border: 0; border-radius: 8px; background: none; cursor: pointer; }
#app .emoji-grid button:hover { background: rgba(255, 213, 74, 0.2); }
#app .chat-drawer .chat-body { max-height: 380px; }
#app .phrases.basha button { background: #fff3c4; }

/* =====================================================================================
   App look (matched to the owner's iPad screenshots of the real app): neutral dark theme,
   top bar, game-centred home, text news banner, 5-tab nav, dark dialogs, room flow sheets.
   Sprites: unity/Sprite/* (audited); only the invite ring's colour ring has no source asset.
   ===================================================================================== */
#app { --panel-bg: rgba(22, 21, 26, 0.96); --muted-ink: #a8a6b1; --line: rgba(255, 255, 255, 0.1); background: #1d1c21; }
#app .screen { background-color: #1d1c21; }
#app .screen.home { background: #24232a url("../extracted_assets/unity/Sprite/GameBackground__CAB-1890d61b_45c2c3a5.png") center / cover no-repeat; }
#app .screen::before { background: linear-gradient(180deg, rgba(20, 19, 24, 0.2), rgba(20, 19, 24, 0.55)); }

/* dark dialogs: the app's HomepagePopupBackground frame */
#app dialog.sheet {
  border-width: 26px; border-image: url("../extracted_assets/unity/Sprite/HomepagePopupBackgroundOldColor_0__eec75e2c2191_2.png") 100 fill / 40px stretch;
}
#app dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
#app .sheet-title { justify-content: center; text-align: center; }

/* ---- top bar ---- */
#app .app-top { direction: ltr; display: grid; gap: 10px; padding: 10px 18px 12px; background: #1b1a1f; border-bottom: 2px solid #26252b; z-index: 5; }
#app .at-row { display: flex; align-items: center; gap: 14px; }
#app .at-fill { flex: 1; }
#app .at-icon { position: relative; width: 46px; height: 46px; padding: 4px; border: 0; background: none; cursor: pointer; }
#app .at-icon img { width: 100%; height: 100%; object-fit: contain; }
#app .at-badge { position: absolute; left: -6px; top: 4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #d6242b; color: #fff; font: 800 13px/22px var(--head); text-align: center; }
#app .at-chips { gap: 12px; }
#app .at-profile { direction: rtl; position: relative; display: flex; align-items: center; gap: 10px; height: 64px; min-width: 0; flex: 0 1 380px; padding: 0 14px 0 56px;
  border: 2px solid #34333a; border-radius: 34px; background: #151418; cursor: pointer; }
#app .at-profile .avatar-wrap { position: absolute; left: -6px; top: 50%; transform: translateY(-50%); width: 72px; height: 72px; }
#app .at-profile .avatar-ring, #app .at-profile .avatar-ring.small { position: relative; width: 72px; height: 72px; border-width: 0; }
#app .at-name { flex: 1; min-width: 0; text-align: center; font: 700 16px var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#app .at-level { position: relative; width: 38px; height: 38px; flex: none; }
#app .at-level img { width: 100%; height: 100%; }
#app .at-level b { position: absolute; inset: 0; display: grid; place-items: center; font: 800 17px var(--head); color: #3a2400; }
#app .at-coins { position: relative; display: flex; align-items: center; justify-content: center; height: 50px; min-width: 160px; flex: 0 1 260px; padding: 0 18px 0 58px;
  border: 2px solid #34333a; border-radius: 26px; background: #151418; font: 800 20px var(--head); cursor: pointer; }
#app .at-coin { position: absolute; left: -6px; top: -6px; width: 60px; height: 60px; object-fit: contain; }
#app .at-plus { position: absolute; left: 30px; bottom: -4px; width: 28px; height: 30px; object-fit: contain; }

/* ---- home body ---- */
#app .tab-home .home-body { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 22px 16px 140px; }
#app .invite-ring { position: absolute; top: 14px; right: 18px; display: grid; justify-items: center; width: 118px; padding: 0; border: 0; background: none; cursor: pointer; z-index: 2; }
#app .ir-art > * { transform: scale(1.7); } /* the Lottie's phone fills the circle like the app */
#app .ir-art { display: block; width: 110px; height: 110px; border-radius: 50%; overflow: hidden; border: 5px solid transparent;
  background: linear-gradient(#1b1a1f, #1b1a1f) padding-box, conic-gradient(#ff2fb3, #7b2ff7, #ff7a18, #ff2fb3) border-box; } /* no source asset for the ring */
#app .ir-label { margin-top: -18px; min-width: 110px; padding: 4px 12px; border-radius: 12px; background: #141317; border: 2px solid #2d2c33; font: 800 18px var(--head); }
#app .news-banner { width: min(620px, 100%); min-height: 76px; display: grid; place-items: center; gap: 8px; padding: 16px 24px 12px; margin-top: 110px;
  border: 0 solid transparent; border-width: 18px; border-image: var(--bg) 40 fill / 18px stretch; text-align: center; transition: opacity .25s; }
#app .news-banner.out { opacity: 0; }
#app .news-banner p { margin: 0; font: 700 18px/1.4 var(--head); }
#app .nb-dots { display: flex; gap: 8px; }
#app .nb-dots i { width: 10px; height: 10px; border-radius: 50%; background: #0b0b0d; }
#app .nb-dots i.on { background: var(--gold); }

#app .game-hero { width: min(620px, 100%); display: grid; justify-items: center; }
#app .gh-art { position: relative; width: 100%; height: 170px; display: grid; place-items: end center; }
#app .gh-arc { position: absolute; bottom: -8px; width: 96%; height: 78px; object-fit: fill; }
#app .gh-cards { position: relative; width: 58%; max-height: 190px; object-fit: contain; object-position: bottom; margin-bottom: 18px; }
#app .gh-panel { position: relative; width: 100%; padding: 8px 20px 26px; border: 0 solid transparent; border-width: 26px;
  border-image: var(--panel) 60 fill / 26px stretch; display: grid; gap: 20px; justify-items: center; margin-top: -30px; }
#app .gh-title { margin: 0; width: 100%; padding-bottom: 14px; border-bottom: 2px solid #2a292f; text-align: center; font: 800 44px var(--head); }
#app .gh-tiles, #app .pn-tiles { direction: ltr; display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; }
#app .gh-tile { width: 196px; aspect-ratio: 301 / 330; display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; padding: 18px 10px 20px;
  border: 0; background: var(--tile) center / 100% 100% no-repeat; cursor: pointer; font: 800 24px var(--head); color: #fff; text-shadow: 0 2px 2px rgba(0, 0, 0, .4); transition: transform .12s; }
#app .gh-tile:hover { transform: translateY(-3px); }
#app .gh-icon { width: 118px; height: 118px; object-fit: contain; }
#app .gh-links { direction: ltr; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; }
#app .gh-links button { display: flex; align-items: center; justify-content: center; gap: 10px; height: 64px; padding: 0 12px; border: 2px solid #3a3940; border-radius: 12px;
  background: #19181c; cursor: pointer; font: 700 16px var(--head); color: #c9c7d1; direction: rtl; white-space: nowrap; }
#app .gh-links button:hover { border-color: #5a5962; color: #fff; }
#app .gh-links img { width: 36px; height: 36px; object-fit: contain; }

/* ---- bottom nav ---- */
#app .app-nav { direction: ltr; position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; justify-content: space-around; height: 116px; padding: 0 10px 8px;
  background: linear-gradient(#1c1b20, #151418); border-top: 2px solid #26252b; z-index: 6; }
#app .an-item { position: relative; display: grid; justify-items: center; gap: 4px; width: 120px; padding: 0; border: 0; background: none; cursor: pointer; font: 700 17px var(--head); color: #8d8b95; }
#app .an-item.active { color: #fff; }
#app .an-icon { position: relative; display: grid; place-items: center; height: 62px; }
#app .an-icon img { height: 62px; width: auto; }
#app .an-home .an-icon { height: 92px; margin-top: -40px; }
#app .an-home .an-icon img { height: 110px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); }
#app .an-home:not(.active) .an-icon img { filter: grayscale(.6) brightness(.8); }
#app .an-lock { position: absolute; top: -8px; right: -12px; width: 34px !important; height: 34px !important; padding: 5px; border-radius: 50%; background: #3a3940; }
#app .an-badge { position: absolute; top: -6px; left: 30px; min-width: 26px; height: 26px; border-radius: 13px; background: #d6242b; color: #fff; font: 800 14px/26px var(--head); text-align: center; }
#app .home-body { padding-bottom: 140px; }

/* ---- play now / create game / running / leaderboard sheets ---- */
#app .playnow-sheet, #app .create-sheet { width: min(620px, 94vw); }
#app .pn-tiles { padding: 24px 12px; border: 0 solid transparent; border-width: 18px;
  border-image: url("../extracted_assets/unity/Sprite/HomepagePopupContainerOldColor_0__57e111fb9028_2.png") 60 fill / 18px stretch; }
#app .pn-tiles { flex-wrap: nowrap; gap: 14px; }
#app .pn-tiles .gh-tile { width: 132px; font-size: 17px; padding: 14px 6px 16px; }
#app .pn-tiles .gh-icon { width: 80px; height: 80px; }
#app .cg-box { display: grid; gap: 0; padding: 6px 12px; border: 0 solid transparent; border-width: 18px;
  border-image: url("../extracted_assets/unity/Sprite/HomepagePopupContainerOldColor_0__57e111fb9028_2.png") 60 fill / 18px stretch; }
#app .cg-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; border-bottom: 2px solid #2a292f; font: 700 21px var(--head); }
#app .cg-row:last-child { border-bottom: 0; }
#app .cg-code { min-width: 170px; padding: 8px 16px; border-radius: 12px; background: #0e0e10; text-align: center; font: 700 19px var(--head); letter-spacing: 1px; }
#app .cg-type { direction: ltr; display: grid; grid-template-columns: 1fr 1fr; margin: 4px 0 12px; padding: 4px; border-radius: 30px; background: #0e0e10; }
#app .cg-type button { border: 0 !important; border-image: none !important; border-radius: 26px !important; padding: 12px !important; font: 800 20px var(--head); color: #8d8b95; background: none; }
#app .cg-type button[aria-checked="true"] { background: #5146d6 !important; color: #fff; box-shadow: 0 3px 0 #3a31a8; }
#app .cg-speed { direction: ltr; display: flex; gap: 6px; padding: 4px; border-radius: 30px; background: #0e0e10; }
#app .cg-speed button { width: 70px; height: 48px; border: 0; border-radius: 24px; background: none; cursor: pointer; }
#app .cg-speed button img { height: 26px; }
#app .cg-speed button[aria-checked="true"] { background: linear-gradient(#ffd21c, #e79a12); }
#app .cg-go { width: 100%; margin-top: 18px; font-size: 22px; }
#app .running-list { display: grid; gap: 10px; min-width: min(520px, 86vw); }
#app .running-list .live-card { width: 100%; background: #151418; }
#app .lb-sheet { width: min(620px, 94vw); }
#app .lb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
#app .lb-list li { display: grid; grid-template-columns: 44px 52px 1fr auto; align-items: center; gap: 12px; min-height: 60px; padding: 4px 16px;
  border-radius: 14px; background: var(--row, none) center / 100% 100% no-repeat, #151418; font: 700 17px var(--head); }
#app .lb-list li.me { outline: 2px solid var(--gold); }
#app .lb-rank { text-align: center; font-size: 20px; }
#app .lb-list .avatar-ring { width: 48px; height: 48px; border-width: 2px; }
#app .lb-wins { color: var(--gold); }

@media (max-width: 640px) {
  #app .app-top { padding: 8px 10px; }
  #app .at-icon { width: 38px; height: 38px; }
  #app .at-profile { height: 52px; padding-left: 50px; }
  #app .at-profile .avatar-wrap, #app .at-profile .avatar-ring, #app .at-profile .avatar-ring.small { width: 58px; height: 58px; }
  #app .at-coins { min-width: 110px; height: 42px; padding-left: 48px; font-size: 16px; }
  #app .at-coin { width: 48px; height: 48px; }
  #app .at-plus { left: 24px; width: 22px; height: 24px; }
  #app .invite-ring { width: 84px; top: 8px; right: 8px; }
  #app .ir-art { width: 76px; height: 76px; }
  #app .ir-label { min-width: 76px; font-size: 14px; }
  #app .news-banner { margin-top: 70px; }
  #app .gh-title { font-size: 30px; }
  #app .gh-tile { width: 140px; font-size: 18px; }
  #app .gh-icon { width: 80px; height: 80px; }
  #app .gh-links button { flex-direction: column; height: auto; padding: 8px 4px; gap: 4px; font-size: 13px; }
  #app .app-nav { height: 88px; }
  #app .an-item { width: 70px; font-size: 12px; }
  #app .an-icon, #app .an-icon img { height: 42px; }
  #app .an-home .an-icon img { height: 78px; }
  #app .an-home .an-icon { height: 60px; margin-top: -28px; }
}

/* ---- end-of-game summary (build art: Congratulations / HardLuck, Cup + CupLeaves + CupLighting + ItemBackGlow, confetti2x2) ---- */
#app .game-summary { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; overflow: hidden;
  background: rgba(8, 8, 10, 0.72); animation: gs-fade .25s ease-out; }
@keyframes gs-fade { from { opacity: 0; } }
#app .gs-card { position: relative; width: min(560px, 100%); max-height: 100%; overflow-y: auto; display: grid; justify-items: center; gap: 12px; padding: 18px 22px 22px;
  border: 0 solid transparent; border-width: 26px;
  border-image: url("../extracted_assets/unity/Sprite/HomepagePopupBackgroundOldColor_0__eec75e2c2191_2.png") 100 fill / 40px stretch;
  animation: gs-pop .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes gs-pop { from { transform: scale(.7); opacity: 0; } }
#app .gs-head { position: relative; width: 240px; height: 170px; display: grid; place-items: center; margin-top: -8px; }
#app .gs-head > img { position: absolute; }
#app .gs-rays { width: 260px; height: 260px; animation: gs-spin 9s linear infinite; opacity: .9; }
@keyframes gs-spin { to { transform: rotate(360deg); } }
#app .gs-leaves { width: 240px; bottom: 6px; }
#app .gs-cup { height: 150px; animation: gs-bounce 1.6s ease-in-out infinite; }
@keyframes gs-bounce { 50% { transform: translateY(-6px) scale(1.03); } }
#app .gs-sparks { width: 210px; top: 2px; animation: gs-blink 1.2s ease-in-out infinite; }
@keyframes gs-blink { 50% { opacity: .35; } }
#app .gs-lose-disc { width: 140px; height: 140px; display: grid; place-items: center; background: var(--bg) center / contain no-repeat; }
#app .gs-cup.grey { position: static; height: 90px; filter: grayscale(1) brightness(.55); animation: none; }
#app .gs-banner { max-width: 88%; height: 64px; object-fit: contain; }
#app .gs-sub { margin: -4px 0 4px; color: var(--muted-ink); font: 600 15px var(--head); }
#app .gs-teams { width: 100%; display: grid; gap: 10px; }
#app .gs-team { direction: ltr; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; min-height: 96px; padding: 10px 18px;
  background: var(--box) center / 100% 100% no-repeat; border-radius: 16px; }
#app .gs-team.lose { opacity: .85; }
#app .gs-team-cup { width: 46px; height: 46px; object-fit: contain; }
#app .gs-players { display: flex; gap: 18px; justify-content: center; }
#app .gs-player { display: grid; justify-items: center; gap: 2px; min-width: 90px; }
#app .gs-player .avatar-ring { width: 54px; height: 54px; border-width: 2px; }
#app .gs-player b { font: 700 15px var(--head); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#app .gs-player small { color: var(--muted-ink); font: 700 13px var(--head); }
#app .gs-score { font: 800 34px var(--head); min-width: 60px; text-align: center; }
#app .gs-team.win .gs-score { color: var(--gold); }
#app .gs-items { list-style: none; margin: 4px 0 0; padding: 0; width: 100%; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
#app .gs-items li { display: grid; justify-items: center; align-content: center; gap: 4px; width: 118px; min-height: 104px; padding: 8px; border-radius: 14px;
  background: #151418; border: 2px solid #2d2c33; opacity: 0; transform: translateY(14px) scale(.9); transition: opacity .3s, transform .35s cubic-bezier(.2, 1.4, .4, 1); }
#app .gs-items li.wide { width: 250px; }
#app .gs-items li.in { opacity: 1; transform: none; }
#app .gs-items .r-img { width: 60px; height: 50px; object-fit: contain; }
#app .gs-items .r-anim { width: 70px; height: 56px; display: block; }
#app .gs-items .r-anim.wide { width: 170px; height: 90px; }
#app .gs-items b { font: 700 14px/1.25 var(--head); text-align: center; }
#app .gs-actions { direction: ltr; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; margin-top: 6px; }
#app .gs-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#app .gs-confetti i { position: absolute; top: -40px; left: var(--x); width: 22px; height: 22px; background: var(--c);
  -webkit-mask: var(--confetti) var(--q) / 200% 200% no-repeat; mask: var(--confetti) var(--q) / 200% 200% no-repeat;
  animation: gs-fall 3.2s var(--d) linear infinite; transform: rotate(var(--r)); }
@keyframes gs-fall { to { top: 105%; transform: rotate(calc(var(--r) + 540deg)) translateX(30px); } }
@media (prefers-reduced-motion: reduce) { #app .gs-rays, #app .gs-cup, #app .gs-sparks, #app .gs-confetti i { animation: none; } }

/* ---- landscape windows (#app.wide-ui, set by applyUiScale): side-by-side menu, scaled to fill the window ---- */
#app.wide-ui .screen.home { zoom: var(--z, 1); height: calc((100dvh - var(--hdr, 56px)) / var(--z, 1)); min-height: 0; }
#app.wide-ui dialog.sheet { zoom: var(--z, 1); }
#app.wide-ui .app-top { display: flex; align-items: center; gap: 14px; padding: 8px 18px; }
#app.wide-ui .app-top .at-row { display: contents; }
#app.wide-ui .app-top .at-row:first-child > :nth-child(1) { order: 1; }
#app.wide-ui .app-top .at-row:first-child > :nth-child(2) { order: 2; }
#app.wide-ui .app-top .at-chips > * { order: 3; }
#app.wide-ui .app-top .at-fill { order: 4; flex: 1; }
#app.wide-ui .app-top .at-row:first-child > :nth-child(4) { order: 5; }
#app.wide-ui .app-top .at-row:first-child > :nth-child(5) { order: 6; }
#app.wide-ui .app-top .at-profile { margin-left: 14px; flex: 0 1 340px; }
#app.wide-ui .app-nav { height: 96px; }
#app.wide-ui .an-home .an-icon { height: 78px; margin-top: -34px; }
#app.wide-ui .an-home .an-icon img, #app.wide-ui .an-home .an-lottie { height: 96px; }
#app.wide-ui .an-icon, #app.wide-ui .an-icon img { height: 52px; }
#app.wide-ui .tab-home .home-body { justify-content: safe center; gap: 12px; padding: 10px 28px 104px; }
#app.wide-ui .tab-home .news-banner { margin-top: 0; width: min(760px, calc(100% - 300px)); min-height: 0; padding: 4px 22px 2px; border-width: 12px; }
#app.wide-ui .tab-home .news-banner p { font-size: 17px; }
#app.wide-ui .game-hero { width: 100%; max-width: 1180px; grid-template-columns: 0.95fr 1.2fr; align-items: center; gap: 30px; }
#app.wide-ui .gh-art { height: 290px; place-items: center; }
#app.wide-ui .gh-arc { bottom: 8%; width: 100%; height: 26%; }
#app.wide-ui .gh-cards { width: 88%; max-height: 88%; margin-bottom: 14%; }
#app.wide-ui .gh-panel { margin-top: 0; gap: 14px; padding: 2px 18px 12px; border-width: 20px; }
#app.wide-ui .gh-title { font-size: 38px; padding-bottom: 8px; }
#app.wide-ui .gh-tile { width: 168px; font-size: 21px; padding: 10px 8px 12px; }
#app.wide-ui .gh-icon { width: 96px; height: 96px; }
#app.wide-ui .gh-links button { height: 54px; }
/* summary on wide windows: trophy + banner beside teams, rewards and buttons (no scrolling on short screens) */
@media all {
  #app.wide-ui .gs-card { direction: ltr; width: min(1040px, 100%); grid-template-columns: 0.85fr 1.25fr; grid-template-areas: "head teams" "banner teams" "sub items" "actions items";
    align-items: center; column-gap: 28px; row-gap: 10px; }
  #app.wide-ui .gs-head { grid-area: head; }
  #app.wide-ui .gs-banner { grid-area: banner; }
  #app.wide-ui .gs-sub { grid-area: sub; align-self: start; }
  #app.wide-ui .gs-teams { grid-area: teams; align-self: end; }
  #app.wide-ui .gs-items { grid-area: items; }
  #app.wide-ui .gs-actions { grid-area: actions; align-self: end; grid-template-columns: 1fr; }
  #app.wide-ui .gs-card > * { direction: rtl; }
  #app.wide-ui[dir="ltr"] .gs-card > * { direction: ltr; }
}

#app .an-lottie { display: block; height: 62px; aspect-ratio: 460 / 420; }
#app .an-home .an-lottie { height: 110px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); }
#app.wide-ui .an-lottie { height: 52px; }
#app .gs-left { margin: -6px 0 0; padding: 6px 14px; border-radius: 10px; background: rgba(214, 36, 43, .18); color: #ffb4ab; font: 700 15px var(--head); text-align: center; }
#app.wide-ui .gs-left { grid-column: 1; }
#app .home-body > * { flex-shrink: 0; } /* never squeeze the banner / game card; the body scrolls instead */
#app .an-lock { display: none; } /* the Clubs Lottie shows its own locked state */

/* ---- Arabic / RTL fixes ---- */
#app .slider, #app .slider input { direction: ltr; } /* the green fill is drawn left to right: keep the range in the same direction */
#app .settings-sheet { width: min(560px, 94vw); }  /* labels and switches stay close together */
#app .sheet-close:focus-visible { outline: none; }
#app .an-home .an-lottie { height: 92px; margin-top: -8px; }
#app .an-home .an-icon { height: 70px; margin-top: -30px; }
#app.wide-ui .an-home .an-lottie { height: 84px; }
#app.wide-ui .an-home .an-icon { height: 64px; margin-top: -28px; }
#app .an-label { position: relative; z-index: 1; }

/* ---- no hairline seams: 9-sliced sprites (border-image) leave sub-pixel gaps between slices at fractional scales
   (1.25x / 1.5x screens, the zoomed menu). The same sprite stretched underneath fills those gaps with matching colour. ---- */
#app .btn, #app .btn-green { background-image: url("../extracted_assets/skin/btn-green.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .btn-yellow { background-image: url("../extracted_assets/skin/btn-yellow.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .btn-blue { background-image: url("../extracted_assets/skin/btn-blue.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .btn-gray { background-image: url("../extracted_assets/skin/btn-gray.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .store-item .btn.price { background-image: url("../extracted_assets/skin/price.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .segmented button { background-image: url("../extracted_assets/skin/seg-off.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .chip { background-image: url("../extracted_assets/skin/chip-off.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .segmented button[aria-checked="true"] { background-image: url("../extracted_assets/skin/seg-on.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .chip[aria-pressed="true"] { background-image: url("../extracted_assets/skin/chip-on.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .toast { background-image: url("../extracted_assets/skin/toast.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .tour-bubble { background-image: url("../extracted_assets/skin/tip.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .home-missions { background-image: url("../extracted_assets/skin/home-card.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .chat-log li { background-image: url("../extracted_assets/skin/chat-other.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .chat-log li.me { background-image: url("../extracted_assets/skin/chat-mine.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app dialog.sheet, #app .gs-card { background-image: url("../extracted_assets/unity/Sprite/HomepagePopupBackgroundOldColor_0__eec75e2c2191_2.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .pn-tiles, #app .cg-box { background-image: url("../extracted_assets/unity/Sprite/HomepagePopupContainerOldColor_0__57e111fb9028_2.png"); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; background-clip: border-box; }
#app .news-banner { background-image: var(--bg); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; }
#app .gh-panel { background-image: var(--panel); background-size: 100% 100%; background-repeat: no-repeat; background-origin: border-box; }
#app .cg-type button:not([aria-checked="true"]) { background-image: none; }

/* ---- focus rings only for keyboard use (clicking no longer leaves a white outline) ---- */
#app :focus:not(:focus-visible) { outline: none; }
#app :focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
#app input[type="range"]:focus, #app input[type="range"]:focus-visible { outline: none; }
#app canvas:focus, #app canvas:focus-visible { outline: none; }

/* ---- keep content inside its card (grid items default to min-width:auto, so wide art could push past the card) ---- */
#app .store-grid > *, #app .grid > *, #app .gh-links > *, #app .gs-items > *, #app .store-item, #app .store-item .art { min-width: 0; }
#app .store-item .art img { width: auto; height: auto; max-width: 100%; max-height: 110px; }
#app .store-item .art.frame-art img { width: 100px; height: 100px; max-width: 100%; object-fit: contain; }
#app .store-item b { max-width: 100%; overflow-wrap: anywhere; }
/* the store's awning (HeaderStore) at its real proportions, repeated across instead of squashed to 28px */
#app .store-head { padding-top: 76px; background: url("../extracted_assets/skin/store-header.png") top center / auto 68px repeat-x; }

/* ---- join by code, announcements, master control ---- */
#app .gh-links { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { #app .gh-links { grid-template-columns: repeat(2, 1fr); } }
#app .gh-links button { min-width: 0; padding: 0 8px; }
#app .gh-links button span { overflow: hidden; text-overflow: ellipsis; }
#app .pn-join { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 14px; padding: 12px; border: 2px dashed #3a3940; border-radius: 12px;
  background: none; color: #c9c7d1; font: 700 16px var(--head); cursor: pointer; }
#app .pn-join:hover { border-color: var(--gold); color: #fff; }
#app .pn-join img { width: 28px; height: 28px; object-fit: contain; }
#app .join-sheet { width: min(420px, 92vw); }
#app .join-form { display: grid; gap: 12px; justify-items: center; }
#app .join-code { direction: ltr; width: 220px; padding: 12px; border: 2px solid #3a3940; border-radius: 14px; background: #0e0e10; color: #fff;
  font: 800 40px/1 var(--head); letter-spacing: 14px; text-align: center; }
#app .join-code:focus { border-color: var(--gold); outline: none; }
#app .join-form .btn { width: 100%; }
#app .announce { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 12px; max-width: min(640px, 92vw);
  padding: 12px 16px; border-radius: 14px; background: #1f1e22; border: 2px solid var(--gold); box-shadow: 0 10px 30px rgba(0, 0, 0, .6); font: 700 16px var(--head); }
#app .announce b { color: var(--gold); white-space: nowrap; }
#app .announce button { margin-inline-start: auto; background: none; border: 0; color: #aaa; font-size: 18px; cursor: pointer; }
#app .master-sheet { width: min(760px, 96vw); }
#app .master { display: grid; gap: 18px; max-height: 70vh; overflow-y: auto; padding-inline-end: 4px; }
#app .master section { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: #151418; border: 1px solid #2d2c33; }
#app .master h3 { display: flex; align-items: center; gap: 10px; margin: 0; font: 800 17px var(--head); }
#app .master input { min-width: 0; padding: 9px 10px; border: 1px solid #3a3940; border-radius: 10px; background: #0e0e10; color: #fff; font: 600 15px var(--font); }
#app .m-msg { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
#app .m-x { width: 38px; border: 0; border-radius: 10px; background: #2a292f; color: #ffb4ab; cursor: pointer; }
#app .m-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#app .m-row .m-ann { flex: 1; }
#app .m-int { width: 70px; }
#app .m-refresh { min-height: 32px; font-size: 13px; margin-inline-start: auto; }
#app .m-room { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px 12px; padding: 8px; border-radius: 10px; background: #0e0e10; }
#app .m-room b { font: 800 20px var(--head); letter-spacing: 2px; }
#app .m-seats { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
#app .m-seat { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; background: #25242a; font: 600 13px var(--font); }
#app .m-seat.bot { opacity: .6; }
#app .m-seat button { border: 0; border-radius: 6px; padding: 2px 8px; background: #d6242b; color: #fff; cursor: pointer; font: 700 12px var(--head); }
#app .gh-links { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (max-width: 640px) { #app .gh-links { grid-template-columns: repeat(2, 1fr); } }
#app .gh-links, #app.wide-ui .gh-links { grid-template-columns: repeat(2, 1fr); }
#app .master-pw { direction: ltr; width: min(320px, 100%); padding: 14px 16px; border: 2px solid #3a3940; border-radius: 14px; background: #0e0e10; color: #fff;
  font: 700 20px var(--font); text-align: center; }
#app .master-pw:focus { border-color: var(--gold); outline: none; }

/* ---- master control: tabs, players, rooms, stats; maintenance / ban bars; feature switches ---- */
#app .m-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 12px; }
#app .m-tabs button { padding: 7px 12px; border: 1px solid #3a3940; border-radius: 10px; background: #151418; color: #c9c7d1; font: 700 14px var(--head); cursor: pointer; }
#app .m-tabs button[aria-selected="true"] { background: var(--gold); color: #2a1d00; border-color: var(--gold); }
#app .master .btn { min-height: 38px; padding: 4px 14px 8px; font-size: 14px; }
#app .master .m-danger { border-image-source: url("../extracted_assets/skin/btn-gray.png"); background-image: none; filter: hue-rotate(0deg); color: #ffb4ab; }
#app .m-player { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: #0e0e10; }
#app .m-av img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: top; background: #25242a; }
#app .m-pinfo { display: grid; min-width: 0; }
#app .m-pinfo b { font: 800 16px var(--head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#app .m-pinfo small, #app .m-ban small { color: var(--muted-ink); }
#app .m-pact { display: flex; flex-wrap: wrap; gap: 6px; }
#app .m-giftbox { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 6px; }
#app .m-giftbox input { width: 110px; }
#app .m-giftbox select, #app .m-home select { max-width: 100%; padding: 8px; border-radius: 10px; background: #0e0e10; color: #fff; border: 1px solid #3a3940; font: 600 14px var(--font); }
#app .m-roomchat { grid-column: 1 / -1; }
#app .m-roomchat input { flex: 1; }
#app .m-form { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 10px 14px; align-items: center; }
#app .m-form input { width: 100px; }
#app .m-games { display: grid; gap: 6px; max-height: 40vh; overflow-y: auto; }
#app .m-game { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 8px; border-radius: 10px; background: #0e0e10; font: 700 14px var(--head); }
#app .m-game .segmented button { padding: 4px 10px; font-size: 12px; min-height: 0; }
#app .m-switch { justify-content: space-between; font: 700 16px var(--head); }
#app .m-badge { padding: 6px 12px; border-radius: 10px; background: #25242a; font: 800 14px var(--head); }
#app .m-badge.on { background: #d6242b; }
#app .m-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
#app .m-stats div { display: grid; justify-items: center; padding: 10px; border-radius: 12px; background: #0e0e10; }
#app .m-stats b { font: 800 26px var(--head); color: var(--gold); }
#app .m-stats small { color: var(--muted-ink); font: 600 13px var(--font); }
#app .m-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 32vh; overflow-y: auto; }
#app .m-list li { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 6px 8px; border-radius: 8px; background: #0e0e10; font: 600 14px var(--font); }
#app .m-list small { color: var(--muted-ink); }
#app .m-log li.k-ban, #app .m-log li.k-kick { color: #ffb4ab; }
#app .m-log li.k-game { color: #b8f5c4; }
#app .maint-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 55; display: flex; justify-content: center; align-items: center; gap: 10px; padding: 8px 16px;
  background: #b8860b; color: #1a1200; font: 700 15px var(--head); text-align: center; }
#app .maint-bar.banned { background: #8b1a1f; color: #fff; }
#app .chat-log li.admin b { color: var(--gold); }
#app.f-no-radio [data-action="radio"], #app.f-no-radio [data-radio], #app.f-no-radio [data-open-radio] { display: none !important; }
#app.f-no-chat [data-chat], #app.f-no-chat .chat-drawer [data-tab="phrases"], #app.f-no-chat .chat-drawer [data-tab="emoji"] { display: none !important; }
#app.f-no-emotes .chat-drawer [data-tab="emotes"] { display: none !important; }
#app.f-no-gifts .chat-drawer [data-tab="gifts"], #app.f-no-gifts .player-card ~ .sub, #app.f-no-gifts .player-card ~ .gifts { display: none !important; }
#app.f-no-store .app-nav [data-nav="store"] { opacity: .45; }
#app .m-giftbox[hidden] { display: none; }
#app .master .segmented { gap: 6px; }
#app .master .segmented button { min-height: 0; padding: 2px 8px; border-width: 8px 12px; font-size: 14px; }
#app .master-sheet { width: min(860px, 96vw); }

/* الحلمنتيشي (replaces Abdo): a happy bounce where Abdo had animations */
@keyframes halam-bounce { 0%, 100% { transform: translateY(0) scale(1, 1); } 30% { transform: translateY(-18%) scale(.96, 1.05); } 55% { transform: translateY(0) scale(1.06, .94); } 75% { transform: translateY(-6%); } }
#app .emote-pop.halam img, #app .halam-win { animation: halam-bounce 1s ease-in-out 3; transform-origin: 50% 100%; }
#app .halam-win { width: auto; height: 200px; margin: 6px auto 0; object-fit: contain; filter: drop-shadow(0 8px 16px rgba(0,0,0,.5)); }
#app .emote-pop.halam img { width: 100%; height: 100%; object-fit: contain; }
#app .tour-char { object-fit: contain; }

/* video emotes (custom_assets/emotes) */
#app .emote-pop.video { border-radius: 18px; overflow: hidden; box-shadow: 0 8px 24px rgba(0, 0, 0, .6); background: #000; }
#app .emote-pop.video video { width: 100%; height: 100%; object-fit: cover; display: block; }
#app .emotes button.video video { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; pointer-events: none; }

/* image emotes with a "scream": shaking picture + pulsing radial lines (extracted Radiallineswhite) */
#app .emote-pop.scream { display: grid; place-items: center; }
#app .emote-pop.scream img { position: relative; width: 62%; height: 62%; object-fit: contain; animation: scream-shake .12s linear infinite, scream-pop .5s ease-out;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); }
#app .scream-rays { position: absolute; inset: -10%; background: var(--rays) center / contain no-repeat; opacity: .85; animation: scream-rays .5s ease-in-out infinite alternate, scream-spin 4s linear infinite; }
@keyframes scream-shake { 0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(-3px, 1px) rotate(-4deg); } 50% { transform: translate(2px, -2px) rotate(3deg); } 75% { transform: translate(-1px, 2px) rotate(-2deg); } 100% { transform: translate(0, 0) rotate(0); } }
@keyframes scream-pop { from { scale: .3; } 60% { scale: 1.25; } to { scale: 1; } }
@keyframes scream-rays { from { scale: .8; opacity: .5; } to { scale: 1.1; opacity: .95; } }
@keyframes scream-spin { to { rotate: 360deg; } }
#app .emotes button.scream img { width: 70%; }

/* =====================================================================================
   Mobile: phones upright and sideways (checked at 390x844 and 844x390, touch)
   ===================================================================================== */
/* the table is sized by the space the stage really has (container units), in every layout */
#app .game-stage { container-type: size; }
#app .game-stage canvas, #app .game-stage canvas[data-layout="wide"] { width: min(100cqw, 100cqh * 16 / 9); height: auto; aspect-ratio: 16 / 9; }
#app .game-stage canvas[data-layout="portrait"] { width: min(100cqw, 100cqh * 3 / 4); aspect-ratio: 3 / 4; }
#app .game-stage canvas[data-layout="phone"] { width: min(100cqw, 100cqh * 750 / 1334); aspect-ratio: 750 / 1334; background: transparent; border-radius: 0; }
/* short screens (phones sideways): no forced minimum height, a slimmer game bar */
@media (max-height: 560px) {
  #app .home, #app .game-screen { min-height: 0; }
  #app .game-bar { padding: 2px 12px; gap: 10px; }
  #app .game-bar .icon-btn { width: 38px; height: 38px; }
  #app .game-bar .game-title { font-size: 15px; }
  #app .game-stage { padding: 4px; }
}
/* scaled (wide) menus: dialogs keep fitting the real screen height */
#app.wide-ui dialog.sheet { max-height: calc(94dvh / var(--z, 1)); max-width: calc(96vw / var(--z, 1)); overflow-y: auto; }
/* narrow screens (phones upright) */
@media (max-width: 520px) {
  #app .gh-tiles { flex-wrap: nowrap; gap: 12px; width: 100%; }
  #app .gh-tile { width: calc(50% - 6px); max-width: 150px; font-size: 17px; padding: 10px 6px 12px; }
  #app .gh-icon { width: 70px; height: 70px; }
  #app .gh-panel { padding: 4px 10px 16px; border-width: 18px; }
  #app dialog.sheet { border-width: 16px; max-width: 100vw; }
  #app .create-sheet, #app .playnow-sheet, #app .lb-sheet, #app .master-sheet { width: 96vw; }
  #app .cg-box { padding: 4px 6px; border-width: 12px; }
  #app .cg-row { gap: 8px; min-height: 56px; font-size: 17px; flex-wrap: wrap; }
  #app .cg-code { min-width: 0; padding: 6px 12px; font-size: 16px; }
  #app .cg-type button { font-size: 16px; padding: 10px 6px !important; min-width: 0; }
  #app .cg-speed button { width: 52px; height: 42px; }
  #app .pn-tiles { gap: 8px; }
  #app .pn-tiles .gh-tile { width: calc(33% - 6px); font-size: 14px; }
  #app .pn-tiles .gh-icon { width: 56px; height: 56px; }
  #app .gs-card { padding: 10px 8px 14px; border-width: 16px; gap: 8px; }
  #app .gs-head { width: 180px; height: 130px; }
  #app .gs-rays { width: 200px; height: 200px; }
  #app .gs-leaves { width: 180px; }
  #app .gs-cup { height: 110px; }
  #app .gs-sparks { width: 160px; }
  #app .gs-banner { height: 48px; max-width: 100%; }
  #app .gs-team { gap: 6px; padding: 8px 10px; min-height: 84px; }
  #app .gs-team-cup { width: 32px; height: 32px; }
  #app .gs-players { gap: 8px; }
  #app .gs-player { min-width: 0; }
  #app .gs-player .avatar-ring { width: 44px; height: 44px; }
  #app .gs-player b { font-size: 13px; max-width: 86px; }
  #app .gs-score { font-size: 26px; min-width: 40px; }
  #app .gs-items li { width: calc(50% - 6px); }
  #app .gs-items li.wide { width: 100%; }
  #app .m-msg { grid-template-columns: 1fr auto; }
  #app .m-msg input[data-l="en"] { grid-column: 1; }
  #app .m-player { grid-template-columns: 44px 1fr; }
  #app .m-pact { grid-column: 1 / -1; }
}
/* the level-up badge animation at its real proportions (it was cropped) */
#app .gs-items .r-anim.wide { width: 180px; height: auto; aspect-ratio: 1066 / 760; }
#app .r-anim.wide { height: auto; aspect-ratio: 1066 / 760; }
/* bigger tap targets on touch screens */
@media (pointer: coarse) {
  #app .sheet-close { width: 44px; height: 44px; }
  #app .at-icon { min-width: 40px; min-height: 40px; }
  #app .toggle { transform: scale(1.15); }
}
/* phones sideways (short + wide): compact home so the game card fits above the nav */
@media (max-height: 560px) {
  #app.wide-ui .app-nav { height: 70px; padding-bottom: 4px; }
  #app.wide-ui .an-icon, #app.wide-ui .an-icon img, #app.wide-ui .an-lottie { height: 40px; }
  #app.wide-ui .an-home .an-lottie { height: 70px; }
  #app.wide-ui .an-home .an-icon { height: 50px; margin-top: -24px; }
  #app.wide-ui .tab-home .home-body { padding: 6px 20px 80px; gap: 6px; }
  #app.wide-ui .tab-home .news-banner { padding: 0 16px; border-width: 8px; }
  #app.wide-ui .tab-home .news-banner p { font-size: 14px; }
  #app.wide-ui .gh-art { height: 180px; }
  #app.wide-ui .gh-panel { gap: 8px; padding: 0 12px 8px; border-width: 14px; }
  #app.wide-ui .gh-title { font-size: 26px; padding-bottom: 4px; }
  #app.wide-ui .gh-tile { width: 120px; font-size: 16px; padding: 6px 6px 8px; }
  #app.wide-ui .gh-icon { width: 58px; height: 58px; }
  #app.wide-ui .gh-links { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  #app.wide-ui .gh-links button { height: 42px; font-size: 13px; padding: 0 6px; gap: 6px; }
  #app.wide-ui .gh-links img { width: 24px; height: 24px; }
  #app.wide-ui .invite-ring { width: 90px; top: 6px; }
  #app.wide-ui .ir-art { width: 70px; height: 70px; }
  #app.wide-ui .ir-label { min-width: 70px; font-size: 14px; margin-top: -12px; }
}
@media (max-height: 380px) {
  #app.wide-ui .app-top { padding: 4px 14px; }
  #app.wide-ui .tab-home .news-banner { display: none; }
  #app.wide-ui .gh-art { height: 150px; }
  #app.wide-ui .gh-tile { width: 104px; font-size: 14px; }
  #app.wide-ui .gh-icon { width: 48px; height: 48px; }
  #app.wide-ui .gh-title { font-size: 22px; }
}
