/**
 * Mobile lobby — scoped under body.lobby-layout-mobile only.
 * Reuses paper-card look from style.css; desktop rules stay untouched.
 */

body.lobby-layout-mobile #lobbyDesktop {
  display: none !important;
}

body.lobby-layout-desktop #lobbyMobile {
  display: none !important;
}

body.lobby-layout-mobile {
  background-color: #7fae3f;
  background-image: url("../img/background_mobile.webp");
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
  overflow: hidden;
  height: 100%;
}

html:has(body.lobby-layout-mobile) {
  height: 100%;
  overflow: hidden;
}

body.lobby-layout-mobile #rpsAppRoot,
body.lobby-layout-mobile #view-lobby.app-view {
  height: 100%;
  min-height: 0;
}

body.lobby-layout-mobile #rpsAppRoot {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body.lobby-layout-mobile #rpsAppViews {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.lobby-layout-mobile #view-lobby.app-view:not(.hidden) {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

body.lobby-layout-mobile #lobbyMobile {
  flex: 1 1 auto;
  min-height: 0;
}

/* Hide lobby bottom nav on game. Tutorial keeps the same bottom nav as lobby
   (exit via Home); only the topbar stays hidden. Game relocates the topbar
   under the logo via #gameMobileTopbarHost. */
body.lobby-layout-mobile.game #lobbyMobileBottomNav,
body.lobby-layout-mobile.tutorial-page #lobbyMobileTopbar {
  display: none !important;
}

/* Until JS moves the topbar into the game host, keep it out of the root flex. */
body.lobby-layout-mobile.game #rpsAppRoot > #lobbyMobileTopbar,
body.phone-shell-preview.game #rpsAppRoot > #lobbyMobileTopbar {
  display: none !important;
}

body.game #gameMobileTopbarHost {
  display: none;
}

body.lobby-layout-mobile.game #gameMobileTopbarHost,
body.phone-shell-preview.game #gameMobileTopbarHost,
body.native-ios.game #gameMobileTopbarHost,
body.native-android.game #gameMobileTopbarHost {
  display: block;
  grid-row: 2;
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  align-self: stretch;
}

body.lobby-layout-mobile.game #gameMobileTopbarHost #lobbyMobileTopbar,
body.phone-shell-preview.game #gameMobileTopbarHost #lobbyMobileTopbar,
body.native-ios.game #gameMobileTopbarHost #lobbyMobileTopbar,
body.native-android.game #gameMobileTopbarHost #lobbyMobileTopbar {
  display: flex !important;
  margin: 2px 0 6px;
  padding-top: 8px;
  width: auto;
  max-width: none;
  box-sizing: border-box;
}

body.game #gameMobileTopbarHost #lobbyMobileSettingsBtn,
body.game #gameMobileTopbarHost .lobby-mobile-settings-btn {
  display: none !important;
}

body.lobby-layout-mobile .lobby-mobile {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 100%;
  color: var(--ink);
  padding: 0;
  box-sizing: border-box;
  overflow: visible;
}

/* ---------- Sticky top bar ---------- */
body.lobby-layout-mobile .lobby-mobile-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin:
    max(10px, env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    0
    max(12px, env(safe-area-inset-left, 0px));
  padding: 8px 9px;
  background: linear-gradient(180deg, #fdf8e8 0%, #f4ead0 55%, #eddfb8 100%);
  border: 2px solid #9c8552;
  border-radius: 18px;
  color: #3f2d18;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 5px 14px rgba(20, 35, 10, 0.35);
  z-index: 30;
}

/* Body already applies top safe-area — only a small gap under the status bar. */
body.native-ios.lobby-layout-mobile:not(.phone-shell-preview) .lobby-mobile-topbar,
body.native-android.lobby-layout-mobile:not(.phone-shell-preview) .lobby-mobile-topbar {
  margin-top: 6px;
  margin-right: 12px;
  margin-left: 12px;
}

body.lobby-layout-mobile .lobby-mobile-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

body.lobby-layout-mobile .lobby-mobile-topbar-avatar-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
}

body.lobby-layout-mobile .lobby-mobile-topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 17px;
  color: #2f5d16;
  background: linear-gradient(180deg, #e2f5b4, #a6d465);
  border: 1px solid rgba(92, 64, 48, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

body.lobby-layout-mobile .lobby-mobile-topbar-avatar-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(60, 40, 10, 0.35));
}

