/* Главное меню.
   Вид из окна неподвижен и всегда целиком: --sill (подоконник) = 3/4 ширины экрана, ставит scene.js.
   Кнопки — всегда 3 ряда, прижаты к низу; обновление и незаконченная партия высоту не меняют.
   Не хватает места — ужимается только середина: lv2 плотнее, lv3 без веера карт, lv4 минимум (фраза скрыта).
   Шаг выбирает scene.js (fitMenu) замером, считая худший случай — с кнопкой «Обновить». */
.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; pointer-events: none; }
/* «дыхание» камеры: за 48 с вид из окна чуть приближается (на 1,6 %) и возвращается; точку приближения ставит scene.js.
   Делает видеокарта — фон не перерисовывается каждый кадр */
#bar-scene { will-change: transform; animation: breathe 48s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.016); } }
@media (prefers-reduced-motion: reduce) { #bar-scene { animation: none; } }
#s-menu { overflow: hidden; background: var(--void); }
#s-menu .menu-body { position: relative; z-index: 1; flex: 1 1 auto; min-height: 0; height: 100%; box-sizing: border-box; overflow: hidden;
  display: flex; flex-direction: column; gap: 0; padding: var(--sill, 75vw) 22px max(env(safe-area-inset-bottom), 12px); }
.web [data-action="exit"] { display: none; }
.web .menu-row:has([data-action="exit"]) { grid-template-columns: 1fr; }

