/* Ритм-бот: «Я знаю» / «Я люблю …». Одна сетка: шаг 8, поля 16, кнопки 56 (карточки и «ЗНАЮ!» 88), радиус 16. Всё по одной оси, кнопки одной группы равны. */
:root { --ui-step: 8px; --ui-pad: 16px; --ui-btn-h: 56px; --ui-radius: 16px; --zn-a: var(--gold, #ffd200); --zn-ink: var(--gold-ink, #17120a); --zn-ok: var(--ok, #3ddc72); --zn-bad: #ff6b75; --zn-warn: var(--warn, #ffb020); }
:root[data-theme="light"] { --zn-a: var(--red, #c9141c); --zn-ink: #fff; --zn-ok: #0a8a5a; --zn-bad: #c81e2a; --zn-warn: #a85d00; }

#gamesView.zn { overflow: hidden; }
.znw { display: flex; flex-direction: column; gap: var(--ui-step); margin: 0 2px; min-height: min(calc(100dvh - 190px), 560px); }
.zn-top { display: flex; align-items: center; justify-content: space-between; gap: var(--ui-step); height: 44px; }
:root:root .zn-top .gback { margin: 0; padding: 0 14px 0 8px; }
:root:root .zn-top .gback.warn { background: var(--zn-bad); color: #fff; box-shadow: none; }
:root:root .zn-top .gback span { white-space: nowrap; }
.zn-count { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; height: 44px; padding: 0 var(--ui-pad); border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.zn-count:empty { visibility: hidden; }
.zn-h { margin: var(--ui-step) 0 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.zn-name { height: 24px; line-height: 24px; text-align: center; color: var(--muted); font-size: 15px; font-weight: 700; }

/* выбор игры */
.zn-list { display: grid; gap: var(--ui-step); }
.zn-card { display: grid; grid-template-columns: 56px minmax(0, 1fr) 24px; align-items: center; column-gap: var(--ui-pad); box-sizing: border-box; width: 100%; height: 88px; padding: 0 var(--ui-pad); border: 0; border-radius: var(--ui-radius); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--zn-a) 40%, transparent); transition: transform .15s var(--ease, ease); }
.zn-card:active { transform: scale(.98); }
.zn-card:focus-visible, .zn-btn:focus-visible, .zn-know:focus-visible, .zn-in:focus-visible { outline: 2px solid var(--zn-a); outline-offset: 2px; }
.zn-card.main { background: linear-gradient(120deg, color-mix(in srgb, var(--zn-a) 24%, var(--surface)), var(--surface) 80%); box-shadow: inset 0 0 0 2px var(--zn-a), 0 0 22px -10px var(--zn-a); }
.zn-card.off { opacity: .55; }
.zn-ic { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--ui-radius); background: color-mix(in srgb, var(--zn-a) 18%, transparent); color: var(--zn-a); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.zn-card.main .zn-ic { background: var(--zn-a); color: var(--zn-ink); }
.zn-ic svg { width: 28px; height: 28px; fill: currentColor; stroke: none; }
.zn-tx { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.zn-t { font-size: 20px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; }
.zn-m { font-size: 14px; font-weight: 600; color: var(--muted); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zn-chev { display: grid; place-items: center; width: 24px; height: 24px; color: var(--muted); }
.zn-chev svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.zn-card.sk { box-shadow: inset 0 0 0 1px var(--line); background: linear-gradient(100deg, var(--surface) 30%, var(--surface2, var(--surface)) 50%, var(--surface) 70%) 0 0 / 300% 100%; animation: znsk 1.4s linear infinite; cursor: default; }
@keyframes znsk { to { background-position: -300% 0; } }
@keyframes zntile { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) { .zn-card:not(.sk) { animation: zntile .4s var(--ease, ease) both; animation-delay: calc(var(--i, 0) * 60ms); } }

/* раунд */
.zn-stage { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--ui-pad); box-sizing: border-box; padding: var(--ui-pad); border-radius: var(--ui-radius); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); text-align: center; overflow: hidden; }
.zn-foot, .zn-foot-in { display: flex; flex-direction: column; gap: var(--ui-step); }
.zn-cap { margin: 0; font-size: 16px; font-weight: 700; color: var(--muted); line-height: 1.25; }
.zn-cap.big { font-size: 22px; color: var(--text); font-weight: 800; }
.zn-eq { display: flex; align-items: center; justify-content: center; gap: 6px; height: 72px; }
.zn-eq i { width: 8px; height: 100%; border-radius: 4px; background: var(--zn-a); transform: scaleY(var(--h, .5)); box-shadow: 0 0 12px -2px var(--zn-a); }
.zn-eq.slow i { opacity: .55; box-shadow: none; }
@media (prefers-reduced-motion: no-preference) {
  .zn-eq i { animation: zneq .9s ease-in-out infinite; animation-delay: calc(var(--k) * -80ms); }
  .zn-eq.slow i { animation-duration: 1.8s; }
}
@keyframes zneq { 0%, 100% { transform: scaleY(.22); } 50% { transform: scaleY(1); } }
.zn-live { display: flex; align-items: center; justify-content: center; gap: var(--ui-step); }
.zn-live b { font-size: 64px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.zn-live .coin { width: 40px; height: 40px; background-size: 40px 40px; vertical-align: 0; }

.zn-know { display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; height: 88px; border: 0; border-radius: var(--ui-radius); background: var(--zn-a); color: var(--zn-ink); font: inherit; font-size: 36px; font-weight: 800; letter-spacing: .02em; cursor: pointer; transition: transform .12s var(--ease, ease), opacity .2s; box-shadow: 0 0 26px -6px var(--zn-a); }
.zn-know:active:not(:disabled) { transform: scale(.97); }
.zn-know:disabled { background: var(--surface2, var(--surface)); color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); cursor: default; }
.zn-know.alt { font-size: 26px; }
@media (prefers-reduced-motion: no-preference) { .zn-know:not(:disabled) { animation: znpulse 1.6s ease-out infinite; } }
@keyframes znpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--zn-a) 60%, transparent), 0 0 26px -6px var(--zn-a); } 70%, 100% { box-shadow: 0 0 0 16px transparent, 0 0 26px -6px var(--zn-a); } }

.zn-btn { display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; min-width: 0; height: var(--ui-btn-h); padding: 0 var(--ui-pad); border: 0; border-radius: var(--ui-radius); background: var(--zn-a); color: var(--zn-ink); font: inherit; font-size: 18px; font-weight: 800; line-height: 1.15; cursor: pointer; transition: transform .12s var(--ease, ease), opacity .2s; }
.zn-btn.ghost { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.zn-btn:active:not(:disabled) { transform: scale(.98); }
.zn-btn:disabled { opacity: .5; cursor: default; }
.zn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ui-step); }