body.lobby-layout-mobile .lobby-mobile-topbar-copy {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.15;
  text-align: left;
}

body.lobby-layout-mobile .lobby-mobile-topbar-title {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #3e6c1c;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.lobby-layout-mobile .lobby-mobile-topbar-sub {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #4e4632;
  white-space: nowrap;
}

/* XP progress toward the next rank */
body.lobby-layout-mobile .lobby-mobile-xp-track {
  display: block;
  width: 100%;
  height: 10px;
  margin: 5px 0 4px;
  border-radius: 999px;
  border: 1px solid rgba(92, 64, 48, 0.45);
  background: linear-gradient(180deg, rgba(112, 92, 52, 0.3), rgba(150, 130, 90, 0.2));
  box-shadow: inset 0 1px 2px rgba(60, 45, 20, 0.28);
  overflow: hidden;
}

body.lobby-layout-mobile .lobby-mobile-xp-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe483 0%, #f4ab2c 62%, #d98317 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: width 0.35s ease;
}

body.lobby-layout-mobile .lobby-mobile-settings-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #9c8552;
  background: linear-gradient(180deg, #fffaea, #ecdcb0);
  background-image: linear-gradient(180deg, #fffaea, #ecdcb0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 2px 0 rgba(120, 90, 50, 0.3);
  color: #4c7a24;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  filter: none;
  transform: none;
  transition: background 0.12s ease;
}

body.lobby-layout-mobile .lobby-mobile-settings-btn i {
  margin: 0;
  line-height: 1;
  display: block;
}

body.lobby-layout-mobile .lobby-mobile-settings-btn:hover,
body.lobby-layout-mobile .lobby-mobile-settings-btn:focus-visible {
  filter: brightness(1.04);
  outline: none;
}

body.lobby-layout-mobile .lobby-mobile-settings-btn:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  filter: brightness(0.98);
}

/* Guest: no XP track/sub — shrink avatar + padding so the bar is tighter. */
body.lobby-layout-mobile .lobby-mobile-topbar.is-guest {
  padding: 5px 8px;
  gap: 8px;
}

body.lobby-layout-mobile .lobby-mobile-topbar.is-guest .lobby-mobile-topbar-avatar-wrap {
  width: 32px;
  height: 32px;
}

body.lobby-layout-mobile .lobby-mobile-topbar.is-guest .lobby-mobile-topbar-avatar {
  width: 22px;
  height: 22px;
  font-size: 12px;
}

body.lobby-layout-mobile .lobby-mobile-topbar.is-guest .lobby-mobile-topbar-title {
  font-size: 15px;
}

body.lobby-layout-mobile .lobby-mobile-topbar.is-guest .lobby-mobile-settings-btn {
  width: 36px;
  height: 36px;
  font-size: 17px;
}

body.lobby-layout-mobile.game #gameMobileTopbarHost #lobbyMobileTopbar.is-guest,
body.phone-shell-preview.game #gameMobileTopbarHost #lobbyMobileTopbar.is-guest,
body.native-ios.game #gameMobileTopbarHost #lobbyMobileTopbar.is-guest,
body.native-android.game #gameMobileTopbarHost #lobbyMobileTopbar.is-guest {
  padding-top: 5px;
  padding-bottom: 5px;
  margin: 2px 0 4px;
}

body.lobby-layout-mobile .lobby-mobile-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  padding:
    12px
    max(14px, env(safe-area-inset-right, 0px))
    12px
    max(14px, env(safe-area-inset-left, 0px));
}

/* ---------- Sticky bottom nav ---------- */
body.lobby-layout-mobile .lobby-mobile-bottom-nav {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding:
    6px 8px
    /* Full safe-area so the bar background reaches the screen edge and icons
       clear the home indicator (matches game-mobile-bottom-nav). */
    max(
      8px,
      calc(var(--safe-bottom, env(safe-area-inset-bottom, 0px)) + var(--admob-banner-offset, 0px))
    )
    8px;
  background: rgba(12, 18, 10, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 30;
}

body.lobby-layout-mobile .lobby-mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  margin: 0;
  padding: 8px 4px 6px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: rgba(207, 232, 166, 0.55);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-shadow: none;
  cursor: pointer;
  filter: none;
  transform: none;
  transition: background 0.15s ease, color 0.15s ease;
}