/* середина: веер карт, название, место под фразой / «Обновить» */
.brand { position: relative; flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; padding: 16px 0 14px; text-align: center; }
.brand-in { position: relative; }
.hero-cards { position: relative; height: 104px; margin-bottom: 12px; --cw: 64px; perspective: 600px; }
.hero-cards .card { position: absolute; left: 50%; top: 0; margin-left: -32px; }
.hero-cards .card:nth-child(1) { transform: translate(-64px, 14px) rotate(-13deg); }
.hero-cards .card:nth-child(2) { z-index: 1; animation: hover 6s ease-in-out infinite; }
.hero-cards .card:nth-child(3) { transform: translate(64px, 14px) rotate(13deg); }
@keyframes hover { 50% { transform: translateY(-5px); } }
.logo { margin-top: 0; font-size: min(44px, 11vw); font-weight: 300; letter-spacing: .14em; line-height: 1; text-indent: .14em;
  background: linear-gradient(180deg, #fff7df 0%, #f1d79a 40%, #b38c45 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(207, 174, 106, .28)); }
.logo-pre { display: block; margin-bottom: 8px; font-size: 15px; font-weight: 600; letter-spacing: .5em; text-indent: .5em; text-transform: none; }
.menu-slot { height: 59px; margin-top: 8px; display: flex; align-items: center; justify-content: center; }
/* фраза завсегдатаев: не больше 3 строк */
.talk { height: 4.2em; min-height: 0; margin: 0 auto; max-width: 34ch; padding: 0 4px; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  color: #b9c3d3; font-size: 14px; line-height: 1.4; font-style: italic; text-align: center; text-wrap: balance; cursor: pointer; transition: opacity .6s ease; }
.talk.fade { opacity: 0; }
#s-menu.upd .talk { display: none; }

/* значок новых сообщений — золотое «сообщение» справа от карт */
.menu-msgs { position: absolute; z-index: 2; top: 18px; left: calc(50% + 108px); min-width: 52px; height: 42px; padding: 0 12px 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 21px 21px 21px 7px; color: #1b1305;
  background: linear-gradient(180deg, #f6e2ad, #cfae6a 55%, #b08c45); box-shadow: inset 0 0 0 1px rgba(255, 240, 200, .6), 0 0 22px rgba(207, 174, 106, .45), 0 6px 16px rgba(0, 0, 0, .5);
  animation: msgs-in .35s cubic-bezier(.2, .9, .3, 1.3), msgs-glow 2.6s ease-in-out .4s infinite; -webkit-tap-highlight-color: transparent; }
.menu-msgs svg { width: 20px; height: 20px; flex: none; }
.menu-msgs b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.menu-msgs.wide b { font-size: 15px; }
.menu-msgs:active { transform: scale(.94); }
@keyframes msgs-in { from { opacity: 0; transform: scale(.5) translateY(6px); } }
@keyframes msgs-glow { 50% { box-shadow: inset 0 0 0 1px rgba(255, 240, 200, .6), 0 0 30px rgba(241, 215, 154, .7), 0 6px 16px rgba(0, 0, 0, .5); } }
@media (max-width: 370px) { .menu-msgs { left: calc(50% + 94px); top: 12px; height: 38px; min-width: 46px; padding: 0 10px 0 8px; } .menu-msgs svg { width: 18px; height: 18px; } .menu-msgs b { font-size: 15px; } .menu-msgs.wide b { font-size: 13px; } }
@media (prefers-reduced-motion: reduce) { .menu-msgs { animation: none; } }

/* кнопки: 3 ряда; незаконченная партия — «Продолжить | Сесть за стол» пополам, текст чуть мельче, чтобы влезал и на 320 px */
.menu-list { display: grid; gap: 10px; }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#s-menu .menu-list .btn { height: 48px; min-height: 0; padding: 4px 12px; }
.menu-first > #btn-continue[hidden] ~ #btn-new { grid-column: 1 / -1; }
.menu-first > #btn-continue:not([hidden]), .menu-first > #btn-continue:not([hidden]) ~ #btn-new { padding-left: 6px; padding-right: 6px; font-size: min(17px, 4.6vw); white-space: nowrap; }
#btn-continue small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.2; }
#btn-continue span { line-height: 1.15; }

/* внизу: «Как установить на телефон» (веб) и версия */
.app-ver { margin: 10px 0 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; letter-spacing: .04em; color: rgba(139, 152, 174, .7); text-align: center; }
.menu-install { color: var(--brass-hi); font-size: 14px; letter-spacing: .02em; text-decoration: none; border-bottom: 1px solid rgba(241, 215, 154, .35); padding-bottom: 1px; }

/* «Обновить игру»: золотая кнопка на месте фразы, по ней пробегает блик */
#s-menu .menu-update { position: relative; overflow: hidden; flex-direction: row; gap: 10px; height: 46px; min-height: 0; max-width: 100%; padding: 0 20px;
  animation: upd-in .35s cubic-bezier(.2, .9, .3, 1.3); }
.menu-update svg { width: 20px; height: 20px; flex: none; }
.menu-update span { font-size: 16.5px; white-space: nowrap; }
.menu-update small { white-space: nowrap; font-size: 12.5px; }
.menu-update::after { content: ""; position: absolute; top: -10%; bottom: -10%; left: 0; width: 38%; pointer-events: none;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 253, 240, .1) 30%, rgba(255, 253, 240, .78) 50%, rgba(255, 253, 240, .1) 70%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-140%) skewX(-20deg); animation: upd-shine 3.8s cubic-bezier(.45, .05, .35, 1) 1.2s infinite; }
@keyframes upd-in { from { opacity: 0; transform: scale(.85); } }
@keyframes upd-shine { 0% { transform: translateX(-140%) skewX(-20deg); } 32%, 100% { transform: translateX(340%) skewX(-20deg); } }
@media (prefers-reduced-motion: reduce) { #s-menu .menu-update, .menu-update::after { animation: none; } .menu-update::after { display: none; } }
@media (max-width: 350px) { .menu-update small { display: none; } #s-menu .menu-update { padding: 0 16px; } }
/* на время замера место под «Обновить» занято всегда */
#s-menu.fit .menu-slot { display: flex !important; }

/* окно обновления */
.upd-meta { margin: 6px 0 10px; color: var(--ink); font-size: 16px; }
.upd-meta small { color: var(--muted); font-size: 13px; }
.upd-notes { margin: 0 0 14px; padding: 10px 14px 10px 30px; text-align: left; font-size: 14px; color: var(--ink); background: rgba(14, 22, 40, .6); border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.upd-notes li + li { margin-top: 4px; }
.upd-bar { height: 10px; margin: 14px 4px 8px; border-radius: 6px; overflow: hidden; background: rgba(14, 22, 40, .8); box-shadow: inset 0 0 0 1px var(--line); }
.upd-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #cfae6a, #f1d79a); transition: width .2s ease; }
.upd-state { margin: 0 0 4px; color: var(--muted); font-size: 14px; }

/* ---------- лесенка уплотнения ---------- */
#s-menu.lv2 .brand { padding: 12px 0 10px; }
#s-menu.lv2 .hero-cards { height: 78px; --cw: 48px; margin-bottom: 10px; }
#s-menu.lv2 .hero-cards .card { margin-left: -24px; }
#s-menu.lv2 .hero-cards .card:nth-child(1) { transform: translate(-48px, 10px) rotate(-13deg); }
#s-menu.lv2 .hero-cards .card:nth-child(3) { transform: translate(48px, 10px) rotate(13deg); }
#s-menu.lv2 .logo { font-size: min(38px, 10vw); }
#s-menu.lv2 .logo-pre { font-size: 13px; margin-bottom: 6px; }
#s-menu.lv2 .menu-slot { height: 54px; margin-top: 6px; }
#s-menu.lv2 .talk { font-size: 13px; }
#s-menu.lv2 .menu-list .btn { height: 46px; }
#s-menu.lv2 .menu-list, #s-menu.lv2 .menu-row { gap: 8px; }
#s-menu.lv2 .app-ver { margin-top: 8px; gap: 4px; }
#s-menu.lv2 .menu-msgs { top: 8px; left: calc(50% + 86px); }

#s-menu.lv3 .brand { padding: 20px 0 8px; }
#s-menu.lv3 .logo { font-size: min(34px, 9.4vw); }
#s-menu.lv3 .logo-pre { font-size: 13px; margin-bottom: 5px; }
#s-menu.lv3 .menu-slot { height: 52px; margin-top: 6px; }
#s-menu.lv3 .talk { font-size: 12.5px; }
#s-menu.lv3 .menu-list .btn { height: 44px; }
#s-menu.lv3 .menu-list, #s-menu.lv3 .menu-row { gap: 8px; }
#s-menu.lv3 .app-ver { margin-top: 6px; gap: 4px; }

#s-menu.lv4 .brand { padding: 20px 0 6px; }
#s-menu.lv4 .logo { font-size: min(32px, 9vw); }
#s-menu.lv4 .logo-pre { font-size: 12px; margin-bottom: 4px; }
#s-menu.lv4 .menu-slot { display: none; height: 44px; margin-top: 6px; }
#s-menu.lv4.upd .menu-slot { display: flex; }
#s-menu.lv4 .menu-list .btn { height: 42px; }
#s-menu.lv4 .menu-list, #s-menu.lv4 .menu-row { gap: 6px; }
#s-menu.lv4 .app-ver { margin-top: 6px; gap: 3px; }

/* lv3–lv4: без веера карт; значок сообщений — справа от слова «Кантина» (место под него — отступ сверху 20 px);
   «Как установить на телефон» и версия — в одну строку */
#s-menu.lv3 .hero-cards, #s-menu.lv4 .hero-cards { display: none; }
#s-menu.lv3 .menu-update, #s-menu.lv4 .menu-update { height: 42px; }
#s-menu.lv3 .menu-msgs, #s-menu.lv4 .menu-msgs { top: -16px; left: calc(50% + 70px); height: 30px; min-width: 42px; padding: 0 9px 0 8px; gap: 4px; border-radius: 15px 15px 15px 6px; }
#s-menu.lv3 .menu-msgs svg, #s-menu.lv4 .menu-msgs svg { width: 16px; height: 16px; }
#s-menu.lv3 .menu-msgs b, #s-menu.lv4 .menu-msgs b { font-size: 14px; }
#s-menu.lv3 .app-ver, #s-menu.lv4 .app-ver { flex-direction: row; flex-wrap: wrap; justify-content: center; column-gap: 12px; row-gap: 2px; }
