/* Home and empty-room screens share the profile's materials and compact canvas. */
:is(.home-screen, .empty-room-screen) #shell-header { display: none; }
:is(.home-screen, .empty-room-screen) .krug-ui > .page {
  width: min(100%, 560px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) clamp(14px, 4.5vw, 25px) calc(112px + env(safe-area-inset-bottom));
}
.home-screen .krug-ui .home-header {
  position: relative;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 21px;
  padding-inline: 7px;
}
.home-screen .home-header > div { min-width: 0; }
.home-screen .krug-ui .home-header .brand {
  display: inline-block;
  margin-bottom: 13px;
  font-size: clamp(14px, 3.1vw, 18px);
  line-height: 1.1;
  letter-spacing: .055em;
  font-weight: 850;
}
.home-screen .home-header .brand > span { font-size: .55em; color: #2851ff; }
.home-screen .krug-ui .home-header h1 {
  max-width: none;
  font-size: clamp(25px, 6.9vw, 39px);
  line-height: 1.07;
  letter-spacing: -.045em;
  font-weight: 820;
}
.home-screen .krug-ui .home-header p {
  margin-top: 6px;
  color: var(--profile-muted);
  font-size: clamp(13px, 3.05vw, 17px);
  line-height: 1.35;
  letter-spacing: -.02em;
}
.home-screen .krug-ui .home-header .profile-avatar {
  display: grid;
  min-width: 44px;
  min-height: 44px;
  padding: 2px;
  margin-top: clamp(19px, 4.4vw, 25px);
  border: 1px solid var(--profile-card);
  background: var(--profile-card);
  box-shadow: 0 4px 10px #233c6a16;
}
.home-screen .home-header .profile-avatar .avatar {
  width: clamp(40px, 10.2vw, 57px);
  height: auto;
  aspect-ratio: 1;
}
.home-screen .krug-ui .home-tools,
.home-screen .krug-ui .home-entry,
.home-screen .krug-ui .home-entry:has(> .return-card) {
  display: block;
  height: auto;
  margin-bottom: 0;
}
.home-screen .krug-ui .return-card {
  display: flex;
  align-items: center;
  gap: clamp(7px, 2vw, 14px);
  min-height: 110px;
  height: auto;
  overflow: hidden;
  margin-bottom: 16px;
  padding: 15px clamp(17px, 4.3vw, 24px);
  border: 1px solid #3155ff;
  border-radius: clamp(23px, 4.7vw, 27px);
  background: linear-gradient(115deg, #2b50fa, #2d4df1);
  color: #fff;
  box-shadow: 0 12px 24px #2851ff24;
}
.home-screen .krug-ui .return-card > .return-copy {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  margin: 0;
  opacity: 1;
  font-size: clamp(12px, 2.8vw, 16px);
}
.home-screen .return-copy > span { display: block; margin-bottom: 7px; }
.home-screen .krug-ui .return-card strong {
  font-size: clamp(18px, 4.25vw, 24px);
  line-height: 1.13;
  font-weight: 780;
  letter-spacing: -.03em;
}
.home-screen .krug-ui .return-card small {
  margin-top: 7px;
  font-size: clamp(12px, 2.65vw, 15px);
  line-height: 1.25;
  color: #e0e6ff;
  opacity: 1;
}
.home-screen .krug-ui .return-card .round-arrow {
  position: static;
  flex: none;
  transform: none;
  width: clamp(33px, 7.3vw, 41px);
  height: clamp(33px, 7.3vw, 41px);
  background: #ffffff25;
  font-size: 29px;
}
.home-screen .krug-ui .return-card .return-art {
  flex: none;
  width: clamp(58px, 16vw, 92px);
  height: auto;
  aspect-ratio: 1.65;
  margin: 0;
  border-radius: 9px;
  pointer-events: none;
}
.home-screen #home-invitations { margin-bottom: 18px; color: var(--profile-ink); }
.home-screen #home-invitations-title {
  margin: 0 0 9px 4px;
  font-size: clamp(18px, 4.6vw, 22px);
  line-height: 1.15;
  letter-spacing: -.035em;
}
.home-screen .invite-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.home-screen .invite-card {
  display: grid;
  grid-template-columns: clamp(92px, 30vw, 146px) minmax(0, 1fr);
  align-items: center;
  gap: 12px 14px;
  padding: clamp(12px, 3.3vw, 16px);
  border: 1px solid var(--profile-border);
  border-radius: 22px;
  background: var(--profile-card);
  box-shadow: var(--profile-shadow);
}
.home-screen .invite-card .invite-cover {
  width: 100%;
  height: auto;
  aspect-ratio: 1.65;
  margin: 0;
  border-radius: 12px;
}
.home-screen .invite-details h3 {
  margin: 0;
  font-size: clamp(21px, 5.4vw, 26px);
  line-height: 1.1;
  letter-spacing: -.035em;
}
.home-screen .invite-sender {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 6px 0 0;
  color: var(--profile-muted);
  font-size: 14px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.home-screen .invite-sender .ward-name { color: var(--profile-ink); font-weight: 650; }
.home-screen .invite-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 8px;
}
.home-screen .invite-actions .button {
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
}
.home-screen .invite-actions .primary { background: #2851ff; color: #fff; }
.home-screen .invite-actions .secondary { background: var(--profile-field); color: var(--profile-ink); box-shadow: none; }
.home-screen .krug-ui .quick-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  height: auto;
  margin-bottom: 15px;
}
.home-screen .krug-ui .home-entry .quick-actions > button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  min-width: 0;
  min-height: 116px;
  padding: 13px clamp(12px, 4.2vw, 24px) 17px;
  border: 1px solid var(--profile-border);
  border-radius: clamp(22px, 4.6vw, 26px);
  color: var(--profile-ink);
  background: var(--profile-card);
  box-shadow: var(--profile-shadow);
}
.home-screen .krug-ui .quick-actions > .create-action {
  background: linear-gradient(115deg, var(--profile-card), color-mix(in srgb, var(--profile-selected) 80%, var(--profile-card)));
}
.home-screen .krug-ui .quick-actions button > span {
  width: 35px;
  height: 35px;
  margin-bottom: 8px;
  border-radius: 11px;
}
.home-screen .quick-actions .create-action > span { background: #2851ff; color: #fff; box-shadow: inset 0 1px 1px #ffffff45; }
.home-screen .quick-actions .join-action > span { border: 2px solid var(--profile-blue); color: var(--profile-blue); background: transparent; }
.home-screen .quick-actions button > span > svg { width: 26px; height: 26px; }
.home-screen .krug-ui .quick-actions strong {
  font-size: clamp(14px, 3.55vw, 20px);
  line-height: 1.15;
  font-weight: 780;
  letter-spacing: -.035em;
}
.home-screen .krug-ui .quick-actions small {
  margin-top: 5px;
  color: var(--profile-muted);
  font-size: clamp(11px, 2.65vw, 15px);
  line-height: 1.25;
  letter-spacing: -.025em;
  opacity: 1;
}
.home-screen .krug-ui .home-tools .count-section {
  display: flex;
  min-height: 74px;
  flex-direction: row;
  align-items: center;
  gap: clamp(12px, 3.4vw, 19px);
  margin-bottom: 19px;
  padding: 14px clamp(15px, 3.3vw, 19px);
  border: 1px solid var(--profile-border);
  border-radius: clamp(22px, 4.6vw, 26px);
  background: var(--profile-card);
  box-shadow: var(--profile-shadow);
}
.home-screen .count-section .friends-icon {
  display: grid;
  flex: none;
  place-items: center;
  padding-right: clamp(11px, 3vw, 17px);
  border-right: 1px solid var(--profile-border);
  color: var(--profile-ink);
}
.home-screen .friends-icon svg { width: 39px; height: 39px; }
.home-screen .friends-icon svg:first-child { height: 15px; color: var(--profile-blue); }
.home-screen .friends-icon svg:last-child { height: 27px; }
.home-screen .count-copy { min-width: 0; flex: 1; }
.home-screen .count-copy h2 { font-size: clamp(16px, 3.75vw, 21px); line-height: 1.15; letter-spacing: -.035em; font-weight: 780; }
.home-screen .count-copy p { margin-top: 5px; font-size: clamp(11px, 2.6vw, 15px); line-height: 1.25; color: var(--profile-muted); letter-spacing: -.025em; }
.home-screen .count-section .count-badge {
  display: grid;
  flex: none;
  min-width: 48px;
  min-height: 37px;
  padding: 4px 9px;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(120deg, #304eff, #294df3);
  color: #fff;
  font-size: 21px;
  font-weight: 750;
}
.home-screen .credit-claim { width: 100%; color: var(--profile-ink); text-align: left; }
.home-screen .credit-claim .progress-coin { --coin-size: 36px; }
.home-screen .credit-claim .count-copy strong { display: block; font-size: clamp(16px, 3.75vw, 21px); line-height: 1.15; letter-spacing: -.035em; }
.home-screen .credit-claim .count-copy small { display: block; margin-top: 5px; color: var(--profile-muted); font-size: clamp(12px, 2.6vw, 15px); font-variant-numeric: tabular-nums; }
.home-screen .credit-claim:disabled { opacity: 1; cursor: default; }
.home-screen .credit-claim:disabled .count-badge { background: var(--profile-field); color: var(--profile-muted); }
.home-screen .credit-claim-error { margin: -10px 0 16px; color: var(--profile-ink); font-size: 14px; }
.home-screen .krug-ui .catalog > .section-heading { margin-bottom: 11px; }
.home-screen .krug-ui .catalog > .section-heading h2 { font-size: clamp(23px, 4.7vw, 27px); letter-spacing: -.03em; font-weight: 790; }
.home-screen .krug-ui .catalog > .section-heading > span { color: var(--profile-muted); font-size: 17px; }
.home-screen .krug-ui .catalog .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 12px; }
.home-screen .krug-ui .game-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--profile-border);
  border-radius: clamp(22px, 4.5vw, 26px);
  background: var(--profile-card);
  color: var(--profile-ink);
  box-shadow: var(--profile-shadow);
}
.krug-ui .game-art.catalog-art {
  display: block;
  background-image: url('/game-covers.png');
  background-size: 200% 200%;
  background-repeat: no-repeat;
  background-color: #e1e7ff;
}
.krug-ui .catalog-art.catalog-art-bunker { background-position: 0 0; }
.krug-ui .catalog-art.catalog-art-mafia { background-position: 100% 0; }
.krug-ui .catalog-art.catalog-art-spy { background-position: 0 100%; }
.krug-ui .catalog-art.catalog-art-durak { background-position: 100% 100%; }
.krug-ui .game-art:is(.catalog-art-crocodile, .catalog-art-alias, .catalog-art-whoami) {
  background-image: url('/party-game-covers.webp');
}
.krug-ui .game-art.catalog-art-crocodile {
  background-color: #c9f2e9;
  background-position: 0 0;
}
.krug-ui .game-art.catalog-art-alias {
  background-color: #dad4fa;
  background-position: 100% 0;
}
.krug-ui .game-art.catalog-art-whoami {
  background-color: #ffe9d5;
  background-position: 0 100%;
}
.krug-ui .sheet .game-art.catalog-art { aspect-ratio: 1.65; }
.home-screen .krug-ui .game-card .game-art.catalog-art { width: 100%; aspect-ratio: 1.65; flex: none; }
.home-screen .krug-ui .game-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 12px clamp(10px, 2.5vw, 14px) 15px;
}
.home-screen .krug-ui .game-card-body > strong {
  font-size: clamp(19px, 4.25vw, 24px);
  line-height: 1.13;
  font-weight: 790;
  letter-spacing: -.035em;
}
.home-screen .krug-ui .game-card-body > .game-description {
  display: block;
  flex: 1;
  min-height: 2.6em;
  margin: 5px 0 12px;
  color: var(--profile-muted);
  font-size: clamp(12px, 2.65vw, 15px);
  line-height: 1.3;
  letter-spacing: -.015em;
}
.home-screen .krug-ui .game-card-body > .game-meta { flex-wrap: nowrap; align-items: flex-start; gap: 8px; color: var(--profile-ink); font-size: clamp(11px, 2.65vw, 15px); font-weight: 500; }
.home-screen .game-meta > svg { flex: none; width: 21px; height: 21px; margin-top: 2px; color: var(--profile-muted); }
.home-screen .game-meta-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; line-height: 1.2; }
.home-screen .game-meta-copy b { font-weight: 650; }
.home-screen .game-meta-copy > span { color: var(--profile-muted); }
.home-screen .home-page > .install-help { margin-top: 18px; border-color: var(--profile-border); background: var(--profile-card); box-shadow: var(--profile-shadow); }
.empty-room-screen .krug-ui > .room-empty-page { padding-top: max(clamp(28px, 7.85vw, 44px), env(safe-area-inset-top)); background: transparent; }
.empty-room-screen .room-empty-page > header { margin-bottom: 15px; padding-inline: 7px; }
.empty-room-screen .room-empty-page > header > h1 { font-size: clamp(31px, 6.95vw, 39px); line-height: 1.08; letter-spacing: -.035em; font-weight: 820; }
.empty-room-screen .room-empty-page > header > p { margin-top: 8px; font-size: clamp(14px, 3.05vw, 17px); line-height: 1.4; color: var(--profile-muted); }
.empty-room-screen .krug-ui .empty-room {
  display: block;
  min-height: 0;
  padding: 12px clamp(16px, 3.5vw, 20px) 44px;
  border: 1px solid var(--profile-border);
  border-radius: clamp(25px, 5vw, 29px);
  background: var(--profile-card);
  box-shadow: var(--profile-shadow);
}
.empty-room-screen .empty-room .room-art { display: block; width: 90%; aspect-ratio: 1.5; margin: 0 auto; }
.empty-room-screen .empty-room .room-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
.empty-room-screen .empty-room > h2 { margin: 0; font-size: clamp(28px, 6.7vw, 38px); line-height: 1.12; letter-spacing: -.04em; font-weight: 820; }
.empty-room-screen .krug-ui .empty-room > p { max-width: 360px; margin: 12px auto 31px; font-size: clamp(17px, 4vw, 23px); line-height: 1.25; color: var(--profile-muted); letter-spacing: -.02em; }
.empty-room-screen .krug-ui .empty-room > button {
  display: flex;
  width: 100%;
  min-height: clamp(52px, 11vw, 63px);
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 11px 14px;
  border-radius: clamp(19px, 4.1vw, 24px);
  font-size: clamp(17px, 4.15vw, 24px);
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -.025em;
}
.empty-room-screen .empty-room > button svg { flex: none; width: 27px; height: 27px; }
.empty-room-screen .krug-ui .empty-room > .primary-button { border: 1px solid #304cff; background: linear-gradient(115deg, #284bff, #2853ff); color: white; box-shadow: 0 10px 20px #2851ff25; }
.empty-room-screen .krug-ui .empty-room > .secondary-button { margin-top: 17px; border: 1px solid var(--profile-border); background: var(--profile-field); color: var(--profile-ink); box-shadow: inset 0 1px 1px #586c9b08; }
@media (max-width: 360px) {
  :is(.home-screen, .empty-room-screen) .krug-ui > .page { padding-inline: 13px; }
  .home-screen .krug-ui .home-header { padding-inline: 3px; gap: 5px; }
  .home-screen .krug-ui .home-header h1 { font-size: 24px; }
  .home-screen .krug-ui .quick-actions { gap: 9px; }
  .home-screen .krug-ui .home-entry .quick-actions > button { padding-inline: 12px; }
  .home-screen .krug-ui .home-tools .count-section { gap: 10px; padding-inline: 12px; }
  .home-screen .count-section .friends-icon { padding-right: 10px; }
  .home-screen .friends-icon svg { width: 30px; height: 30px; }
  .home-screen .count-section .count-badge { min-width: 39px; min-height: 34px; font-size: 18px; }
  .home-screen .krug-ui .catalog .game-grid { gap: 9px; }
  .home-screen .krug-ui .game-card-body > .game-meta { gap: 5px; }
  .home-screen .game-meta > svg { width: 17px; height: 17px; }
  .empty-room-screen .krug-ui .empty-room { padding-inline: 15px; padding-bottom: 25px; }
}
@media (prefers-reduced-motion: reduce) {
  :is(.home-screen, .empty-room-screen) .krug-ui :is(.game-card, .game-art, .return-card, .quick-actions button, .empty-room > button) { transition: none; animation: none; }
}