body.lobby-layout-mobile .lobby-mobile-nav-item i,
body.lobby-layout-mobile .lobby-mobile-nav-item .svg-inline--fa {
  margin: 0;
  font-size: 20px;
  width: 20px;
  height: 20px;
  line-height: 1;
  display: block;
  vertical-align: middle;
}

body.lobby-layout-mobile .lobby-mobile-nav-item span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.lobby-layout-mobile .lobby-mobile-nav-item:hover,
body.lobby-layout-mobile .lobby-mobile-nav-item:focus-visible {
  color: rgba(207, 232, 166, 0.9);
  background: rgba(255, 255, 255, 0.06);
  background-image: none;
  box-shadow: none;
  filter: none;
  outline: none;
}

body.lobby-layout-mobile .lobby-mobile-nav-item:active {
  transform: none;
  box-shadow: none;
  filter: none;
  background: rgba(255, 255, 255, 0.1);
}

body.lobby-layout-mobile .lobby-mobile-nav-item.is-active {
  color: #f4ffe0;
  background: linear-gradient(180deg, rgba(141, 197, 63, 0.4), rgba(70, 118, 28, 0.55));
  background-image: linear-gradient(180deg, rgba(141, 197, 63, 0.4), rgba(70, 118, 28, 0.55));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 6px rgba(0, 0, 0, 0.28);
}

body.lobby-layout-mobile .lobby-mobile-nav-item.is-active i,
body.lobby-layout-mobile .lobby-mobile-nav-item.is-active .svg-inline--fa {
  color: #e8ffb4;
  filter: drop-shadow(0 0 6px rgba(190, 255, 120, 0.55));
}

body.lobby-layout-mobile .lobby-mobile-inner {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

body.lobby-layout-mobile .lobby-mobile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 2px 0 0;
}

body.lobby-layout-mobile .lobby-mobile-logo-wrap {
  position: relative;
  display: inline-flex;
  justify-content: center;
}

body.lobby-layout-mobile .lobby-mobile-logo-wrap::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 165%;
  height: 165%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    closest-side,
    rgba(255, 226, 138, 0.42),
    rgba(255, 226, 138, 0.14) 52%,
    rgba(255, 226, 138, 0) 72%
  );
  pointer-events: none;
  z-index: 0;
  animation: lobbyLogoGlow 4.5s ease-in-out infinite;
}

body.lobby-layout-mobile .lobby-mobile-logo {
  position: relative;
  z-index: 1;
  width: min(200px, 70vw);
  height: auto;
  display: inline-block;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 10px rgba(255, 214, 120, 0.35));
}

@keyframes lobbyLogoGlow {
  0%,
  100% {
    opacity: 0.7;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.07);
  }
}

/* Live player count right under the logo */
body.lobby-layout-mobile .lobby-mobile-online-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: center;
  margin: 0;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(14, 24, 9, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #eaf6d2;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

body.lobby-layout-mobile .lobby-mobile-online-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #74e86a;
  box-shadow: 0 0 0 3px rgba(116, 232, 106, 0.22);
  animation: lobbyOnlinePulse 1.9s ease-in-out infinite;
}

@keyframes lobbyOnlinePulse {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(116, 232, 106, 0.16);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(116, 232, 106, 0.28);
  }
}

body.lobby-layout-mobile .landing img.logo {
  width: min(180px, 72vw);
  height: auto;
  display: inline-block;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.3));
}

/* Transparent shell — controls float on bamboo bg */
body.lobby-layout-mobile .lobby-mobile-card.card {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

body.lobby-layout-mobile .lobby-mobile-auth-switch {
  display: none !important;
}

body.lobby-layout-mobile .lobby-mobile-account {
  margin-bottom: 12px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(251, 247, 232, 0.94), rgba(235, 218, 179, 0.94));
  border: 1px solid rgba(179, 173, 132, 0.85);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(42, 57, 20, 0.2);
}

body.lobby-layout-mobile .lobby-mobile-guest-intro {
  display: none !important;
}

body.lobby-layout-mobile .lobby-mobile-play {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
}

body.lobby-layout-mobile .lobby-mobile-name-field {
  margin: 0;
  max-width: 92%;
  align-self: center;
  width: 100%;
}

