/* The app shares the site's wallet controls and original booster renderer. */
body.app-shell {
  background: #05030d;
  color: #fff;
  --app-sidebar: 220px;
  margin: 0;
  overflow-x: clip;
}
.app-shell .mk-header {
  background: #05030d;
  border: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-shell .mk-header-row {
  display: flex;
  max-width: none;
  height: 100px;
  padding: 16px 28px;
  gap: 20px;
}
.app-shell .mk-brand {
  width: 164px;
  flex: 0 0 164px;
}
.app-shell .mk-header-row > nav,
.app-shell .mk-menu {
  display: none;
}
.app-shell .mk-wallet {
  margin-left: auto;
}
.app-shell .mk-moderator-tools {
  display: none;
}
.app-shell .mk-wallet button {
  white-space: nowrap;
}
.app-sidebar {
  position: fixed;
  top: 112px;
  left: 20px;
  bottom: 24px;
  width: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.app-sidebar nav {
  scrollbar-width: none;
  display: grid;
  gap: 12px;
}
.app-sidebar a {
  color: #c3b5d5;
  text-decoration: none;
  font-weight: 800;
  font-size: 17px;
  padding: 20px 16px;
  border: 1px solid transparent;
  border-radius: 18px;
}
.app-sidebar a:hover,
.app-sidebar a[aria-current] {
  background: #26123f;
  color: #fff;
  border-color: #7543a8;
}
.app-sidebar a.app-create {
  color: #160c29;
  background: #ffba00;
  text-align: center;
  margin-top: 24px;
  padding: 19px 10px;
}
.app-sidebar p {
  color: #887799;
  font-size: 12px;
  padding: 16px;
}
.app-hits {
  position: absolute;
  z-index: 21;
  left: calc(var(--app-sidebar) + 20px);
  right: 245px;
  top: 18px;
  height: 64px;
  border: 1px solid #41215c;
  border-radius: 18px;
  background: #10091d;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.app-hits > strong {
  padding: 0 20px;
  font-size: 12px;
  color: #af94cb;
  flex-shrink: 0;
}
.hits-window {
  min-width: 0;
  overflow: hidden;
  flex: 1;
}
#hits-track {
  display: flex;
  width: max-content;
}
.hits-empty {
  font-size: 13px;
  color: #bfb0ce;
  padding: 20px;
}
/* 3s per card (about 95px/s: 250px plus padding), whatever the number of hits; set by client/recent-hits.mjs. */
#hits-track.has-hits {
  animation: app-ticker calc(var(--hits-count, 15) * 3s) linear infinite;
}
.hits-group {
  display: flex;
}
.hit-item {
  width: 250px;
  display: flex;
  gap: 12px;
  padding: 5px 18px;
  color: white;
  text-decoration: none;
}
.hit-item img {
  width: 34px;
  height: 49px;
  object-fit: contain;
}
.hit-item div {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 4px;
}
.hit-item strong {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hit-item span {
  color: #ffba00;
  font-weight: 800;
  font-size: 13px;
}
.app-hits:hover #hits-track,
.app-hits:focus-within #hits-track,
.app-motion-paused #hits-track {
  animation-play-state: paused;
}
@keyframes app-ticker {
  to {
    transform: translateX(-50%);
  }
}
.app-main {
  margin-left: var(--app-sidebar);
  padding: 10px 28px 30px 20px;
  min-width: 0;
}
.app-main h1,
:is(.app-profile, .app-leaderboard) .rewards-main h1,
.community-create > h1 {
  font-size: clamp(26px, 2.6vw, 48px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.045em;
  margin: 10px 0 20px;
}
.app-main h1 span,
:is(.app-profile, .app-leaderboard) .rewards-main h1 span,
.community-create > h1 span {
  color: #ffba00;
}
.app-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.app-toolbar h2 {
  font-size: 14px;
  font-weight: 600;
  color: #af9abc;
  margin: 0;
}
.app-toolbar > div {
  display: flex;
  gap: 8px;
}
.app-toolbar button {
  background: #160d25;
  border: 1px solid #41215c;
  color: #cdbbdf;
  border-radius: 9px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.app-toolbar #previous-pool,
.app-toolbar #next-pool {
  font-size: 20px;
  padding: 1px 12px;
}
#app-feedback:empty {
  display: none;
}
#app-feedback {
  font-size: 13px;
  color: #cdbbdf;
}
.app-pools {
  touch-action: pan-x pinch-zoom;
  display: flex;
  gap: 24px;
  overflow-x: auto;
  padding-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: #5a3378 #10091d;
}
.app-pools[hidden],
#krew-panel[hidden] {
  display: none;
}
.app-pool {
  flex: 0 0 clamp(285px, 28vw, 420px);
  min-width: 0;
  border: 1px solid #48245f;
  border-radius: 24px;
  background: linear-gradient(160deg, #11091e, #10091b);
  padding: 20px;
  overflow: hidden;
}
.app-pool-art {
  height: clamp(300px, 44vh, 540px);
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}
.app-pool-art mimikrew-booster {
  max-width: 280px;
}
.app-pack-count {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid #8251ac;
  border-radius: 24px;
  padding: 5px 16px;
  background: #170d26;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}
.app-pool-status {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 20px;
  background: #26123f;
  padding: 5px 12px;
  font-size: 11px;
}
.app-pool-body h2 {
  margin: 0 0 14px;
  font-size: 21px;
  letter-spacing: -0.025em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-pool-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #b8a4cd;
  margin-bottom: 25px;
}
.app-odds {
  color: #ffba00;
  background: #ffba0010;
  border: 1px solid #ffba0033;
  border-radius: 20px;
  padding: 5px 10px;
  text-decoration: none;
  white-space: nowrap;
}
.app-pool-totals {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 13px;
}
.app-pool-totals > span {
  color: #a58abc;
  font-size: 12px;
}
.app-progress {
  display: block;
  width: 100%;
  height: 7px;
  border: 0;
  border-radius: 10px;
  background: #030108;
  margin: 12px 0 16px;
  overflow: hidden;
}
.app-progress::-webkit-progress-bar {
  background: #030108;
  border-radius: 10px;
}
.app-progress::-webkit-progress-value {
  background: #ffba00;
  border-radius: 10px;
}
.app-progress::-moz-progress-bar {
  background: #ffba00;
  border-radius: 10px;
}
.app-join {
  display: block;
  text-align: center;
  border-radius: 13px;
  background: #ffba00;
  color: #150a26;
  text-decoration: none;
  padding: 16px;
  font-size: 16px;
  font-weight: 800;
}
.app-join:hover,
.app-create:hover {
  filter: brightness(1.07);
}
.app-footnote {
  color: #9e87b1;
  font-size: 11px;
  max-width: 760px;
  line-height: 1.6;
  margin: 12px 0 0;
}
.app-empty {
  padding: 40px;
  background: #10091b;
  border: 1px solid #48245f;
  border-radius: 20px;
  color: #c7b6d7;
  width: 100%;
}
.app-shell :focus-visible {
  outline: 2px solid #ffba00;
  outline-offset: 4px;
}
@media (max-width: 1099px) {
  body.app-shell {
    --app-sidebar: 180px;
  }
  .app-sidebar {
    width: 150px;
    left: 12px;
  }
  .app-sidebar a {
    font-size: 14px;
    padding: 18px 10px;
  }
  .app-hits {
    right: 210px;
  }
  .app-hits > strong {
    padding: 0 12px;
  }
  .app-shell .mk-brand {
    width: 140px;
    flex-basis: 140px;
  }
}
@media (max-width: 1099px) {
  body.app-shell {
    --app-sidebar: 0px;
  }
  .app-shell .mk-header-row {
    display: flex;
    height: 76px;
    padding: 10px 16px;
  }
  .app-shell .mk-brand {
    width: 128px;
    flex-basis: 128px;
  }
  .app-hits {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    margin: 4px 16px 18px;
    height: 58px;
  }
  .app-sidebar {
    position: relative;
    inset: auto;
    width: auto;
    margin: 0 16px 14px;
  }
  .app-sidebar nav {
    scrollbar-width: none;
    display: flex;
    overflow-x: auto;
    gap: 6px;
  }
  .app-sidebar a {
    white-space: nowrap;
    padding: 12px;
    font-size: 12px;
    border-radius: 12px;
  }
  .app-sidebar a.app-create {
    margin: 0;
    padding: 12px;
  }
  .app-sidebar p {
    display: none;
  }
  .app-main {
    margin: 0;
    padding: 0 16px 25px;
  }
  .app-main h1 {
    font-size: 30px;
    max-width: 480px;
  }
  .app-pool {
    flex-basis: 82vw;
    padding: 18px;
  }
  .app-pool-art {
    height: 300px;
  }
  .app-pool-meta {
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #hits-track.has-hits {
    animation: none;
  }
}
/* Shared App 1 chrome; page-specific forms and tables keep their existing behavior. */
.app-shell .app-content:not(.app-main) {
  box-sizing: border-box;
  width: auto;
  max-width: none;
  margin: 0 28px 40px calc(var(--app-sidebar) + 20px);
  padding-top: 20px;
}
.app-shell > .site-footer {
  display: none;
}
.app-sidebar svg {
  width: 25px;
  height: 25px;
  flex-shrink: 0;
}
.app-sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-sidebar a.app-create {
  order: 5;
  justify-content: center;
}
.app-sidebar a[data-app-view="leaderboard"] {
  order: 3;
}
.app-sidebar a[data-app-view="referral"] {
  order: 4;
}
.app-sidebar a[data-app-view="public"] {
  order: 1;
}
.app-sidebar a[data-app-view="krew"] {
  order: 2;
}
@media (max-width: 1099px) {
  body.app-shell {
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  }
  .app-shell .app-content:not(.app-main) {
    margin: 0 16px 24px;
    width: auto;
    padding-top: 16px;
  }
  .app-sidebar {
    position: fixed;
    z-index: 100;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    background: #10091c;
    border-top: 1px solid #53316b;
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }
  .app-sidebar nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    overflow: visible;
  }
  .app-sidebar nav a {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 10px 1px;
    font-size: clamp(9px, 2.65vw, 14px);
    line-height: 1.2;
    letter-spacing: -0.025em;
    border-radius: 16px;
    font-weight: 700;
    min-width: 0;
    margin: 0;
  }
  .app-sidebar nav a.app-create {
    order: 3;
    background: transparent;
    color: #ffba00;
  }
  .app-sidebar a[data-app-view="leaderboard"] {
    order: 4;
  }
  .app-sidebar a[data-app-view="referral"] {
    order: 5;
  }
  .app-sidebar nav a[aria-current="page"] {
    color: #ffba00;
    background: #28133e;
    border: 1px solid #8650b5;
  }
  .app-sidebar svg {
    width: 27px;
    height: 27px;
  }
  .app-shell .app-hits {
    margin-top: 4px;
  }
  .app-shell main {
    scroll-margin-bottom: 110px;
  }
  .app-shell #referrals-section {
    scroll-margin-top: 16px;
  }
}
/* Compact directory cards: 3.5 cards across the available desktop rail. */
.app-pools {
  scrollbar-width: none;
}
.app-pools::-webkit-scrollbar {
  display: none;
}
a.app-pool {
  box-sizing: border-box;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  flex-basis: calc((100% - 72px) / 3.5);
}
a.app-pool .booster-stage {
  cursor: pointer;
  touch-action: pan-x pinch-zoom;
}
.app-pool-meta {
  flex-wrap: wrap;
}
@media (min-width: 1100px) {
  .app-sidebar svg {
    display: none;
  }
}
@media (max-width: 1099px) {
  a.app-pool {
    flex-basis: 82vw;
  }
}
/* The directory is a viewport-sized game lobby, not a vertically scrolling document. */
html:has(body.app-directory) {
  height: 100%;
  overflow: hidden;
}
body.app-directory {
  height: 100dvh;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.app-directory > .mk-header {
  flex: 0 0 auto;
}
.app-directory .app-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 16px;
}
.app-directory .app-main h1 {
  flex-shrink: 0;
}
.app-directory .app-pools {
  flex: 1;
  min-height: 0;
  overflow-y: hidden;
  padding-bottom: 0;
  overscroll-behavior: none;
}
.app-directory .app-pool {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
}
.app-directory .app-pool-art {
  flex: 1;
  min-height: 0;
  height: auto;
  margin-bottom: 22px;
}
.app-directory .app-pool-art mimikrew-booster {
  min-height: 0;
}
.app-directory .app-pool-body {
  flex: 0 0 auto;
}
.app-directory .app-pool-body h2 {
  margin-bottom: 10px;
  font-size: clamp(16px, 1.5vw, 21px);
}
.app-directory .app-pool-meta {
  margin-bottom: 16px;
}
.app-directory .app-progress {
  margin: 10px 0 12px;
}
.app-directory .app-join {
  padding: 12px;
}
@media (max-width: 1099px) {
  .app-directory .app-hits {
    flex: 0 0 52px;
    margin-bottom: 8px;
  }
  .app-directory .app-main {
    padding-bottom: 8px;
  }
  .app-directory .app-main h1 {
    font-size: clamp(22px, 6vw, 30px);
    margin: 4px 0 12px;
  }
  .app-directory .app-pool {
    padding: 14px;
  }
  .app-directory .app-pool-meta {
    margin-bottom: 10px;
  }
}
@media (max-height: 650px) {
  .app-directory .mk-header-row {
    height: 70px;
  }
  .app-directory .app-main h1 {
    margin: 0 0 10px;
    font-size: 25px;
  }
  .app-directory .app-pool-body h2 {
    margin-bottom: 6px;
  }
  .app-directory .app-pool-meta {
    margin-bottom: 6px;
  }
  .app-directory .app-join {
    padding: 8px;
  }
}

