:root {
  --shared-topbar-height: 64px;
  --shared-topbar-bg: rgba(250, 252, 250, 0.96);
  --shared-topbar-border: rgba(24, 35, 32, 0.18);
  --shared-topbar-text: #182320;
  --shared-topbar-muted: #5e6b67;
  --shared-topbar-control-bg: rgba(255, 255, 255, 0.86);
  --shared-topbar-hover: rgba(15, 118, 110, 0.11);
  --shared-topbar-accent: #126a59;
}

html.dark,
html[data-theme="dark"],
html[data-hindi-theme="dark"],
body.dark {
  --shared-topbar-bg: rgba(20, 23, 22, 0.95);
  --shared-topbar-border: rgba(255, 255, 255, 0.16);
  --shared-topbar-text: #f3f7f5;
  --shared-topbar-muted: #b7c2be;
  --shared-topbar-control-bg: rgba(255, 255, 255, 0.06);
  --shared-topbar-hover: rgba(94, 234, 212, 0.12);
  --shared-topbar-accent: #6ee7c8;
}

.shared-study-topbar {
  position: sticky !important;
  top: 0 !important;
  min-height: var(--shared-topbar-height) !important;
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center !important;
  gap: 12px !important;
  padding: 8px 18px !important;
  color: var(--shared-topbar-text) !important;
  background: var(--shared-topbar-bg) !important;
  border-bottom: 1px solid var(--shared-topbar-border) !important;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  z-index: 1100 !important;
}

.shared-study-topbar--generated {
  position: sticky;
  top: 0;
  width: 100%;
}

.shared-study-topbar__left {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.shared-study-topbar__left > .shared-study-topbar__menu {
  display: none !important;
}

.shared-study-topbar__brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--shared-topbar-text) !important;
  text-decoration: none !important;
}

.shared-study-topbar__brand img {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(12, 28, 23, 0.18));
}

