:root {
  --bg: #000000; /* black */
  --panel: #1a1a1a; /* dark grey (slightly lighter for contrast) */
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #22d3ee;
  --accent-2: #60a5fa;
  --home-top-card-height: 240px;
  --home-article-card-height: 390px;
}
@media (max-width: 960px) {
  :root {
    --home-top-card-height: 220px;
    --home-article-card-height: 364px;
  }
}
@media (max-width: 680px) {
  :root {
    --home-top-card-height: 200px;
    --home-article-card-height: 332px;
  }
}

/* Minimal bootstrap spinner support */
@keyframes spinner-border {
  to { transform: rotate(360deg); }
}
.spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: -0.125em;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border .75s linear infinite;
}
.spinner-border-sm {
  width: 1.25rem;
  height: 1.25rem;
  border-width: 0.2em;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

html {
  min-height: 100%;
}

body.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 840px;
  margin: 0 auto;
  padding: 1rem;
}

.site-header, .site-footer {
  background: #0a0a0a; /* near black header/footer */
  border-bottom: 1px solid #1f2937;
}
.site-header {
  cursor: default;
}
.site-header a,
.site-header button,
.site-header .menu-dropdown > .menu-link,
.site-header .auth-user {
  cursor: pointer;
}
.site-header input,
.site-header textarea {
  cursor: text;
}

.site-main {
  flex: 1 0 auto;
}
.site-footer {
  border-top: 1px solid #1f2937;
  border-bottom: none;
  cursor: default;
}
.site-footer a,
.site-footer button {
  cursor: pointer;
}
.site-footer .container {
  padding-top: .85rem;
  padding-bottom: 1rem;
}
.site-footer__content {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
  align-items: center;
}
.site-footer__social {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: .1rem;
}
.site-footer__sociallink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  line-height: 1;
  text-decoration: none;
}
.site-footer__sociallink:hover,
.site-footer__sociallink:focus-visible {
  color: var(--accent-2);
}
.site-footer__sociallink i {
  font-size: 1.2rem;
}
.site-footer__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .75rem;
}
.site-footer__badge {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  cursor: default;
}
.site-footer__link {
  color: var(--accent-2);
}
.site-footer__iconlink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .92rem;
  line-height: 1;
}
.site-footer__note {
  color: var(--muted);
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .35rem;
}
.site-footer__separator {
  color: #64748b;
}

.home-topic-strip {
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
}

.home-topic-strip__row {
  display: block;
  line-height: normal;
}

.home-topic-strip__row + .home-topic-strip__row {
  margin-top: 0.35rem;
}

.home-topic-strip__label {
  margin-right: 0.45rem;
  color: var(--text);
}

.home-topic-strip__items {
  color: var(--muted);
}

.home-topic-strip__entry {
  display: inline-block;
  white-space: nowrap;
}

.home-topic-strip__entry--wrappable {
  display: inline;
  white-space: normal;
}

.home-topic-strip__badge-lock {
  display: inline-block;
  white-space: nowrap;
}

.home-topic-strip__link {
  font-weight: 400;
  color: var(--text);
}

.home-topic-strip__empty {
  color: var(--muted);
}

.home-topic-strip__separator {
  color: var(--muted);
}

.site-header h1 { margin: 0; font-size: 1.25rem; }
nav a { margin-right: 1rem; }