body.lobby-layout-mobile .lobby-mobile-name-label {
  display: block;
  margin: 0 0 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

body.lobby-layout-mobile .lobby-mobile-name-field .input-icon-wrap {
  background: linear-gradient(180deg, #fbf7e8 0%, #f4f0da 52%, #ebdab3 100%);
  border: 1px solid #b3ad84;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 1.5px 2px rgba(70, 84, 30, 0.22);
}

body.lobby-layout-mobile .lobby-mobile-name-field input {
  background: transparent;
  border: 0;
  color: #3a2e14;
  font-weight: 700;
}

/* Shared type for Play Now */
body.lobby-layout-mobile .lobby-mobile-random-btn {
  font-family: "Arial Rounded MT Bold", Arial, sans-serif;
  letter-spacing: 1px;
}

body.lobby-layout-mobile .lobby-mobile-random-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 92%;
  margin: 4px auto 0 22px;
  height: 75px;
  font-size: 20px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  /* Room for the overhanging play icon on the left */
  padding-left: 78px;
  overflow: visible;
}

body.lobby-layout-mobile .lobby-mobile-play-icon {
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  width: 103px;
  height: 103px;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35));
}

body.lobby-layout-mobile .lobby-mobile-play-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  gap: 2px;
}

body.lobby-layout-mobile .lobby-mobile-play-label {
  position: relative;
  z-index: 1;
}

body.lobby-layout-mobile .lobby-mobile-play-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: none;
  opacity: 0.9;
  line-height: 1.1;
}

/* Light sweep across the main CTA; clipped inside the button radius */
body.lobby-layout-mobile .lobby-mobile-play-shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

body.lobby-layout-mobile .lobby-mobile-play-shine::before {
  content: "";
  position: absolute;
  top: -60%;
  left: -45%;
  width: 34%;
  height: 220%;
  transform: rotate(18deg);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.42) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: lobbyPlayShine 4s ease-in-out infinite;
}

@keyframes lobbyPlayShine {
  0%,
  62% {
    left: -45%;
    opacity: 0;
  }
  66% {
    opacity: 1;
  }
  94%,
  100% {
    left: 118%;
    opacity: 0;
  }
}

/* 2×2 entry tiles */
body.lobby-layout-mobile .lobby-mobile-actions--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 10px;
  margin-top: 24px;
  padding: 0 2px;
  overflow: visible;
}

body.lobby-layout-mobile .lobby-mobile-tile {
  --tile-border: #b09660;
  --tile-border-dark: #8a7443;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  width: 100%;
  min-height: 105px;
  padding: 0 22px 14px 22px;
  margin: 0;
  box-sizing: border-box;
  overflow: visible;
  text-decoration: none;
  text-align: center;
  color: #4a3420 !important;
  font-family: "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
  background: linear-gradient(180deg, #fbf3dc 0%, #f2e7c6 60%, #ecdfb6 100%) !important;
  border: 3px solid var(--tile-border) !important;
  border-bottom-width: 4px !important;
  border-radius: 16px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 252, 240, 0.92),
    inset 0 5px 6px -4px rgba(255, 255, 255, 0.9),
    0 4px 9px rgba(25, 45, 12, 0.32) !important;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

body.lobby-layout-mobile .lobby-mobile-tile--blue {
  --tile-border: #4a7fd0;
  --tile-border-dark: #2f5a9c;
}

body.lobby-layout-mobile .lobby-mobile-tile--red {
  --tile-border: #cd3f2d;
  --tile-border-dark: #9c2b1d;
}

body.lobby-layout-mobile #createBtn.lobby-mobile-tile,
body.lobby-layout-mobile #joinToggleBtn.lobby-mobile-tile,
body.lobby-layout-mobile #tutorialBtn.lobby-mobile-tile,
body.lobby-layout-mobile #mobileLeaderboardBtn.lobby-mobile-tile {
  border: 0 !important;
  box-shadow: none !important;
}

body.lobby-layout-mobile #createBtn.lobby-mobile-tile {
  background: url("../img/card-blue.png") center / 100% 100% no-repeat !important;
}

body.lobby-layout-mobile #joinToggleBtn.lobby-mobile-tile {
  background: url("../img/card-red.png") center / 100% 100% no-repeat !important;
}

body.lobby-layout-mobile #tutorialBtn.lobby-mobile-tile {
  background: url("../img/card-torquoise.png") center / 100% 100% no-repeat !important;
}

body.lobby-layout-mobile #mobileLeaderboardBtn.lobby-mobile-tile {
  background: url("../img/card-yellow.png") center / 100% 100% no-repeat !important;
}

