/* P11 — Global Product Experience Reboot: lobby + HUD + settings foundation. */

:root {
  --p11-ink: #160a25;
  --p11-panel: rgba(20, 9, 39, 0.82);
  --p11-panel-soft: rgba(35, 15, 55, 0.62);
  --p11-line: rgba(255, 255, 255, 0.14);
  --p11-text: #fff8f1;
  --p11-muted: rgba(255, 255, 255, 0.62);
  --p11-gold: #ffd95a;
  --p11-orange: #ff9b3d;
  --p11-violet: #b98aff;
  --p11-mint: #8fffd1;
}

/* -------- gameplay HUD: only information required during a run -------- */
#hud {
  align-items: flex-start;
}

#hud .score-pill {
  min-width: 110px;
}

#hud .coin-pill {
  min-width: 70px;
}

#hud .hud-actions {
  margin-left: auto;
}

#hud #pauseBtn {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  font-size: 16px;
}

/* -------- immersive lobby -------- */
#menu.p11-lobby {
  display: block;
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 188, 100, 0.16), transparent 24%),
    linear-gradient(180deg, rgba(12, 5, 27, 0.18), rgba(11, 4, 22, 0.82));
}

#menu.p11-lobby::before {
  background:
    radial-gradient(circle at 50% 18%, rgba(232, 137, 255, 0.12), transparent 28%),
    linear-gradient(180deg, transparent 50%, rgba(10, 4, 20, 0.64));
}

.p11-lobby-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding:
    max(14px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  pointer-events: none;
}

.p11-lobby-shell button,
.p11-lobby-shell .p11-top-stat,
.p11-lobby-shell .wallet-pill {
  pointer-events: auto;
}

.p11-topbar {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.p11-top-stat,
.p11-lobby-wallet {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  padding: 8px 14px;
  border: 1px solid var(--p11-line);
  border-radius: 16px;
  background: rgba(18, 7, 31, 0.58);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.p11-top-stat {
  justify-self: start;
}

.p11-top-stat span {
  color: rgba(255, 255, 255, 0.46);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.8px;
}

.p11-top-stat strong {
  color: var(--p11-gold);
  font-size: 20px;
  line-height: 1;
}

.p11-mini-brand {
  justify-self: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.p11-top-actions {
  justify-self: end;
  display: flex;
  gap: 8px;
  align-items: center;
}

.p11-lobby-wallet {
  color: var(--p11-gold);
  font-weight: 800;
  font-size: 18px;
}

.p11-icon-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--p11-line);
  border-radius: 16px;
  background: rgba(18, 7, 31, 0.58);
  color: #fff;
  font: 800 20px/1 "Baloo 2", sans-serif;
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease;
}

.p11-icon-button:active {
  transform: scale(0.92);
}

.p11-hero-stage {
  position: relative;
  z-index: 2;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(300px, 0.72fr);
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 4vw, 64px);
  width: min(1080px, 100%);
  margin: 0 auto;
}

.p11-character-stage {
  position: relative;
  min-height: min(68vh, 680px);
  display: grid;
  place-items: end center;
  isolation: isolate;
}

.p11-character-stage::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7%;
  width: min(430px, 80%);
  aspect-ratio: 1.65;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 201, 110, 0.28), rgba(174, 98, 255, 0.10) 48%, transparent 72%);
  filter: blur(4px);
  z-index: -2;
}

.p11-character-stage::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7%;
  width: min(330px, 66%);
  height: 42px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(5, 2, 12, 0.48);
  filter: blur(8px);
  z-index: -1;
}

.p11-hero-avatar {
  display: block;
  max-width: min(430px, 76vw);
  max-height: min(69vh, 690px);
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 28px 28px rgba(0, 0, 0, 0.38));
  animation: p11HeroIdle 3.2s ease-in-out infinite;
  user-select: none;
  pointer-events: none;
}

@keyframes p11HeroIdle {
  0%, 100% { transform: translateY(0) rotate(-0.6deg); }
  50% { transform: translateY(-8px) rotate(0.8deg); }
}

.p11-hero-badge {
  position: absolute;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(16, 7, 29, 0.72);
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.1px;
  text-transform: uppercase;
  backdrop-filter: blur(9px);
}

.p11-hero-copy {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  pointer-events: auto;
}

.p11-hero-copy .logo {
  font-size: clamp(58px, 8vw, 104px);
  line-height: 0.82;
  text-align: left;
}

.p11-hero-copy .tagline {
  margin-top: 2px;
  font-size: clamp(11px, 1.5vw, 14px);
}

.p11-objective-chip {
  width: min(100%, 390px);
  display: grid;
  gap: 2px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 15px;
  background: rgba(21, 8, 39, 0.54);
  backdrop-filter: blur(10px);
}

.p11-objective-chip span {
  color: var(--p11-mint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}

.p11-objective-chip strong {
  color: #fff;
  font-size: 14px;
  line-height: 1.25;
}

#startBtn.p11-play-btn {
  min-width: min(330px, 82vw);
  min-height: 68px;
  padding: 15px 48px;
  font-size: 26px;
  box-shadow:
    0 7px 0 #a95010,
    0 18px 38px rgba(255, 139, 45, 0.38),
    0 0 55px rgba(255, 211, 84, 0.14);
}