/* React dark mode additions */
.react-menu { list-style: none; margin: 0; padding: 0; display: flex; gap: .75rem; }
.react-menu .menu-link {
  color: var(--text);
  text-decoration: none;
  padding: .25rem .5rem;
  border-radius: 6px;
  border: 1px solid transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.react-menu .menu-link:hover,
.menu-dropdown__list .menu-link:hover {
  border-color: #1f2937;
  background: #0f0f0f;
  color: var(--text);
}
.react-menu .menu-link.active { color: #0b1220; background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-weight: 700; border-color: transparent; }
.react-menu-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "nav auth";
  align-items: center;
  column-gap: 1rem;
  row-gap: .5rem;
}
.react-menu-primary {
  grid-area: nav;
  justify-self: start;
  min-width: 0;
}
.auth-status,
.auth-login-icon {
  grid-area: auth;
  justify-self: end;
}
.auth-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  font-size: .9rem;
  color: var(--muted);
  min-width: 0;
  position: relative;
}
.auth-status__media-note {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  text-transform: lowercase;
  text-align: right;
  padding-right: 1.7rem;
  flex: 0 0 auto;
}
.auth-status__media-note-gap {
  display: inline-block;
  width: 1.55rem;
  flex: 0 0 1.55rem;
}
.header-search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid #1f2937;
  border-radius: 999px;
  background: #0f0f0f;
  transition: width .2s ease, border-color .2s ease, background-color .2s ease;
}
.header-search-toggle.is-open {
  width: clamp(180px, 24vw, 260px);
  border-color: #1f2937;
  background: #0f0f0f;
  position: absolute;
  right: calc(88px + 1.3rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 30000;
  box-shadow: 0 12px 24px rgba(0,0,0,0.45);
}
.header-search-toggle input {
  width: 0;
  min-width: 0;
  opacity: 0;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 0;
  outline: none;
  transition: width .2s ease, opacity .15s ease, padding .2s ease;
}
.header-search-toggle.is-open input {
  flex: 1 1 auto;
  width: 100%;
  opacity: 1;
  padding: 0 .35rem 0 .8rem;
}
.header-search-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  padding: 0;
}
.auth-status .auth-user {
  order: 1;
  margin-right: 0 !important;
  white-space: nowrap;
}
.auth-status .menu-link {
  color: var(--text);
  text-decoration: none;
  padding: .25rem .5rem;
  border-radius: 6px;
  border: 1px solid transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.react-menu-primary .menu-link__icon {
  display: none;
  font-size: 1rem;
  line-height: 1;
}
.react-menu-primary .menu-link__text {
  display: inline;
}
.auth-status .menu-link:hover {
  border-color: #1f2937;
  background: #0f0f0f;
  color: var(--text);
  text-decoration: none;
}
.auth-status .auth-logout-icon {
  order: 2;
}
.menu-dropdown__list {
  list-style: none;
  color: var(--text);
}
.menu-dropdown__list .menu-link {
  color: var(--text);
  display: block;
}
.menu-dropdown {
  position: relative;
  z-index: 10000;
}
.auth-login-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  color: #fff;
}
.auth-login-icon svg,
.auth-login-icon img,
.auth-logout-icon svg,
.auth-logout-icon img {
  width: 100%;
  height: 100%;
}
.auth-login-icon:hover {
  transform: scale(1.05);
}
.auth-logout-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: #fff;
}
.auth-logout-icon:hover {
  transform: scale(1.05);
}
@media (max-width: 980px) {
  .react-menu-container {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "nav auth";
    row-gap: .4rem;
    align-items: center;
  }
  .auth-status {
    display: grid;
    grid-template-rows: auto auto;
    justify-items: end;
    align-items: center;
    row-gap: .2rem;
    min-width: 170px;
  }
  .auth-status .auth-user {
    position: static;
    margin-top: 0;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    order: 1;
  }
  .auth-status .auth-logout-icon {
    order: 0;
  }
}
@media (max-width: 740px) {
  .react-menu-primary .menu-link__text {
    display: none;
  }
  .react-menu-primary .menu-link__icon {
    display: inline-block;
    font-size: 2rem;
  }
  .react-menu-primary .menu-link--responsive-icon {
    width: 44px;
    height: 44px;
    justify-content: center;
    padding: 0;
    border-radius: 999px;
    border-color: #1f2937;
    background: #0f0f0f;
  }
}
@media (max-width: 760px) {
  .auth-status {
    min-width: 140px;
  }
  .header-search-toggle.is-open {
    width: min(200px, calc(100vw - 170px));
  }
  .auth-status .auth-user {
    max-width: 140px;
  }
}
@media (max-width: 620px) {
  #react-nav {
    min-width: 300px;
    overflow: visible;
  }
  .react-menu-container {
    min-width: 300px;
  }
  .auth-status__media-note {
    display: none;
  }
  .header-search-toggle.is-open {
    right: calc(88px + 1rem);
  }
}
.article-display.article-display--mini {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.home-top-card-fixed {
  height: var(--home-top-card-height);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.home-about-preview-card {
  justify-content: flex-start;
}
.home-about-preview-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.home-about-preview-text {
  flex: 1;
  min-height: 0;
  color: var(--muted);
  line-height: 1.34;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.home-articles-grid,
.home-top-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, 392px);
  justify-content: center;
  gap: 1rem;
}
@media (max-width: 860px) {
  .home-articles-grid,
  .home-top-row {
    grid-template-columns: minmax(0, 392px);
  }
}
@media (max-width: 460px) {
  .home-articles-grid,
  .home-top-row {
    grid-template-columns: minmax(0, 1fr);
  }
}
.article-display.article-display--mini.home-article-card-fixed {
  height: var(--home-article-card-height);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.home-article-card-shell {
  overflow: hidden;
}
.mini-pattern-chart {
  margin-top: 0.2rem;
  padding: 0.35rem;
  border: 2px solid #374151;
  border-radius: 10px;
  background: #0a0a0a;
  width: 100%;
}
.mini-pattern-chart--link {
  display: block;
  text-decoration: none;
}
.mini-pattern-chart--compact {
  padding: 0.25rem;
  border-width: 1.5px;
  width: 100%;
}
.article-display--mini .mini-pattern-chart {
  margin-top: auto;
}
.mini-pattern-chart__grid {
  display: flex;
  width: 100%;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: flex-end;
  align-content: flex-end;
  gap: 1px;
  min-height: 45px;
  max-height: 45px;
  overflow: hidden;
}
.mini-pattern-chart--compact .mini-pattern-chart__grid {
  min-height: 22px;
  max-height: 22px;
}
.mini-pattern-chart__column {
  position: relative;
  flex: 0 0 4px;
  height: 40px;
  overflow: hidden;
  box-sizing: border-box;
}
.mini-pattern-chart--compact .mini-pattern-chart__column {
  flex: 0 0 2px;
  height: 20px;
}
.mini-pattern-chart__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 999px;
  opacity: 0.45;
}
.mini-pattern-chart__rail {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-50%);
  background: #1f2937;
}
.mini-pattern-chart__dot {
  position: absolute;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #0a0a0a;
  transform: translate(-50%, 50%);
  background: var(--accent-2);
}
.mini-pattern-chart--compact .mini-pattern-chart__dot {
  width: 6px;
  height: 6px;
}
.article-display--list {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.article-display--list-with-chart {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}
.article-display__chart {
  flex: 0 0 140px;
  max-width: 40%;
}
.article-display__chart--empty {
  visibility: hidden;
  pointer-events: none;
}
.article-display__chart .mini-pattern-chart {
  margin-top: 0;
  overflow: hidden;
}
.article-display--list-with-chart .mini-pattern-chart--compact .mini-pattern-chart__grid {
  min-height: 43px;
  max-height: 43px;
  flex-wrap: nowrap;
  gap: 0;
}
.article-display--list-with-chart .mini-pattern-chart--compact .mini-pattern-chart__column {
  height: 39px;
}
.article-display__body {
  flex: 1;
  width: 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.article-display__list-title-row {
  width: 100%;
  max-width: 100%;
  line-height: 1.25;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
}
.article-display__list-title-slot {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.article-display__list-title-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
}
.article-display__list-title-text {
  display: block;
  flex: 0 1 auto;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.article-display__list-meta {
  display: flex;
  align-items: baseline;
  gap: .2rem .45rem;
  flex-wrap: wrap;
  min-width: 0;
  overflow: hidden;
}
.article-display__list-meta-group {
  min-width: 0;
}
.article-display__excerpt-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-top: .4rem;
}
.article-display__excerpt {
  flex: 1;
  min-height: 0;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.article-display__excerpt--mini {
  font-size: 1rem;
}
.article-display__excerpt-inline {
  color: var(--muted);
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.article-display__more-inline {
  font-weight: 600;
}
.article-display__tail-nowrap {
  white-space: nowrap;
}
.help-walkthrough-step {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 1rem;
  background: rgba(15,23,42,0.35);
}
.help-walkthrough-step__body {
  color: #cbd5e1;
  line-height: 1.6;
}
.help-walkthrough-step__body--stacked {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.help-walkthrough-step__body::after {
  content: '';
  display: block;
  clear: both;
}
.help-walkthrough-step__image {
  float: right;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 0 .85rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,0.32);
  background: #05070b;
  box-shadow: 0 18px 40px rgba(0,0,0,0.26);
}
.help-walkthrough-step--stacked .help-walkthrough-step__image {
  float: none;
  margin: 0;
}
.help-walkthrough-step--analyze {
  background:
    linear-gradient(180deg, rgba(15,23,42,0.52), rgba(9,12,18,0.62)),
    rgba(15,23,42,0.35);
}
.help-walkthrough-step__image--analyze {
  border-radius: 20px;
  border: 1px solid rgba(96,165,250,0.26);
  box-shadow:
    0 22px 48px rgba(0,0,0,0.34),
    0 0 0 1px rgba(255,255,255,0.04) inset;
}
@media (max-width: 720px) {
  .help-walkthrough-step__image {
    float: none;
    margin: 0 0 .85rem 0;
    max-width: 100% !important;
  }
}
.article-display--onesheet {
  width: 100%;
}
.article-display__onesheet-stack {
  width: min(100%, 430px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: .8rem;
}
.article-display__onesheet-card {
  padding: 1rem 1rem 1.05rem;
  border-radius: 18px;
}
.article-display__onesheet-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}
.article-display__onesheet-topline > div {
  flex-shrink: 0;
}
.article-display__onesheet-divider {
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: .45rem 0;
}
.article-display__onesheet-headline {
  margin: 0;
  font-size: clamp(1.4rem, 4.9vw, 1.9rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}
.article-display__onesheet-meta {
  color: var(--muted);
  margin: .45rem 0 0;
  line-height: 1.5;
}
.article-display__onesheet-taxonomy {
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.55;
  display: grid;
  gap: .3rem;
}
.article-display__onesheet-patterns {
  gap: .55rem;
}
.article-display__onesheet-pattern-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .72rem .85rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.16);
  background: #0d0d0d;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.25;
}
.article-display__onesheet-pattern-dot {
  width: .7rem;
  height: .7rem;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12);
}
.article-display__onesheet-heatmap {
  margin: 0 0 .8rem;
}
.article-display__onesheet-chip-card {
  color: var(--muted);
  font-size: .92rem;
}
.article-display__onesheet-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  color: var(--muted);
}
.article-display__onesheet-controls-group {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
}
.article-display__onesheet-slider-group {
  font-size: .9rem;
}
.article-display__onesheet-toggle-group {
  gap: .75rem;
}
.article-display__onesheet-wordcount {
  margin-left: auto;
  font-size: .95rem;
  font-weight: 600;
}
.article-display__onesheet-content {
  width: 100%;
}
.article-display__onesheet-content-card {
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 1rem;
  background: #0b0b0b;
  border-radius: 18px;
  border: 1px solid #1f1f1f;
}
@media (max-width: 680px) {
  .article-display__onesheet-stack,
  .article-display__onesheet-content-card {
    width: min(100%, 100%);
  }
  .article-display__onesheet-headline {
    font-size: clamp(1.2rem, 6.2vw, 1.6rem);
  }
  .article-display__onesheet-topline {
    flex-direction: column;
    align-items: flex-start;
  }
  .article-display__onesheet-controls {
    align-items: flex-start;
  }
  .article-display__onesheet-wordcount {
    margin-left: 0;
    width: 100%;
  }
}
.auth-login-icon:hover {
  transform: scale(1.05);
}

.react-shell .page h2 { margin-top: 0; }
.react-shell .page p { color: var(--muted); }

.card {
  background: var(--panel);
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  box-shadow: 0px 10px 30px rgba(0,0,0,0.25);
}

label { display: block; margin: 1rem 0 .25rem; color: var(--muted); }
input {
  background: #0f0f0f;
  border: 1px solid #1f2937;
  color: var(--text);
  padding: .5rem .75rem;
  border-radius: 6px;
  margin-right: .5rem;
}
button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #0b1220;
  padding: .5rem .75rem;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }

