/* «Рисовач»: the drawing and its titles 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
   fibbage-stage.css, meme-stage.css and the others). The markup and the moving part are shared/client/draw-stage.ts;
   the page supplies the palette (--light-card, --light-ink, --tv-line, --accent, --accent-ink, --text-primary,
   --text-secondary; on /tv/ body[data-tv-game="drawful"], on the PC pc-stage.css). The title card's base is
   question-stage.css .tv-option.

   Drawing (`is-drawing`, the screen only): the white cut card «Рисуйте на телефонах» with the pencil stamp and a pen
   line drawing itself. Presenting: the drawing big on its white cut sheet with the artist, the hint under it (and a PC
   player's title field). Voting: the sheet on the left, the titles on the right as white cut cards two by two.
   A PC player's titles are buttons: hover gives the pink edge, the pick keeps it, the others fade, its own title stays
   dimmed. The reveal (question-stage.css .qs-reveal): the drawing on white, the titles on white with ink, the real
   one on the ink card with the green edge, the author in pink. */
.dws-root {
    --font-display: 'Unbounded', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    /* The /tv/ hand-cut corners (tv/style.css .tv). */
    --cut-1: 26px 12px 22px 16px / 16px 24px 12px 22px;
    --cut-2: 14px 24px 14px 26px / 24px 14px 22px 12px;
    --cut-3: 22px 16px 28px 12px / 12px 20px 16px 26px;
    --cut-4: 12px 26px 16px 22px / 22px 12px 26px 16px;
    flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 40px; padding: 0 8px;
}
@keyframes dws-cut-in { from { opacity: 0; transform: translateY(-26px) rotate(-5deg) scale(1.06); } }
@keyframes dws-scribble { 0%, 100% { rotate: -8deg; translate: 0 0; } 25% { rotate: 4deg; translate: 2px -3px; } 50% { rotate: -4deg; translate: -1px 1px; } 75% { rotate: 7deg; translate: 1px -2px; } }
@keyframes dws-line { 60%, 100% { stroke-dashoffset: 0; } }

.dws-root :is(.tv-draw-card, .tv-draw-frame, .tv-draw-side) { display: none; }
.dws-root.is-drawing .tv-draw-card { display: flex; }
.dws-root:is(.is-presenting, .is-voting) :is(.tv-draw-frame, .tv-draw-side) { display: flex; }
.dws-root.is-presenting { flex-direction: column; gap: 20px; }

/* ── Drawing: the card ── */
.tv-draw-card {
    flex-direction: column; align-items: center; gap: 18px; width: 860px; padding: 52px 64px 44px; text-align: center;
    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) 28%, transparent);
    rotate: -1.4deg; animation: dws-cut-in .7s cubic-bezier(.3, 1.45, .5, 1) both;
}
.tv-draw-pencil {
    display: grid; place-items: center; width: 100px; height: 100px; border-radius: 46% 54% 50% 50% / 54% 46% 54% 46%;
    font-size: 50px; background: var(--accent); color: var(--accent-ink);
    box-shadow: 4px 5px 0 rgb(23 25 31 / 20%); animation: dws-scribble 1.6s ease-in-out infinite;
}
.tv-draw-title { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 50px; line-height: 1.12; letter-spacing: -.035em; color: var(--accent); text-wrap: balance; }
.tv-draw-card-hint { margin: 0; font-size: 24px; font-weight: 600; color: var(--text-secondary); text-wrap: balance; }
/* A pen line drawing itself under the card's text, again and again. */
.tv-draw-scribble { width: 360px; height: 54px; }
.tv-draw-scribble path { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 520; stroke-dashoffset: 520; animation: dws-line 2.6s ease-in-out infinite; }

