/* Учётка (ADR-007): кнопка в лобби, окна входа, регистрации и профиля.
   Подложку и карточку берём у прочих окон (.over/.card), язык рядов — у
   настроек: третьего вида окон на одном экране быть не должно. */

/* --- кнопка в лобби -------------------------------------------------------- */

/* В углу карточки лобби, напротив заголовка: вход — не главное действие
   лобби (главное — сесть за стол), и в поток он не вклинивается. */
.lobby-card { position: relative; }
#acct {
  position: absolute;
  top: 18px;
  right: 18px;
}
.acct-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 180px;
  padding: 5px 11px 5px 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--chalk, #e8e4d8);
  font: 500 12px/1 Rubik, system-ui, sans-serif;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.acct-btn:hover { border-color: rgba(212, 175, 55, 0.5); }
.acct-btn:not(:has(.acct-ava)) { padding: 7px 14px; }
.acct-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Кружок — тем же кодом, что на табло (hud/avapaint): буквы, шар, картинка. */
.acct-ava,
#profile .ava {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 600 9px/1 Rubik, system-ui, sans-serif;
  color: #16140f;
  background: hsl(var(--hue, 40) 42% 62%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.acct-ava.ball,
#profile .ava.ball {
  background:
    radial-gradient(circle at 50% 50%, #fff 0 34%, rgba(255, 255, 255, 0) 34%),
    var(--bc, #888);
}
.acct-ava.ball.stripe,
#profile .ava.ball.stripe {
  background:
    radial-gradient(circle at 50% 50%, #fff 0 34%, rgba(255, 255, 255, 0) 34%),
    linear-gradient(var(--bc, #888) 0 0) 50% 50% / 100% 60% no-repeat,
    #f4f1e8;
}
#profile .ava.image {
  color: transparent;
  background: var(--pic) center / cover no-repeat, #2a2d33;
}
#profile .ava.empty { background: rgba(236, 231, 220, 0.08); }

/* --- окна -------------------------------------------------------------------- */

/* Выше лобби (z-index 40): профиль открывается из него. */
#profile {
  z-index: 50;
  background: radial-gradient(circle at 50% 45%, rgba(24, 26, 32, 0.72), rgba(6, 7, 9, 0.88));
}

/* Селектор с .over: у карточки итога (.over .card) текст по центру, и
   простой .acct-card эту специфичность не перебивал. */
.over .card.acct-card {
  width: min(360px, calc(100cqw - 32px));
  min-width: 0;
  padding: 18px 20px;
  text-align: left;
}
.over .card.acct-card.wide { width: min(600px, calc(100cqw - 32px)); }
.acct-card h2 {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--chalk-mute, #9b978c);
}
.acct-card h3 {
  margin: 18px 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass, #c9a227);
}
.acct-card h4 {
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--chalk-mute, #9b978c);
}

.acct-card .muted { margin: 10px 0 0; font-size: 12px; line-height: 1.45; color: var(--chalk-mute, #9b978c); }

.acct-form { display: grid; gap: 10px; }
.acct-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--chalk-mute, #9b978c);
}
.acct-card input:not([type=checkbox]):not([type=file]) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--chalk, #e8e4d8);
  font: 14px/1.2 Rubik, system-ui, sans-serif;
}
.acct-card input:focus { outline: none; border-color: rgba(212, 175, 55, 0.55); }

/* Сообщение под формой: ошибка или «готово». Пустое места не занимает. */
.acct-err { margin: 0; min-height: 0; font-size: 12.5px; color: #f0a597; }
.acct-err:empty { display: none; }

.acct-card .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
/* У окна итога кнопки стоят под текстом с отступом (`.over button`) — в
   формах он лишний. */
.acct-card button { margin-top: 0; padding: 8px 16px; font-size: 13px; }
.acct-card button.primary {
  border-color: rgba(212, 175, 55, 0.55);
  background: rgba(212, 175, 55, 0.14);
  color: var(--brass, #d4af37);
}
.acct-card button:disabled { opacity: 0.5; cursor: default; }

/* --- профиль ------------------------------------------------------------------- */

.prof-head { display: flex; align-items: center; gap: 14px; }
.prof-ava { position: relative; flex: none; cursor: pointer; }
#profile .ava.big { width: 64px; height: 64px; font-size: 20px; }
.prof-ava-hint {
  position: absolute;
  inset: auto 0 -2px;
  text-align: center;
  font-size: 10px;
  color: var(--chalk, #e8e4d8);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.15s;
}
.prof-ava:hover .prof-ava-hint,
.prof-ava:focus-within .prof-ava-hint { opacity: 1; }
.prof-id { flex: 1; min-width: 0; display: grid; gap: 6px; }
.prof-name { display: flex; gap: 6px; }
.prof-name input { font-size: 16px !important; font-weight: 500; }
.prof-login { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--chalk-mute, #9b978c); }
/* .tag, а не .chip: .chip — кружок забитого шара на табло (board.css). */
.prof-login .tag {
  flex: none;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.12);
  color: var(--brass, #d4af37);
  font-size: 11px;
}
.prof-close {
  align-self: flex-start;
  width: 32px;
  height: 32px;
  padding: 0 !important;
  border-radius: 50% !important;
  font-size: 18px !important;
}
.prof-err { margin-top: 10px; }

/* Статистика: плитки чисел, потом списки. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.tile {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
}
.tile b { font-size: 22px; font-weight: 700; color: var(--chalk, #e8e4d8); }
.tile span { font-size: 11px; color: var(--chalk-mute, #9b978c); }

.plist { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.plist li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 13px;
}
.plist .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--chalk, #e8e4d8); }
.plist .res { font-variant-numeric: tabular-nums; color: var(--chalk, #e8e4d8); }
.plist .res.win { color: #7fdca2; }
.plist .res.loss { color: #f0a597; }
.plist .meta { font-size: 11px; color: var(--chalk-mute, #9b978c); white-space: nowrap; }

/* Приглашения. */
.inv-make { justify-content: space-between; }
.acct-card .check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--chalk, #e8e4d8); }
.inv-new { display: flex; gap: 6px; margin-top: 8px; }
/* display: flex перебивает атрибут hidden — возвращаем ему силу. */
.inv-new[hidden] { display: none; }
.inv-new input { font-size: 12px !important; }
.inv-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.inv-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--chalk-mute, #9b978c); }
.inv-list .revoke { padding: 4px 10px !important; font-size: 11px !important; }

.sess-text { margin: 0 0 8px; font-size: 13px; color: var(--chalk, #e8e4d8); }

/* Узко (телефон стоймя): кнопка входа — под заголовком, а не поверх него. */
@container screen (max-width: 420px) {
  #acct { position: static; display: flex; justify-content: flex-end; margin: -6px 0 6px; }
  .tile b { font-size: 18px; }
  .plist .meta { display: none; }
  /* Неактивная «Сохранить» съедала полполя, и имя не помещалось. Появится,
     как только имя начнут править; сохранить можно и Enter'ом. */
  .prof-name button:disabled { display: none; }
}