/* Removed temporary debug outlines */

/* TEMP: word-item attribute spans should fill container width */
.word-item { display: inline-block; }
.word-item .attributes-markers { display: block; width: 100%; }
.word-item .attributes-markers .attr {
  display: block;
  width: 100%;
  height: 0;
  line-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--accent-2);
}

/* Highlight style and interactions */
.highlighted {
  background: #ffff33; /* neon yellow */
  color: #000;
}
.word-item { cursor: pointer; }
.word-item .word-text {
  display: inline-block;
  background: #000;
  color: #fff;
  padding: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.word-item.word-on .word-text {
  background: #ffff33;
  color: #000;
}
.word-item.word-item--editable,
.word-item.word-item--editable .word-text {
  cursor: text;
}

.article-word-heatmap {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 14px;
  overflow: hidden;
  margin: 0 0 .85rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #05080c;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.45);
}

.article-word-heatmap--sticky {
  position: sticky;
  top: 12px;
  z-index: 8;
}

.article-word-heatmap__segment {
  flex: 1 1 0;
  min-width: 1px;
  height: 100%;
  cursor: pointer;
}

.article-word-heatmap__segment:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: -2px;
}

/* Selection highlight for article words */
.word-item::selection { background: #ffff33; color: #000; }
.word-item *::selection { background: #ffff33; color: #000; }

.article-side-panel {
  position: fixed;
  top: 70px;
  bottom: 20px;
  width: min(320px, 85vw);
  background: #060606;
  border: 1px solid #1f2937;
  border-radius: 12px 0 0 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.65);
  transform: translateX(110%);
  transition: transform 0.35s ease;
  z-index: 1200;
  pointer-events: none;
}
.article-side-panel.open {
  pointer-events: auto;
}
.article-side-panel--left {
  left: 0;
  border-radius: 0 12px 12px 0;
  transform: translateX(-100%);
}
.article-side-panel--left.open {
  transform: translateX(0);
}
.article-side-panel--right {
  right: 0;
  border-radius: 12px 0 0 12px;
}
.article-side-panel--right.open {
  transform: translateX(0);
}
.article-side-panel__inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 1rem;
  overflow-y: auto;
}
.article-side-panel__inner::-webkit-scrollbar {
  width: 10px;
}
.article-side-panel__inner::-webkit-scrollbar-track {
  background: #050505;
}
.article-side-panel__inner::-webkit-scrollbar-thumb {
  background: #2b2b2b;
  border-radius: 999px;
}
.article-side-panel__inner::-webkit-scrollbar-thumb:hover {
  background: #3d3d3d;
}
.article-side-panel__inner {
  scrollbar-width: thin;
  scrollbar-color: #2b2b2b #050505;
}
.article-side-panel__sticky-controls {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -0.15rem -1rem 0;
  padding: 0.15rem 1rem 0.85rem;
  background: #060606;
  box-shadow: 0 14px 18px rgba(6, 6, 6, 0.98);
  isolation: isolate;
}
.article-side-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}
.article-panel-controls button {
  min-width: 170px;
}
.mouse-indicator {
  font-size: .9rem;
  color: var(--muted);
}
.mouse-indicator strong {
  color: var(--text);
}

