/* «Что за мем?»: a step of a round on the big screen, one look on the shared screen (/tv/) and on a PC player's stage
   (owner 2026-10-29: «версии некоторых экранов в ПК и ТВ почти не отличаются» → one code for both, after
   hundred-board.css, question-stage.css, quiplash-matchup.css, truth-detect.css, wyr-choice.css, fibbage-stage.css,
   knowme-stage.css and wml-stage.css). The markup and the moving part are shared/client/meme-stage.ts; /tv/
   «Имаджинариум» reuses the view (tv/style.css adds its own bits). The page supplies the palette (--light-card,
   --light-ink, --tv-line, --accent, --accent-ink, --gold, --text-primary, --rp-correct) and the cuts (--cut-1…4,
   --cut-shadow).

   The prompt on a white cut card with the teal shadow (a situation in ink, or the meme), the hint under it; with cards
   (the table, a PC player's hand) the prompt moves left and the cards fill the right as cut cards with a letter
   stamp. A PC player's cards are buttons: hover lifts the card, the pick gets the purple edge, the others fade, its
   own card on the table carries a label. */
@keyframes mms-cut-in { from { opacity: 0; transform: translateY(-26px) rotate(-5deg) scale(1.06); } }

.mms-root .tv-meme-main { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; }
.mms-root .tv-meme-prompt {
    display: grid; place-items: center; max-width: 980px; padding: 40px 56px; background: var(--light-card); color: var(--light-ink);
    border: 2px solid var(--tv-line); border-radius: 30px 18px 34px 20px / 20px 32px 18px 30px;
    box-shadow: 9px 11px 0 color-mix(in srgb, var(--accent) 30%, transparent); rotate: -1.2deg;
    animation: mms-cut-in .7s cubic-bezier(.3, 1.45, .5, 1) both;
}
.mms-root .tv-meme-prompt-text { margin: 0; font-weight: 700; font-size: 42px; line-height: 1.28; text-align: center; text-wrap: balance; overflow-wrap: anywhere; }
.mms-root .tv-meme-prompt.is-image { padding: 14px; }
.mms-root .tv-meme-prompt-image { display: block; max-width: 640px; max-height: 360px; border-radius: 16px; object-fit: contain; opacity: 0; transition: opacity .35s ease; }
.mms-root .tv-meme-prompt-image.is-loaded { opacity: 1; }
.mms-root .tv-meme-side { display: flex; flex-direction: column; align-items: center; gap: 18px; min-width: 0; }
.mms-root .tv-meme-hint { display: inline-flex; align-items: center; gap: 12px; margin: 0; font-size: 25px; font-weight: 700; color: var(--text-primary); text-align: center; text-wrap: balance; }
.mms-root .tv-meme-table:empty { display: none; }
/* With cards: the prompt on the left, the cards fill the right; the grid shares the height whatever the count, its
   columns picked by meme-stage.ts memeGrid so the pictures come out as big as the box allows. */
.mms-root.is-voting .tv-meme-main { flex-direction: row; align-items: center; gap: 30px; padding: 0 8px; }
.mms-root.is-voting .tv-meme-prompt { flex: 0 0 auto; max-width: 300px; padding: 24px 24px; }
.mms-root.is-voting .tv-meme-prompt-text { font-size: 26px; }
.mms-root.is-voting .tv-meme-prompt.is-image { padding: 10px; }
.mms-root.is-voting .tv-meme-prompt-image { max-width: 280px; max-height: 420px; }
.mms-root.is-voting .tv-meme-side { flex: 1; align-self: stretch; justify-content: center; gap: 14px; }
.mms-root.is-voting .tv-meme-hint { font-size: 21px; }
/* The table takes what the view leaves (a big room's foot of chips is taller), at most its 500 px. */
.mms-root.is-voting .tv-meme-table { flex: 1 1 0; height: auto; max-height: 500px; min-height: 0; }
.mms-root .tv-meme-table {
    width: 100%; height: 500px; display: grid; gap: 18px; padding: 4px 10px 10px;
    grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr));
}
.mms-root .tv-meme-table.is-captions { height: auto; max-height: 470px; grid-template-rows: none; grid-auto-rows: minmax(96px, auto); align-content: center; }
.mms-root .tv-meme-card {
    position: relative; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px;
    background: var(--light-card); color: var(--light-ink); border: 2px solid var(--tv-line);
    border-radius: var(--cut-1); box-shadow: var(--cut-shadow); rotate: -.8deg;
    animation: mms-cut-in .6s cubic-bezier(.3, 1.45, .5, 1) both; animation-delay: calc(180ms + var(--i, 0) * 110ms);
}
.mms-root .tv-meme-card:nth-child(4n + 2) { border-radius: var(--cut-2); rotate: .9deg; translate: 4px 4px; }
.mms-root .tv-meme-card:nth-child(4n + 3) { border-radius: var(--cut-3); rotate: -.4deg; translate: -2px -2px; }
.mms-root .tv-meme-card:nth-child(4n + 4) { border-radius: var(--cut-4); rotate: .6deg; translate: -4px 2px; }
/* Pictures in justified rows (meme-stage.ts memeJustified, owner 2026-10-29: memes of different proportions fit tightly,
   no empty bands in a card): the script sets each card's place and size, the picture fills it. */
