/* Главная, выбор варианта, выбор соперника и лобби.
   Токены и примитивы — в theme.css, экран партии — в nardy.css. */

/* --- общие раскладки --- */

.stack { display: flex; flex-direction: column; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

/* арт игры: всегда закрывает контейнер целиком */
.art { display: block; width: 100%; height: 100%; }
img.art { object-fit: cover; }

/* --- обложка ---
   Владелец (10.10): «верхняя часть громоздкая, человек должен сразу понимать,
   куда заходит». Поэтому вместо строки профиля, заголовка и чипов — одна
   картинка с названием; профиль и настройки — аватар в её углу. */

#hub-cover {
  position: relative;
  flex: none;
  aspect-ratio: 1170 / 502;
  max-height: 210px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #1a120c;
  box-shadow: var(--sh-1);
}
.cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
}
/* затемнение снизу-слева — под заголовок; сама картинка там спокойная */
#hub-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(8, 6, 4, .88) 0%, rgba(8, 6, 4, .35) 48%, transparent 72%),
    linear-gradient(90deg, rgba(8, 6, 4, .45), transparent 60%);
  pointer-events: none;
}
.cover-txt {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 11px;
  z-index: 1;
  color: #fff;
}
.cover-txt h1 {
  font-size: 23px;
  line-height: 1.1;
  letter-spacing: -.3px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
}
.cover-txt p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255, 255, 255, .82);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cover-txt .ic {
  width: 14px;
  height: 14px;
  margin: 0 2px 0 1px;
  vertical-align: -2px;
  color: #ffd27a;
}

/* аватар — вход в профиль и настройки; шестерёнка-значок подсказывает,
   что за ним настройки, а не только имя */
.cover-me {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.cover-me .avatar {
  width: 36px;
  height: 36px;
  font-size: 15px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 4px 14px rgba(0, 0, 0, .5);
}
.cover-gear {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-1);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}
.cover-gear .ic { width: 12px; height: 12px; }
.cover-me:active { transform: scale(.94); }

#av-note { margin: -10px 2px 0; }

/* входящие приглашения не должны теряться при скролле */
#invites {
  position: sticky;
  top: calc(-6px + var(--sa-top, 0px));
  z-index: 6;
  background: var(--bg);
  padding: 6px 0;
  margin: -6px 0;
}

/* --- каталог --- */

.gcard {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: #120d09;
  box-shadow: var(--sh-1);
  cursor: pointer;
  transition: transform .14s ease;
}
.gcard:active { transform: scale(.98); }

.gcard-art { aspect-ratio: 4 / 3; overflow: hidden; }
.gcard.feature .gcard-art { aspect-ratio: 20 / 9; }

/* подпись лежит на фото; затемнение снизу держит белый текст читаемым
   на любой картинке */
.gcard-foot {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 11px 9px;
  background: linear-gradient(180deg, transparent, rgba(6, 5, 4, .78) 45%, rgba(6, 5, 4, .92));
  color: #fff;
}
.gcard-name {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.15;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .6);
}
.gcard-sub {
  margin-top: 2px;
  font-size: 12px;
  color: rgba(255, 255, 255, .72);
}
.gcard.feature .gcard-name { font-size: 20px; }

/* «Скоро» — заметно тише готовых игр и без активного CTA */
.gcard.soon { box-shadow: none; cursor: default; }
.gcard.soon:active { transform: none; }
.gcard.soon .gcard-art { opacity: .5; filter: saturate(.4); }
.gcard.soon .gcard-name { color: rgba(255, 255, 255, .75); }

.badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--r-full);
  background: rgba(8, 10, 14, .72);
  border: 1px solid var(--line);
  color: var(--text-2);
  backdrop-filter: blur(4px);
}
.badge .ic { width: 12px; height: 12px; }

/* --- играть с другом --- */

.friend-head { display: flex; align-items: center; gap: 12px; }
.friend-head .big-ic { color: var(--accent); }
.friend-head b { font-size: 15px; }

/* --- строки партий («Продолжить» и недавние) --- */

#hub-continue { display: flex; flex-direction: column; gap: 6px; margin-top: -4px; }
.cont-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--text-3);
  padding-left: 2px;
}
/* несколько партий — лента вбок: край следующей карточки виден и зовёт
   пролистать, а высота блока не растёт с числом партий */
.cont-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--pad));
  padding: 0 var(--pad);
  scroll-padding: 0 var(--pad);
}
.cont-row::-webkit-scrollbar { display: none; }
.ccard {
  flex: 1 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 8px;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid rgba(var(--accent-rgb), .35);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.cont-row.many .ccard { flex-basis: 78%; }
.ccard:active { transform: scale(.98); }
.ccard:disabled { opacity: .6; }
.ccard b { display: block; font-size: 15px; font-weight: 600; }
.ccard .gmini { width: 40px; height: 40px; }
.ccard-go {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 14px rgba(var(--accent-rgb), .35);
}
.ccard-go .ic { width: 15px; height: 15px; margin-left: 2px; }
#recent-list { display: flex; flex-direction: column; gap: 8px; }

.mrow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--line);
}
.mrow b { font-size: 15px; font-weight: 600; }
.mrow-sub { margin-top: 1px; }

