:root {
  --page-shell-standard: 1120px;
  --page-shell-text: 960px;
  --page-shell-workbench: 1320px;
  --page-shell-max: var(--page-shell-standard);
  --page-shell-gutter: clamp(16px, 2.2vw, 28px);
  --page-header-title: clamp(2.35rem, 3.35vw, 3.15rem);
  --page-header-rule: rgb(147 162 179 / 0.16);
  --page-nav-bg: rgb(7 12 15 / 0.82);
  --page-nav-border: rgb(147 162 179 / 0.18);
  --page-nav-active: rgb(45 212 191 / 0.15);
  --page-nav-accent: #2dd4bf;
  --shell-control-height: 40px;
  --shell-control-radius: 7px;
  --shell-control-font: 0.74rem;
  --shell-control-label: 0.62rem;
  --shell-sticky-nav-height: 66px;
  --shell-sticky-gap: 8px;
  --shell-secondary-sticky-top: calc(var(--shell-sticky-nav-height) + var(--shell-sticky-gap));
  --shell-fixed-nav-left: max(
    var(--page-shell-gutter),
    calc((100vw - var(--page-shell-max)) / 2 + var(--page-shell-gutter))
  );
  --shell-fixed-nav-width: min(
    calc(100vw - (var(--page-shell-gutter) * 2)),
    calc(var(--page-shell-max) - (var(--page-shell-gutter) * 2))
  );
}

.overview-shell,
.diagnosis-search-shell {
  --page-shell-max: var(--page-shell-standard);
}

.report-shell,
.guide-shell,
.methodology-shell {
  --page-shell-max: var(--page-shell-text);
}

.rankings-shell,
.graph-shell {
  --page-shell-max: var(--page-shell-workbench);
}

.app-shell,
.song-shell {
  width: min(var(--page-shell-max), 100%) !important;
  max-width: var(--page-shell-max) !important;
  margin-inline: auto !important;
  padding: calc(22px + var(--shell-sticky-nav-height) + 12px) var(--page-shell-gutter) 48px !important;
}

.graph-shell {
  gap: 0 !important;
}

.app-shell > .topbar,
.song-shell > .topbar,
.app-shell > .site-nav,
.song-shell > .site-nav,
.song-main {
  width: 100% !important;
  max-width: none !important;
  margin-inline: auto !important;
}

.app-shell > .topbar,
.song-shell > .topbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 16px !important;
  align-items: end !important;
  margin: 0 0 12px !important;
  padding: 0 0 12px !important;
  border-bottom: 1px solid var(--page-header-rule) !important;
  background: transparent !important;
  box-shadow: none !important;
  min-height: 82px !important;
}

.app-shell > .topbar h1,
.song-shell > .topbar h1,
.guide-shell .topbar h1,
.graph-shell > .topbar h1 {
  max-width: none !important;
  margin: 0 !important;
  font-size: var(--page-header-title) !important;
  line-height: 0.98 !important;
  letter-spacing: 0 !important;
}

.app-shell > .topbar .eyebrow,
.song-shell > .topbar .eyebrow {
  margin: 0 0 8px !important;
}

.app-shell > .topbar > div:first-child > p:not(.eyebrow),
.song-shell > .topbar > div:first-child > p:not(.eyebrow) {
  display: none !important;
}

.topbar-tools {
  display: grid !important;
  justify-items: end !important;
  align-self: end !important;
  min-width: 0 !important;
}

.language-switcher {
  min-height: var(--shell-control-height) !important;
  border-radius: var(--shell-control-radius) !important;
}

.language-switcher select {
  min-height: var(--shell-control-height) !important;
  border-radius: var(--shell-control-radius) !important;
  font-size: var(--shell-control-font) !important;
  font-weight: 900 !important;
}