.mms-root .tv-meme-table.is-justified { display: block; position: relative; padding: 0; }
.mms-root .tv-meme-table.is-justified .tv-meme-card { position: absolute; padding: 8px; transition: left .3s ease, top .3s ease, width .3s ease, height .3s ease; }
.mms-root .tv-meme-table.is-justified button.tv-meme-card { transition: left .3s ease, top .3s ease, width .3s ease, height .3s ease, border-color .2s ease, border-width .2s ease, box-shadow .2s ease, opacity .25s ease, scale .15s ease; }
.mms-root .tv-meme-table.is-justified .tv-meme-card-image { border-radius: 8px; }
/* The letter: a stamp, cut too and turned the other way (as the answers' letters on /tv/). */
.mms-root .tv-meme-card .tv-option-letter, .mms-show .tv-option-letter {
    position: absolute; z-index: 1; top: -12px; left: -12px; display: grid; place-items: center; width: 42px; height: 42px;
    font-family: var(--font-display, inherit); font-size: 19px; font-weight: 800; color: var(--accent-ink); background: var(--accent);
    border-radius: 46% 54% 50% 50% / 54% 46% 54% 46%; rotate: -6deg; box-shadow: 2px 3px 0 rgb(0 0 0 / 30%);
}
.mms-root .tv-meme-card:nth-child(even) .tv-option-letter { rotate: 5deg; border-radius: 54% 46% 46% 54% / 46% 54% 50% 50%; }
.mms-root .tv-meme-card-image { width: 100%; height: 100%; min-height: 0; border-radius: 10px; object-fit: contain; opacity: 0; transition: opacity .35s ease; }
.mms-root .tv-meme-card-image.is-loaded { opacity: 1; }
.mms-root .tv-meme-table.is-captions .tv-meme-card { justify-content: flex-start; padding: 16px 20px 16px 30px; }
/* The whole caption, no «…»: meme-stage.ts fitCaptions sets --caption-size (22 → 14 px) so every card fits the table. */
.mms-root .tv-meme-card-text { font-size: var(--caption-size, 22px); font-weight: 600; line-height: 1.25; text-align: left; overflow-wrap: break-word; }

/* ── A PC player's cards (buttons): hover lifts, the pick gets the purple edge and its shadow, the rest fade; its own
   card on the table carries «Ваша карта» on an ink strip and takes no vote unless the room allows it. ── */