/* ── The drawing on its sheet ── */
.tv-draw-frame {
    position: relative; flex-direction: column; align-items: center; gap: 12px; margin: 0; padding: 14px 14px 12px;
    background: #fff; border: 2px solid var(--tv-line); border-radius: var(--cut-2);
    box-shadow: 8px 10px 0 rgb(23 25 31 / 12%); rotate: -1deg; animation: dws-cut-in .6s cubic-bezier(.3, 1.45, .5, 1) both;
}
.tv-draw-frame > img { display: block; width: 400px; height: 300px; object-fit: contain; border-radius: 10px; background: #fff; }
.dws-root.is-presenting .tv-draw-frame > img { width: 520px; height: 340px; }
.tv-draw-frame.is-blank > img { visibility: hidden; }
.tv-draw-artist { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; color: var(--text-secondary); }
.tv-draw-artist .rp-player { color: var(--light-ink); font-weight: 700; }

/* ── The hint and the titles ── */
.tv-draw-side { flex-direction: column; align-items: center; gap: 16px; min-width: 0; }
.dws-root.is-voting .tv-draw-side { flex: 1; align-items: stretch; }
.tv-draw-hint { margin: 0; font-size: 24px; font-weight: 700; color: var(--text-primary); text-align: center; text-wrap: balance; }
.tv-draw-hint:empty { display: none; }
.tv-draw-options { width: 100%; grid-auto-rows: minmax(0, 1fr); gap: 20px 22px; padding: 4px 8px; max-height: calc(var(--tv-fb-rows, 2) * 96px + (var(--tv-fb-rows, 2) - 1) * 20px + 8px); }
.tv-draw-options:empty { display: none; }
.dws-root .tv-draw-options .tv-option {
    min-height: 0; max-height: 96px; font-size: 23px; font-weight: 600; background: var(--light-card); color: var(--light-ink);
    border: 2px solid var(--tv-line); box-shadow: 5px 6px 0 rgb(23 25 31 / 12%);
    border-radius: var(--cut-1); rotate: -1.1deg;
    animation-name: dws-cut-in; animation-duration: .6s; animation-timing-function: cubic-bezier(.3, 1.45, .5, 1);
}
.dws-root .tv-draw-options .tv-option:nth-child(4n + 2) { border-radius: var(--cut-2); }
.dws-root .tv-draw-options .tv-option:nth-child(4n + 3) { border-radius: var(--cut-3); }
.dws-root .tv-draw-options .tv-option:nth-child(4n + 4) { border-radius: var(--cut-4); }
.dws-root .tv-draw-options .tv-option:nth-child(even) { rotate: 1deg; translate: 0 6px; }
.dws-root .tv-draw-options .tv-option-letter {
    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%); font-family: var(--font-display); font-weight: 800;
}
.dws-root .tv-draw-options .tv-option:nth-child(even) .tv-option-letter { rotate: 5deg; border-radius: 54% 46% 46% 54% / 46% 54% 50% 50%; }
.tv-draw-options .tv-option-text { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tv-draw-slot { width: 100%; }
.tv-draw-slot:empty, .dws-root:not(.is-presenting) .tv-draw-slot { display: none; }

/* ── A PC player's titles (buttons) ── */
.dws-root button.tv-option {
    width: 100%; margin: 0; font-family: inherit; text-align: left; cursor: default;
    transition: border-color .2s ease, box-shadow .2s ease, opacity .25s ease, scale .15s ease;
}
.dws-root.is-votable:not(.is-locked) button.tv-option:not(:disabled) { cursor: pointer; }
.dws-root.is-votable:not(.is-locked) button.tv-option:hover:not(:disabled) { border-color: var(--accent); }
.dws-root button.tv-option:active:not(:disabled) { scale: .97; }
.dws-root button.tv-option:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.dws-root .tv-option.is-own { opacity: .45; }
.dws-root.is-locked .tv-option:not(.is-selected) { opacity: .45; }
.dws-root .tv-draw-options .tv-option.is-selected { border-color: var(--accent); box-shadow: 6px 7px 0 color-mix(in srgb, var(--accent) 45%, transparent); }

/* ── The reveal (reveal-results.js `dashboard` in question-stage.css .qs-reveal: /tv/ #r-box, a PC player's
   #reveal-container) in the phones' colours (df-theme.css) ── */
:is(body[data-tv-game="drawful"], body[data-rp-game="drawful"]) .qs-reveal .rr-context-drawing { max-width: 360px; max-height: 270px; margin: 0 auto 16px; border: 2px solid var(--tv-line); border-radius: 14px; box-shadow: 6px 7px 0 rgb(23 25 31 / 12%); rotate: -1deg; }
:is(body[data-tv-game="drawful"], body[data-rp-game="drawful"]) .qs-reveal .rr-context-text { color: var(--light-ink); font-weight: 700; }
:is(body[data-tv-game="drawful"], body[data-rp-game="drawful"]) .qs-reveal .rr-option.rr-type-wrong { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
:is(body[data-tv-game="drawful"], body[data-rp-game="drawful"]) .qs-reveal .rr-author-name { color: var(--accent); font-weight: 700; }
:is(body[data-tv-game="drawful"], body[data-rp-game="drawful"]) .qs-reveal .rr-option.rr-type-correct { background: var(--df-ink); border-color: var(--rp-correct); }
:is(body[data-tv-game="drawful"], body[data-rp-game="drawful"]) .qs-reveal .rr-option.rr-type-correct .rr-option-text { color: #fff; }
:is(body[data-tv-game="drawful"], body[data-rp-game="drawful"]) .qs-reveal .rr-option.rr-type-correct :is(.rr-vote-count, .rr-voters-label) { color: var(--df-on-ink-muted); }
:is(body[data-tv-game="drawful"], body[data-rp-game="drawful"]) .qs-reveal .rr-option.rr-type-correct .rr-voter { color: #fff; background: rgb(255 255 255 / 14%); }

@media (prefers-reduced-motion: reduce) {
    .dws-root :is(.tv-draw-card, .tv-draw-frame, .tv-option, .tv-draw-pencil, .tv-draw-scribble path) { animation: none; }
    .tv-draw-scribble path { stroke-dashoffset: 0; }
}