.app-shell > .site-nav,
.song-shell > .site-nav {
  position: fixed !important;
  top: 0 !important;
  left: var(--shell-fixed-nav-left) !important;
  z-index: 260 !important;
  width: var(--shell-fixed-nav-width) !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.34fr) !important;
  gap: 8px !important;
  align-items: center !important;
  margin: 0 0 18px !important;
  border: 1px solid var(--page-nav-border) !important;
  border-radius: 0 0 10px 10px !important;
  padding: 7px !important;
  background: linear-gradient(180deg, rgb(6 11 14 / 0.98), rgb(8 14 18 / 0.94)) !important;
  box-shadow: 0 18px 42px rgb(0 0 0 / 0.26) !important;
  backdrop-filter: blur(18px) !important;
}

.site-nav-group.page-links {
  display: grid !important;
  grid-template-columns: auto repeat(7, minmax(72px, 1fr)) !important;
  gap: 7px !important;
  align-items: center !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

.site-nav-label {
  height: var(--shell-control-height) !important;
  min-height: var(--shell-control-height) !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 9px !important;
  color: var(--page-nav-accent) !important;
  font-size: 0.68rem !important;
  font-weight: 950 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
}

.site-nav-link {
  min-width: 0 !important;
  height: var(--shell-control-height) !important;
  min-height: var(--shell-control-height) !important;
  display: grid !important;
  place-items: center !important;
  border: 1px solid var(--page-nav-border) !important;
  border-radius: var(--shell-control-radius) !important;
  padding: 0 10px !important;
  color: #c7d4df !important;
  background: rgb(6 10 15 / 0.72) !important;
  font-size: var(--shell-control-font) !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
  text-align: center !important;
  text-decoration: none !important;
  white-space: nowrap !important;
}

.site-nav-link.active {
  border-color: rgb(45 212 191 / 0.56) !important;
  color: #f0fffd !important;
  background: var(--page-nav-active) !important;
  box-shadow: 0 0 0 1px rgb(45 212 191 / 0.12) inset !important;
}

.site-nav-link.active::after {
  content: none !important;
}

.site-nav-link:hover {
  border-color: rgb(45 212 191 / 0.46) !important;
  color: #f0fffd !important;
  background: rgb(45 212 191 / 0.1) !important;
}

.shell-quick-search {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  border: 1px solid rgb(45 212 191 / 0.2);
  border-radius: var(--shell-control-radius);
  padding: 4px;
  background: rgb(3 8 12 / 0.6);
}

.shell-quick-search label {
  min-width: 0;
  display: grid;
}

.shell-quick-search span {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.shell-quick-search input,
.shell-quick-search button {
  height: var(--shell-control-height);
  min-height: var(--shell-control-height);
  border-radius: var(--shell-control-radius);
  font-size: var(--shell-control-font);
  font-weight: 900;
}

.shell-quick-search input {
  min-width: 0;
  width: 100%;
  border: 1px solid rgb(147 162 179 / 0.2);
  padding: 0 11px;
  color: #f3fbfb;
  background: rgb(5 10 15 / 0.82);
  outline: none;
}

.shell-quick-search input:focus {
  border-color: rgb(45 212 191 / 0.56);
  box-shadow: 0 0 0 3px rgb(45 212 191 / 0.12);
}

.shell-quick-search button {
  border: 1px solid rgb(45 212 191 / 0.42);
  padding: 0 12px;
  color: #eafffd;
  background: rgb(45 212 191 / 0.14);
  cursor: pointer;
  white-space: nowrap;
}

.shell-quick-search button:hover {
  border-color: rgb(45 212 191 / 0.66);
  background: rgb(45 212 191 / 0.2);
}

.mobile-menu-button,
.mobile-shell-menu {
  display: none;
}

.mobile-menu-button-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.song-main {
  padding-top: 18px !important;
}

.song-shell .report-section {
  scroll-margin-top: calc(var(--shell-secondary-sticky-top) + 64px) !important;
}

.song-shell .report-tabs {
  --section-accent: #39d7c5;
  position: sticky !important;
  top: var(--shell-secondary-sticky-top) !important;
  z-index: 230 !important;
  min-height: 46px !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  overflow-x: auto !important;
  margin: 10px 0 18px !important;
  border: 1px solid rgb(125 154 166 / 0.24) !important;
  border-top: 3px solid var(--section-accent) !important;
  border-radius: 0 0 8px 8px !important;
  padding: 6px !important;
  background: linear-gradient(180deg, rgb(6 11 14 / 0.98), rgb(8 14 17 / 0.94)) !important;
  backdrop-filter: blur(18px) !important;
  box-shadow: 0 18px 42px rgb(0 0 0 / 0.32) !important;
  white-space: nowrap !important;
  scrollbar-width: thin;
}

.rankings-main {
  --table-header-offset: calc(var(--shell-secondary-sticky-top) + 54px) !important;
}

.scroll-context-bar.is-fixed {
  top: var(--shell-secondary-sticky-top) !important;
  z-index: 225 !important;
}

.floating-table-header.visible {
  top: calc(var(--shell-secondary-sticky-top) + 48px) !important;
  z-index: 215 !important;
}

.song-shell .report-tabs::before {
  content: attr(data-active-label);
  position: sticky;
  left: 0;
  z-index: 2;
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: 7px;
  padding: 0 10px;
  color: #07100f;
  background: var(--section-accent);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0;
  box-shadow: 10px 0 18px rgb(6 11 14 / 0.72);
}

.song-shell .report-tabs a {
  --tab-accent: #39d7c5;
  --tab-bg: rgb(57 215 197 / 0.12);
  flex: 0 0 auto !important;
  min-height: 32px !important;
  display: grid !important;
  place-items: center !important;
  border: 1px solid rgb(125 154 166 / 0.22) !important;
  border-radius: 7px !important;
  padding: 0 11px !important;
  color: #b9c9cb !important;
  background: rgb(16 23 27 / 0.72) !important;
  font-size: 0.7rem !important;
  font-weight: 950 !important;
  position: relative !important;
  white-space: nowrap !important;
}

.song-shell .report-tabs .mobile-tab {
  display: none !important;
}

.song-shell .report-tabs a[href="#summary"] {
  --tab-accent: #39d7c5;
  --tab-bg: rgb(57 215 197 / 0.16);
}

.song-shell .report-tabs a[href="#impactMetrics"] {
  --tab-accent: #56d9f2;
  --tab-bg: rgb(86 217 242 / 0.15);
}

.song-shell .report-tabs a[href="#officialResult"] {
  --tab-accent: #72d883;
  --tab-bg: rgb(114 216 131 / 0.15);
}

.song-shell .report-tabs a[href="#votes"] {
  --tab-accent: #d3a33f;
  --tab-bg: rgb(211 163 63 / 0.16);
}

.song-shell .report-tabs a[href="#facts"] {
  --tab-accent: #5f8cff;
  --tab-bg: rgb(95 140 255 / 0.15);
}

.song-shell .report-tabs a[href="#path"] {
  --tab-accent: #b874ff;
  --tab-bg: rgb(184 116 255 / 0.15);
}

.song-shell .report-tabs a[href="#stageDiff"] {
  --tab-accent: #e879f9;
  --tab-bg: rgb(232 121 249 / 0.15);
}

.song-shell .report-tabs a[href="#advice"] {
  --tab-accent: #f7b267;
  --tab-bg: rgb(247 178 103 / 0.16);
}

.song-shell .report-tabs a[href="#advanced"] {
  --tab-accent: #cbd5e1;
  --tab-bg: rgb(203 213 225 / 0.12);
}

.song-shell .report-tabs a:hover,
.song-shell .report-tabs a.active {
  border-color: var(--tab-accent) !important;
  color: #f7fffd !important;
  background: var(--tab-bg) !important;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.04) inset !important;
}

.song-shell .report-tabs a.active {
  color: #ffffff !important;
}

.song-shell .report-tabs a.active::after {
  content: "";
  width: calc(100% - 18px);
  height: 2px;
  position: absolute;
  right: 9px;
  bottom: 4px;
  left: 9px;
  border-radius: 999px;
  background: var(--tab-accent);
}

.song-shell .report-tabs[data-active-section="summary"] {
  --section-accent: #39d7c5;
}

.song-shell .report-tabs[data-active-section="impactMetrics"] {
  --section-accent: #56d9f2;
}

.song-shell .report-tabs[data-active-section="officialResult"] {
  --section-accent: #72d883;
}

.song-shell .report-tabs[data-active-section="votes"] {
  --section-accent: #d3a33f;
}

.song-shell .report-tabs[data-active-section="facts"] {
  --section-accent: #5f8cff;
}

.song-shell .report-tabs[data-active-section="path"] {
  --section-accent: #b874ff;
}

.song-shell .report-tabs[data-active-section="stageDiff"] {
  --section-accent: #e879f9;
}

.song-shell .report-tabs[data-active-section="advice"] {
  --section-accent: #f7b267;
}

.song-shell .report-tabs[data-active-section="advanced"] {
  --section-accent: #cbd5e1;
}

@media (max-width: 900px) {
  :root {
    --shell-control-height: 34px;
    --shell-control-font: 0.68rem;
    --shell-sticky-nav-height: 102px;
    --shell-sticky-gap: 6px;
  }

  .app-shell,
  .song-shell {
    padding: calc(16px + var(--shell-sticky-nav-height) + 10px) var(--page-shell-gutter) 38px !important;
  }

  .app-shell > .topbar,
  .song-shell > .topbar {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    min-height: 0 !important;
  }

  .app-shell > .topbar h1,
  .song-shell > .topbar h1,
  .guide-shell .topbar h1,
  .graph-shell > .topbar h1 {
    font-size: clamp(2rem, 8vw, 2.35rem) !important;
  }

  .topbar-tools {
    justify-items: stretch !important;
  }

  .app-shell > .site-nav,
  .song-shell > .site-nav {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    overflow: hidden !important;
    padding: 6px !important;
    scrollbar-width: thin !important;
  }

  .site-nav-group.page-links {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    gap: 6px !important;
    overflow-x: auto !important;
    padding-bottom: 2px !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .site-nav-label {
    display: none !important;
  }

  .site-nav-link {
    flex: 0 0 auto !important;
    min-width: 78px !important;
  }

  .shell-quick-search {
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .shell-quick-search label,
  .shell-quick-search input {
    min-width: 0 !important;
  }
}

@media (max-width: 767px) {
  :root {
    --shell-sticky-nav-height: 0px;
    --shell-sticky-gap: 0px;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  .app-shell,
  .song-shell {
    padding-top: 16px !important;
  }

  .app-shell > .topbar,
  .song-shell > .topbar {
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    min-height: 56px !important;
    padding-right: 56px !important;
  }

  .app-shell > .topbar h1,
  .song-shell > .topbar h1,
  .guide-shell .topbar h1,
  .graph-shell > .topbar h1 {
    font-size: clamp(1.42rem, 7vw, 2rem) !important;
    line-height: 1.08 !important;
  }

  .app-shell > .topbar .topbar-tools,
  .song-shell > .topbar .topbar-tools {
    display: none !important;
  }

  .app-shell > .site-nav,
  .song-shell > .site-nav {
    display: none !important;
  }

  .mobile-menu-button {
    position: fixed !important;
    top: max(12px, env(safe-area-inset-top)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    z-index: 520 !important;
    width: 44px !important;
    height: 44px !important;
    display: inline-grid !important;
    place-items: center !important;
    border: 1px solid rgb(148 163 184 / 0.52) !important;
    border-radius: 12px !important;
    padding: 0 !important;
    color: #111827 !important;
    background: rgb(255 255 255 / 0.96) !important;
    box-shadow: 0 14px 30px rgb(15 23 42 / 0.16) !important;
    backdrop-filter: blur(14px) !important;
    cursor: pointer !important;
  }

  .mobile-menu-button:focus-visible,
  .mobile-shell-menu-close:focus-visible,
  .mobile-shell-menu-link:focus-visible,
  .mobile-shell-menu-language select:focus-visible {
    outline: 3px solid rgb(79 70 229 / 0.24) !important;
    outline-offset: 2px !important;
  }

  .mobile-menu-icon {
    width: 18px;
    display: grid;
    gap: 4px;
  }

  .mobile-menu-icon span {
    display: block;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: opacity 0.16s ease, transform 0.16s ease;
    transform-origin: center;
  }

  body.mobile-menu-open .mobile-menu-icon span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  body.mobile-menu-open .mobile-menu-icon span:nth-child(2) {
    opacity: 0;
  }

  body.mobile-menu-open .mobile-menu-icon span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .mobile-shell-menu:not([hidden]) {
    display: block !important;
  }

  .mobile-shell-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 500;
    border: 0;
    padding: 0;
    background: rgb(15 23 42 / 0.34);
    cursor: pointer;
  }

  .mobile-shell-menu-panel {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    z-index: 510;
    width: min(328px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    display: grid;
    gap: 14px;
    overflow-y: auto;
    border: 1px solid rgb(203 213 225 / 0.9);
    border-radius: 16px;
    padding: 14px;
    color: #111827;
    background: rgb(255 255 255 / 0.98);
    box-shadow: 0 24px 72px rgb(15 23 42 / 0.28);
  }

  .mobile-shell-menu-head {
    min-height: 42px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding-right: 46px;
  }

  .mobile-shell-menu-head strong {
    font-size: 0.95rem;
    line-height: 1.2;
  }

  .mobile-shell-menu-close {
    display: none;
    position: relative;
    width: 38px;
    height: 38px;
    border: 1px solid rgb(203 213 225);
    border-radius: 10px;
    padding: 0;
    background: #fff;
    cursor: pointer;
  }

  .mobile-shell-menu-close::before,
  .mobile-shell-menu-close::after {
    content: "";
    position: absolute;
    top: 18px;
    left: 10px;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: #111827;
  }

  .mobile-shell-menu-close::before {
    transform: rotate(45deg);
  }

  .mobile-shell-menu-close::after {
    transform: rotate(-45deg);
  }

  .mobile-shell-menu-language label,
  .mobile-shell-menu-nav {
    display: grid;
    gap: 7px;
  }

  .mobile-shell-menu-language span,
  .mobile-shell-menu-nav > span {
    color: #4f46e5;
    font-size: 0.68rem;
    font-weight: 950;
    letter-spacing: 0.02em;
  }

  .mobile-shell-menu-language select {
    width: 100%;
    min-height: 40px;
    border: 1px solid rgb(203 213 225);
    border-radius: 10px;
    padding: 0 12px;
    color: #111827;
    background: #fff;
    font-size: 0.82rem;
    font-weight: 850;
  }

  .mobile-shell-menu-links {
    display: grid;
    gap: 7px;
  }

  .mobile-shell-menu-link {
    min-height: 42px;
    display: grid;
    align-items: center;
    border: 1px solid rgb(203 213 225);
    border-radius: 10px;
    padding: 0 12px;
    color: #111827;
    background: #fff;
    font-size: 0.82rem;
    font-weight: 900;
    text-decoration: none;
  }

  .mobile-shell-menu-link.active {
    border-color: rgb(79 70 229 / 0.42);
    color: #3730a3;
    background: rgb(238 242 255);
    box-shadow: 0 0 0 1px rgb(79 70 229 / 0.08) inset;
  }

  .mobile-shell-menu-link:active {
    transform: translateY(1px);
  }

  .scroll-context-bar.is-fixed {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    z-index: 30 !important;
    border-radius: 10px !important;
  }

  .scroll-context-spacer.active {
    display: none !important;
  }

  .song-shell .report-tabs .desktop-tab {
    display: none !important;
  }

  .song-shell .report-tabs .mobile-tab {
    display: grid !important;
  }
}

@media (max-width: 480px) {
  .app-shell,
  .song-shell {
    padding-inline: 10px !important;
  }

  .site-nav-link {
    min-height: var(--shell-control-height) !important;
    min-width: 76px !important;
    padding-inline: 8px !important;
    font-size: 0.67rem !important;
  }

  .shell-quick-search {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .shell-quick-search button {
    width: auto !important;
    padding-inline: 10px !important;
  }

  .song-shell .report-tabs {
    margin-top: 10px !important;
  }

  .song-shell .report-tabs::before {
    display: none;
  }
}