.p11-daily-btn {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 222, 111, 0.28);
  border-radius: 13px;
  background: rgba(70, 46, 22, 0.58);
  color: #ffe783;
  font: 800 12px/1 "Baloo 2", sans-serif;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.p11-daily-btn:disabled {
  opacity: 0.64;
  cursor: default;
}

.p11-bottom-nav {
  position: relative;
  z-index: 7;
  justify-self: center;
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--p11-line);
  border-radius: 22px;
  background: rgba(14, 6, 27, 0.68);
  backdrop-filter: blur(15px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
}

.p11-nav-btn {
  min-height: 58px;
  display: grid;
  place-items: center;
  gap: 2px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font: 800 10px/1.1 "Baloo 2", sans-serif;
  letter-spacing: 0.9px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.1s ease;
}

.p11-nav-btn::before {
  content: attr(data-icon);
  color: #fff;
  font-size: 21px;
  line-height: 1;
  letter-spacing: 0;
}

.p11-nav-btn:hover,
.p11-nav-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.p11-nav-btn:active {
  transform: scale(0.95);
}

#cosmeticBtn.p11-nav-btn {
  padding: 0 6px;
  white-space: normal;
}

/* -------- progress sheet -------- */
.p11-sheet {
  position: absolute;
  z-index: 36;
  left: 50%;
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + 78px);
  width: min(560px, calc(100vw - 28px));
  max-height: min(62vh, 560px);
  transform: translateX(-50%);
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background: rgba(18, 8, 34, 0.94);
  backdrop-filter: blur(18px);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.56);
  pointer-events: auto;
  animation: p11SheetIn 0.2s ease-out;
}

@keyframes p11SheetIn {
  from { opacity: 0; transform: translate(-50%, 14px) scale(0.98); }
}

.p11-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.p11-sheet-head h2 {
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.p11-sheet-close {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

.p11-sheet-section {
  display: grid;
  gap: 9px;
}

.p11-sheet-section + .p11-sheet-section {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.p11-sheet-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.p11-achievement-summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.7);
}

.p11-achievement-summary strong {
  color: var(--p11-violet);
  font-size: 20px;
}

/* -------- settings -------- */
#settingsOverlay {
  z-index: 42;
}

.p11-settings-panel {
  width: min(420px, calc(100vw - 28px));
  align-items: stretch;
  text-align: left;
}

.p11-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.p11-settings-head h2 {
  color: #fff;
  font-size: 30px;
}

.p11-setting-row {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.p11-setting-copy {
  display: grid;
  gap: 2px;
}

.p11-setting-copy strong {
  color: #fff;
  font-size: 14px;
}

.p11-setting-copy span {
  color: rgba(255, 255, 255, 0.47);
  font-size: 11px;
}

.p11-setting-action {
  min-width: 48px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font: 800 13px/1 "Baloo 2", sans-serif;
  cursor: pointer;
}

#settingsOverlay #audioBtn {
  margin-left: 0;
  width: 48px;
  height: 44px;
  border-radius: 12px;
}

#settingsOverlay #privacyBtn {
  min-height: 44px;
  border-radius: 12px;
}

/* -------- responsive -------- */
@media (max-width: 760px) {
  .p11-topbar {
    grid-template-columns: auto 1fr auto;
  }

  .p11-mini-brand {
    display: none;
  }

  .p11-hero-stage {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0;
    padding-top: 4px;
    padding-bottom: 10px;
  }

  .p11-character-stage {
    min-height: 0;
    height: min(49vh, 480px);
  }

  .p11-hero-avatar {
    max-height: min(48vh, 470px);
    max-width: min(78vw, 360px);
  }

  .p11-hero-copy {
    align-items: center;
    text-align: center;
    gap: 9px;
  }

  .p11-hero-copy .logo {
    font-size: clamp(47px, 13vw, 76px);
    text-align: center;
  }

  .p11-hero-copy .tagline {
    display: none;
  }

  .p11-objective-chip {
    width: min(88vw, 390px);
    text-align: left;
  }

  #startBtn.p11-play-btn {
    min-height: 62px;
    font-size: 23px;
  }

  .p11-bottom-nav {
    gap: 4px;
    padding: 6px;
  }

  .p11-nav-btn {
    min-height: 54px;
    font-size: 9px;
  }

  .p11-nav-btn::before {
    font-size: 19px;
  }
}

@media (max-width: 430px) {
  .p11-top-stat,
  .p11-lobby-wallet {
    min-height: 44px;
    padding: 7px 10px;
    border-radius: 14px;
  }

  .p11-top-stat span {
    display: none;
  }

  .p11-icon-button {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .p11-character-stage {
    height: min(43vh, 410px);
  }

  .p11-hero-avatar {
    max-height: min(43vh, 405px);
  }

  .p11-hero-badge {
    bottom: 1%;
  }
}

@media (max-height: 690px) and (orientation: landscape) {
  .p11-hero-stage {
    grid-template-columns: 0.9fr 0.72fr;
    grid-template-rows: 1fr;
  }

  .p11-character-stage {
    height: 64vh;
    min-height: 0;
  }

  .p11-hero-avatar {
    max-height: 61vh;
  }

  .p11-hero-copy .logo {
    font-size: clamp(46px, 7vw, 72px);
  }

  .p11-objective-chip {
    display: none;
  }

  #startBtn.p11-play-btn {
    min-height: 56px;
    font-size: 21px;
  }

  .p11-bottom-nav {
    width: min(620px, 78vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  .p11-hero-avatar,
  .p11-sheet {
    animation: none !important;
  }
}