.pattern-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.pattern-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .75rem;
  border: 1px solid #1f2937;
  background: #0d0d0d;
  color: var(--text);
  border-radius: 8px;
  padding: .6rem .8rem;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.pattern-item .pattern-label {
  font-weight: 600;
}
.pattern-item .pattern-pin {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid currentColor;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.panel-close {
  align-self: flex-end;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.panel-close:hover {
  color: var(--text);
}
.panel-tab {
  position: fixed;
  top: 120px;
  background: #0d0d0d;
  color: var(--text);
  border: 1px solid #1f1f1f;
  border-radius: 8px 0 0 8px;
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  z-index: 1150;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
  background-image: radial-gradient(circle at top, rgba(255,255,255,0.08), transparent 50%);
  transition: left 0.35s ease, right 0.35s ease, border-color 0.2s ease, color 0.2s ease, background-image 0.2s ease;
}
.panel-tab--right {
  right: 0;
}
.panel-tab-stack {
  position: fixed;
  z-index: 1150;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.panel-tab-stack--left {
  top: 120px;
  left: 0;
}
.panel-tab-stack .panel-tab {
  position: static;
  top: auto;
  left: auto;
  right: auto;
}
.panel-tab--stacked {
  border-radius: 0 8px 8px 0;
}
.panel-tab:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
  background-image: radial-gradient(circle at top, rgba(255,255,255,0.15), transparent 50%);
}

.article-side-panel select {
  background: #0d0d0d;
  border: 1px solid #1f2937;
  color: var(--text);
  padding: .5rem .75rem;
  border-radius: 6px;
}
.article-side-panel select:focus {
  outline: 2px solid var(--accent);
}

.comparative-heatmap-grid {
  display: flex;
  align-items: flex-start;
  gap: 0;
  width: 100%;
}
.comparative-heatmap-card {
  display: grid;
  grid-template-rows: 6.25rem 1.25rem minmax(320px, 62vh);
  gap: .45rem;
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.comparative-heatmap-card--current {
  box-shadow: none;
}
.comparative-heatmap-card__label {
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
  padding: 0 .2rem;
}
.comparative-heatmap-card__label-button {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: .2rem 0;
  min-height: 0;
  height: 100%;
  color: inherit;
  cursor: pointer;
}
.comparative-heatmap-card__label-button:hover .comparative-heatmap-card__label,
.comparative-heatmap-card__label-button:focus-visible .comparative-heatmap-card__label {
  color: #93c5fd;
}
.comparative-heatmap-card__label-button:focus-visible {
  outline: 2px solid rgba(147,197,253,0.7);
  outline-offset: 2px;
}
.comparative-heatmap-card--current .comparative-heatmap-card__label {
  color: #93c5fd;
}
.comparative-heatmap-card__meta {
  min-height: 1.2rem;
  font-size: .66rem;
  color: var(--muted);
  text-align: center;
  padding: 0 .2rem;
}
.comparative-heatmap-strip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  height: 100%;
  min-height: 0;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  background: #05080c;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.45);
}
.comparative-heatmap-strip__segment {
  flex: 1 1 0;
  min-height: 1px;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  cursor: pointer;
  background-image: none;
  box-shadow: none;
}
.comparative-heatmap-strip__segment:hover {
  filter: brightness(1.12);
}
.comparative-heatmap-strip__segment:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: -2px;
  position: relative;
  z-index: 1;
}
.comparative-heatmap-card__state {
  min-height: 0;
  height: 100%;
  display: grid;
  place-items: center;
  padding: .8rem .45rem;
  border-radius: 16px;
  border: 1px dashed rgba(148,163,184,0.24);
  background: rgba(255,255,255,0.02);
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
  text-align: center;
}
.comparative-heatmap-tooltip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  box-sizing: border-box;
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: .9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,0.25);
  background: rgba(8, 12, 18, 0.96);
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
  backdrop-filter: blur(12px);
}
.comparative-heatmap-tooltip__eyebrow {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #93c5fd;
}
.comparative-heatmap-tooltip__snippet {
  margin: .45rem 0 0 0;
  color: var(--text);
  font-size: .86rem;
  line-height: 1.45;
}
.comparative-heatmap-tooltip__sections {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin-top: .8rem;
}
.comparative-heatmap-tooltip__section {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.comparative-heatmap-tooltip__section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  color: var(--text);
  font-size: .8rem;
  font-weight: 700;
}
.comparative-heatmap-tooltip__section-header span:last-child {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
}
.comparative-heatmap-tooltip__chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.comparative-heatmap-tooltip__chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 1.85rem;
  padding: .26rem .55rem;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: .74rem;
  line-height: 1.2;
}
.comparative-heatmap-tooltip__chip-dot {
  width: .52rem;
  height: .52rem;
  border-radius: 999px;
  flex: 0 0 auto;
}
.comparative-heatmap-tooltip__more,
.comparative-heatmap-tooltip__empty {
  color: var(--muted);
  font-size: .74rem;
  line-height: 1.35;
}
.homepage-rankings-help-trigger {
  font: inherit;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.16);
  cursor: help;
}
.homepage-rankings-help-trigger:hover,
.homepage-rankings-help-trigger:focus-visible {
  filter: brightness(1.06);
}
.homepage-rankings-help-trigger:focus-visible {
  outline: 2px solid rgba(147,197,253,0.8);
  outline-offset: 2px;
}
.homepage-rankings-help-popup {
  position: fixed;
  z-index: 40000;
  width: min(420px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  padding: 1rem 1rem .95rem;
  border-radius: 14px;
  border: 1px solid rgba(74, 222, 128, 0.35);
  background: rgba(7,10,17,0.96);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: .8rem;
}
.homepage-rankings-help-popup__title {
  margin: 0;
  font-size: 1.05rem;
  color: #f8fafc;
}
.homepage-rankings-help-popup__section {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.homepage-rankings-help-popup__label {
  color: #e5edf5;
  font-size: .88rem;
  font-weight: 700;
}
.homepage-rankings-help-popup__text {
  margin: 0;
  color: #dbe4ee;
  font-size: .88rem;
  line-height: 1.55;
}
.homepage-rankings-help-popup__link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  align-self: flex-start;
  margin-top: .1rem;
  padding: .45rem .7rem;
  border-radius: 999px;
  text-decoration: none;
  color: #06110b;
  background: #4ade80;
  font-weight: 600;
}
.homepage-rankings-help-popup__link:hover,
.homepage-rankings-help-popup__link:focus-visible {
  filter: brightness(1.03);
}
@media (max-width: 520px) {
  .comparative-heatmap-grid {
    gap: 0;
  }
  .comparative-heatmap-strip,
  .comparative-heatmap-card__state {
    min-height: 260px;
  }
}

.stats-panel h4 {
  margin: 0 0 .5rem 0;
  color: var(--text);
}
.stats-row {
  margin-bottom: .75rem;
  position: relative;
  z-index: 0;
  overflow: visible;
}
.stats-row:hover,
.stats-row:focus-within {
  z-index: 12;
}
.stats-row__header {
  display: flex;
  justify-content: space-between;
  font-size: .85rem;
  color: var(--text);
}
.stats-row__bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #101010;
  border: 1px solid #1f1f1f;
  overflow: hidden;
  margin-top: .25rem;
  position: relative;
}
.stats-row__bar-text {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .8rem;
  font-weight: 600;
  color: #fff;
  text-align: right;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.stats-row__stacked {
  margin-top: 0;
  height: 14px;
}
.stats-row__segment {
  margin-top: 0;
}
.stats-row__segment + .stats-row__segment {
  margin-top: 0;
}
.stats-row__segment + .stats-row__segment {
  margin-top: 0;
}
.stats-row__fill {
  height: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: width 0.3s ease;
}
.stats-row__fill--primary {
  position: relative;
  z-index: 2;
}
.stats-row__fill--secondary {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0.35;
  z-index: 1;
}
.stats-row__fill--tertiary {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0.2;
  z-index: 0;
}
.stats-row__popup {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  width: min(280px, calc(100vw - 3rem));
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background:
    linear-gradient(180deg, rgba(17,17,17,0.98), rgba(8,8,8,0.98));
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  visibility: hidden;
}
.stats-row__popup::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 18px;
  width: 12px;
  height: 12px;
  background: rgba(12,12,12,0.98);
  border-top: 1px solid rgba(255,255,255,0.12);
  border-left: 1px solid rgba(255,255,255,0.12);
  transform: rotate(45deg);
}
.stats-row:hover .stats-row__popup,
.stats-row:focus-within .stats-row__popup {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}
.stats-row__popup-title {
  margin-bottom: 0.55rem;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
}
.stats-row__popup-items {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.stats-row__popup-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
}
.stats-row__popup-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--stats-popup-color, var(--accent));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}
.stats-row__popup-swatch--outline {
  border-radius: 3px;
  background: transparent;
  border: 2px solid var(--stats-popup-color, var(--accent));
  box-sizing: border-box;
}
.stats-row__popup-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.stats-row__popup-item-label {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}
.stats-row__popup-item-name {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.stats-row__popup-item-value {
  color: var(--accent-2);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}
.stats-row__popup-note {
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}
.stats-meta {
  color: var(--muted);
  font-size: .85rem;
}
.articles-filter-bar input,
.articles-filter-bar select {
  width: 100%;
  background: #0f0f0f;
  border: 1px solid #1f2937;
  color: var(--text);
  padding: .5rem .75rem;
  border-radius: 6px;
}
.articles-filter-bar select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}
.articles-filter-bar input:focus,
.articles-filter-bar select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.articles-pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}
.articles-pagination button {
  border: 1px solid #1f2937;
  background: #0b0b0b;
  color: var(--text);
  padding: .4rem .9rem;
  border-radius: 6px;
  cursor: pointer;
}
.articles-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.articles-pagination span {
  color: var(--muted);
}
.articles-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.articles-footer__count {
  color: var(--muted);
}
.percentile-badge--tappable {
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.percentile-badge-popover-layer {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
}
.percentile-badge-popover__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  padding: 0;
}
.percentile-badge-popover {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(34rem, calc(100vw - 1.5rem));
  background: rgba(8, 8, 8, 0.97);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.percentile-badge-popover__close {
  position: absolute;
  top: .5rem;
  right: .5rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
  padding: .25rem;
}
.percentile-badge-popover__body {
  white-space: pre-line;
  text-align: left;
  font-size: .95rem;
  line-height: 1.55;
  max-height: min(40vh, 24rem);
  overflow-y: auto;
  padding: 1rem 2.5rem 1.1rem 1rem;
}
.word-item--has-tooltip {
  position: relative;
}

.word-item--has-tooltip::after {
  content: attr(data-tooltip);
  position: fixed;
  left: 40px;
  right: 40px;
  bottom: 0;
  transform: none;
  background: rgba(8, 8, 8, 0.95);
  color: #fff;
  padding: 1rem 1.5rem;
  border-radius: 0;
  white-space: pre-line;
  max-width: 800px;
  text-align: left;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  max-height: 40vh;
  overflow-y: auto;
  transition: opacity 0.15s ease, box-shadow 0.15s ease;
  z-index: 2147483647;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.45);
  left: 50%;
  transform: translateX(-50%);
  padding-right: 2rem;
  padding-left: 2rem;
}

.word-item--has-tooltip:hover::after {
  opacity: 1;
  pointer-events: auto;
}

/* content page status spinner */
.status-spinner{display:inline-block;width:14px;height:14px;border:2px solid #777;border-top-color:transparent;border-radius:50%;vertical-align:middle}
.status-spinner.is-active{border-color:#4caf50;border-top-color:transparent;animation:status-spin .8s linear infinite}
@keyframes status-spin{to{transform:rotate(360deg)}}
