/* Games tab: small, constant motion that invites a tap — a light sweep over the cards, the word tiles in a wave,
   the quiz bars breathing, a shimmer on the battle bar, a pulsing «Крутить». All transform/opacity on small elements;
   off with Живые анимации (.still) and with reduced motion. */
.y button[aria-label="Крик души"], .y button[aria-label="Слово дня"], .y button[aria-label="Квиз дня"],
.y button[aria-label="Битва групп"], .y button[aria-label="Колесо дня"], .y button[aria-label="Рейтинг недели"] {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, color-mix(in srgb, var(--ac) 14%, var(--s1)) 0%, var(--s1) 62%) !important; }
.y button[aria-label="Битва групп"], .y button[aria-label="Рейтинг недели"] {
  background: linear-gradient(225deg, color-mix(in srgb, var(--ac) 14%, var(--s1)) 0%, var(--s1) 62%) !important; }
/* No light sweep inside the cards: an animated layer clipped by each rounded card made scrolling stutter. */

/* Word of the day: the mini board ripples like letters being tried. */
.y button[aria-label="Слово дня"] .stag-pop { animation: pop .5s var(--spring) both, g-wave 3.6s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 14ms), calc(1s + var(--i, 0) * 70ms); }
@keyframes g-wave { 0%, 18%, 100% { transform: none; } 8% { transform: translateY(-3px) scale(1.08); } }

/* Quiz: the bars breathe one after another. */
.y button[aria-label="Квиз дня"] .grow { animation: grow .9s var(--spring) both, g-eq 1.8s ease-in-out infinite alternate; transform-origin: bottom; }
.y button[aria-label="Квиз дня"] .grow:nth-child(2) { animation-delay: 0s, .2s; }
.y button[aria-label="Квиз дня"] .grow:nth-child(3) { animation-delay: 0s, .4s; }
.y button[aria-label="Квиз дня"] .grow:nth-child(4) { animation-delay: 0s, .6s; }
.y button[aria-label="Квиз дня"] .grow:nth-child(5) { animation-delay: 0s, .8s; }
@keyframes g-eq { from { transform: scaleY(1); } to { transform: scaleY(.55); } }

/* Battle: the bar stays a plain accent fill (its moving shimmer repainted every frame). */
.y button[aria-label="Битва групп"] .fill { min-width: 6px; }

/* Wheel: «Крутить» is an accent pill with a soft pulse. */
.y button[aria-label="Колесо дня"] > span[style*="height: 36px"] { position: relative; background: var(--ac) !important; color: var(--ink); }
.y button[aria-label="Колесо дня"] > span[style*="height: 36px"]::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 2px solid var(--ac); animation: g-pulse 2.2s ease-out infinite; }
@keyframes g-pulse { 0% { transform: scale(1); opacity: .7; } 70%, 100% { transform: scale(1.35, 1.6); opacity: 0; } }

/* Weekly rating: the leaders' faces bob in turn. */
.y button[aria-label="Рейтинг недели"] > span:first-child > span { animation: g-bob 2.8s ease-in-out infinite; }
.y button[aria-label="Рейтинг недели"] > span:first-child > span:nth-child(2) { animation-delay: .3s; }
.y button[aria-label="Рейтинг недели"] > span:first-child > span:nth-child(3) { animation-delay: .6s; }
@keyframes g-bob { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-4px); } }

.still .y button::after, .y.still button::after { animation: none !important; opacity: 0; }
.y.still button[aria-label] * { animation-iteration-count: 1 !important; }
@media (prefers-reduced-motion: reduce) { .y button[aria-label]::after { animation: none !important; opacity: 0; } .y button[aria-label] * { animation-iteration-count: 1 !important; } }

