:root { view-transition-name: none; }

@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

#cwPageTransition {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2147483646;
  pointer-events: none;
  opacity: 0;
  background: rgba(4, 8, 18, .1);
  backdrop-filter: blur(1.5px);
  transition: opacity 140ms cubic-bezier(.22, 1, .36, 1);
}
#cwPageTransition::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px;
  border: 4px solid rgba(91, 221, 255, .26);
  border-top-color: #00d4ff;
  border-right-color: #63edff;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(0, 212, 255, .5);
  opacity: 0;
  transform: scale(.9);
  visibility: hidden;
  z-index: 2;
}

body.cw-page-leaving #cwPageTransition {
  opacity: 1;
  background: radial-gradient(circle at center, rgba(5, 18, 32, .78) 0 31px, transparent 32px), conic-gradient(from 0deg at center, #00d4ff 0deg 78deg, rgba(99, 237, 255, .18) 78deg 360deg), rgba(4, 8, 18, .1);
  background-position: center, center, center;
  background-repeat: no-repeat;
  background-size: 76px 76px, 46px 46px, auto;
}
body.cw-page-leaving #cwPageTransition::before {
  opacity: 1 !important;
  transform: scale(1);
  visibility: visible !important;
  animation: cw-page-spinner-spin .76s linear infinite;
}
.cw-page-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 1px solid rgba(99, 226, 255, .72);
  border-radius: 50%;
  background: rgba(5, 18, 32, .68);
  box-shadow: 0 0 0 7px rgba(0, 212, 255, .12), 0 0 28px rgba(0, 212, 255, .22), 0 16px 36px rgba(0, 0, 0, .3);
  margin: -38px;
  opacity: 0;
  transform: scale(.94);
  visibility: hidden;
  transition: none;
}
.cw-page-loader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(91, 221, 255, .24);
  border-top-color: #00d4ff;
  border-right-color: #57e7ff;
  border-radius: 50%;
  filter: drop-shadow(0 0 7px rgba(0, 212, 255, .52));
  animation: cw-page-spinner-spin .76s linear infinite;
}
body.cw-page-leaving .cw-page-loader { opacity: 1 !important; transform: scale(1); visibility: visible !important; }
body.cw-page-leaving > :not(#cwPageTransition) {
  opacity: 1;
  transform: none;
}

@keyframes cw-page-spinner-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  #cwPageTransition, .cw-page-loader, body.cw-page-leaving > :not(#cwPageTransition) { transition: none; transform: none; }
  #cwPageTransition::before { animation: none; }
  .cw-page-loader-spinner { animation: none; }
}

/* ── Unified signed-in sidebar ── */
body:not(.cw-unified-sidebar-page) .cw-richside,
body:not(.cw-unified-sidebar-page) .cw-sidebar,
body:not(.cw-unified-sidebar-page) #sideNav.side {
  visibility: hidden !important;
}

/* Generated account frames briefly contain their legacy shell before the shared
   initializer replaces it. Keep that frame out of view rather than showing a
   second navigation system for one paint. */
