/* Shared responsive guardrails for app1-app10. Branding, colours and icons stay app-specific. */
html,
body,
#root {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

:where(.mobile-shell, .auth-shell),
:where(.mobile-shell, .auth-shell) * {
  box-sizing: border-box;
}

:where(.mobile-shell, .auth-shell) :where(
  .page-shell,
  .market-grid,
  .page-market-grid,
  .list-stack,
  .hub-stack,
  .utility-grid,
  .mini-stat-grid,
  .page-form,
  .info-card,
  .wallet-hero
) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

:where(.mobile-shell, .auth-shell) :where(
  .market-card,
  .list-card,
  .hub-link,
  .game-pick-card,
  .info-card,
  .wallet-hero,
  .page-form,
  .auth-card
) {
  max-width: 100%;
  min-width: 0;
}

:where(.mobile-shell, .auth-shell) :where(
  .market-card,
  .list-card,
  .hub-link,
  .game-pick-card,
  .info-card,
  .wallet-hero,
  .page-form
) > * {
  min-width: 0;
}

:where(.mobile-shell, .auth-shell) :where(
  .market-card,
  .list-card,
  .hub-link,
  .game-pick-card,
  .info-card,
  .wallet-hero,
  .page-form
) :where(strong, b, span, small, p, h1, h2, h3, label) {
  overflow-wrap: anywhere;
}

:where(.mobile-shell, .auth-shell) :where(img, svg, video, canvas) {
  max-width: 100%;
}

:where(.mobile-shell, .auth-shell) :where(input, select, textarea, button) {
  max-width: 100%;
  min-width: 0;
}

/* Shared compact header for inner PageShell screens. */
:where(.mobile-shell) .page-top {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 54px;
  height: 54px;
  padding: 6px 10px;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 8px;
  border-radius: 18px;
}

:where(.mobile-shell) .page-top > div { min-width: 0; }
:where(.mobile-shell) .page-top > div > span { display: none; }

:where(.mobile-shell) .page-top h1 {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: 18px;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:where(.mobile-shell) .page-top .page-back {
  width: 36px;
  height: 36px;
  border-radius: 13px;
}

:where(.mobile-shell) .page-top .page-back svg,
:where(.mobile-shell) .page-top > svg {
  width: 20px;
  height: 20px;
  max-width: 20px;
  max-height: 20px;
  color: #fff;
  stroke: currentColor;
}

:where(.mobile-shell) .page-top > img {
  width: 36px !important;
  height: 36px !important;
  object-fit: contain;
}

:where(.mobile-shell) :where(.market-grid, .page-market-grid, .utility-grid, .mini-stat-grid) > * {
  min-width: 0;
}

/* Shared compact bottom navigation; tenant colours continue through theme variables. */
:where(.mobile-shell) .bottom-nav:not(.ng-bottom-nav) {
  width: min(430px, 100vw);
  height: 68px;
  grid-template-columns: 1fr 1fr 72px 1fr 1fr;
  padding: 4px 7px max(6px, env(safe-area-inset-bottom, 0px));
  border-radius: 18px 18px 0 0;
  overflow: visible;
}

:where(.mobile-shell) .bottom-nav:not(.ng-bottom-nav) > a {
  min-width: 0;
  padding: 4px 1px 3px;
  gap: 2px;
  font-size: 10px;
  line-height: 1;
}

:where(.mobile-shell) .bottom-nav:not(.ng-bottom-nav) > a > svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

:where(.mobile-shell) .common-injected-nav svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:where(.mobile-shell) .bottom-nav:not(.ng-bottom-nav) .bottom-fab-wrap {
  height: 68px;
}

:where(.mobile-shell) .bottom-nav:not(.ng-bottom-nav) .bottom-fab-dice {
  bottom: 19px;
  width: 58px;
  height: 58px;
  border: 4px solid rgba(255,255,255,.96);
  background:
    radial-gradient(circle at 32% 22%, rgba(255,255,255,.55), transparent 25%),
    linear-gradient(145deg, var(--theme-accent), var(--theme-primary-deep));
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--theme-primary) 35%, transparent),
    0 8px 18px rgba(20,35,30,.3),
    inset 0 2px 4px rgba(255,255,255,.3);
  overflow: hidden;
}