/* Telegram: the Mini App fills the window, so sheets fit its height and have no rounded bottom; the role chip is compact. */
.y section.sheet { max-height: min(800px, calc(100% - 10px)) !important; }
@media (max-width: 599px) { .y section.sheet { border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important; } }
html.in-tg .y section.sheet { border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.y header > button[aria-pressed] { padding: 0 12px 0 10px !important; gap: 6px !important; font-size: 13px !important; margin-left: 6px; }
/* Narrow screens: the same 44 px circle as share and bell, icon dead centre (no gap left for the hidden label). */
@media (max-width: 420px) { .y header > button[aria-pressed] { width: 44px; height: 44px !important; padding: 0 !important; gap: 0 !important; justify-content: center; font-size: 0 !important; } }

/* Wheel of the day: the wheel sits on its own dark disc with a thin rim, so it stands out from the card. */
.y button[aria-label="Колесо дня"] .amb-spin { border-radius: 50%; background: color-mix(in srgb, var(--bg) 80%, black); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ac) 45%, transparent), 0 4px 14px rgba(0,0,0,.45); }
.y button[aria-label="Колесо дня"] .amb-spin > circle:first-of-type { fill: color-mix(in srgb, var(--bg) 75%, black); }


/* Header logo: bigger and free-standing — no dark plate or rim around it, the mark fills its 48 px square. */
.y header > .badge { width: 48px !important; height: 48px !important; border-radius: 15px !important; background: transparent !important; box-shadow: none !important; }
.y header > .badge img { width: 100%; height: 100%; }
.y header > .badge .tint { inset: 0; }
.y header > .badge + span > span:first-child { font-size: 15px !important; }
.y .g-feed[data-solo="true"] { display: none; }

/* «Зайди сюда»: a card with something to do right now (word not guessed, quiz waiting, a free spin, taps left) breathes a soft accent rim. */
.y button[data-ready="true"] { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ac) 40%, transparent) !important; }
.y button[data-ready="true"]::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ac) 85%, transparent), inset 0 0 22px color-mix(in srgb, var(--ac) 22%, transparent);
  animation: g-ready 2.6s ease-in-out infinite; }
@keyframes g-ready { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }
.y.still button[data-ready="true"]::before { animation: none; opacity: .7; }
@media (prefers-reduced-motion: reduce) { .y button[data-ready="true"]::before { animation: none; opacity: .7; } }

/* Anything behind an open sheet stands still: the screen is dimmed there anyway, and the sheet (a spinning wheel,
   a tap button) gets every frame. Background canvases skip those frames too (app.js r_gridLoop). */
.dim.on *, .dim.on *::before, .dim.on *::after { animation-play-state: paused !important; }

/* Battle: your own group in the ranking reads by its bold name only, without a coloured band. */
.y .g-me { background: transparent !important; }

/* Header on narrow screens: the title shrinks before anything overlaps it. */
.y header > .badge + span { overflow: hidden; }
.y header > .badge + span > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 380px) { .y header > .badge { width: 42px !important; height: 42px !important; } .y header > .badge + span > span:first-child { font-size: 13.5px !important; } .y header { gap: 6px !important; } }

/* Wheel of the day: the disc and its labels live on their own compositor layers from the start, so the 5 s turn
   is a pure GPU rotation instead of repainting the conic gradient every frame. */
.y .g-wheel, .y .g-wl { will-change: transform; backface-visibility: hidden; }

/* Level ring: the same soft accent glow inside as the battle button (games card and level sheet). */
.y .lv-glow::before { content: ""; position: absolute; inset: 14%; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--ac) 46%, transparent) 0%, color-mix(in srgb, var(--ac) 22%, transparent) 50%, color-mix(in srgb, var(--ac) 10%, transparent) 100%);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ac) 38%, transparent), 0 0 14px color-mix(in srgb, var(--ac) 22%, transparent); pointer-events: none; }

/* Keep the existing composer visible; only the message list scrolls. */
.y section.sheet:has(.g-shout-layout) { height: min(800px, calc(100% - 10px)); }
.y section.sheet:has(.g-shout-layout) > div:last-child { flex: 1; min-height: 0; overflow: hidden !important; display: flex; flex-direction: column; }
.y .g-shout-layout { height: auto !important; flex: 1; min-height: 0; }