body.lobby-layout-mobile #createBtn.lobby-mobile-tile:active,
body.lobby-layout-mobile #joinToggleBtn.lobby-mobile-tile:active,
body.lobby-layout-mobile #tutorialBtn.lobby-mobile-tile:active,
body.lobby-layout-mobile #mobileLeaderboardBtn.lobby-mobile-tile:active {
  box-shadow: none !important;
}

body.lobby-layout-mobile .lobby-mobile-tile--teal {
  --tile-border: #37b0a7;
  --tile-border-dark: #24837c;
}

body.lobby-layout-mobile .lobby-mobile-tile--gold {
  --tile-border: #dfa128;
  --tile-border-dark: #ac7712;
}

body.lobby-layout-mobile .lobby-mobile-tile-badge {
  position: absolute;
  top: -9px;
  right: -6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 2px solid #5c4030;
  background: linear-gradient(180deg, #ff9059, #e0452e);
  color: #fff !important;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 3;
}

body.lobby-layout-mobile .lobby-mobile-tile:hover {
  filter: brightness(1.03);
}

body.lobby-layout-mobile .lobby-mobile-tile:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 0 0 3px rgba(255, 252, 240, 0.92),
    inset 0 2px 5px rgba(90, 65, 30, 0.18),
    0 2px 5px rgba(25, 45, 12, 0.26) !important;
}

body.lobby-layout-mobile .lobby-mobile-tile:disabled {
  opacity: 0.45;
  filter: grayscale(0.25);
  cursor: not-allowed;
  transform: none;
}

body.lobby-layout-mobile .lobby-mobile-tile-icon {
  position: absolute;
  left: 50%;
  top: -30px;
  transform: translateX(-50%);
  width: 90px;
  height: 90px;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.28));
}

body.lobby-layout-mobile .lobby-mobile-tile-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.15em;
  line-height: 1.05;
  text-align: center;
}

/* Compact Game Center under the grid */
body.lobby-layout-mobile .lobby-mobile-extras {
  display: flex;
  justify-content: center;
  margin-top: 2px;
}

body.lobby-layout-mobile .lobby-mobile-gamecenter-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 14px;
  border: 0 !important;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22) !important;
  color: #fff !important;
  font-family: "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  box-shadow: none !important;
}

body.lobby-layout-mobile .lobby-mobile-gamecenter-link:active {
  filter: brightness(1.08);
}

body.lobby-layout-mobile .lobby-mobile-gamecenter-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* Login with Apple / Email */
body.lobby-layout-mobile .lobby-mobile-social {
  margin-top: 2px;
  padding-top: 0;
  text-align: center;
}