/* Funded leaders: a quiet gold seal, shared by every carousel copy. */
.app-pool.app-pool-hot {
  border-color: #a77b24;
  box-shadow: inset 0 0 18px #ffbd0009;
}
.app-hot-badge {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid #b4852f;
  border-radius: 12px 4px 12px 4px;
  background: #21102f;
  color: #ffbd00;
  box-shadow: 0 0 18px #ffbd001c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  pointer-events: none;
}
.app-hot-badge svg {
  width: 17px;
  height: 20px;
  fill: currentColor;
}

/* Profile heading follows the directory's type scale and vertical rhythm. */
.app-shell:is(.app-profile, .app-leaderboard) .app-content,
.app-shell .community-create.app-content {
  padding-top: 10px;
}
.app-profile #profile-content > .profile-summary {
  margin-top: 0;
}
@media (max-width: 1099px) {
  .app-shell:is(.app-profile, .app-leaderboard) .app-content,
  .app-shell .community-create.app-content {
    padding-top: 0;
  }
  :is(.app-profile, .app-leaderboard) .rewards-main h1,
  .community-create > h1 {
    font-size: clamp(22px, 6vw, 30px);
    line-height: 1.25;
    margin: 4px 0 12px;
  }
}
@media (max-height: 650px) {
  :is(.app-profile, .app-leaderboard) .mk-header-row {
    height: 70px;
  }
  :is(.app-profile, .app-leaderboard) .rewards-main h1,
  .community-create > h1 {
    margin: 0 0 10px;
    font-size: 25px;
  }
}

.app-leaderboard .rewards-main > .rewards-rules {
  padding: 0;
}

.app-pool-badges {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
}
.app-pool-badges span {
  border: 1px solid #8251ac;
  border-radius: 8px;
  padding: 4px 8px;
  background: #26123f;
  color: white;
  font-size: 10px;
  font-weight: 800;
}
.app-pool-badges .app-demo-tag {
  color: #cdb9df;
  font-size: 9px;
}
.app-official-cover {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  border-radius: 16px;
}
.app-opening-countdown {
  display: block;
  color: #ffba00;
  font-size: 12px;
  margin: 0 0 8px;
}

/* Fractional scroll compensation preserves smooth motion on integer-scroll browsers. */
:is(.app-pools, .lobby-packs, .lobby-hit-rail) > * {
  translate: var(--carousel-fraction, 0px) 0;
}

:is(.app-pools, .lobby-packs) .booster-stage {
  touch-action: pan-x pinch-zoom;
}
@media (min-width: 1100px) {
  .app-sidebar nav a.app-create {
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: var(--color-accent);
    box-shadow: 0 5px 0 var(--color-accent-shadow);
  }
}
