/* Clearwave game kit — same tokens, class names and look as clearwaveapps.com/play/* (Card Majlis):
 * calm flat surfaces, Inter + Sora, solid accent buttons, soft ghost buttons, rich gradient game tiles, bottom-sheet menus. */
/* Fonts (Inter, Sora, Noto Kufi Arabic): self-hosted in shared/fonts/. Each page links shared/fonts/fonts.css in its <head> next to this file (and preloads the two Latin files), so text never waits on a second site. */
:root {
  --bg: #f4f8f9; --surface: #ffffff; --surface2: #eaf2f4; --ink: #102a33; --muted: #557079;
  --line: #d4e3e7; --accent: #0e7c86; --accent-ink: #ffffff; --good: #15803d; --bad: #dc2626;
  --warn: #b45309; --gold: #ffc94d; --coral: #ff6b5b; --wave: #0e7c86;
  --felt: #14532d; --felt2: #166534; --tile: #0f766e;
  --accent2: #0f766e; --glass: var(--bg); --page-a: var(--bg); --page-b: var(--bg);
  --radius: 14px; --shadow: 0 8px 28px rgba(16, 42, 51, .12);
  --font: 'Inter', 'Noto Kufi Arabic', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Arabic', 'Noto Sans CJK SC', sans-serif;
  --display: 'Sora', var(--font);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1619; --surface: #122126; --surface2: #183038; --ink: #e5f2f4; --muted: #92b0b8;
    --line: #23404a; --shadow: 0 8px 28px rgba(0, 0, 0, .45); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1619; --surface: #122126; --surface2: #183038; --ink: #e5f2f4; --muted: #92b0b8;
  --line: #23404a; --shadow: 0 8px 28px rgba(0, 0, 0, .45); color-scheme: dark;
}
/* Card tables use the majlis amber accent (set by cw-kit.js from the page's game id). */
:root[data-cw-kind="cards"] { --accent: #b45309; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font);
  overflow-x: hidden; overscroll-behavior: none; -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100dvh;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Header: plain row on the page background, title in Sora, soft square icon buttons. */
.cw-top {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
}
.cw-top h1, .cw-top div.cw-title { font: 700 1.15rem var(--display); margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.cw-top .back { text-decoration: none; color: var(--ink); }
/* Static header in the page HTML (back arrow + h1) before CW.shell fills it: same height as the finished bar. */
.cw-top[data-static] { min-height: 62px; box-sizing: border-box; }
/* The game menu stays invisible until CW.shell has turned its hero into the poster (icon, title, Story button),
   so it appears once in its final layout instead of jumping (layout shift). Shown after 2.5 s whatever happens. */
html:not(.cw-shelled) .cw-menu:is(:has(> .cw-hero), :has(> .cw-poster)) { visibility: hidden; animation: cw-reveal 0s 2.5s forwards; }
@keyframes cw-reveal { to { visibility: visible; } }
.cw-coins {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 99px;
  background: var(--surface2); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; flex: 0 0 auto;
}
.cw-coins i { width: 15px; height: 15px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe08a, #f59e0b 70%); box-shadow: inset 0 0 0 1px rgba(146, 64, 14, .35); display: inline-block; }
.cw-icon {
  width: 42px; height: 42px; min-width: 42px; border-radius: 12px; border: 0; background: var(--surface2);
  font-size: 1.15rem; display: grid; place-items: center; flex: 0 0 auto; padding: 0;
  transition: transform .12s ease, background .15s ease;
}
.cw-icon:hover { background: color-mix(in srgb, var(--surface2) 85%, var(--ink) 8%); }
.cw-icon:active { transform: scale(.94); }

/* Buttons & chips */
.cw-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  border: 0; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 1.02rem; min-height: 52px; padding: 10px 16px; text-decoration: none;
  transition: transform .12s ease, filter .15s ease, background .15s ease;
}
.cw-btn:hover { filter: brightness(1.06); }
.cw-btn:active { transform: scale(.98); }
.cw-btn:disabled { opacity: .55; cursor: default; filter: none; transform: none; }
.cw-btn.ghost { background: var(--surface2); color: var(--ink); }
.cw-btn.ghost:hover { filter: none; background: color-mix(in srgb, var(--surface2) 88%, var(--ink) 7%); }
.cw-btn.shop, .cw-btn.shop-btn { background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; }
.cw-link { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 8px; }
.cw-chips { display: flex; gap: 8px; width: 100%; }
.cw-chip {
  flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; font-weight: 600; transition: background .15s, border-color .15s, transform .12s;
}
.cw-chip:active { transform: scale(.97); }
.cw-chip.now { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Screens */
.cw-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 16px 24px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.cw-menu { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cw-hero { font-size: 52px; line-height: 1; display: flex; gap: 10px; margin-bottom: 8px; justify-content: center; }
.cw-hero > * { animation: cw-bob 2.4s ease-in-out infinite; }
.cw-hero > *:nth-child(2) { animation-delay: .3s; }
.cw-hero > *:nth-child(3) { animation-delay: .6s; }
@keyframes cw-bob { 50% { transform: translateY(-6px); } }
.cw-sub { color: var(--muted); text-align: center; margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.cw-best { color: var(--muted); font-size: 14px; text-align: center; }
.cw-h3 { margin: 6px 0 0; font: 700 1rem var(--display); color: var(--muted); }
.cw-made { color: var(--muted); font-size: .8rem; text-align: center; margin: 12px 0 0; }

/* Game intro tile (built by CW.shell from .cw-hero): the majlis table tile, one colour per game (--tile). */
.cw-poster {
  position: relative; overflow: hidden; width: 100%; margin-bottom: 4px; padding: 18px 16px 16px;
  border-radius: 18px; color: #fff; text-align: center;
  background: linear-gradient(150deg, var(--tile), color-mix(in srgb, var(--tile) 55%, #000));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--tile) 35%, transparent);
  animation: cw-in .35s cubic-bezier(.2, .8, .3, 1);
}
.cw-poster::after { content: ''; position: absolute; inset: auto -30px -40px auto; width: 130px; height: 130px; border-radius: 50%; background: rgba(255, 255, 255, .08); pointer-events: none; }
.cw-poster::before { content: ''; position: absolute; inset: -50px auto auto -40px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255, 255, 255, .05); pointer-events: none; }
.cw-poster .cw-hero { position: relative; font-size: 48px; margin: 0 0 8px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .3)); }
.cw-poster .cw-hero img { width: 96px; height: 96px; border-radius: 22px; object-fit: cover; display: block; }
.cw-poster h2 { position: relative; font: 700 1.6rem var(--display); letter-spacing: -.02em; margin: 0; }
.cw-poster .tag { position: relative; margin: 4px auto 0; max-width: 320px; font-size: .86rem; line-height: 1.35; opacity: .88; }
.cw-poster .ar { position: relative; display: block; font-family: 'Noto Kufi Arabic', var(--font); color: var(--gold); font-size: 15px; margin-top: 2px; }
@keyframes cw-in { from { transform: translateY(8px) scale(.98); } }

/* HUD */
.cw-hud { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.cw-stat { background: var(--surface); border-radius: 12px; padding: 6px 12px; text-align: center; min-width: 74px; box-shadow: 0 1px 0 var(--line); }
.cw-stat b { display: block; font: 700 18px var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.cw-stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.cw-stat.turn { box-shadow: 0 0 0 2px var(--accent) inset; }
.cw-bar { display: flex; gap: 8px; margin-top: 14px; width: 100%; max-width: 440px; }
.cw-bar .cw-btn { min-height: 44px; font-size: .95rem; }

/* Settings menu: the majlis bottom sheet (header row, icon · label · value rows). */
.cw-pop {
  position: fixed; left: 50%; bottom: 0; top: auto; right: auto; transform: translateX(-50%); z-index: 50;
  width: min(560px, 100%); max-height: 88vh; overflow: auto; background: var(--surface);
  border-radius: 22px 22px 0 0; padding: 4px 12px max(14px, env(safe-area-inset-bottom));
  box-shadow: 0 0 0 100vmax rgba(5, 15, 18, .45), var(--shadow);
  animation: cw-sheet .22s cubic-bezier(.2, .8, .3, 1);
}
.cw-pop-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px 6px; }
.cw-pop-head h2 { margin: 0; font: 700 1.2rem var(--display); }
.cw-pop > button { display: flex; align-items: center; width: 100%; gap: 12px; background: none; border: 0; padding: 12px 6px; border-radius: 12px; text-align: start; }
.cw-pop > button:hover, .cw-pop > button:focus-visible { background: var(--surface2); outline: none; }
.cw-pop > button > span { flex: 1; font-weight: 600; }
.cw-pop small { color: var(--muted); font-size: .9rem; }
.cw-pop .cw-ic { font-style: normal; width: 28px; text-align: center; font-size: 1.2rem; flex: 0 0 auto; }
@keyframes cw-sheet { from { transform: translate(-50%, 40px); } }

/* Modal */
.cw-modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(5, 15, 18, .45); animation: cw-fade .2s ease; }
.cw-card { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); padding: 20px 18px 16px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; animation: cw-rise .24s cubic-bezier(.2, .8, .3, 1); max-height: 90dvh; overflow: auto; }
.cw-card h2 { font: 700 1.3rem var(--display); margin: 0; text-align: center; letter-spacing: -.01em; }
.cw-card p, .cw-card li { color: var(--muted); line-height: 1.5; margin: 0; font-size: 15px; }
.cw-card ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }
.cw-card .big { font-size: 46px; text-align: center; line-height: 1; }
.cw-stars { text-align: center; font-size: 30px; letter-spacing: 4px; }
.cw-stars .off { filter: grayscale(1); opacity: .3; }
@keyframes cw-fade { from { opacity: 0; } }
@keyframes cw-rise { from { transform: translateY(24px); opacity: 0; } }

/* Toast + floating text */
.cw-toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-weight: 600; z-index: 70; animation: cw-toast .25s ease; font-size: 14px; max-width: 90vw; text-align: center; box-shadow: 0 10px 24px rgba(0, 0, 0, .2); }
@keyframes cw-toast { from { opacity: 0; transform: translate(-50%, 20px); } }
.cw-float { position: fixed; z-index: 55; pointer-events: none; font-weight: 800; font-family: var(--display); color: var(--gold); text-shadow: 0 2px 0 rgba(0, 0, 0, .25); transform: translate(-50%, -50%); white-space: nowrap; }
.cw-fx { position: fixed; inset: 0; pointer-events: none; z-index: 54; }

/* Arabic: page chrome reads right to left; game boards keep their own direction. */
html.cw-lang-ar .cw-top, html.cw-lang-ar .cw-menu, html.cw-lang-ar .cw-card, html.cw-lang-ar .cw-pop, html.cw-lang-ar .cw-toast { direction: rtl; }
html.cw-lang-ar .cw-top .back { transform: scaleX(-1); }
/* UI copy that is still English keeps its own punctuation order inside the RTL chrome. */
html.cw-lang-ar :is(.cw-sub, .cw-best, .cw-poster .tag, .cw-card p, .cw-card li, .cw-toast) { unicode-bidi: plaintext; }
html.cw-lang-ar body { font-family: 'Noto Kufi Arabic', var(--font); }
/* Arabic text only for players who chose Arabic. Mark Arabic-only bits with class "ar-only". */
html:not(.cw-lang-ar) .ar-only, html:not(.cw-lang-ar) .cw-poster .ar { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .cw-hero > *, .cw-card, .cw-modal, .cw-pop, .cw-poster, .cw-toast { animation: none !important; }
}

/* ---- Walkthrough video player ---- */
.cw-wt-btn { position: relative; z-index: 1; margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 800; font-size: 14px;
  padding: 8px 16px 8px 8px; border-radius: 999px; border: 0; cursor: pointer; color: #1d1640; background: #ffd23f; box-shadow: 0 6px 16px rgba(0,0,0,.25), inset 0 -3px 0 rgba(0,0,0,.12); }
.cw-wt-btn .pl { width: 26px; height: 26px; border-radius: 50%; background: #1d1640; display: grid; place-items: center; }
.cw-wt-btn .pl::after { content: ''; margin-left: 3px; border-left: 10px solid #ffd23f; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.cw-wt-btn:hover { transform: translateY(-1px); } .cw-wt-btn:active { transform: translateY(1px); }
@media (prefers-reduced-motion: no-preference) { .cw-wt-btn .pl { animation: cw-wt-beat 1.6s ease-in-out infinite; } }
@keyframes cw-wt-beat { 50% { transform: scale(1.12); } }
.cw-wt { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 12px; background: rgba(8, 6, 20, .78); backdrop-filter: blur(6px); animation: cw-wt-in .22s ease-out; }
.cw-wt.out { opacity: 0; transition: opacity .2s; }
@keyframes cw-wt-in { from { opacity: 0; } }
.cw-wt-box { width: min(420px, 100%, calc((100dvh - 110px) * 0.5625)); background: #120e26; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.6); color: #fff; }
.cw-wt-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; font-family: var(--display, inherit); }
.cw-wt-head .cw-icon { color: #fff; background: rgba(255,255,255,.1); }
.cw-wt-stage { position: relative; aspect-ratio: 9 / 16; background: #000; }
.cw-wt-stage video { width: 100%; height: 100%; display: block; object-fit: contain; }
.cw-wt-cap { position: absolute; left: 10px; right: 10px; bottom: 14px; padding: 10px 14px; border-radius: 16px; font-weight: 800; font-size: 16px; line-height: 1.3; text-align: center;
  background: rgba(18, 14, 38, .88); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.4); border: 2px solid rgba(255, 210, 63, .7);
  opacity: 0; transform: translateY(8px); transition: opacity .18s, transform .18s; pointer-events: none; }
.cw-wt-cap.on { opacity: 1; transform: none; }
.cw-wt-end { position: absolute; inset: 0; display: grid; align-content: end; gap: 10px; padding: 24px; background: linear-gradient(transparent 40%, rgba(0,0,0,.7)); }
.cw-wt-end[hidden] { display: none; }
.cw-wt-bar { height: 4px; background: rgba(255,255,255,.12); } .cw-wt-bar i { display: block; height: 100%; width: 0; background: #ffd23f; }

/* ---- Painted avatars (inline wherever an avatar is printed as text) ---- */
img.cw-av { display: inline-block; width: 1.3em; height: 1.3em; border-radius: 50%; object-fit: cover; vertical-align: -0.28em;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 2px 6px rgba(0, 0, 0, .3); background: #2a1f5c; }
/* Avatar frames (shared/cw-avatars.js FRAMES): a ring drawn in the border box, static (no animation). */
img.cw-av.cw-fr { box-sizing: border-box; border: var(--fw, max(2px, .12em)) solid transparent; background: linear-gradient(#2a1f5c, #2a1f5c) padding-box, var(--fr) border-box;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .3); }
.cw-fr-silver { --fr: linear-gradient(145deg, #ffffff, #9aa4b2 45%, #eef1f5 60%, #6b7280); }
.cw-fr-mint { --fr: linear-gradient(145deg, #b8fff0, #2dd4bf 50%, #0f766e); }
.cw-fr-rose { --fr: linear-gradient(145deg, #ffe4e6, #f9a8b8 40%, #e8a27c 65%, #b76e5a); }
.cw-fr-gold { --fr: linear-gradient(145deg, #fff3b0, #f5c542 35%, #b7791f 60%, #ffe08a 80%, #8a5a00); box-shadow: 0 0 0 1px rgba(80, 50, 0, .5), 0 0 10px rgba(255, 200, 60, .45); }
.cw-fr-neon { --fr: conic-gradient(from 200deg, #22d3ee, #a855f7, #f472b6, #22d3ee); box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), 0 0 10px rgba(168, 85, 247, .7), 0 0 4px rgba(34, 211, 238, .8); }
.cw-fr-rainbow { --fr: conic-gradient(#ff5f6d, #ffc371, #f9f871, #5ff2a0, #4fc3ff, #a77bff, #ff5f6d); }
.cw-fr-royal { --fr: conic-gradient(from 90deg, #fde68a, #7c3aed, #fde68a, #4c1d95, #fde68a, #7c3aed, #fde68a); box-shadow: 0 0 0 1px rgba(30, 10, 60, .6), 0 0 12px rgba(250, 204, 21, .5); }

/* ---- Living motion (cw-kit.js "Living motion") ---- */
.cw-living { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; contain: strict; }
.cw-living i { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; opacity: .22; will-change: transform;
  background: radial-gradient(circle, var(--tint, var(--accent)) 0%, color-mix(in srgb, var(--tint, var(--accent)) 35%, transparent) 30%, transparent 62%); }
.cw-living .b1 { left: -20vmax; top: -25vmax; animation: cw-drift1 26s ease-in-out infinite alternate; }
/* b2 is placed from the left (same spot as right: -25vmax): a right-anchored blob moves when the scrollbar appears, which counts as a big layout shift. */
.cw-living .b2 { left: calc(100vw - 45vmax); top: 20vh; opacity: .16; background: radial-gradient(circle, var(--accent) 0%, transparent 65%); animation: cw-drift2 32s ease-in-out infinite alternate; }
.cw-living .b3 { left: 10vw; top: calc(100vh - 35vmax); /* same spot as bottom: -35vmax, but it never moves when the page height changes */ opacity: .14; background: radial-gradient(circle, var(--gold) 0%, transparent 65%); animation: cw-drift3 38s ease-in-out infinite alternate; }
.cw-living b { position: absolute; bottom: -40px; font-size: var(--sz); line-height: 1; color: var(--tint, var(--accent)); opacity: 0; font-weight: 800;
  animation: cw-float var(--d) linear var(--dl) infinite; will-change: transform, opacity; }
@keyframes cw-drift1 { to { transform: translate3d(18vw, 14vh, 0); } }
@keyframes cw-drift2 { to { transform: translate3d(-16vw, -10vh, 0); } }
@keyframes cw-drift3 { to { transform: translate3d(12vw, -18vh, 0); } }
@keyframes cw-float {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  10% { opacity: .16; }
  50% { transform: translate3d(36px, -55vh, 0) rotate(160deg); }
  90% { opacity: .12; }
  100% { transform: translate3d(-36px, -110vh, 0) rotate(320deg); opacity: 0; }
}
@keyframes cw-float2 {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  10% { opacity: .16; }
  50% { transform: translate3d(-36px, -55vh, 0) rotate(-160deg); }
  90% { opacity: .12; }
  100% { transform: translate3d(36px, -110vh, 0) rotate(-320deg); opacity: 0; }
}
.cw-living b:nth-of-type(even) { animation-name: cw-float2; }
:root[data-theme="dark"] .cw-living i { opacity: .3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cw-living i { opacity: .3; } }
html.cw-paused .cw-living *, html.cw-paused [class*="cw-idle-"] { animation-play-state: paused !important; }
html.cw-paused .cw-living b { display: none; }

/* Buttons and menus feel alive: lift, light sweep, staggered menu entrance. */
@media (prefers-reduced-motion: no-preference) {
  .cw-btn { position: relative; overflow: hidden; transition: transform .16s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, background .15s; }
  .cw-btn:hover { transform: translateY(-2px); }
  .cw-btn:active { transform: translateY(1px) scale(.98); }
  .cw-btn:not(.ghost)::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
    transform: translateX(-120%); pointer-events: none; will-change: transform; }
  /* The shine loops only on game-menu buttons (a handful per page); elsewhere it plays on hover/focus.
     Looping it on every button (43 in the shop alone) kept the whole page repainting. */
  .cw-menu .cw-btn:not(.ghost)::after, .cw-btn:not(.ghost):is(:hover, :focus-visible)::after { animation: cw-sweep 5s ease-in-out infinite; }
  .cw-menu:not([hidden]) > * { animation: cw-in .45s cubic-bezier(.34,1.56,.64,1) backwards; }
  .cw-menu > *:nth-child(2) { animation-delay: .05s; } .cw-menu > *:nth-child(3) { animation-delay: .1s; } .cw-menu > *:nth-child(4) { animation-delay: .15s; }
  .cw-menu > *:nth-child(5) { animation-delay: .2s; } .cw-menu > *:nth-child(6) { animation-delay: .25s; } .cw-menu > *:nth-child(n+7) { animation-delay: .3s; }
  .cw-poster > :first-child { animation: cw-bob 4s ease-in-out infinite; }
  .cw-poster::after { content: ''; position: absolute; inset: 0; width: auto; height: auto; border-radius: inherit; pointer-events: none;
    background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.22) 50%, transparent 65%); background-size: 250% 100%; animation: cw-sheen 6s ease-in-out infinite; }
  .cw-idle-bob { animation: cw-bob 3s ease-in-out infinite; }
  .cw-idle-breathe { animation: cw-breathe 3.2s ease-in-out infinite; }
  .cw-idle-sway { animation: cw-sway 4s ease-in-out infinite; transform-origin: 50% 90%; }
  .cw-idle-glow { animation: cw-glow 1.8s ease-in-out infinite; }
  .cw-idle-shine { position: relative; overflow: hidden; }
  .cw-idle-shine::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.4) 50%, transparent 65%);
    transform: translateX(-120%); animation: cw-sweep 3.5s ease-in-out infinite; }
}
@keyframes cw-sweep { 0%, 60% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@keyframes cw-sheen { 0%, 55% { background-position: 150% 0; } 100% { background-position: -100% 0; } }
@keyframes cw-breathe { 50% { transform: scale(1.035); } }
@keyframes cw-sway { 50% { transform: rotate(3deg); } }
@keyframes cw-glow { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 55%, transparent), 0 0 22px color-mix(in srgb, var(--gold) 60%, transparent); } }
@media (prefers-reduced-motion: reduce) { .cw-living b { display: none; } .cw-living i { animation: none; } }

/* Motion setting = Reduced (set by cw-kit.js): stop one-shot and looping animations site-wide. */
html.cw-reduce *, html.cw-reduce *::before, html.cw-reduce *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }

/* ---- Reaction dock (every game screen) ---- */
.cw-emote-dock { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 60;
  width: 52px; height: 52px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; font-size: 26px; cursor: pointer;
  background: linear-gradient(180deg, #fff3c4, #ffd23f); box-shadow: 0 8px 20px rgba(0,0,0,.28), inset 0 -3px 0 rgba(0,0,0,.12), 0 0 0 3px rgba(255,255,255,.7); }
.cw-emote-dock:active { transform: scale(.92); }
@media (prefers-reduced-motion: no-preference) { html:not(.cw-paused) .cw-emote-dock span { display: inline-block; animation: cw-bob 2.6s ease-in-out infinite; } }
html.cw-lang-ar .cw-emote-dock { right: auto; left: max(14px, env(safe-area-inset-left)); }

/* ---- Vivid pass: brighter page colour and stronger living glow on every game ---- */
:root { --bg: #f3f0ff; }
.cw-living i { opacity: .36; filter: blur(55px) saturate(1.6); }
.cw-living .b2 { opacity: .3; background: radial-gradient(circle, #ec4899 0%, transparent 65%); }
.cw-living .b3 { opacity: .28; background: radial-gradient(circle, #06b6d4 0%, transparent 65%); }
.cw-living b { filter: saturate(1.5); }

/* ---- Shine pass for every page: glossy primary buttons and posters ---- */
.cw-btn:not(.ghost) { background-image: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,0) 55%); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 40%, transparent), inset 0 1px 0 rgba(255,255,255,.45), inset 0 -3px 0 rgba(0,0,0,.12); }
.cw-poster { box-shadow: 0 12px 30px color-mix(in srgb, var(--tile) 45%, transparent), inset 0 1px 0 rgba(255,255,255,.35); outline: 1px solid rgba(255,255,255,.22); outline-offset: -1px; }
.cw-chip.on, .cw-chip[aria-pressed="true"] { box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 40%, transparent), inset 0 1px 0 rgba(255,255,255,.4); }

/* ---- Performance pass: the living backdrop's soft radial gradients don't need a blur filter
   (a 55px blur on screen-sized moving layers is the main cause of lag on phones). ---- */
.cw-living i { filter: none !important; width: 70vmax; height: 70vmax; background: radial-gradient(circle, color-mix(in srgb, var(--tint, var(--accent)) 85%, transparent) 0%, transparent 62%); }
.cw-living .b2 { background: radial-gradient(circle, rgba(236, 72, 153, .9) 0%, transparent 62%); }
.cw-living .b3 { background: radial-gradient(circle, rgba(6, 182, 212, .9) 0%, transparent 62%); }
.cw-living b { filter: none !important; }
.cw-living b:nth-of-type(n+9) { display: none; }
@media (max-width: 700px) { .cw-living b:nth-of-type(n+6) { display: none; } }

/* ---- Smooth mode (cw-kit.js turns it on when a device can't keep up): decorative motion off, gameplay motion kept ---- */
html.cw-lite .cw-living, html.cw-lite .sparkles { display: none !important; }
html.cw-lite * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
html.cw-lite .cw-tdeco .x::before, html.cw-lite .cw-tdeco .x::after, html.cw-lite .cwg-sheen::before, html.cw-lite [class*="sheen"]::before, html.cw-lite [class*="sheen"]::after { animation: none !important; }
html.cw-lite .cwc-live .turn .av::after { animation-duration: 2.4s; }

/* ---- Phones: decoration holds still (gameplay animations are unchanged) ---- */
@media (hover: none) {
  .cw-living i { animation: none !important; }
  .cw-tdeco .x::before, .cw-tdeco .x::after { animation: none !important; }
  .cwg-amb { display: none !important; }
  .cwg-orn i, .cwg-orn b { animation: none !important; }
}
html.cw-lite .cwg-amb { display: none !important; }

/* ==== Reactions: fun, modern panel (styles only; same buttons and behaviour) ==== */
.cw-modal:has(#rx) { background: rgba(6, 4, 18, .55); backdrop-filter: blur(3px); }
.cw-card:has(#rx) { max-width: 440px; border-radius: 28px; padding: 18px 16px 14px; color: #f4f1ff;
  background: radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--accent, #7c3aed) 38%, #1a1530) 0%, #14102a 55%, #0e0b1f 100%);
  border: 1px solid rgba(255,255,255,.12); box-shadow: 0 30px 60px -12px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.18); }
.cw-card:has(#rx) h2 { font-size: 1.45rem; font-weight: 800; background: linear-gradient(90deg, #fff, #ffe08a 45%, #ff9ad5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cw-card:has(#rx) h2::after { content: ' 🎉'; -webkit-text-fill-color: initial; }
#rx { display: grid; gap: 8px; }
#rx p, #rx .rx-count, #rx > div > p { color: rgba(236,232,255,.75); }
#rx a { color: #ffd23f; }
/* tabs */
#rx .react-tabs { gap: 8px; padding: 2px 2px 6px; scrollbar-width: none; }
#rx .react-tabs button { color: #fff; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); padding: 5px 13px 5px 5px; font-size: 13px; transition: transform .15s, background .15s; }
#rx .react-tabs button:first-child { padding-left: 13px; }
#rx .react-tabs button.on { background: linear-gradient(135deg, #8b5cf6, #ec4899); border-color: transparent; box-shadow: 0 6px 16px rgba(236,72,153,.4); }
#rx .react-tabs button:active { transform: scale(.95); }
#rx .rx-legends { color: #ffd23f; font-weight: 800; }
#rx .react-groups button { color: #e8e4ff; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); padding: 5px 12px; font-weight: 700; }
#rx .react-groups button.on { color: #1a1406; background: linear-gradient(180deg, #ffe7a0, #ffc94d); border-color: transparent; box-shadow: 0 4px 12px rgba(255,201,77,.35); }
#rx input[type="search"], #rx input { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); color: #fff; border-radius: 14px; }
/* reaction tiles */
#rx .react-grid { gap: 10px; padding: 2px; scrollbar-width: thin; }
#rx .react-grid button { position: relative; gap: 10px; padding: 10px 10px 10px 8px; border-radius: 16px; color: #fff; font-size: 13.5px; line-height: 1.25;
  background: linear-gradient(160deg, rgba(255,255,255,.1), rgba(255,255,255,.03)); border: 1px solid rgba(255,255,255,.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08); transition: transform .18s cubic-bezier(.34,1.56,.64,1), background .15s, border-color .15s; }
#rx .react-grid button .e { flex: none; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 26px;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.35), transparent 60%), linear-gradient(145deg, #8b5cf6, #ec4899);
  box-shadow: 0 6px 14px rgba(0,0,0,.3), inset 0 -2px 0 rgba(0,0,0,.15); transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
#rx .react-grid > :nth-child(6n+2) .e, #rx .react-grid > :nth-child(6n+2) button .e { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.35), transparent 60%), linear-gradient(145deg, #f59e0b, #ef4444); }
#rx .react-grid > :nth-child(6n+3) .e, #rx .react-grid > :nth-child(6n+3) button .e { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.35), transparent 60%), linear-gradient(145deg, #10b981, #0ea5e9); }
#rx .react-grid > :nth-child(6n+4) .e, #rx .react-grid > :nth-child(6n+4) button .e { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.35), transparent 60%), linear-gradient(145deg, #3b82f6, #8b5cf6); }
#rx .react-grid > :nth-child(6n+5) .e, #rx .react-grid > :nth-child(6n+5) button .e { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.35), transparent 60%), linear-gradient(145deg, #ec4899, #f43f5e); }
#rx .react-grid > :nth-child(6n) .e, #rx .react-grid > :nth-child(6n) button .e { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.35), transparent 60%), linear-gradient(145deg, #eab308, #84cc16); }
#rx .react-grid button small { margin-top: 4px; display: inline-flex; align-items: center; gap: 3px; width: max-content; padding: 2px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; color: #c9f7ea; background: rgba(95,242,208,.12); border: 1px solid rgba(95,242,208,.25); }
#rx .react-grid button:hover, #rx .react-grid button:focus-visible { transform: translateY(-2px); background: linear-gradient(160deg, rgba(255,255,255,.16), rgba(255,255,255,.05)); border-color: rgba(255,210,63,.6); box-shadow: 0 10px 22px -8px rgba(0,0,0,.6), 0 0 0 1px rgba(255,210,63,.35); }
#rx .react-grid button:hover .e, #rx .react-grid button:focus-visible .e { transform: rotate(-8deg) scale(1.12); }
#rx .react-grid button:active { transform: scale(.95); }
#rx .react-grid button:active .e { transform: scale(1.25) rotate(6deg); }
#rx .react-grid .rx-item > button { opacity: .7; }
#rx .react-grid .rx-item > button small { color: #ffe7a0; background: rgba(255,210,63,.12); border-color: rgba(255,210,63,.3); }
#rx .react-grid button.combo { color: #3d2a00; background: linear-gradient(160deg, #fff7d1, #ffd36b); border-color: rgba(255,255,255,.6); }
#rx .react-grid button.combo small { color: #5a3d00; background: rgba(255,255,255,.5); border-color: rgba(122,75,0,.25); }
#rx .react-grid .pbtn svg { border-radius: 14px; background: rgba(255,255,255,.08); }
.cw-card:has(#rx) .cw-btn { border-radius: 999px; background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.06)); color: #fff; border: 1px solid rgba(255,255,255,.16); }
/* phones: the panel slides up like a sheet */
@media (max-width: 560px) {
  .cw-modal:has(#rx) { place-items: end center; padding: 0; }
  .cw-card:has(#rx) { max-width: none; border-radius: 26px 26px 0 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); animation: cw-sheet .32s cubic-bezier(.2,.8,.2,1); }
  .cw-card:has(#rx)::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.3); margin: -6px auto 4px; }
  #rx .react-grid { max-height: 50dvh; }
}
@keyframes cw-sheet { from { transform: translateY(100%); } }
/* the 😎 button */
.cw-emote-dock { width: 56px; height: 56px; font-size: 28px; background: radial-gradient(circle at 35% 28%, #fff8d6 0%, #ffd23f 45%, #f59e0b 100%);
  box-shadow: 0 10px 24px rgba(245,158,11,.45), 0 0 0 3px rgba(255,255,255,.85), 0 0 0 6px rgba(245,158,11,.25), inset 0 -4px 0 rgba(0,0,0,.12);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s; }
@media (hover: hover) { .cw-emote-dock:hover { transform: translateY(-3px) scale(1.06) rotate(-6deg); } }
.cw-emote-dock::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(255,210,63,.6); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) { html:not(.cw-paused):not(.cw-lite) .cw-emote-dock::after { animation: cw-dockring 2.8s ease-out infinite; } }
@keyframes cw-dockring { 0% { transform: scale(.9); opacity: .8; } 70%, 100% { transform: scale(1.35); opacity: 0; } }
#rx, #rx > * { min-width: 0; }
#rx .react-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#rx .react-grid button, #rx .react-grid .rx-item { min-width: 0; }
#rx .react-grid button > span { min-width: 0; overflow-wrap: anywhere; }

/* Story intro (CW.intro): a storybook card over the game, illustrated for adventures, text-only for classics. */
.cw-story { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at center, rgba(10, 14, 30, .78), rgba(4, 6, 14, .94)); animation: cw-story-in .35s ease both; }
.cw-story.out { animation: cw-story-out .25s ease both; }
.cw-story-card { width: min(560px, 100%); border-radius: 22px; overflow: hidden; background: #15182c; color: #f4f1ff; box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .08); }
.cw-story.art .cw-story-card { width: min(860px, 100%); }
.cw-story-pic { display: none; aspect-ratio: 16 / 9; background: #0c0e1c; overflow: hidden; }
.cw-story.art .cw-story-pic { display: block; }
.cw-story-pic img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transform: scale(1.02); transition: opacity .6s ease; }
.cw-story-pic img.in { opacity: 1; }
@media (prefers-reduced-motion: no-preference) { .cw-story-pic img.in { animation: cw-story-pan 14s ease-out both; } }
.cw-story-body { padding: 18px 22px 16px; }
.cw-story-title { display: block; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; color: #ffd23f; margin-bottom: 6px; }
.cw-story-text { font-size: clamp(16px, 2.3vw, 19px); line-height: 1.55; margin: 0 0 14px; min-height: 4.6em; }
.cw-story-text.in { animation: cw-story-text .45s ease both; }
.cw-story-foot { display: flex; align-items: center; gap: 10px; }
.cw-story-dots { display: flex; gap: 6px; flex: 1; }
.cw-story-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .25); transition: background .3s, transform .3s; }
.cw-story-dots i.on { background: #ffd23f; transform: scale(1.25); }
.cw-story-skip, .cw-story-next { font: inherit; font-weight: 800; border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; }
.cw-story-skip { background: transparent; color: #b9b4d6; }
.cw-story-next { background: #ffd23f; color: #1d1640; box-shadow: 0 4px 0 #b88a00; min-width: 120px; }
.cw-story-next:active { transform: translateY(2px); box-shadow: 0 2px 0 #b88a00; }
.cw-story-btn .bk { width: 26px; height: 26px; border-radius: 50%; background: #1d1640; display: grid; place-items: center; font-size: 14px; }
@keyframes cw-story-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes cw-story-out { to { opacity: 0; } }
@keyframes cw-story-text { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes cw-story-pan { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.1) translate(-2%, -1%); } }

/* Share your win: a small button after a win, and a preview with Download / WhatsApp / Copy link on computers */
.cw-sharewin { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 8500; display: flex; gap: 6px; align-items: center;
  animation: cw-sw-in .35s cubic-bezier(.2,1.4,.4,1) both; }
.cw-sharewin.out { animation: cw-sw-out .25s ease both; }
.cw-sharewin .go { font: inherit; font-weight: 800; font-size: 16px; border: 0; border-radius: 999px; padding: 12px 20px; cursor: pointer; color: #1d1640; background: #ffd23f; box-shadow: 0 6px 20px rgba(0,0,0,.35), 0 3px 0 #b88a00; }
.cw-sharewin .x { font: inherit; border: 0; border-radius: 50%; width: 34px; height: 34px; cursor: pointer; color: #fff; background: rgba(20,24,44,.85); }
.cw-sharewin-modal { position: fixed; inset: 0; z-index: 9100; display: grid; place-items: center; padding: 16px; background: rgba(4,6,14,.82); }
.cw-sharewin-modal .box { position: relative; width: min(420px, 100%); background: #15182c; border-radius: 20px; padding: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.cw-sharewin-modal img { display: block; width: 100%; border-radius: 12px; }
.cw-sharewin-modal .row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.cw-sharewin-modal .row .cw-btn { font-size: 14px; padding: 10px 6px; text-align: center; text-decoration: none; }
.cw-sharewin-x { position: absolute; top: -12px; right: -12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #2a2f4d; color: #fff; cursor: pointer; font-size: 16px; }
.cw-offercard { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 8500; width: min(460px, calc(100% - 24px)); display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: 18px; background: #1b1f38; color: #fff; box-shadow: 0 14px 40px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,210,63,.35); animation: cw-sw-in .35s cubic-bezier(.2,1.4,.4,1) both; }
.cw-offercard.out { animation: cw-sw-out .25s ease both; }
.cw-offercard .ic { font-size: 30px; line-height: 1; }
.cw-offercard .tx { display: grid; gap: 2px; min-width: 0; }
.cw-offercard b { font-size: 15px; line-height: 1.25; }
.cw-offercard small { font-size: 12.5px; color: #cfd6ea; line-height: 1.3; }
.cw-offercard .go { font-weight: 800; font-size: 14px; text-decoration: none; white-space: nowrap; border-radius: 999px; padding: 10px 14px; color: #1d1640; background: #ffd23f; box-shadow: 0 3px 0 #b88a00; }
.cw-offercard .x { position: absolute; top: -10px; right: -10px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: #2a2f4d; color: #fff; cursor: pointer; font-size: 13px; }
[dir="rtl"].cw-offercard .x { right: auto; left: -10px; }
@keyframes cw-sw-in { from { opacity: 0; transform: translate(-50%, 30px) scale(.9); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes cw-sw-out { to { opacity: 0; transform: translate(-50%, 20px); } }

/* ---------- Victory card (CW.winCard) ---------- */
.cw-card.cw-win { max-width: 400px; padding-top: 8px; text-align: center; overflow: hidden; position: relative;
  background: radial-gradient(120% 70% at 50% 0%, #5b3a9e 0%, #2a1752 55%, #1a0f36 100%); color: #fff7e0; box-shadow: 0 0 0 2px #ffcf5a, 0 0 0 5px rgba(255,207,90,.25), 0 30px 70px rgba(0,0,0,.6); }
.cw-card.cw-win.lose { background: radial-gradient(120% 70% at 50% 0%, #3d4a63 0%, #232b3d 60%, #161b28 100%); box-shadow: 0 0 0 2px #b9c4d8, 0 30px 70px rgba(0,0,0,.6); }
.cw-card.cw-win h2 { font-size: clamp(1.5rem, 6vw, 1.9rem); color: #ffe08a; text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 22px rgba(255,200,80,.45); order: 2; }
.cw-card.cw-win.lose h2 { color: #e6ecf7; text-shadow: 0 3px 0 rgba(0,0,0,.35); }
.cw-win-hero { position: relative; height: 150px; display: grid; place-items: center; order: 1; margin: 0 -18px; }
.cw-win-hero .rays { position: absolute; width: 300px; height: 300px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(255,214,102,.55) 0 8deg, transparent 8deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%); mask: radial-gradient(circle, #000 18%, transparent 68%); animation: cw-rays 14s linear infinite; }
.cw-win.lose .cw-win-hero .rays { background: repeating-conic-gradient(rgba(190,205,230,.25) 0 8deg, transparent 8deg 20deg); }
.cw-win-hero .glow { position: absolute; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, rgba(255,230,140,.85), rgba(255,180,40,0) 70%); animation: cw-glow 2.4s ease-in-out infinite; }
.cw-win.lose .cw-win-hero .glow { background: radial-gradient(circle, rgba(200,215,240,.45), transparent 70%); }
.cw-win-hero .cup { position: relative; font-size: 96px; line-height: 1; filter: drop-shadow(0 12px 10px rgba(0,0,0,.45)); animation: cw-cup .9s cubic-bezier(.34,1.56,.64,1) both, cw-cupf 3.2s ease-in-out .9s infinite; }
.cw-win-hero .spark { position: absolute; color: #fff4c2; font-style: normal; font-size: 18px; animation: cw-spark 1.8s ease-in-out infinite; }
.cw-win-hero .s1 { left: 26%; top: 24%; } .cw-win-hero .s2 { right: 25%; top: 34%; animation-delay: .6s; font-size: 14px; } .cw-win-hero .s3 { left: 33%; bottom: 18%; animation-delay: 1.1s; font-size: 12px; }
.cw-win.lose .spark { display: none; }
.cw-card.cw-win .cw-win-sub { order: 3; color: #e8dcff; margin-top: -4px; }
.cw-win-places { order: 4; list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 5px; }
.cw-card.cw-win .cw-win-places li { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 12px; background: rgba(255,255,255,.08); color: #f6efff; font-weight: 700; font-size: 15px; }
.cw-card.cw-win .cw-win-places li.first { background: linear-gradient(90deg, rgba(255,207,90,.32), rgba(255,207,90,.08)); box-shadow: inset 0 0 0 1px rgba(255,207,90,.55); }
.cw-win-places .md { font-size: 20px; } .cw-win-places .dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.6); } .cw-win-places small { margin-left: auto; color: #cbbfe6; font-weight: 700; }
.cw-win-stats { order: 5; display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 6px; }
.cw-win-stats div { padding: 8px 4px; border-radius: 12px; background: rgba(255,255,255,.07); display: grid; gap: 1px; } .cw-win-stats b { font-size: 17px; } .cw-win-stats small { color: #cbbfe6; font-size: 11.5px; font-weight: 700; }
.cw-win-coins { order: 6; justify-self: center; align-self: center; margin: 2px auto 0; padding: 6px 16px; border-radius: 999px; background: linear-gradient(180deg, #ffe58a, #f5b528); color: #4a2a00; font: 900 18px var(--display); box-shadow: 0 3px 0 #b07a10, 0 0 16px rgba(255,200,60,.5); }
.cw-card.cw-win .cw-actions { order: 9; margin-top: 10px !important; }
.cw-card.cw-win .cw-actions .cw-btn:first-child { min-height: 56px; font-size: 19px; font-weight: 900; color: #3a2200; border: 0; background: linear-gradient(180deg, #ffe680, #ffb42e 60%, #f39a12); box-shadow: 0 5px 0 #b06a08, 0 10px 22px rgba(255,170,40,.45), inset 0 2px 0 rgba(255,255,255,.6); animation: cw-rematch 1.8s ease-in-out infinite; }
.cw-card.cw-win .cw-actions .cw-btn:first-child:active { transform: translateY(3px); box-shadow: 0 2px 0 #b06a08, 0 6px 14px rgba(255,170,40,.4); }
.cw-card.cw-win .cw-actions .cw-btn.ghost { color: #e8dcff; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
@keyframes cw-rays { to { transform: rotate(360deg); } }
@keyframes cw-glow { 50% { transform: scale(1.18); opacity: .75; } }
@keyframes cw-cup { from { transform: scale(.2) translateY(40px) rotate(-18deg); opacity: 0; } }
@keyframes cw-cupf { 50% { transform: translateY(-6px) rotate(2deg); } }
@keyframes cw-spark { 0%, 100% { transform: scale(.4); opacity: 0; } 50% { transform: scale(1.2); opacity: 1; } }
@keyframes cw-rematch { 50% { box-shadow: 0 5px 0 #b06a08, 0 10px 30px rgba(255,190,60,.75), inset 0 2px 0 rgba(255,255,255,.6); } }
@media (prefers-reduced-motion: reduce) { .cw-win-hero *, .cw-card.cw-win .cw-actions .cw-btn { animation: none !important; } }
html.cw-still .cw-win-hero *, html.cw-still .cw-card.cw-win .cw-actions .cw-btn { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }

/* Lifted card (CW.tapToPlay): tap once to lift, tap again or double-tap to play */
.cw-lift { translate: 0 -22%; filter: drop-shadow(0 0 6px rgba(255, 214, 102, .95)) drop-shadow(0 8px 10px rgba(0, 0, 0, .35)); z-index: 30 !important; transition: translate .12s ease; }

/* Quick meme bar: opened by the 😎 dock, a slim scrolling row of recent and favourite memes beside it. */
.cw-qbar { position: fixed; z-index: 61; bottom: max(16px, env(safe-area-inset-bottom)); right: calc(max(14px, env(safe-area-inset-right)) + 66px); left: 10px;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 6px; border-radius: 20px;
  background: rgba(8, 24, 28, .94); box-shadow: 0 0 0 1px rgba(255, 210, 94, .35), 0 10px 26px rgba(0, 0, 0, .45);
  animation: cw-qbar-in .2s cubic-bezier(.3, 1.4, .5, 1) both; transform-origin: right center; }
.cw-qbar::-webkit-scrollbar { display: none; }
.cw-qbar.out { animation: cw-qbar-out .17s ease-in both; }
html.cw-lang-ar .cw-qbar { right: 10px; left: calc(max(14px, env(safe-area-inset-left)) + 66px); transform-origin: left center; }
@keyframes cw-qbar-in { from { opacity: 0; transform: scaleX(.3); } to { opacity: 1; transform: none; } }
@keyframes cw-qbar-out { to { opacity: 0; transform: scaleX(.4); } }
.cw-qb { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 64px; min-height: 58px; padding: 4px 3px;
  border: 0; border-radius: 14px; background: rgba(255, 255, 255, .08); color: #fff; font: 700 10px/1.1 var(--font); cursor: pointer; }
.cw-qb .qe { font-size: 26px; line-height: 1; }
.cw-qb .qt { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.cw-qb.snd { box-shadow: inset 0 0 0 1.5px rgba(255, 210, 94, .5); }
.cw-qb.more { background: rgba(255, 210, 94, .18); }
.cw-qb:active { transform: scale(.92); }
.cw-emote-dock.open { box-shadow: 0 0 0 3px #fff, 0 0 18px rgba(255, 210, 94, .8) !important; }
@media (prefers-reduced-motion: reduce) { .cw-qbar, .cw-qbar.out { animation: none; } }

/* Meme stickers at the table: the emoji pops out of the sender's seat in a round badge with the phrase under it. */
.meme.sticker { flex-direction: column; gap: 5px; padding: 0; background: none; box-shadow: none; max-width: min(200px, 60vw); text-align: center; }
.meme.sticker::after { display: none; }
.meme.sticker .e { display: grid; place-items: center; width: 80px; height: 80px; font-size: 50px; border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ffffff 0%, #fff1c2 55%, #ffc94d 100%);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(255, 201, 77, .55), 0 8px 18px rgba(0, 0, 0, .42);
  animation: cw-stk-pop .55s cubic-bezier(.3, 1.7, .5, 1) both, rx-wiggle .9s ease-in-out .55s infinite; }
.meme.sticker > span:not(.e):not(.rx-wave) { background: #fff; color: #102a33; padding: 6px 12px; border-radius: 16px; font-size: 15px; line-height: 1.2;
  box-shadow: 0 0 0 2.5px #ffc94d, 0 5px 12px rgba(0, 0, 0, .35); }
.meme.sticker .meme-who { font-size: 11px; }
@keyframes cw-stk-pop { 0% { transform: scale(.2) rotate(-25deg); } 60% { transform: scale(1.18) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
@media (prefers-reduced-motion: reduce) { .meme.sticker .e { animation: none; } }