:where(.mobile-shell) .bottom-nav:not(.ng-bottom-nav) .bottom-fab-dice :where(svg, img) {
  display: block;
  width: 30px;
  height: 30px;
  max-width: 30px;
  max-height: 30px;
  object-fit: cover;
  border-radius: 50%;
}

:where(.mobile-shell) .bottom-nav:not(.ng-bottom-nav) .bottom-fab-label {
  margin-bottom: 3px;
  font-size: 9px;
}

:where(.mobile-shell):has(.common-injected-nav) {
  padding-bottom: 82px;
}

:where(.mobile-shell):has(.common-injected-nav) > :where(.am-screen, .am-shell, .wd-screen, .wdp-screen) {
  padding-bottom: 82px;
}

/* Shared wallet layout: clear balance hierarchy and five visible actions. */
:where(.mobile-shell .php-wallet) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

:where(.mobile-shell .php-wallet) .php-wallet-hero {
  min-height: 132px;
  padding: 17px 112px 17px 15px;
  overflow: hidden;
}

:where(.mobile-shell .php-wallet) .php-wallet-hero > div:first-child {
  position: relative;
  z-index: 2;
  min-width: 0;
}

:where(.mobile-shell .php-wallet) .php-wallet-hero strong {
  max-width: 100%;
  font-size: clamp(28px, 8.5vw, 38px);
  line-height: 1.05;
  white-space: nowrap;
}

:where(.mobile-shell .php-wallet) .php-wallet-art {
  right: 14px;
  bottom: 20px;
  width: 92px;
  min-width: 92px;
  height: 54px;
}

:where(.mobile-shell .php-wallet) .php-balance-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px 9px 8px;
  overflow: hidden;
}

:where(.mobile-shell .php-wallet) .php-balance-row {
  min-width: 0;
  min-height: 108px;
  padding: 11px 8px;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  align-content: start;
  border-bottom: 0;
}

:where(.mobile-shell .php-wallet) .php-balance-row:first-child {
  grid-column: 1 / -1;
  min-height: 72px;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  grid-template-rows: 1fr;
  border-bottom: 1px solid rgba(15,86,96,.14);
}

:where(.mobile-shell .php-wallet) .php-balance-row:nth-child(3) {
  border-left: 1px solid rgba(15,86,96,.14);
}

:where(.mobile-shell .php-wallet) .php-balance-row > strong {
  grid-column: 2;
  margin-top: 6px;
  font-size: clamp(17px, 5vw, 22px);
  white-space: nowrap;
}

:where(.mobile-shell .php-wallet) .php-balance-row:first-child > strong {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  margin: 0;
  font-size: clamp(20px, 6vw, 26px);
}

:where(.mobile-shell .php-wallet) .php-wallet-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

:where(.mobile-shell .php-wallet) .php-wallet-actions a {
  min-width: 0;
  min-height: 104px;
  padding: 12px 2px 8px;
}

:where(.mobile-shell .php-wallet) .php-wallet-actions span {
  width: 40px;
  height: 40px;
  margin-bottom: 7px;
}

