/* Каталог: шапка и общая раскладка страницы */
.page { max-width: 1100px; margin: 0 auto; }

.topbar {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: var(--tap); padding: 0 6px; border-radius: var(--r-btn);
  color: var(--ink); text-decoration: none;
}
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }

.brand:focus-visible, .icon-btn:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

.icon-btn {
  width: var(--tap); height: var(--tap); padding: 0; cursor: pointer;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-btn);
  background: var(--surface); color: var(--ink);
  transition: border-color .2s ease, transform .15s ease;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 22px; height: 22px; }

.content { padding: 8px 16px 40px; }
.title { margin: 8px 0 0; font-size: clamp(28px, 5vw, 40px); letter-spacing: -.02em; }
.subtitle { margin: 6px 0 20px; color: var(--muted); font-size: 17px; line-height: 1.5; }

.empty[hidden] { display: none; }
.empty {
  border: 1px dashed var(--line); border-radius: var(--r-win);
  padding: 48px 20px; text-align: center; background: var(--surface); color: var(--muted);
}

.noscript { margin: 0; padding: 12px 16px; background: var(--accent-soft); color: var(--ink); text-align: center; }

/* Сетка карточек: 2 колонки на телефоне, больше на широких экранах */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.card {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.card:hover { transform: translateY(-3px); }
.card:active { transform: scale(.97); }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 22px; }
.card.is-soon { opacity: .62; }

.card-cover {
  position: relative; border-radius: var(--r-card); overflow: hidden;
  border: 1px solid var(--line); background: var(--surface);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.card-cover img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; }
.card[aria-pressed="true"] .card-cover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px var(--accent-soft); }
.card-title { font-size: 17px; font-weight: 700; padding: 0 4px; overflow-wrap: anywhere; color: var(--ink); }

.badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 700;
}

/* Главный постер: плавно раскрывается и сворачивается */
.poster-wrap {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur) ease;
}
.poster-wrap.is-open { grid-template-rows: 1fr; }
.poster-clip { overflow: hidden; min-height: 0; }

.poster {
  position: relative; margin: 4px 0 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-win);
  padding: 16px; box-shadow: 0 6px 16px oklch(0.3 0.03 260 / .1); /* тень не должна выходить за обрезку блока */
  display: flex; flex-wrap: wrap; gap: 20px;
  opacity: 0; transition: opacity var(--dur) ease;
}
.poster-wrap.is-open .poster { opacity: 1; }

.poster-cover {
  flex: none; width: 160px; margin: 0;
  border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--line);
}
.poster-cover img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; }

.poster-body {
  flex: 1 1 240px; min-width: 0; padding: 8px 4px;
  display: flex; flex-direction: column; justify-content: center; gap: 12px;
}
.poster-title {
  margin: 0; padding-right: 48px; font-size: clamp(28px, 5vw, 44px);
  line-height: 1.08; letter-spacing: -.02em; overflow-wrap: anywhere;
}
.poster-desc { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.5; max-width: 52ch; text-wrap: pretty; }
.poster-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; }

.btn-play {
  flex: 1 1 160px; max-width: 260px; min-height: 52px; padding: 0 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-btn); text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
  font: 700 18px inherit; font-family: inherit; cursor: pointer;
  transition: filter .2s ease, transform .15s ease;
}
.btn-play:hover { filter: brightness(1.07); }
.btn-play:active { transform: scale(.98); }
.btn-play:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn-play:disabled { background: var(--accent-soft); color: var(--muted); cursor: not-allowed; filter: none; transform: none; }
.soon-note { color: var(--muted); font-weight: 600; }

.poster-close {
  position: absolute; top: 12px; right: 12px;
  width: var(--tap); height: var(--tap); padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-btn);
  background: var(--surface); color: var(--ink); font-size: 22px; line-height: 1;
  transition: border-color .2s ease;
}
.poster-close:hover { border-color: var(--accent); }
.poster-close:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Телефон: постер компактный, картинка около 60 пикселей слева от текста */
@media (max-width: 599px) {
  .poster { flex-wrap: nowrap; gap: 12px; padding: 12px; align-items: flex-start; }
  .poster-cover { width: 60px; border-radius: 10px; }
  .poster-body { flex: 1 1 0; padding: 0; gap: 8px; justify-content: flex-start; }
  .poster-title { font-size: 24px; padding-right: 48px; }
  .poster-desc { font-size: 15px; }
  .poster-actions { margin-top: 4px; }
  .btn-play { flex: 1 1 100%; max-width: none; min-height: 48px; }
}