@supports selector(body:has(#sideNav)) {
  body:has(#sideNav):not(.cw-unified-sidebar-page) .shell,
  body:has(#sideNav):not(.cw-unified-sidebar-page) .top {
    visibility: hidden !important;
  }
  body:has(.cw-richside):not(.cw-unified-sidebar-page) .cw-shell,
  body:has(.cw-sidebar):not(.cw-unified-sidebar-page) .cw-shell,
  body:has(.cw-richside):not(.cw-unified-sidebar-page) .cw-top,
  body:has(.cw-sidebar):not(.cw-unified-sidebar-page) .cw-top {
    visibility: hidden !important;
  }
}

body.cw-unified-sidebar-page .cw-richside[data-cw-unified-sidebar],
body.cw-unified-sidebar-page .cw-sidebar[data-cw-unified-sidebar],
body.cw-unified-sidebar-page .side[data-cw-unified-sidebar] {
  visibility: visible !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
  padding: 28px 18px !important;
  color: #e8eaf0;
}

/* Dashboard and Global Markets use the same fixed rail geometry as generated account pages. */
body.cw-unified-sidebar-page .cw-richside[data-cw-unified-sidebar],
body.cw-unified-sidebar-page .cw-sidebar[data-cw-unified-sidebar],
body.cw-unified-sidebar-page .side[data-cw-unified-sidebar] {
  position: fixed !important;
  top: 56px !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 224px !important;
  flex: 0 0 224px !important;
  padding: 19px 11px !important;
  overflow-y: auto !important;
  scrollbar-width: none;
}
body.cw-unified-sidebar-page .cw-shell {
  display: block !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 82px 30px 45px 232px !important;
  visibility: visible !important;
}
body.cw-unified-sidebar-page .cw-top,
body.cw-unified-sidebar-page .top { visibility: visible !important; }
body.cw-unified-sidebar-page .cw-shell .cw-main {
  width: 100% !important;
  margin-left: 0 !important;
  padding: 0 !important;
}

.cw-unified-nav-group { margin: 0 0 29px; }
.cw-unified-nav-group:last-child { margin-bottom: 0; }
.cw-unified-nav-label {
  margin: 0 0 10px;
  padding: 0 12px;
  color: #6b7280;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.cw-unified-nav-link {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  margin: 4px 0 !important;
  padding: 11px 10px !important;
  border-radius: 12px !important;
  border-left: 3px solid transparent;
  color: #9ea7b7 !important;
  font-size: .9rem !important;
  font-weight: 750 !important;
  letter-spacing: -.01em;
  white-space: nowrap;
  transition: background .16s cubic-bezier(.23,1,.32,1), color .16s cubic-bezier(.23,1,.32,1), border-color .16s cubic-bezier(.23,1,.32,1);
}
.cw-unified-nav-link:hover { background: rgba(255,255,255,.04) !important; color: #f1f5f9 !important; }
.cw-unified-nav-link:active { transform: scale(.98); }
.cw-unified-nav-link span:last-child { display: block !important; flex: 0 0 auto; width: max-content; max-width: none !important; white-space: nowrap !important; }
.cw-unified-nav-link[aria-current="page"] {
  border-left-color: #00d4ff;
  background: linear-gradient(90deg, rgba(0,212,255,.15), rgba(0,212,255,.055)) !important;
  box-shadow: inset 0 0 0 1px rgba(0,212,255,.08), 0 7px 20px rgba(0,0,0,.12);
  color: #f8fafc !important;
}
.cw-unified-nav-link.cw-unified-signout { color: #d9a4ad !important; }
.cw-unified-nav-link.cw-unified-signout .cw-unified-nav-icon { color: #ef8797; }
.cw-unified-nav-link.cw-unified-signout:hover { background: rgba(239, 135, 151, .08) !important; color: #ffe6ea !important; }
.cw-unified-nav-icon {
  display: grid;
  place-items: center;
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  color: #00d4ff;
}
.cw-unified-nav-icon svg { display: block; width: 22px; height: 22px; }

@media (min-width: 961px) and (max-height: 820px) {
  body.cw-unified-sidebar-page .cw-richside[data-cw-unified-sidebar],
  body.cw-unified-sidebar-page .cw-sidebar[data-cw-unified-sidebar],
  body.cw-unified-sidebar-page .side[data-cw-unified-sidebar] { padding-top: 14px !important; padding-bottom: 14px !important; }
  .cw-unified-nav-group { margin-bottom: 15px; }
  .cw-unified-nav-label { margin-bottom: 5px; }
  .cw-unified-nav-link { min-height: 40px; margin: 1px 0 !important; padding: 7px 11px !important; }
}

@media (max-width: 960px) {
  body.cw-unified-sidebar-page .cw-richside[data-cw-unified-sidebar],
  body.cw-unified-sidebar-page .cw-sidebar[data-cw-unified-sidebar],
  body.cw-unified-sidebar-page .side[data-cw-unified-sidebar] { display: none !important; }
  body.cw-unified-sidebar-page .cw-shell { padding: 74px 14px 36px !important; }
}

/* ── Shared signed-in risk and legal disclosure ── */
.cw-account-disclosure {
  margin: 0 30px 48px 232px;
  padding: 28px 30px 22px;
  border: 1px solid rgba(245, 185, 74, .22);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(17, 23, 36, .96), rgba(13, 17, 29, .96));
  box-shadow: 0 16px 38px rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255, 255, 255, .025);
  color: #9caabd;
}
.cw-account-disclosure-heading { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; color: #f2bc55; font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.cw-account-disclosure-heading span { display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid rgba(245, 185, 74, .35); border-radius: 6px; background: rgba(245, 185, 74, .08); font-size: .7rem; }
.cw-account-disclosure-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr); gap: 28px; }
.cw-account-disclosure p { margin: 0 0 12px; color: #9caabd; font-size: .72rem; line-height: 1.58; }
.cw-account-disclosure p:last-child { margin-bottom: 0; }
.cw-account-disclosure strong { color: #e6edf6; }
.cw-account-disclosure-aside { padding: 16px; border: 1px solid rgba(255, 255, 255, .07); border-radius: 10px; background: rgba(255, 255, 255, .025); }
.cw-account-disclosure-aside p { margin: 0; color: #7f91a7; font-size: .69rem; line-height: 1.55; }
.cw-account-disclosure-links { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .07); }
.cw-account-disclosure-links a { color: #a9bacd; font-size: .67rem; font-weight: 700; text-decoration: none; transition: color .16s cubic-bezier(.23,1,.32,1); }
.cw-account-disclosure-links a:hover { color: #72e5ff; }
@media (max-width: 960px) { .cw-account-disclosure { margin: 0 14px 36px; padding: 22px 20px 18px; } .cw-account-disclosure-grid { grid-template-columns: 1fr; gap: 16px; } }

/* ── iOS and Android phone experience ── */
@supports (padding: max(0px)) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { padding-bottom: env(safe-area-inset-bottom); }
}

@media (max-width: 760px) {
  html { scroll-padding-top: calc(70px + env(safe-area-inset-top)); }
  body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
  a, button, [role="button"], .cw-marketcard { touch-action: manipulation; }
  input, select, textarea, button { font-size: 16px; }
  .cw-top, .top { min-height: calc(58px + env(safe-area-inset-top)); height: auto; padding: env(safe-area-inset-top) 12px 0; gap: 7px; }
  .cw-brand { min-width: 0; margin-right: 0; }
  .cw-brand img { max-width: 116px; height: auto; max-height: 29px; }
  .cw-top-tools { gap: 7px !important; max-width: calc(100vw - 136px); padding-left: 6px !important; }
  .cw-market-search { width: clamp(116px, 34vw, 176px) !important; min-height: 40px; height: 40px !important; padding-left: 9px !important; }
  .cw-market-search input { display: block !important; font-size: 16px !important; }
  .cw-market-search span { display: none !important; }
  .cw-search-submit { width: 32px; height: 32px; flex: 0 0 32px; }
  .cw-notification-trigger, .cw-profile-trigger, .cw-public-session-account { min-width: 40px !important; min-height: 40px !important; }
  .cw-profile-copy, .cw-profile-trigger .cw-profile-name, .cw-profile-trigger .cw-profile-meta, .cw-public-session-copy { display: none !important; }
  .cw-profile-trigger, .cw-public-session-account { padding: 4px !important; border-radius: 50% !important; }
  .cw-site-search-panel { top: calc(100% + 6px) !important; left: auto !important; right: 0 !important; width: min(360px, calc(100vw - 20px)) !important; max-height: min(55dvh, 360px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .cw-site-search-result { min-height: 48px; padding: 10px 11px; }
  .cw-shell, body.cw-unified-sidebar-page .cw-shell { padding: calc(76px + env(safe-area-inset-top)) 14px calc(34px + env(safe-area-inset-bottom)) !important; }
  .cw-heading { gap: 12px; margin-bottom: 18px; }
  .cw-heading h1 { font-size: clamp(1.35rem, 7vw, 1.65rem); line-height: 1.08; }
  .cw-heading p { font-size: .88rem; line-height: 1.55; }
  .cw-statgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .cw-stat { min-height: 96px; padding: 13px; }
  .cw-panelhead, .cw-body { padding-left: 14px; padding-right: 14px; }
  .cw-marketgrid { gap: 11px; }
  .cw-marketcard { padding: 15px; border-radius: 13px; }
  .cw-cardtitle { font-size: .9rem; line-height: 1.42; }
  .cw-vote, .cw-action, .cw-filter, .cw-sidelink, .cw-sidefilter { min-height: 44px; }
  .cw-detail-layout, .cw-detail-slip-column { min-width: 0; }
  .cw-detail-slip#cwDashSlip { width: 100% !important; max-width: 100% !important; }
  .cw-account-disclosure { margin: 0 12px calc(28px + env(safe-area-inset-bottom)); padding: 18px 16px; }
}

@media (max-width: 390px) {
  .cw-top, .top { padding-left: 9px; padding-right: 9px; }
  .cw-brand img { max-width: 96px; max-height: 25px; }
  .cw-top-tools { max-width: calc(100vw - 114px); gap: 5px !important; }
  .cw-market-search { width: clamp(106px, 35vw, 132px) !important; }
  .cw-notification-trigger, .cw-profile-trigger, .cw-public-session-account { min-width: 38px !important; min-height: 38px !important; }
  .cw-stat-value { font-size: 1.16rem; }
}