/* ввод ответа */
.zn-got { margin: 0; font-size: 20px; font-weight: 800; color: var(--zn-a); }
.zn-cd { font-size: 80px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; min-height: 80px; }
.zn-cd.warn { color: var(--zn-warn); }
.zn-cd.bad { color: var(--zn-bad); }
@media (prefers-reduced-motion: no-preference) { .zn-cd.bad { animation: znbeat 1s ease-in-out infinite; } }
@keyframes znbeat { 50% { transform: scale(1.08); } }
.zn-bar { width: 100%; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--text) 14%, transparent); overflow: hidden; }
.zn-bar i { display: block; width: 100%; height: 100%; border-radius: 4px; background: var(--zn-a); transform-origin: left; transition: transform .1s linear; }
.zn-lab { font-size: 15px; font-weight: 700; color: var(--muted); }
.zn-in { box-sizing: border-box; width: 100%; height: var(--ui-btn-h); padding: 0 var(--ui-pad); border: 2px solid var(--line); border-radius: var(--ui-radius); background: var(--bg); color: var(--text); font: inherit; font-size: 22px; font-weight: 700; text-align: center; }
.zn-in:focus { border-color: var(--zn-a); outline: none; }

/* итог */
.zn-res { gap: 8px; min-height: 0; }
.zn-res .zn-cover { width: 64px; height: 64px; }
.zn-res .zn-verdict { font-size: 36px; }
.zn-verdict { font-size: 40px; line-height: 1.1; font-weight: 800; letter-spacing: .01em; }
.zn-res.ok .zn-verdict { color: var(--zn-ok); }
.zn-res.warn .zn-verdict { color: var(--zn-warn); }
.zn-res.bad .zn-verdict { color: var(--zn-bad); }
.zn-sub { margin: -8px 0 0; min-height: 18px; font-size: 15px; font-weight: 600; color: var(--muted); }
.zn-song { display: flex; align-items: center; gap: var(--ui-pad); max-width: 100%; text-align: left; }
.zn-cover { flex: none; display: grid; place-items: center; width: 80px; height: 80px; border-radius: var(--ui-radius); background: var(--surface2, var(--bg)); color: var(--muted); overflow: hidden; }
.zn-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.zn-cover svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.zn-stx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.zn-artist { font-size: 20px; line-height: 1.2; font-weight: 800; overflow-wrap: anywhere; }
.zn-title { font-size: 17px; line-height: 1.2; font-weight: 600; overflow-wrap: anywhere; }
.zn-year { font-size: 14px; color: var(--muted); font-weight: 600; }
.zn-pts { display: flex; align-items: center; justify-content: center; gap: var(--ui-step); min-height: 40px; }
.zn-pts b { font-size: 40px; line-height: 1; font-weight: 800; color: var(--zn-a); font-variant-numeric: tabular-nums; }
.zn-pts .coin { width: 32px; height: 32px; background-size: 32px 32px; vertical-align: 0; }
.zn-why { display: flex; flex-direction: column; gap: 3px; align-items: stretch; width: 100%; max-width: 280px; margin: 0 auto; }
.zn-why:empty { display: none; }
.zn-why-row { display: flex; justify-content: space-between; align-items: center; gap: var(--ui-step); padding: 3px 12px; border-radius: 10px; background: color-mix(in srgb, var(--zn-a) 14%, transparent); font-size: 15px; line-height: 22px; font-weight: 700; }
.zn-why-row b { color: var(--zn-a); font-variant-numeric: tabular-nums; font-size: 17px; }
.zn-streak { margin-left: var(--ui-step); padding: 4px 10px; border-radius: 10px; background: color-mix(in srgb, var(--zn-a) 18%, transparent); color: var(--zn-a); font-size: 14px; font-weight: 800; }
.zn-said { margin: 0; max-width: 100%; min-height: 20px; font-size: 15px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zn-res.hit::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(closest-side, color-mix(in srgb, var(--zn-ok) 45%, transparent), transparent 80%); opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .zn-res.hit::after { animation: znhit .9s ease-out; }
  .zn-res.hit .zn-pts b { animation: znpop .5s var(--ease, ease-out); }
  .zn-res.bad .zn-verdict { animation: znshake .4s ease-in-out; }
}
@keyframes znhit { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
@keyframes znpop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes znshake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* пустой экран, ошибка, конец списка */
.zn-note { gap: 12px; }
.zn-badge { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: color-mix(in srgb, var(--zn-a) 18%, transparent); color: var(--zn-a); }
.zn-badge.ok { background: color-mix(in srgb, var(--zn-ok) 20%, transparent); color: var(--zn-ok); }
.zn-badge.bad { background: color-mix(in srgb, var(--zn-bad) 18%, transparent); color: var(--zn-bad); }
.zn-badge svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.zn-nh { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }
.zn-np { margin: 0; font-size: 17px; font-weight: 600; color: var(--muted); line-height: 1.3; }

/* плитка в меню «Угадай мелодию» */
.mtile.t-know { --c: var(--zn-a); }
.mtile.t-know .mic svg { fill: currentColor; stroke: none; }
html[data-brand="electro"] .mtile.t-know { min-height: 96px; }

/* голос: микрофон в ряду с полем, строка состояния под ним */
.zn-inrow { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ui-step); width: 100%; }
.zn-inrow.voice { grid-template-columns: minmax(0, 1fr) var(--ui-btn-h); }
.zn-mic { display: grid; place-items: center; box-sizing: border-box; width: var(--ui-btn-h); height: var(--ui-btn-h); padding: 0; border: 0; border-radius: var(--ui-radius); background: var(--surface2, var(--bg)); color: var(--zn-a); box-shadow: inset 0 0 0 2px var(--line); cursor: pointer; transition: transform .12s var(--ease, ease); }
.zn-mic svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.zn-mic:active:not(:disabled) { transform: scale(.94); }
.zn-mic:disabled { opacity: .45; cursor: default; }
.zn-mic.rec { background: var(--zn-bad); color: #fff; box-shadow: none; }
:root:root .zn-mic:focus-visible { outline: 2px solid var(--zn-a); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) { .zn-mic.rec { animation: znrec 1s ease-in-out infinite; } }
@keyframes znrec { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--zn-bad) 30%, transparent); } }
.zn-vs { display: flex; align-items: center; justify-content: center; gap: var(--ui-step); min-height: 24px; font-size: 16px; font-weight: 700; color: var(--muted); line-height: 1.2; }
.zn-vs.rec { color: var(--zn-bad); }
.zn-vs.ok { color: var(--zn-ok); }
.zn-vs.bad { color: var(--zn-bad); }
.zn-meter { display: inline-flex; align-items: center; gap: 3px; height: 20px; }
.zn-meter i { width: 4px; height: 100%; border-radius: 2px; background: currentColor; transform: scaleY(.3); }
.zn-vs.wait .zn-meter i { opacity: .6; }
@media (prefers-reduced-motion: no-preference) { .zn-vs.wait .zn-meter i { animation: zneq .9s ease-in-out infinite; } .zn-vs.wait .zn-meter i:nth-child(2n) { animation-delay: -.3s; } }

