/* «Шкала»: the shared line of cards, one look on the phones, a PC player's stage and the shared screen (/tv/).
   Markup and moving part: shared/client/lineup-line.ts. The page supplies the palette:
   --lul-ink (text on the cards), --lul-card (card paper), --lul-accent (theme card, high end),
   --lul-low (low end), --lul-wrong (a card out of order), --text-primary (text on the page background).

   The theme on top as a cut card, the scale under it: «мало» end, the cards, «много» end. A narrow box (phone) lays
   the cards top to bottom, a wide one (PC, TV, ≥ 760 px) left to right. Cards use the /tv/ hand-cut corners. */
.lul-root {
    --font-display: 'Unbounded', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --cut-1: 22px 12px 20px 14px / 14px 22px 12px 20px;
    --cut-2: 14px 22px 12px 20px / 22px 12px 20px 14px;
    --cut-shadow: 4px 5px 0 rgb(0 0 0 / 30%);
    container-type: inline-size;
    display: flex; flex-direction: column; gap: 14px; width: 100%;
}
@keyframes lul-in { from { opacity: 0; transform: translateY(-14px) rotate(-3deg) scale(1.04); } }
@keyframes lul-stamp { 0% { transform: scale(1.8) rotate(-12deg); opacity: 0; } 60% { transform: scale(.92) rotate(-6deg); opacity: 1; } 100% { transform: scale(1) rotate(-6deg); } }

.lul-theme {
    align-self: center; max-width: 100%; padding: 12px 20px 14px; text-align: center;
    color: var(--lul-ink); background: var(--lul-accent); border-radius: var(--cut-1); box-shadow: var(--cut-shadow); rotate: -1deg;
}
.lul-theme-kicker { display: block; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .72; }
.lul-theme-text { margin: 2px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 21px; line-height: 1.2; text-wrap: balance; overflow-wrap: anywhere; }

.lul-scale { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lul-end {
    align-self: flex-start; padding: 4px 12px; font-size: 13px; font-weight: 800; border-radius: 999px;
    color: var(--lul-ink); background: var(--lul-low);
}
.lul-end.is-high { align-self: flex-end; background: var(--lul-accent); }
.lul-end:empty { display: none; }

.lul-cards { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lul-card {
    position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'num hint arrows' 'num who arrows';
    align-items: center; column-gap: 12px; row-gap: 2px; padding: 10px 12px; min-height: 64px;
    color: var(--lul-ink); background: var(--lul-card); border: 3px solid transparent; border-radius: var(--cut-2); box-shadow: var(--cut-shadow);
    touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
    transition: border-color .2s ease, opacity .2s ease, scale .15s ease;
}
.lul-card.is-tilt-a { border-radius: var(--cut-1); rotate: -.6deg; }
.lul-card.is-tilt-b { rotate: .5deg; }
.lul-card.is-dragging { rotate: 0deg; }
.lul-card.is-new { animation: lul-in .45s cubic-bezier(.3, 1.4, .5, 1) both; }
.lul-card.is-mine { border-color: var(--lul-accent); }
.lul-card.is-dragging { z-index: 2; scale: 1.03; box-shadow: 8px 10px 0 rgb(0 0 0 / 34%); transition: none; }
.lul-root.is-movable .lul-card { cursor: grab; }
/* While a card is dragged the others step aside to show where it lands (lineup-line.ts paint()); the drop glides (FLIP). */
.lul-cards.is-sorting .lul-card:not(.is-dragging) { transition: border-color .2s ease, opacity .2s ease, scale .15s ease, translate .18s cubic-bezier(.2, .8, .2, 1); }
.lul-card.is-dragging { will-change: translate; }
/* A finger held the card long enough: it lifts, and now it drags (shared/client/lineup-line.ts LONG_PRESS_MS). */
.lul-card.is-held { z-index: 2; scale: 1.03; box-shadow: 8px 10px 0 rgb(0 0 0 / 34%); }
.lul-hint { grid-area: hint; margin: 0; font-weight: 800; font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.lul-who { grid-area: who; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; font-size: 13px; }
.lul-you, .lul-ready {
    padding: 1px 8px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; border-radius: 999px;
    color: var(--lul-ink); background: var(--lul-accent);
}
.lul-ready { color: #fff; background: var(--rp-correct, #1f7a4a); }
.lul-number {
    grid-area: num; display: grid; place-items: center; min-width: 52px; height: 52px; padding: 0 6px;
    font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--lul-ink); background: var(--lul-low);
    border-radius: 46% 54% 50% 50% / 54% 46% 54% 46%; rotate: -6deg;
}
.lul-number.is-hidden { font-size: 24px; color: rgb(30 26 46 / 55%); background: rgb(30 26 46 / 10%); }
.lul-card.is-revealed .lul-number { animation: lul-stamp .4s cubic-bezier(.2, .8, .2, 1) both; }
.lul-card.is-revealed:not(.is-wrong) .lul-number { color: #fff; background: var(--rp-correct, #1f7a4a); }
.lul-card.is-wrong { border-color: var(--lul-wrong); }
.lul-card.is-wrong .lul-number { color: #fff; background: var(--lul-wrong); }

.lul-arrows { grid-area: arrows; display: flex; flex-direction: column; gap: 6px; }
.lul-arrow {
    position: relative; width: 40px; height: 34px; padding: 0; border: 0; border-radius: 12px; cursor: pointer;
    background: rgb(30 26 46 / 10%); color: var(--lul-ink);
}
/* A chevron drawn with borders (no emoji, no arrow glyphs): up/left = earlier on the line, down/right = later. */
.lul-arrow::before {
    content: ''; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px;
    border-left: 3px solid currentColor; border-top: 3px solid currentColor; translate: -50% -30%; rotate: 45deg;
}
.lul-arrow.is-later::before { translate: -50% -70%; rotate: 225deg; }
.lul-arrow:disabled { opacity: .3; cursor: default; }
.lul-arrow:not(:disabled):active { scale: .92; }

/* Wide box (PC stage, /tv/): the scale runs left to right, the ends at both sides. */
@container (min-width: 760px) {
    .lul-root { gap: 26px; }
    .lul-theme { padding: 16px 34px 20px; }
    .lul-theme-kicker { font-size: 15px; }
    .lul-theme-text { font-size: 34px; }
    .lul-scale { flex-direction: row; align-items: center; gap: 16px; }
    .lul-end { align-self: center; flex: 0 0 auto; max-width: 140px; font-size: 16px; text-align: center; padding: 8px 14px; }
    .lul-end.is-high { align-self: center; }
    .lul-cards { flex: 1 1 auto; flex-direction: row; justify-content: center; gap: 14px; min-width: 0; }
    .lul-card {
        flex: 1 1 0; max-width: 220px; min-width: 0; grid-template-columns: minmax(0, 1fr); grid-template-areas: 'num' 'hint' 'who' 'arrows';
        justify-items: center; text-align: center; row-gap: 8px; padding: 16px 12px 14px; min-height: 200px;
    }
    .lul-hint { font-size: 21px; }
    .lul-who { justify-content: center; }
    .lul-number { min-width: 64px; height: 64px; font-size: 28px; }
    .lul-arrows { flex-direction: row; }
    .lul-arrow.is-earlier::before { translate: -30% -50%; rotate: -45deg; }
    .lul-arrow.is-later::before { translate: -70% -50%; rotate: 135deg; }
}

@media (prefers-reduced-motion: reduce) {
    .lul-card.is-new, .lul-card.is-revealed .lul-number { animation: none; }
    .lul-cards.is-sorting .lul-card:not(.is-dragging) { transition: none; }
}
