:root {
    --bg0: #120D0A; --bg1: #1C1512;
    --accent: #E9A23B; --accent-hi: #FFC46B;
    --cream: #F4EAD9; --mut: #A89A88;
    --line: rgba(244, 234, 217, .14);
    --disp: 'Unbounded', 'Arial Black', sans-serif;
    --body: 'Manrope', 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; cursor: none; }
body { font-family: var(--body); color: var(--cream); }

#fit { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); overflow: hidden; }
#stage { position: absolute; top: 0; left: 0; width: 1920px; height: 1080px;
    transform-origin: 0 0; background: var(--bg0); overflow: hidden; }

/* ---- витрина (видеофон) ---- */
/* isolation: z-index видео и скрима живут внутри витрины
   и никогда не всплывают над шапкой и текстом меню */
.vitrine { position: absolute; inset: 0; isolation: isolate; background:
    radial-gradient(90% 70% at 18% 88%, rgba(233, 162, 59, .28), rgba(233, 162, 59, 0) 60%),
    radial-gradient(70% 55% at 30% 60%, rgba(120, 72, 30, .30), rgba(120, 72, 30, 0) 70%),
    linear-gradient(160deg, #1a120c 0%, #120D0A 70%); }
.vitrine video, .vitrine .poster { position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: 0; background-size: cover; background-position: center; }
.vitrine .poster { transition: opacity 1s ease; transform-origin: 100% 50%;
    animation: drift 20s ease-in-out infinite alternate; }
/* медленный «наезд» на постер: экран не выглядит зависшим, пока грузится видео */
@keyframes drift { from { transform: scale(1); } to { transform: scale(1.06); } }
/* под видео постер невидим — на паузе: бегущая анимация заставляет ТВ
   собирать кадр 60 раз в секунду вместо 24 (частота видео). Пауза, а не
   снятие анимации: при угасании постер не «прыгает» обратно к scale(1) */
.vitrine .poster:not(.on) { animation-play-state: paused; }
.vitrine video.on, .vitrine .poster.on { opacity: 1; }
.vitrine video.top { z-index: 2; }
/* смена композиции; длительность = FADE_S в player.js */
.vitrine video.fade { transition: opacity 1s ease; }
.vitrine .scrim { position: absolute; inset: 0; z-index: 3; }
/* затемнение выступает за правый край видео: на ТВ сцена масштабирована
   (0,47×), край попадает на дробный пиксель, и видео со скримом закрывают его
   лишь частично — сквозь них светилась тонкая вертикальная полоса.
   Выступ непрозрачен и одного цвета с фоном меню — его не видно */
.vitrine .scrim { right: -6px; }
/* широкая видеопанель слева на всех экранах: объект у левой трети,
   оба края мягко уходят в фон (справа — под текст) */
.vitrine { inset: 0 auto 0 0; width: 66.67%; }
.vitrine video, .vitrine .poster { object-position: 100% 50%; background-position: 100% 50%; }
/* правый край витрины — полностью непрозрачный фон задолго до границы:
   иначе светлый кадр просвечивает и обрывается видимой вертикальной линией.
   Спад до .9 — прежний, меняется только хвост: .97 у края → 1 до края */
/* экраны 1-2: меню с 36% ширины (54% витрины) */
body[data-screen="1"] .scrim, body[data-screen="2"] .scrim { background:
    linear-gradient(90deg,
        rgba(18,13,10,.94) 0%, rgba(18,13,10,0) 18%,
        rgba(18,13,10,0) 34%, rgba(18,13,10,.9) 58%,
        rgba(18,13,10,.95) 75%, rgba(18,13,10,1) 92%); }
/* экраны 3-4: меню с 32% (48% витрины) — затемнение начинается раньше */
body[data-screen="3"] .scrim, body[data-screen="4"] .scrim { background:
    linear-gradient(90deg,
        rgba(18,13,10,.94) 0%, rgba(18,13,10,0) 16%,
        rgba(18,13,10,0) 30%, rgba(18,13,10,.9) 48%,
        rgba(18,13,10,.95) 70%, rgba(18,13,10,1) 90%); }

/* ---- лоадер видео ---- */
/* центр видимой части витрины — до начала меню */
.loader { position: absolute; top: 120px; bottom: 0; left: 0; width: 36%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background:
        radial-gradient(300px 330px at 50% 46%, rgba(18,13,10,.88), rgba(18,13,10,.55) 60%, rgba(18,13,10,0)),
        linear-gradient(90deg, rgba(18,13,10,.45), rgba(18,13,10,.25) 70%, rgba(18,13,10,0));
    opacity: 0; transition: opacity .6s ease, transform .6s ease; }
body[data-screen="3"] .loader, body[data-screen="4"] .loader { width: 32%; }
/* display: flex выше перебивает hidden: скрытый лоадер оставался на странице,
   и его бесконечный shimmer пересчитывал стили 60 раз в секунду весь показ */
.loader[hidden] { display: none; }
.loader.show { opacity: 1; }
.loader.done { opacity: 0; transform: scale(1.04); }
.loader .emblem { width: 290px; height: 290px; overflow: visible; }
.loader .emblem * { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.loader .ring-track { stroke: var(--line); stroke-width: 3; }
.loader .ring { stroke: var(--accent); stroke-width: 4; stroke-dasharray: 100; stroke-dashoffset: 100;
    transform: rotate(-90deg); transform-box: fill-box; transform-origin: center;
    transition: stroke-dashoffset .6s ease, stroke .6s ease;
    filter: drop-shadow(0 0 6px rgba(233, 162, 59, .55)); }
.loader .draw { stroke-dasharray: 100; stroke-dashoffset: 100; }
.loader .cup, .loader .handle { stroke: #E8C79A; stroke-width: 7; }
.loader .em { stroke: var(--accent); stroke-width: 10; stroke-linecap: square; stroke-linejoin: miter; }
.loader .coffee { fill: var(--accent); stroke: #B97A3E; stroke-width: 3; opacity: .85; }
.loader .steam { stroke: var(--accent-hi); stroke-width: 6; stroke-dasharray: 100;
    stroke-dashoffset: 100; opacity: 0; }
.loader.show .draw { animation: draw .9s ease-out forwards; }
.loader.show .em { animation-delay: .35s; }
.loader.show .coffee { animation: breathe 3s ease-in-out infinite; }
.loader.show .steam { animation: steam 2.4s ease-in-out .9s infinite; }
.loader.show .s2 { animation-delay: 1.3s; }
.loader.show .s3 { animation-delay: 1.7s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes breathe { 0%, 100% { opacity: .78; } 50% { opacity: .95; } }
/* пар поднимается: путь идёт от чашки вверх — проявляется снизу и тает хвостом вверх */
@keyframes steam {
    0% { stroke-dashoffset: 100; opacity: 0; }
    20% { opacity: 1; }
    55% { stroke-dashoffset: 0; opacity: 1; }
    100% { stroke-dashoffset: -100; opacity: 0; }
}
.loader .wordmark { margin-top: 30px; font-family: var(--disp); font-weight: 700; font-size: 46px;
    letter-spacing: .18em; padding-left: .18em; color: var(--accent);
    background: linear-gradient(100deg, var(--accent) 35%, var(--accent-hi) 50%, var(--accent) 65%);
    background-size: 300% 100%; -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; animation: shimmer 3.2s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.loader .caption { margin-top: 14px; font-size: 22px; font-weight: 600; letter-spacing: .04em;
    color: var(--mut); font-variant-numeric: tabular-nums; }
/* нет связи: кольцо гаснет, пар замедляется, подпись с отсчётом */
.loader.offline .ring { stroke: var(--mut); filter: none; }
.loader.offline .steam { animation-duration: 4.8s; }
.loader.offline .caption { color: var(--cream); }

/* ---- шапка ---- */
.tvhead { position: absolute; top: 0; left: 0; right: 0; height: 120px; padding: 0 64px;
    display: flex; align-items: center; gap: 28px; border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(18,13,10,.9), rgba(18,13,10,.35)); }
.logomark { width: 60px; height: 60px; border-radius: 50%; object-fit: cover;
    border: 1px solid var(--line); }
.logo { font-family: var(--disp); font-weight: 700; font-size: 34px; letter-spacing: .1em; color: var(--accent); }
.scr { font-family: var(--disp); font-weight: 600; font-size: 40px; margin-left: 24px; }
.clock { margin-left: auto; font-size: 30px; font-weight: 600; color: var(--mut);
    font-variant-numeric: tabular-nums; }

/* ---- меню ---- */
.menu { position: absolute; top: 120px; bottom: 0; right: 0;
    padding: 48px 64px 64px 40px; display: grid; grid-template-columns: 1fr 1fr;
    column-gap: 56px; align-content: start; overflow: hidden; }
body[data-screen="1"] .menu, body[data-screen="2"] .menu { left: 36%; }
body[data-screen="3"] .menu, body[data-screen="4"] .menu { left: 32%; }
.menu.swap { animation: fadein .6s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.cat { margin-bottom: 40px; }
.cat h3 { font-family: var(--disp); font-weight: 500; font-size: 40px; color: var(--accent);
    margin: 0 0 6px; }
.cat .rule { height: 2px; background: linear-gradient(90deg, var(--accent), transparent 70%);
    opacity: .5; margin-bottom: 20px; }
.item { display: flex; align-items: baseline; gap: 28px; margin-bottom: 18px; }
.item .nm { font-size: 32px; font-weight: 600; line-height: 1.2; }
.item .vol { display: block; font-size: 20px; font-weight: 500; color: var(--mut); margin-top: 2px; }
/* описание занимает всю ширину до цены — без пустоты перед ней
   (поэтому и у цены нет min-width: короткая цена не держит пустой резерв);
   pre-line — переносы строк, которые оператор поставил Enter'ом в админке */
.item .desc { display: block; font-size: 21px; font-weight: 400; color: var(--mut);
    line-height: 1.35; white-space: pre-line; }
/* цена всегда у правого края колонки, как бы коротко ни было название */
.item .pr { margin-left: auto; flex-shrink: 0;
    font-size: 34px; font-weight: 700; color: var(--accent); white-space: nowrap;
    font-variant-numeric: tabular-nums; text-align: right;
    transition: opacity .4s; }
.pr.flash { animation: flash 1.5s ease-out; }
@keyframes flash {
    0% { color: var(--accent-hi); text-shadow: 0 0 26px rgba(255, 196, 107, .8); }
    100% { color: var(--accent); text-shadow: none; }
}

/* ---- компактный режим при переполнении ---- */
#stage.compact .item .nm { font-size: 32px; }
#stage.compact .item .desc { font-size: 19px; }
#stage.compact .item .pr { font-size: 30px; }
#stage.compact .item { margin-bottom: 12px; }
#stage.compact .cat { margin-bottom: 28px; }
#stage.compact .cat h3 { font-size: 34px; }

@media (prefers-reduced-motion: reduce) {
    .menu.swap { animation: none; }
    .pr.flash { animation: none; }
    .vitrine .poster, .loader .wordmark, .loader.show .coffee, .loader.show .steam { animation: none; }
    .loader.show .draw { animation: none; stroke-dashoffset: 0; }
    .loader.show .steam { opacity: .8; stroke-dashoffset: 0; }
}