.mms-root button.tv-meme-card {
    margin: 0; font-family: inherit; cursor: pointer;
    transition: border-color .2s ease, border-width .2s ease, box-shadow .2s ease, opacity .25s ease, scale .15s ease;
}
.mms-root button.tv-meme-card:hover:not(:disabled) { border-color: var(--accent); box-shadow: 7px 9px 0 color-mix(in srgb, var(--accent) 35%, transparent); }
.mms-root button.tv-meme-card:active:not(:disabled) { scale: .97; }
.mms-root button.tv-meme-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.mms-root button.tv-meme-card:disabled { cursor: default; }
.mms-root .tv-meme-table.is-votable button.tv-meme-card:disabled { opacity: .55; }
.mms-root .tv-meme-table.is-locked .tv-meme-card:not(.is-selected) { opacity: .45; }
.mms-root .tv-meme-card.is-selected {
    border-color: var(--gold); border-width: 4px; box-shadow: 6px 7px 0 color-mix(in srgb, var(--gold) 45%, transparent);
    /* The entrance stays in the list with its own delay, so taking the pick off doesn't replay it (owner 2026-10-30:
       «когда сним выделение с карты у нее странная аним» — the card vanished and flew in again). */
    animation: mms-cut-in .6s cubic-bezier(.3, 1.45, .5, 1) calc(180ms + var(--i, 0) * 110ms) both, mms-stamp .26s cubic-bezier(.3, 1.45, .5, 1);
}
.mms-root .tv-meme-card.is-selected .tv-option-letter { background: var(--gold); }
.mms-root .tv-meme-card-label {
    position: absolute; z-index: 1; left: 10px; right: 10px; bottom: 10px; padding: 5px 10px; border-radius: 8px;
    font-size: 15px; font-weight: 700; color: #fff; background: rgb(23 25 31 / 82%); text-align: center;
}
.mms-root .tv-meme-table.is-captions .tv-meme-card.is-own { padding-bottom: 46px; }
@keyframes mms-stamp { 0% { scale: 1; } 45% { scale: 1.04; } 100% { scale: 1; } }

/* ── Round end (reveal-results.js with `dashboard`), memes: the cards as the phones' image grid, big; owner and voters
   under each picture. On /tv/ (#r-box, also «Как хорошо ты меня знаешь?» meme questions) and on a PC player's stage
   (#reveal-container.mms-reveal); meme-stage.ts memeRevealLayout sets the sizes. ── */