body.lobby-layout-mobile .lobby-mobile-social-label {
  margin: 0 0 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

body.lobby-layout-mobile .lobby-mobile-social-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

body.lobby-layout-mobile .lobby-mobile-social-btn {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
  padding: 0;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--apple {
  /* Official Sign in with Apple logo-only: black fill, Apple logo artwork only. */
  background: #000;
  color: #fff;
  overflow: hidden;
  /* Match sibling social buttons; Apple allows matching UI corner radius. */
  border-radius: 12px;
  box-shadow: none;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--apple-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  padding: 6px;
  box-sizing: border-box;
  pointer-events: none;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--apple:hover,
body.lobby-layout-mobile .lobby-mobile-social-btn--apple:focus-visible {
  opacity: 0.92;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--apple:active {
  opacity: 0.82;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--apple:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--email {
  background: linear-gradient(180deg, #7db33a, #2f5d16);
  color: #fff;
  border: 1px solid #24470f;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--email i {
  font-size: 22px;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--facebook {
  /* Official Facebook logo mark (complete circle + “f”). Meta: don’t use the
     bare “f” alone; logo must be complete and unaltered. */
  background: transparent;
  color: #1877f2;
  overflow: visible;
  border-radius: 0;
  box-shadow: none;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--facebook-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--facebook:hover,
body.lobby-layout-mobile .lobby-mobile-social-btn--facebook:focus-visible {
  opacity: 0.92;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--facebook:active {
  opacity: 0.82;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--facebook:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--google {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #747775;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--google img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

body.lobby-layout-mobile .lobby-mobile-social-btn--google i {
  font-size: 20px;
  color: #4285f4;
}

.lobby-login-providers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
  align-items: stretch;
}

.lobby-login-title {
  grid-column: 1 / -1;
  margin: 0 0 2px;
  font-size: 1.15rem;
  color: #2a3914;
  text-align: center;
}

.lobby-login-providers > button {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  height: auto;
  border-radius: 12px !important;
  padding: 10px 8px;
  font-size: 17px !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.lobby-login-providers .sign-in-with-apple-btn__inner,
.lobby-login-providers .sign-in-with-google-btn__inner {
  gap: 6px;
}

.lobby-login-providers .sign-in-with-apple-btn__text,
.lobby-login-providers .sign-in-with-google-btn__text,
.lobby-login-providers .btn-facebook-label,
.lobby-login-providers .lobby-provider-btn span {
  white-space: normal;
  line-height: 1.2;
  text-align: center;
  font-size: inherit;
  font-weight: inherit;
}

.lobby-provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid rgba(42, 57, 20, 0.25);
  font-weight: 700;
  cursor: pointer;
}

.lobby-provider-btn--email {
  background: linear-gradient(180deg, #7db33a, #2f5d16);
  color: #fff;
  border-color: #24470f;
}

.lobby-provider-btn--google {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #747775;
  border-radius: 4px;
  font-weight: 500;
  box-shadow: none;
}

.lobby-provider-btn--google:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

.lobby-provider-btn--google img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.lobby-provider-btn--google i {
  color: #4285f4;
}

.lobby-login-back-inline {
  width: 100%;
  margin-top: 10px;
}

.lobby-login-resend-wrap {
  margin: 12px 0 0;
  text-align: center;
}

.lobby-login-resend {
  display: inline;
  margin: 0;
  padding: 0;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--green-dark, #2e5b16) !important;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.lobby-login-otp-hint {
  margin: 0 0 12px;
  color: #3a4a22;
}

#loginOtp {
  letter-spacing: 0.35em;
  font-size: 1.25rem;
  text-align: center;
  font-weight: 700;
}

body.lobby-layout-mobile .lobby-mobile-login .sign-in-with-apple-btn,
body.lobby-layout-mobile .lobby-mobile-login .btn-facebook,
body.lobby-layout-mobile .lobby-mobile-login .sign-in-with-google-btn,
body.lobby-layout-mobile .lobby-mobile-login .lobby-provider-btn {
  width: 100%;
}

body.lobby-layout-mobile .lobby-mobile-social-btn:active {
  transform: translateY(1px);
  filter: brightness(0.96);
}

body.lobby-layout-mobile .lobby-mobile-leaderboard {
  display: none !important;
}

body.lobby-layout-mobile .lobby-mobile-edit-profile .field,
body.lobby-layout-mobile .lobby-mobile-login .field,
body.lobby-layout-mobile .lobby-mobile-register .field,
body.lobby-layout-mobile .lobby-mobile-reset .field {
  margin-bottom: 12px;
}

body.lobby-layout-mobile .lobby-mobile-login,
body.lobby-layout-mobile .lobby-mobile-register,
body.lobby-layout-mobile .lobby-mobile-reset,
body.lobby-layout-mobile .lobby-mobile-edit-profile {
  padding: 14px;
  background: linear-gradient(180deg, rgba(251, 247, 232, 0.96), rgba(235, 218, 179, 0.96));
  border: 1px solid rgba(179, 173, 132, 0.85);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(42, 57, 20, 0.22);
}

body.lobby-layout-mobile .lobby-mobile-login-apple {
  margin-top: 16px;
}

body.lobby-layout-mobile .lobby-mobile-login-apple .lobby-or {
  margin: 0 0 12px;
}

body.lobby-layout-mobile .lobby-mobile-login-apple .sign-in-with-apple-btn {
  width: 100%;
}

body.lobby-layout-mobile .lobby-mobile .site-footer {
  margin-top: 2px;
  padding-top: 4px;
  font-size: 11px;
  opacity: 0.88;
}

body.lobby-layout-mobile .lobby-mobile .site-footer-privacy,
body.lobby-layout-mobile .lobby-mobile .site-footer-credit a {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  body.lobby-layout-mobile .lobby-mobile-logo-wrap::before,
  body.lobby-layout-mobile .lobby-mobile-online-dot,
  body.lobby-layout-mobile .lobby-mobile-play-shine::before {
    animation: none;
  }
}

/* Stats: no paper card background — tiles float on bamboo */
body.lobby-layout-mobile.player-stats-page .stats-card.card,
body.lobby-layout-mobile .stats-card.card {
  background: transparent;
  background-image: none;
  border: 0;
  box-shadow: none;
  margin: 12px auto;
  padding: 12px 14px 20px;
  max-width: none;
}

body.lobby-layout-mobile.player-stats-page .player-stats-head h1,
body.lobby-layout-mobile .stats-card .player-stats-head h1,
body.lobby-layout-mobile .stats-card .card-account-label {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

body.lobby-layout-mobile.player-stats-page .player-stats-member-since,
body.lobby-layout-mobile .stats-card .player-stats-member-since {
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

body.lobby-layout-mobile .player-stat-tile {
  background: #fffef6;
}

body.lobby-layout-mobile .player-stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.lobby-layout-mobile .player-stat-body {
  background: #fffef6;
}

body.lobby-layout-mobile .player-stat-value {
  text-shadow: none;
}

body.lobby-layout-mobile .player-stat-sub {
  color: #7a8068;
}

body.lobby-layout-mobile .player-stats-section-title {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Inside phone shell: fill frame; bg comes from .phone-shell-viewport */
body.phone-shell-preview.lobby-layout-mobile {
  background: transparent !important;
  background-image: none !important;
  overflow: hidden !important;
}

body.phone-shell-preview.lobby-layout-mobile .lobby-mobile {
  height: auto;
  min-height: 100%;
}

body.phone-shell-preview.lobby-layout-mobile #rpsAppRoot {
  height: 100%;
}

body.phone-shell-preview.lobby-layout-mobile .lobby-mobile-topbar {
  margin-top: 6px;
  margin-right: max(12px, var(--safe-right, env(safe-area-inset-right, 0px)));
  margin-left: max(12px, var(--safe-left, env(safe-area-inset-left, 0px)));
}

body.phone-shell-preview.lobby-layout-mobile .lobby-mobile-bottom-nav {
  padding-bottom: max(8px, calc(var(--safe-bottom, env(safe-area-inset-bottom, 0px)) + var(--admob-banner-offset, 0px)));
  padding-right: max(6px, var(--safe-right, env(safe-area-inset-right, 0px)));
  padding-left: max(6px, var(--safe-left, env(safe-area-inset-left, 0px)));
}

body.phone-shell-preview.lobby-layout-mobile .lobby-mobile-scroll {
  padding-top: 12px;
  padding-right: max(14px, var(--safe-right, env(safe-area-inset-right, 0px)));
  padding-bottom: 12px;
  padding-left: max(14px, var(--safe-left, env(safe-area-inset-left, 0px)));
}

/* iOS welcome / guest welcome modals */
#welcomeNameModal .welcome-name-panel,
#guestWelcomeModal .guest-welcome-panel {
  max-width: 360px;
  width: min(92vw, 360px);
}

#welcomeNameModal .welcome-name-lead,
#guestWelcomeModal .guest-welcome-text {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.35;
}

#guestWelcomeModal .guest-welcome-hint {
  margin: -6px 0 14px;
  text-align: center;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.35;
}

#welcomeNameModal .welcome-name-link-label {
  margin: 16px 0 8px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
}

#welcomeNameModal .welcome-name-account-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#welcomeNameModal .welcome-name-account-btns .lobby-btn,
#welcomeNameModal .welcome-name-account-btns .lobby-provider-btn,
#welcomeNameModal .sign-in-with-apple-btn,
#guestWelcomeModal .sign-in-with-apple-btn,
#guestWelcomeModal .lobby-provider-btn,
#guestWelcomeModal #guestWelcomeContinueBtn {
  width: 100%;
  justify-content: center;
}

#welcomeNameModal .welcome-name-account-btns .lobby-provider-btn,
#guestWelcomeModal .lobby-provider-btn {
  pointer-events: auto;
  position: relative;
  z-index: 2;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#welcomeNameModal .welcome-name-account-btns .lobby-outline-btn {
  color: #55692c;
  background: linear-gradient(180deg, #fbf7e8 0%, #f4f0da 52%, #ebdab3 100%);
  border: 1px solid #b3ad84;
  text-shadow: none;
  -webkit-text-stroke: 0;
}

#welcomeNameModal .welcome-name-view.hidden {
  display: none;
}

#welcomeNameModal .msg,
#welcomeNameLoginView .msg,
#welcomeNameRegisterView .msg {
  margin-top: 10px;
}