/* экранная клавиатура открыта (класс ставит znayu.js): шапка и нижнее меню спрятаны, экран игры занимает видимую часть, «Ответить» над клавиатурой */
html.zn-kb #top, html.zn-kb #mnav, html.zn-kb .bg-fab { display: none; }
html.zn-kb, html.zn-kb body { overflow: hidden; }
html.zn-kb #gamesView.zn { position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-h, 100dvh); z-index: 40; box-sizing: border-box; margin: 0; padding: var(--ui-step) var(--ui-pad); background: var(--bg); overflow: hidden; animation: none; }
html.zn-kb #gamesView.zn .znw { height: 100%; min-height: 0; margin: 0; }
html.zn-kb #gamesView.zn .zn-stage { flex: 0 0 auto; justify-content: center; gap: var(--ui-step); padding: var(--ui-step) var(--ui-pad); min-height: 0; }
html.zn-kb #gamesView.zn .zn-got, html.zn-kb #gamesView.zn .zn-lab { display: none; }
html.zn-kb #gamesView.zn .zn-cd { font-size: 56px; min-height: 56px; }
html.zn-kb #gamesView.zn .zn-vs { min-height: 0; }
html.zn-kb #gamesView.zn .zn-vs:empty { display: none; }

/* 1.47: «Ответить» и «Сказать голосом»: две одинаковые кнопки на всю ширину друг под другом (любой рукой) */
.zn-voice { gap: var(--ui-step); background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 2px var(--zn-a); }
.zn-voice .zn-mic-ic { display: grid; place-items: center; width: 24px; height: 24px; color: var(--zn-a); }
.zn-voice .zn-mic-ic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.zn-voice.rec { background: var(--zn-bad); color: #fff; box-shadow: none; }
.zn-voice.rec .zn-mic-ic { color: #fff; }
@media (prefers-reduced-motion: no-preference) { .zn-voice.rec { animation: znrec 1s ease-in-out infinite; } }
/* таймер узнавания 30,0 и плашка «Не узнали» */
.zn-live b { min-width: 0; text-align: center; }
html.zn-kb #gamesView.zn .zn-name { display: none; }
html.zn-kb #gamesView.zn .zn-foot, html.zn-kb #gamesView.zn .zn-foot-in { flex: 0 0 auto; }
html.zn-kb #gamesView.zn .zn-stage { flex: 0 1 auto; min-height: 0; overflow: hidden; }
/* экран ввода на невысоком телефоне (360x640): обе кнопки видны над нижним меню */
@media (max-height: 740px) {
  html:not(.zn-kb) #gamesView.zn .zn-lab { display: none; }
  html:not(.zn-kb) #gamesView.zn .zn-cd { font-size: 56px; min-height: 56px; }
  html:not(.zn-kb) #gamesView.zn .zn-stage { gap: var(--ui-step); padding-top: var(--ui-step); padding-bottom: var(--ui-step); }
}

/* 1.51: экран «Разрешите микрофон» и «Микрофон не разрешён»: главная кнопка крупная, вторая спокойнее */
.zn-gbtns { display: flex; flex-direction: column; gap: var(--ui-step); }
.zn-btn.zn-small { height: 48px; min-height: 48px; font-size: 15px; font-weight: 700; opacity: .9; }
.zn-btn.busy { opacity: .75; }
.zn-voice.off, .zn-voice:disabled.off { opacity: .55; }
.zn-note .zn-nh { font-size: 26px; line-height: 1.15; }
.zn-cover.big { width: 112px; height: 112px; animation: zn-pop .32s ease-out both; }
@keyframes zn-pop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .zn-cover.big { animation: none; } }