.shared-study-topbar__brand span {
  overflow: hidden;
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-study-topbar__brand:hover span,
.shared-study-topbar__brand:focus-visible span {
  color: var(--shared-topbar-accent);
}

.shared-study-topbar__brand:focus-visible {
  border-radius: 5px;
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.shared-study-topbar__completion,
.shared-study-topbar__spacer {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
}

.shared-study-topbar__completion {
  min-width: 0;
  padding: 7px 11px;
  color: var(--shared-topbar-muted);
  background: var(--shared-topbar-hover);
  border: 1px solid var(--shared-topbar-border);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.shared-study-topbar__actions {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.shared-study-topbar__button,
.shared-study-topbar .shared-study-topbar__button,
.shared-study-topbar__actions > .shared-study-topbar__button {
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 42px !important;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--shared-topbar-text) !important;
  background: var(--shared-topbar-control-bg) !important;
  border: 1px solid var(--shared-topbar-border) !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 8px rgba(17, 39, 32, 0.07) !important;
  font: inherit !important;
  font-size: 1.08rem !important;
  line-height: 1 !important;
  text-decoration: none !important;
  cursor: pointer;
}

.shared-study-topbar__button:hover,
.shared-study-topbar__button:focus-visible {
  background: var(--shared-topbar-hover) !important;
  border-color: var(--shared-topbar-accent) !important;
  color: var(--shared-topbar-accent) !important;
  outline: none;
}

.shared-study-topbar__button svg,
.shared-study-topbar__button i {
  width: 21px !important;
  height: 21px !important;
  font-size: 21px !important;
  pointer-events: none;
}

.shared-study-topbar__icon {
  display: block;
  overflow: visible;
}

.pahadi-pathshala-footer-logo {
  width: 52px !important;
  height: 52px !important;
  flex: 0 0 52px;
  margin: 0 10px 0 0 !important;
  object-fit: contain;
  filter: drop-shadow(0 5px 12px rgba(12, 28, 23, 0.15));
}

.studyhub-footer-brand-link,
.continent-footer-brand-link {
  display: grid !important;
  grid-template-columns: 52px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center !important;
  column-gap: 10px !important;
  row-gap: 1px !important;
}

.studyhub-footer-brand-link > .pahadi-pathshala-footer-logo,
.continent-footer-brand-link > .pahadi-pathshala-footer-logo {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin: 0 !important;
}

.studyhub-footer-brand-link > :not(.pahadi-pathshala-footer-logo),
.continent-footer-brand-link > :not(.pahadi-pathshala-footer-logo) {
  grid-column: 2;
}

.unified-site-footer-brand,
.uk-study-footer__brand {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
}

.unified-site-footer-brand > .pahadi-pathshala-footer-logo,
.uk-study-footer__brand > .pahadi-pathshala-footer-logo {
  grid-row: 1 / span 2;
}

.unified-site-footer-brand > strong,
.unified-site-footer-brand > p,
.uk-study-footer__brand > h2,
.uk-study-footer__brand > p {
  grid-column: 2;
}

.pahadi-pathshala-footer-home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  color: inherit;
  text-decoration: none;
}

.pahadi-pathshala-footer-home img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.pahadi-pathshala-footer-home strong {
  font-size: 1rem;
}

.shared-study-topbar > .shared-study-topbar__legacy {
  display: none !important;
}

.shared-study-topbar-duplicate {
  display: none !important;
}

.shared-study-search-removed,
.shared-study-focus-removed {
  display: none !important;
}

.shared-study-sidebar-offset {
  top: var(--shared-topbar-height) !important;
  max-height: calc(100dvh - var(--shared-topbar-height)) !important;
}

.shared-study-main-offset {
  padding-top: var(--shared-main-offset) !important;
}

.shared-sidebar-quiz {
  width: calc(100% - 4px);
  min-height: 42px;
  margin: 10px 2px 12px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--shared-topbar-text);
  background: var(--shared-topbar-hover);
  border: 1px solid var(--shared-topbar-border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.shared-sidebar-quiz:hover,
.shared-sidebar-quiz:focus-visible {
  color: var(--shared-topbar-accent);
  border-color: currentColor;
}

.shared-sidebar-quiz .shared-study-topbar__icon {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  order: 2;
}

@media (min-width: 901px) {
  .shared-study-topbar__left > .shared-study-topbar__menu {
    display: none !important;
  }
}

@media (max-width: 900px) {
  .shared-study-topbar {
    position: fixed !important;
    inset: 0 0 auto !important;
    width: 100% !important;
    min-height: 60px !important;
    padding: 7px 9px !important;
    gap: 6px !important;
  }

  .shared-study-topbar__left > .shared-study-topbar__menu {
    display: inline-flex !important;
  }

  .shared-study-topbar__brand {
    gap: 0;
  }

  .shared-study-topbar__brand img {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .shared-study-topbar__brand span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .shared-study-topbar__button,
  .shared-study-topbar .shared-study-topbar__button {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
  }

  .shared-study-topbar__completion {
    max-width: 128px;
    overflow: hidden;
    font-size: 0.7rem;
    text-overflow: ellipsis;
  }

  /* World History keeps its topbar inside .app. Reserve its fixed height
     before scripts run so the first hero is never hidden on refresh. */
  body:has(.progress-shell.shared-study-topbar) .app {
    padding-top: var(--shared-topbar-height, 60px) !important;
  }

  body:has(.progress-shell.shared-study-topbar) main.shared-study-main-offset {
    padding-top: 0 !important;
  }

  body:has(.progress-shell.shared-study-topbar) #sidebar-scrim {
    inset: var(--shared-topbar-height, 60px) 0 0 !important;
  }
}

@media (max-width: 390px) {
  .shared-study-topbar {
    gap: 4px !important;
  }

  .shared-study-topbar__completion {
    max-width: 106px;
    padding-inline: 6px;
  }
}

@media print {
  .shared-study-topbar,
  .shared-sidebar-quiz,
  #shared-highlight-toolbar {
    display: none !important;
  }
}

mark.shared-user-highlight {
  margin: 0;
  padding: 0 1px;
  color: inherit;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  cursor: pointer;
}

mark.shared-highlight-yellow {
  background: rgba(250, 204, 21, 0.46);
}

mark.shared-highlight-green {
  background: rgba(74, 222, 128, 0.38);
}

mark.shared-highlight-pink {
  background: rgba(244, 114, 182, 0.38);
}

mark.shared-highlight-blue {
  background: rgba(96, 165, 250, 0.38);
}

#shared-highlight-toolbar {
  position: fixed;
  z-index: 1400;
  display: none;
  align-items: center;
  gap: 5px;
  box-sizing: border-box;
  max-width: calc(100vw - 16px);
  padding: 6px;
  color: var(--shared-topbar-text);
  background: var(--shared-topbar-bg);
  border: 1px solid var(--shared-topbar-border);
  border-radius: 7px;
  box-shadow: 0 8px 24px rgba(12, 20, 18, 0.18);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

#shared-highlight-toolbar.is-visible {
  display: flex;
}

#shared-highlight-toolbar button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  box-shadow: none;
  cursor: pointer;
}

#shared-highlight-toolbar button:hover,
#shared-highlight-toolbar button:focus-visible {
  background: var(--shared-topbar-hover);
  border-color: var(--shared-topbar-border);
  outline: none;
}

#shared-highlight-toolbar [data-highlight-remove] {
  font-size: 1.35rem;
  line-height: 1;
}

#shared-highlight-toolbar [data-highlight-remove][hidden] {
  display: none;
}

.shared-highlight-swatch {
  width: 18px;
  height: 18px;
  display: block;
  border: 1px solid rgba(24, 35, 32, 0.2);
  border-radius: 50%;
}

.shared-highlight-swatch.is-yellow {
  background: #facc15;
}

.shared-highlight-swatch.is-green {
  background: #4ade80;
}

.shared-highlight-swatch.is-pink {
  background: #f472b6;
}

.shared-highlight-swatch.is-blue {
  background: #60a5fa;
}

.shared-highlight-divider {
  width: 1px;
  height: 22px;
  background: var(--shared-topbar-border);
}