.gmini {
  width: 44px;
  height: 32px;
  flex: none;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}

/* --- профиль (шторка) --- */

.prof-rows { width: 100%; display: flex; flex-direction: column; }
.prof-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 14px 2px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.prof-row.static { cursor: default; }
.prof-row:active { opacity: .6; }
.prof-row .ic { color: var(--text-3); }
#prof-rules-text { text-align: left; padding: 10px 2px; line-height: 1.5; }
#prof-rules-text p { margin: 0 0 10px; }
#prof-rules-text b { color: var(--text); }

/* --- экран выбора варианта --- */

#variant-hero {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
}
#variant-art { width: 100%; height: 132px; }
.variant-hero-txt {
  position: absolute;
  inset: auto 0 0 0;
  padding: 12px 14px;
  background: linear-gradient(180deg, transparent, rgba(8, 10, 14, .9) 60%);
}
.variant-hero-txt p { margin: 2px 0 0; }

.vcard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease;
}
.vcard:active { transform: scale(.99); border-color: rgba(var(--accent-rgb), .4); }
.vcard-top { display: flex; align-items: center; gap: 12px; }
.vcard-art {
  width: 68px;
  height: 44px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.vcard-name { font-size: 16px; font-weight: 600; }
.vcard-tag { font-size: 13px; color: var(--accent); margin-top: 2px; }
.vcard-about { margin: 0; line-height: 1.45; }
/* «Правила» — ссылка, а не кнопка: рядом уже есть «Выбрать», и две кнопки
   одного веса заставляли бы выбирать между ними */
.vcard-rules-btn {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
.vcard-rules {
  margin: 0;
  padding-left: 18px;
  line-height: 1.5;
  color: var(--text-2);
}
.vcard-rules li { margin-bottom: 4px; }
.vcard-pick { align-self: flex-start; }

/* --- экран выбора соперника --- */

.opp-hero {
  position: relative;
  flex: none;
  height: 128px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  background: #120d09;
}
#opp-art { position: absolute; inset: 0; }
.opp-hero-txt {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 14px 11px;
  background: linear-gradient(180deg, transparent, rgba(6, 5, 4, .85) 55%);
  color: #fff;
}
.opp-title { font-size: 21px; font-weight: 700; line-height: 1.15; }
.opp-hero-txt p { margin: 2px 0 0; color: rgba(255, 255, 255, .75); }

.opp-sect { display: flex; flex-direction: column; gap: 8px; }
.opp-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--text-3);
  padding-left: 2px;
}
.opp-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid rgba(var(--accent-rgb), .3);
  box-shadow: var(--sh-1);
}
.orow-head { display: flex; align-items: center; gap: 12px; }
.orow-head b, .orow b { display: block; font-size: 15px; font-weight: 600; }

/* квадратная плашка под иконкой — тёплый отсвет акцента, а не заливка:
   залитая кнопка на экране одна */
.otile {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--accent-rgb), .14);
  color: var(--accent);
}
.otile .ic { width: 21px; height: 21px; }

.orow {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.orow .small { display: block; margin-top: 1px; }
.orow:active { transform: scale(.985); background: var(--surface-2); }
.orow:disabled { opacity: .55; }
.orow-go { width: 18px; height: 18px; color: var(--text-3); flex: none; }

/* сложность бота: три равные кнопки, выбранная — в цвет акцента */
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1;
  padding: 9px 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.seg button[aria-checked="true"] {
  border-color: rgba(var(--accent-rgb), .7);
  background: rgba(var(--accent-rgb), .14);
  color: var(--accent);
  font-weight: 600;
}

/* --- лобби --- */

.screen.lobby {
  justify-content: center;
  gap: 18px;
  padding: calc(24px + var(--sa-top, 0px)) var(--pad)
           calc(24px + var(--sa-bottom, 0px));
}
.lobby-head { display: flex; flex-direction: column; gap: 6px; }
.lobby-head p { margin: 0; max-width: 320px; line-height: 1.45; }

.vs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: 340px;
  padding: 18px 12px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
}
.vs-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.vs-name { font-size: 14px; font-weight: 600; max-width: 100%; }
.vs-mid {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-3);
}

/* пустое кресло соперника «дышит», пока мы ждём */
.avatar.pending { animation: wait-pulse 1.8s ease-in-out infinite; }
@keyframes wait-pulse {
  0%, 100% { opacity: .45; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 340px;
}
#wait-hint { margin: 0; max-width: 340px; line-height: 1.45; }

/* --- адаптив --- */

@media (min-width: 520px) {
  :root { --pad: 20px; }
  .grid-2 { grid-template-columns: repeat(3, 1fr); }
  #hub-games.grid-2 { grid-template-columns: repeat(3, 1fr); }
}
@media (orientation: landscape) and (max-height: 480px) {
  #hub-cover { max-height: 150px; }
  .grid-2 { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .avatar.pending { animation: none; opacity: .6; }
  .gcard:active, .vcard:active { transform: none; }
}

/* плавающее окно звонка не должно перекрывать шестерёнку профиля */
#call-wrap.float { top: calc(10px + var(--sa-top, 0px) + 48px); }
