.shell-app,
.stage {
  position: relative;
  min-height: 100vh;
}

.stage {
  position: fixed;
  inset: 0;
  min-width: 0;
}

.stage-frame-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: #000;
}

.stage-overlay,
.game-frame {
  position: absolute;
  inset: 0;
}

.stage-overlay {
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at center, rgba(181, 255, 61, 0.1), transparent 35%),
    linear-gradient(180deg, rgba(5, 10, 18, 0.74), rgba(5, 10, 18, 0.92));
}

.stage-overlay-card {
  width: min(520px, 100%);
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(24px);
}

.overlay-status {
  margin: 0;
  color: var(--text);
}

.game-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.shell-controls {
  position: fixed;
  left: 18px;
  top: 18px;
  z-index: 20;
  display: flex;
  gap: 9px;
}

.shell-app:has(.games-overview:not(.is-hidden)) .shell-controls {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
}

.shell-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  max-width: min(190px, calc(100vw - 36px));
  padding: 5px 11px 5px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--glass);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  text-align: left;
  backdrop-filter: blur(18px);
}

.shell-pill:hover,
.chat-launcher[aria-expanded="true"],
.view-toggle[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  transform: translateY(-1px);
}

.shell-pill-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06110c;
  font-family: var(--ui-display);
  font-weight: 700;
}

.shell-pill-badge svg {
  width: 17px;
  height: 17px;
}

.shell-pill-copy {
  display: grid;
  line-height: 1.15;
}

.shell-pill-copy strong {
  font-size: 13px;
}

.shell-pill-copy small {
  max-width: 150px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-unread {
  position: absolute;
  top: -7px;
  right: -7px;
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border: 2px solid var(--page-bg);
  border-radius: 999px;
  background: var(--accent);
  color: #06110c;
  font-size: 12px;
  font-weight: 900;
}

.games-overview {
  position: fixed;
  inset: 0;
  z-index: 6;
  overflow: auto;
  background: var(--body-bg);
  color: var(--text);
}

.games-overview.is-hidden {
  display: none !important;
}

.market-shell {
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  gap: 14px;
  min-height: 100vh;
  padding: 0 14px 14px 0;
}

.market-sidebar,
.market-rail,
.overview-topbar {
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
}

.market-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 16px 14px;
  border-width: 0 1px 0 0;
  border-radius: 0;
  box-shadow: none;
}

.market-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

.market-brand small {
  color: var(--accent);
  font-size: 9px;
}

.brand-badge {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07100b;
  font-family: var(--ui-display);
  font-weight: 800;
}

.side-nav {
  display: grid;
  gap: 7px;
  margin-top: 24px;
}

.nav-label {
  margin: 8px 0 2px;
  color: var(--soft);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.side-nav button {
  display: flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.side-nav svg,
.overview-nav svg {
  width: 15px;
  height: 15px;
  margin-right: 9px;
  flex: 0 0 auto;
}

.side-nav button {
  padding: 0 11px;
}

.side-nav button.active,
.side-nav button:hover {
  border-color: var(--line);
  background: rgba(181, 255, 61, 0.08);
  color: var(--text);
}

.market-main {
  min-width: 0;
  padding-top: 14px;
}

.overview-topbar {
  position: sticky;
  top: 14px;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 8px 10px;
  border-radius: var(--radius-lg);
}

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 10px;
  z-index: 12;
  display: grid;
  gap: 10px;
  width: min(280px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: var(--shadow);
}

.profile-menu label {
  display: grid;
  gap: 6px;
}

.profile-menu span,
.profile-menu small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.profile-menu input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.overview-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.overview-nav a,
.overview-nav button {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.overview-nav a.active,
.overview-nav a:hover,
.overview-nav button:hover {
  background: rgba(181, 255, 61, 0.1);
  color: var(--text);
}

.overview-nav a.active::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: -9px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.overview-search {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(2, 8, 15, 0.54);
  color: var(--muted);
}

.overview-search svg {
  width: 16px;
  height: 16px;
}

.overview-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: 0;
}

.overview-search kbd {
  display: inline-flex;
  gap: 3px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--soft);
  font: 10px var(--ui-body);
}

.overview-live-summary {
  display: flex;
  gap: 8px;
}

.overview-live-summary span,
.notification-btn,
.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.overview-live-summary span {
  padding: 0 11px;
  white-space: nowrap;
}

.overview-live-summary svg,
.notification-btn svg,
.profile-pill svg {
  width: 15px;
  height: 15px;
}

.notification-btn {
  justify-content: center;
  width: 40px;
  padding: 0;
}

.profile-pill {
  padding: 0 9px 0 4px;
}

.profile-avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-2));
  color: #fff;
  font-size: 11px;
}

@media (prefers-color-scheme: light) {
  .overview-search {
    background: rgba(255, 255, 255, 0.82);
  }

  .overview-live-summary span,
  .notification-btn,
  .profile-pill {
    background: rgba(255, 255, 255, 0.72);
  }

  .side-nav button.active,
  .side-nav button:hover {
    background: rgba(138, 215, 25, 0.11);
  }

  .profile-menu {
    background: #ffffff;
    box-shadow: 0 18px 42px rgba(39, 73, 92, 0.14);
  }

  .profile-menu input {
    background: #f7fbfd;
    color: #111c27;
  }
}

.overview-back {
  position: sticky;
  top: 84px;
  z-index: 7;
  float: right;
  min-height: 36px;
  margin: 12px 0 -48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 800;
}

@media (max-width: 1180px) {
  .market-shell {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .market-brand span:not(.brand-badge),
  .side-nav button {
    font-size: 0;
  }
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  .market-shell {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .market-sidebar {
    position: static;
    flex-direction: row;
    align-items: center;
    height: auto;
    overflow-x: auto;
  }

  .side-nav {
    display: flex;
    margin: 0;
  }

  .nav-label {
    display: none;
  }

  .overview-topbar,
  .market-rail {
    grid-template-columns: 1fr;
  }

  .overview-live-summary,
  .overview-nav {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .market-shell {
    padding: 8px;
  }

  .shell-controls {
    left: 10px;
    top: 10px;
    gap: 7px;
  }

  .shell-pill {
    min-height: 42px;
    width: 42px;
    padding: 4px;
  }

  .shell-pill-copy {
    display: none;
  }

  .shell-pill-badge {
    width: 32px;
    height: 32px;
  }

  .market-sidebar {
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
  }

  .market-brand {
    font-size: 0;
  }

  .brand-badge {
    width: 32px;
    height: 32px;
  }

  .side-nav {
    flex: 1;
    gap: 4px;
  }

  .side-nav button {
    min-height: 32px;
    padding: 0 9px;
    font-size: 0;
  }

  .side-nav svg {
    width: 16px;
    height: 16px;
    margin-right: 0;
  }

  .market-main {
    padding-top: 8px;
  }

  .overview-topbar {
    top: 8px;
    grid-template-columns: 1fr;
    gap: 7px;
    min-height: 0;
    padding: 8px;
    border-radius: 16px;
  }

  .overview-search {
    grid-row: 1;
    min-height: 38px;
  }

  .overview-nav {
    grid-row: 2;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 1px;
    scrollbar-width: none;
  }

  .overview-nav::-webkit-scrollbar {
    display: none;
  }

  .overview-nav a,
  .overview-nav button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 11px;
    white-space: nowrap;
  }

  .overview-nav svg {
    width: 13px;
    height: 13px;
    margin-right: 6px;
  }

  .overview-nav a.active::after {
    bottom: -5px;
  }

  .overview-live-summary,
  .notification-btn,
  .profile-pill {
    display: none;
  }
}