/* Профиль: аватар в шапке, меню и окно редактирования */
.avatar-btn {
  width: var(--tap); height: var(--tap); padding: 0; cursor: pointer;
  border: 2px solid var(--accent); border-radius: 50%;
  color: oklch(0.2 0.03 260); font: 700 18px inherit; font-family: inherit;
  transition: transform .15s ease, filter .2s ease;
}
.avatar-btn:hover { filter: brightness(1.05); }
.avatar-btn:active { transform: scale(.95); }
.avatar-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.menu {
  position: absolute; right: 16px; top: 64px; z-index: 20;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 6px; box-shadow: var(--shadow); min-width: 180px;
}
.menu[hidden] { display: none; }
.menu-item {
  width: 100%; min-height: var(--tap); padding: 0 14px; text-align: left; cursor: pointer;
  border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit;
}
.menu-item:hover { background: var(--accent-soft); }
.menu-item:focus-visible { outline: 3px solid var(--accent); }

.dialog {
  width: min(400px, calc(100% - 32px)); padding: 24px; margin: auto;
  border: 0; border-radius: var(--r-win); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: oklch(0.2 0.02 260 / .5); }
.profile-form { display: grid; gap: 18px; }
.dialog-title { margin: 0; font-size: 24px; }
.field { display: grid; gap: 6px; }
.field-label { font-weight: 600; }
.text-input {
  min-height: 48px; width: 100%; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-btn);
  background: var(--bg); color: var(--ink); font: inherit;
}
.text-input:focus-visible { outline: 3px solid var(--accent); border-color: var(--accent); }
.avatars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.avatar-option {
  aspect-ratio: 1; min-height: var(--tap); padding: 0; cursor: pointer;
  border: 2px solid transparent; border-radius: 50%;
  color: oklch(0.2 0.03 260); font: 700 22px inherit; font-family: inherit;
  transition: transform .15s ease;
}
.avatar-option:active { transform: scale(.95); }
.avatar-option[aria-pressed="true"] { border: 3px solid var(--ink); }
.avatar-option:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.dialog-note { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-secondary, .btn-primary {
  min-height: 48px; padding: 0 20px; border-radius: var(--r-btn); font: inherit; cursor: pointer;
}
.btn-secondary { border: 1px solid var(--line); background: none; color: var(--ink); }
.btn-primary { padding: 0 22px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-secondary:focus-visible, .btn-primary:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* Кошелёк: полоса над списком, окно, серия */
.wallet-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 16px; font-variant-numeric: tabular-nums; transition: border-color .2s ease, transform .15s ease;
}
.chip:hover { border-color: var(--accent); }
/* Кошелёк стоит последним в полосе и имеет фиксированный размер под число и слово: пока баланс меняется, плашка не меняет ширину и ничего вокруг не двигается */
#wallet-open { flex: none; }
#wallet-balance { display: inline-block; min-width: 5ch; text-align: right; white-space: nowrap; }
#wallet-unit { display: inline-block; min-width: 5.4ch; text-align: left; white-space: nowrap; }
.chip:active { transform: scale(.97); }
.chip:focus-visible, .btn-claim:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chip-icon { width: 22px; height: 22px; flex: none; }
.chip.streak { color: oklch(0.58 0.18 45); }
.chip.streak b { color: var(--ink); }
.chip.streak.cold { color: var(--muted); }
.chip.streak.risk { border-color: oklch(0.65 0.17 45); animation: risk 1.8s ease-in-out infinite; }
.btn-claim {
  min-height: var(--tap); padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 16px; font-weight: 700;
  animation: bob 2s ease-in-out infinite;
}
.btn-claim[hidden] { display: none; }
.pulse { animation: pulse .5s ease; }
@keyframes pulse { 0% { transform: scale(1); } 40% { transform: scale(1.08); border-color: var(--accent); } 100% { transform: scale(1); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes risk { 0%, 100% { box-shadow: 0 0 0 0 oklch(0.65 0.17 45 / 0); } 50% { box-shadow: 0 0 0 4px oklch(0.65 0.17 45 / .25); } }

.wallet-dialog { max-height: 90vh; overflow: auto; }
.wallet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wallet-balance small { color: var(--muted); font-size: 14px; }
.wallet-balance b { font-size: 40px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.wallet-balance span { font-size: 18px; color: var(--muted); }
.wallet-dialog h3 { margin: 0 0 8px; font-size: 17px; }
.flame { color: oklch(0.62 0.19 45); }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 220px; overflow: auto; }
.log li { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.log-time { grid-column: 1; color: var(--muted); font-size: 12px; }
.log-amount { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-variant-numeric: tabular-nums; }
.log-amount.plus { color: var(--accent); }
.log-empty { color: var(--muted); display: block !important; }
.records { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 15px; }
.records dt { color: var(--muted); }
.records dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.wallet-dialog .btn-primary, .wallet-dialog .btn-secondary { min-height: 48px; }
@media (max-width: 420px) { .wallet-bar .chip { padding: 0 11px; gap: 5px; } }
@media (max-width: 380px) { .chip { padding: 0 12px; font-size: 15px; } .wallet-balance b { font-size: 34px; } }
.wallet-dialog[open] { display: grid; gap: 16px; }

/* Аккаунт: окно и меню */
.account-dialog { max-height: 90vh; overflow: auto; }
.account-dialog[open] { display: grid; gap: 14px; }
.account-form { display: grid; gap: 14px; }
.account-dialog [hidden] { display: none !important; }
.conflict-list { display: grid; gap: 8px; }
.conflict-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg); font-size: 15px; line-height: 1.4; }
.menu-status { margin: 4px 0 0; padding: 6px 12px 8px; color: var(--muted); font-size: 13px; line-height: 1.4; max-width: 240px; overflow-wrap: anywhere; }
.menu-status:empty { display: none; }
.avatar-btn { position: relative; overflow: visible; font-size: 20px; }
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.emojis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.emoji-option {
  height: 44px; padding: 0; border: 2px solid var(--line); border-radius: 12px; background: var(--surface);
  font-size: 24px; line-height: 1; cursor: pointer;
}
.emoji-option:hover { border-color: var(--accent); }
.emoji-option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.emoji-option:focus-visible, .photo-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo-toggle {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; text-align: left;
  border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer;
}
.photo-toggle[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.photo-toggle img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-btn.offline::after { content: ''; position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; background: oklch(0.65 0.17 45); border: 2px solid var(--bg); }
#profile-dialog { max-height: 90vh; overflow: auto; }
.field[hidden] { display: none; }

/* Подвал сайта (компактный) */
.footer { margin-top: 32px; padding: 14px 16px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; }
.footer-brand { font-size: 16px; font-weight: 800; color: var(--ink); text-decoration: none; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 16px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 36px; color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.footer-links a.footer-tg { gap: 8px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; font-size: 14px; }
.footer-links a.footer-tg:hover { border-color: #2AABEE; color: var(--ink); text-decoration: none; }
.footer-tg svg { width: 20px; height: 20px; flex: none; }
.footer a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.footer-games { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 10px 0 2px; }
.footer-games a { color: var(--muted); text-decoration: none; font-size: 13px; min-height: 28px; display: inline-flex; align-items: center; }
.footer-games a:hover { color: var(--accent); text-decoration: underline; }
.footer-copy { margin: 4px 0 0; font-size: 12px; line-height: 1.5; }

/* Календарь серии: окошко под значком огонька, вид как у прежней лесенки серии */
.wallet-bar { position: relative; }
.cal-pop { position: absolute; left: 0; top: calc(100% + 8px); z-index: 20; width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 16px; box-shadow: 0 12px 32px oklch(0.2 0.02 260 / .28); display: flex; flex-direction: column; gap: 12px; }
.cal-pop[hidden] { display: none; }
.cal-top { display: flex; align-items: center; gap: 12px; }
.cal-top > div { flex: 1; min-width: 0; }
.flame { color: oklch(0.62 0.19 45); }
.flame.big { width: 44px; height: 44px; flex: none; }
.cal-pop.cold .flame { color: var(--muted); }
.cal-label { color: var(--muted); font-size: 14px; font-weight: 600; }
.cal-count { font-size: 24px; font-weight: 800; }
.cal-best { color: var(--muted); font-size: 14px; }
.cal-month { font-size: 15px; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.cal-wd { color: var(--muted); font-size: 12px; font-weight: 600; padding-bottom: 2px; }
.cal-day { display: flex; align-items: center; justify-content: center; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-day.on { background: var(--accent-soft); border-color: var(--accent); }
.cal-day.future { color: var(--muted); font-weight: 400; }
.cal-day.today { border: 2px solid var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 0 14px 2px var(--accent); }

/* Рейтинг игроков */
#rating-body { max-height: min(64vh, 560px); overflow-y: auto; }
.rating-tabs { display: flex; gap: 6px; margin: 0 0 10px; flex-wrap: wrap; }
.rating-tab { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.rating-tab[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
.rating-tab:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.rating-sec { margin: 0 0 14px; }
.rating-sec-title { margin: 0 0 4px; font-size: 16px; }
.rating-list.short { max-height: none; overflow: visible; }
.rating-sub { margin: 0 0 8px; color: var(--muted); font-size: 14px; font-weight: 600; }
.rating-note { margin: 4px 0 12px; color: var(--muted); }
.rating-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: min(60vh, 520px); overflow-y: auto; }
.rating-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; border: 1px solid transparent; }
.rating-row.me { border-color: var(--accent); background: var(--accent-soft); }
.rating-row .rk { width: 28px; flex: none; text-align: center; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.rating-row.top .rk { color: var(--ink); font-size: 18px; }
.rating-row .av { width: 36px; height: 36px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: oklch(0.2 0.03 260); }
.rating-row .nm { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rating-row .bal { font-variant-numeric: tabular-nums; white-space: nowrap; }