:is(.tv, .mms-reveal) .is-meme-cards .rr-screen1,
.mms-reveal.is-meme-cards .rr-screen1 { grid-template-columns: 300px minmax(0, 1fr); column-gap: 32px; }
:is(.tv, .mms-reveal) .rr-option-image-row { grid-column: 2; align-self: center; display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 16px 18px; max-height: 560px; }
:is(.tv, .mms-reveal) .rr-container.rr-dashboard .rr-option-image-card {
    width: var(--tv-card-w, 196px); max-width: none; min-width: 0; border-radius: var(--cut-1); box-shadow: var(--cut-shadow);
    background: var(--rr-surface, var(--tv-surface)); border-width: 2px;
}
:is(.tv, .mms-reveal) .rr-option-image-card:nth-child(even) { border-radius: var(--cut-2); rotate: .8deg; }
:is(.tv, .mms-reveal) .rr-option-image-card:nth-child(odd) { rotate: -.7deg; }
:is(.tv, .mms-reveal) .rr-option-image-card > img { aspect-ratio: auto; height: var(--tv-card-img-h, 150px); object-fit: contain; background: rgb(23 25 31 / 5%); }
:is(.tv, .mms-reveal) .rr-option-image-card .rr-owner-avatar { width: 26px; height: 26px; font-size: 13px; }
:is(.tv, .mms-reveal) .rr-option-image-info { padding: 8px 10px 10px; }
:is(.tv, .mms-reveal) .rr-option-image-owner { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 6px; color: var(--rr-card-ink, var(--rr-ink, #fff)); }
:is(.tv, .mms-reveal) .rr-option-image-voters { font-size: 15px; margin-top: 4px; color: var(--rr-muted, var(--text-secondary)); }
/* The author and the voters apart (owner 2026-11-02: «не совсем понятно, кто мем выбрал, а кто за него проголосовал»):
   «Автор:» bold line with the points, then a thin rule and the muted «Голосовали:» line. */
:is(.tv, .mms-reveal) .rr-option-image-label { font-size: 14px; font-weight: 600; }
:is(.tv, .mms-reveal) .rr-option-image-owner .rr-author-points { font-size: 16px; }
:is(.tv, .mms-reveal) .rr-option-image-voters { padding-top: 5px; border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent); display: flex; flex-wrap: wrap; align-items: center; column-gap: 4px; }
:is(.tv, .mms-reveal) .rr-option-image-card.rr-type-correct { border-color: var(--rp-correct); box-shadow: 6px 7px 0 color-mix(in srgb, var(--rp-correct) 45%, transparent); }

/* ── The one-by-one show at the start of the voting (meme-stage.ts `present`, owner 2026-10-29: «мемы показывались по
   одному, вылетали с анимацией… и на них уже был бы вбит текст: сверху, снизу, как обычно у мемов»). The step hides
   under it (the table's cards deal in when it goes); each card flies in big on a white cut card with its letter,
   the caption on black bands above and below the picture in the meme font, then flies off the other way as the next one comes. ── */
@font-face { font-family: "WDYM Meme"; font-style: normal; font-weight: 700; font-display: swap; src: url("/whatdoyoumeme/assets/fonts/oswald-cyrillic-ext-700-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "WDYM Meme"; font-style: normal; font-weight: 700; font-display: swap; src: url("/whatdoyoumeme/assets/fonts/oswald-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "WDYM Meme"; font-style: normal; font-weight: 700; font-display: swap; src: url("/whatdoyoumeme/assets/fonts/oswald-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "WDYM Meme"; font-style: normal; font-weight: 700; font-display: swap; src: url("/whatdoyoumeme/assets/fonts/oswald-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@keyframes mms-fly-in {
    0% { opacity: 0; transform: translateX(calc(var(--side, -1) * 70vw)) rotate(calc(var(--side, -1) * 14deg)) scale(.7); }
    70% { opacity: 1; transform: translateX(calc(var(--side, -1) * -14px)) rotate(calc(var(--side, -1) * -2.4deg)) scale(1.02); }
    100% { opacity: 1; transform: rotate(calc(var(--side, -1) * -1deg)); }
}
@keyframes mms-fly-out { to { opacity: 0; transform: translate(calc(var(--side, -1) * -60vw), -40px) rotate(calc(var(--side, -1) * -12deg)) scale(.8); } }
.mms-root.is-presenting .tv-meme-main { display: none; }
.mms-present { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.mms-show {
    grid-area: 1 / 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 14px 14px 10px; background: var(--light-card); color: var(--light-ink); border: 2px solid var(--tv-line);
    border-radius: 30px 18px 34px 20px / 20px 32px 18px 30px; box-shadow: 10px 12px 0 color-mix(in srgb, var(--accent) 32%, transparent);
    animation: mms-fly-in .62s cubic-bezier(.25, 1.1, .45, 1) both;
}
.mms-show.is-leaving { animation: mms-fly-out .5s cubic-bezier(.5, 0, .8, .4) both; }
.mms-show .tv-option-letter { width: 56px; height: 56px; font-size: 26px; top: -18px; left: -18px; }
.mms-show-count { font-size: 18px; font-weight: 700; color: color-mix(in srgb, var(--light-ink) 60%, transparent); }
.mms-meme { position: relative; margin: 0; display: flex; flex-direction: column; align-items: stretch; line-height: 0; border-radius: 14px; overflow: hidden; background: var(--meme-bg, #000); transition: background-color .3s ease; }
/* One height for every meme (small pictures grow too), at least 560 px wide so the bands keep the caption short; a narrow or very wide one keeps its whole picture on black. */
.mms-meme-image { display: block; height: 270px; width: auto; max-width: 900px; min-width: 560px; object-fit: contain; opacity: 0; transition: opacity .3s ease; }
.mms-meme-image.is-loaded { opacity: 1; }
.mms-meme-text {
    display: block; margin: 0; padding: .32em 3%; color: #fff; text-align: center;
    font-family: var(--meme-font, Impact, sans-serif); font-weight: 700; font-size: var(--meme-size, 36px); line-height: 1.06;
    letter-spacing: .01em; overflow-wrap: anywhere; text-wrap: balance;
    text-shadow: .06em .06em 0 #000, -.06em -.06em 0 #000, .06em -.06em 0 #000, -.06em .06em 0 #000,
        0 .07em 0 #000, 0 -.07em 0 #000, .07em 0 0 #000, -.07em 0 0 #000;
}
/* The caption sits on bands above and below the picture (owner: text already on the picture must stay readable), each in the colour of the picture's edge next to it (meme-stage.ts tint, black until the picture is read). */
.mms-meme-text.is-top { background: var(--meme-top, transparent); }
.mms-meme-text.is-bottom { background: var(--meme-bottom, transparent); }
.mms-meme-text:empty { display: none; }
/* A PC player's stage has less height under its header than /tv/: the meme a bit smaller, the show in the step's box. */
html.rp-stage .mms-present { min-height: 0; padding-top: 18px; }
html.rp-stage .mms-meme-image { height: 270px; max-width: 840px; }