:where(.mobile-shell .php-wallet) .php-wallet-actions a:nth-child(1) span { background: linear-gradient(145deg,#18ce96,#07885f); }
:where(.mobile-shell .php-wallet) .php-wallet-actions a:nth-child(2) span { background: linear-gradient(145deg,#19b9d5,#08769c); }
:where(.mobile-shell .php-wallet) .php-wallet-actions a:nth-child(3) span { background: linear-gradient(145deg,#8c6cf2,#5835bd); }
:where(.mobile-shell .php-wallet) .php-wallet-actions a:nth-child(4) span { background: linear-gradient(145deg,#ffbd42,#ed7c11); }
:where(.mobile-shell .php-wallet) .php-wallet-actions a:nth-child(5) span { background: linear-gradient(145deg,#ff6c89,#ce315a); }

:where(.mobile-shell .php-wallet) .php-wallet-actions b {
  font-size: 8px;
  line-height: 1.2;
}

:where(.mobile-shell .php-wallet) .php-wallet-actions small {
  display: block;
  margin-top: 3px;
  font-size: 6px;
  line-height: 1.2;
}

@media (max-width: 360px) {
  :where(.mobile-shell .php-wallet) .php-wallet-hero {
    padding-right: 96px;
  }

  :where(.mobile-shell .php-wallet) .php-wallet-art {
    right: 9px;
    width: 78px;
    min-width: 78px;
  }

  :where(.mobile-shell .php-wallet) .php-wallet-actions span {
    width: 35px;
    height: 35px;
  }
}

/* Shared Transactions layout and readable responsive cards. */
#txPhpPort {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  padding-bottom: 84px !important;
}

#txPhpPort .txp-header {
  min-height: 54px !important;
  padding: 6px 11px !important;
  grid-template-columns: 38px minmax(0,1fr) 38px !important;
}

#txPhpPort .txp-header h1 {
  overflow: hidden;
  font-size: 17px !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#txPhpPort .txp-filters {
  max-width: calc(100% - 20px);
  margin: 9px 10px 8px !important;
  padding: 8px !important;
}

#txPhpPort :where(.txp-dates, .txp-selects) {
  width: 100%;
  min-width: 0;
}

#txPhpPort .txp-dates {
  grid-template-columns: minmax(0,1fr) 24px minmax(0,1fr) !important;
}

#txPhpPort :where(.txp-dates input, .txp-selects select) {
  min-width: 0;
  width: 100%;
  font-size: 10px !important;
}

#txPhpPort .txp-quick {
  width: 100%;
  max-width: 100%;
  gap: 6px !important;
  padding-inline: 10px !important;
  overflow-x: auto !important;
  overscroll-behavior-x: contain;
}

#txPhpPort .txp-quick button {
  flex: 0 0 auto;
  min-width: max-content;
  color: #fff !important;
}

#txPhpPort .txp-quick button:nth-child(1) { background: linear-gradient(145deg,#42cfd0,#087f91) !important; }
#txPhpPort .txp-quick button:nth-child(2) { background: linear-gradient(145deg,#45df82,#07954b) !important; }
#txPhpPort .txp-quick button:nth-child(3) { background: linear-gradient(145deg,#39cad1,#087f9b) !important; }
#txPhpPort .txp-quick button:nth-child(4) { background: linear-gradient(145deg,#ff6688,#df2855) !important; }
#txPhpPort .txp-quick button:nth-child(5) { background: linear-gradient(145deg,#ffbd42,#ed7c11) !important; }
#txPhpPort .txp-quick button:nth-child(6) { background: linear-gradient(145deg,#9b69ef,#6535ca) !important; }
#txPhpPort .txp-quick button:nth-child(7) { background: linear-gradient(145deg,#6b8cff,#4054ca) !important; }
#txPhpPort .txp-quick button:nth-child(8) { background: linear-gradient(145deg,#ffca37,#ee7b08) !important; }

#txPhpPort .txp-tabs {
  max-width: calc(100% - 20px);
  margin-inline: 10px !important;
  grid-template-columns: repeat(4,minmax(0,1fr)) !important;
}

#txPhpPort .txp-tabs button {
  min-width: 0;
  padding-inline: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#txPhpPort .txp-list {
  width: 100%;
  max-width: 100%;
  padding-inline: 10px !important;
}

#txPhpPort .txp-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#txPhpPort .txp-top {
  grid-template-columns: 46px minmax(0,1fr) minmax(74px,auto) !important;
  gap: 8px !important;
  padding: 10px 9px 8px !important;
}

#txPhpPort :where(.txp-main, .txp-right) {
  min-width: 0;
}

#txPhpPort .txp-main :where(h3, p, time) {
  max-width: 100%;
  overflow-wrap: anywhere;
}

#txPhpPort .txp-right strong {
  font-size: clamp(11px,3.6vw,15px) !important;
  line-height: 1.15;
  white-space: nowrap;
}

#txPhpPort .txp-summary {
  width: calc(100% - 18px);
  grid-template-columns: minmax(0,1fr) minmax(0,.9fr) minmax(0,1.15fr) !important;
}

#txPhpPort .txp-summary span {
  min-width: 0;
  padding-inline: 7px !important;
}

#txPhpPort .txp-summary b {
  max-width: 100%;
  font-size: clamp(7px,2.4vw,10px) !important;
  white-space: nowrap;
}

@media (max-width: 350px) {
  #txPhpPort .txp-top {
    grid-template-columns: 40px minmax(0,1fr) minmax(64px,auto) !important;
    gap: 6px !important;
  }
  #txPhpPort .txp-icon { width: 40px !important; height: 40px !important; }
  #txPhpPort .txp-icon svg { width: 27px !important; height: 27px !important; }
}

/* Home: remove unnecessary inner gutters while retaining a small safe edge. */
.mobile-shell.is-home {
  padding-left: 8px !important;
  padding-right: 8px !important;
}

.mobile-shell.is-home :where(.market-grid, .home-wallet-actions, .utility-grid) {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Support: compact, fully visible chat and composer above bottom navigation. */
.mobile-shell.is-support {
  --bottom-nav-height: 68px;
}
.common-support-page {
  width: 100% !important;
  max-width: 100% !important;
  height: calc(100dvh - 68px) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
.common-support-page .sp-php-header {
  min-height: 58px !important;
  padding: 8px 12px !important;
  gap: 10px !important;
  background: linear-gradient(135deg,var(--theme-primary),var(--theme-primary-deep)) !important;
}
.common-support-page .sp-php-head h2 { font-size: 18px !important; }
.common-support-page .sp-php-status { font-size: 11px !important; }
.common-support-page .sp-php-thread {
  min-height: 0 !important;
  padding: 12px 10px !important;
  overflow-y: auto !important;
  filter: none !important;
  opacity: 1 !important;
}
.common-support-page .sp-php-msg { max-width: 86% !important; }
.common-support-page .sp-php-bubble {
  max-width: 100% !important;
  padding: 9px 12px !important;
  font-size: 13px !important;
  overflow-wrap: anywhere !important;
}
.common-support-page .sp-php-msg.mine .sp-php-bubble {
  background: var(--theme-primary-deep) !important;
}
.common-support-page .sp-php-composer {
  position: relative !important;
  z-index: 8 !important;
  width: 100% !important;
  padding: 8px 10px max(8px,env(safe-area-inset-bottom)) !important;
}
.common-support-page .sp-php-composer input[type=text] {
  min-width: 0 !important;
  padding: 10px 13px !important;
  font-size: 13px !important;
}
.common-support-page :where(.sp-php-attach-btn,.sp-php-send) { height: 40px !important; }
.common-support-page .sp-php-attach-btn { width: 40px !important; }
.common-support-page .sp-php-send {
  width: 52px !important;
  background: var(--theme-primary-deep) !important;
}

/* Time Table: compact three-column schedule. */
.common-time-table .list-stack {
  gap: 0 !important;
  margin-top: 2px !important;
  overflow: hidden !important;
  border: 1px solid color-mix(in srgb,var(--theme-primary) 25%,transparent) !important;
  border-radius: 15px !important;
  background: #fff !important;
}
.common-time-table :where(.common-time-head,.list-card > div) {
  display: grid !important;
  grid-template-columns: minmax(0,1.4fr) minmax(74px,.8fr) minmax(74px,.8fr) !important;
  align-items: center !important;
  gap: 6px !important;
}
.common-time-table .common-time-head {
  min-height: 38px !important;
  padding: 5px 10px !important;
  color: #fff !important;
  background: linear-gradient(135deg,var(--theme-primary-deep),var(--theme-primary)) !important;
}
.common-time-table .common-time-head strong {
  color: #fff !important;
  font-size: 9px !important;
  text-align: center !important;
  text-transform: uppercase !important;
}
.common-time-table .common-time-head strong:first-child { text-align: left !important; }
.common-time-table .list-card {
  min-height: 46px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(50,80,65,.13) !important;
  border-radius: 0 !important;
  background: #fff !important;
  box-shadow: none !important;
}
.common-time-table .list-card:nth-child(odd) { background: color-mix(in srgb,var(--theme-primary) 7%,#fff) !important; }
.common-time-table .list-card > div { min-height: 46px !important; padding: 5px 10px !important; }
.common-time-table .list-card strong { font-size: 11px !important; }
.common-time-table .list-card span { display: contents !important; }
.common-time-table .list-card span b {
  display: block !important;
  padding: 6px 3px !important;
  border-radius: 9px !important;
  font-size: 9px !important;
  text-align: center !important;
  white-space: nowrap !important;
}
.common-time-table .common-open-time { color:#17643b !important; background:#daf2df !important; }
.common-time-table .common-close-time { color:#8b4e08 !important; background:#fff0c8 !important; }

/* Charts and Game Rates: compact themed lists. */
:where(.common-charts-page,.common-game-rates) :where(.hub-stack,.list-stack) {
  gap: 7px !important;
  margin-top: 2px !important;
}
.common-charts-page .hub-link,
.common-game-rates .list-card {
  min-height: 58px !important;
  padding: 8px 10px !important;
  border: 1px solid color-mix(in srgb,var(--theme-primary) 18%,transparent) !important;
  border-radius: 14px !important;
  background: color-mix(in srgb,var(--theme-primary) 6%,#fff) !important;
  box-shadow: 0 7px 17px rgba(25,55,45,.09) !important;
}
.common-charts-page .hub-link > span {
  width: 36px !important;
  height: 36px !important;
  border-radius: 11px !important;
  background: linear-gradient(145deg,var(--theme-accent),var(--theme-primary-deep)) !important;
}
.common-charts-page .hub-link > span svg {
  width: 19px !important;
  height: 19px !important;
  fill: none !important;
  stroke: #fff !important;
}
.common-charts-page .hub-link strong { font-size: 12px !important; }
.common-charts-page .hub-link small { font-size: 9px !important; }
.common-charts-page :where(.hub-link > svg,.common-chart-next) {
  width: 17px !important;
  height: 17px !important;
  fill: none !important;
  stroke: var(--theme-primary-deep) !important;
}
.common-game-rates .list-card { border-left: 4px solid var(--theme-primary) !important; }
.common-game-rates .list-card strong { font-size: 13px !important; }
.common-game-rates .list-card span { font-size: 10px !important; }
.common-game-rates .list-card > b {
  min-width: 112px !important;
  padding: 7px 9px !important;
  border-radius: 11px !important;
  color: #fff !important;
  font-size: 11px !important;
  text-align: center !important;
  white-space: nowrap !important;
  background: linear-gradient(135deg,var(--theme-primary),var(--theme-primary-deep)) !important;
}

/* Final wallet-art anchor: prevent legacy float/relative rules from moving it over the amount. */
.mobile-shell .php-wallet .php-wallet-hero {
  position: relative !important;
  padding-right: 122px !important;
}

.mobile-shell .php-wallet .php-wallet-art {
  position: absolute !important;
  z-index: 3 !important;
  top: 58% !important;
  right: 16px !important;
  bottom: auto !important;
  left: auto !important;
  width: 92px !important;
  min-width: 92px !important;
  height: 54px !important;
  margin: 0 !important;
  animation: none !important;
  transform: translateY(-50%) skew(-4deg) !important;
}

@media (max-width: 390px) {
  .mobile-shell .php-wallet .php-wallet-hero { padding-right: 105px !important; }
  .mobile-shell .php-wallet .php-wallet-art {
    right: 11px !important;
    width: 80px !important;
    min-width: 80px !important;
    height: 48px !important;
  }
}

@media (max-width: 360px) {
  :where(.mobile-shell) {
    padding-inline: 8px;
  }

  :where(.mobile-shell) .bottom-nav {
    width: 100vw;
  }
}
