:root {
  --bg-dark: #262526;
  --bg-light: #ffffff;
  --text-dark: #262526;
  --text-light: #ffffff;
  --accent: #06d6a0;
  --accent-strong: #04b58a;
  --accent-soft: rgba(6, 214, 160, 0.12);
  --border: rgba(38, 37, 38, 0.14);
  --border-soft: rgba(38, 37, 38, 0.08);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.18), 0 2px 4px -1px rgba(0, 0, 0, 0.12);
  --danger: #e63946;
  --warning: #b7791f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar__inner,
.page {
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
}

.topbar__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand__logo {
  display: block;
  width: auto;
  height: 30px;
}

.topbar__link {
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.topbar__link:hover {
  color: var(--text-light);
}

.topbar__audit-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--accent);
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.topbar__audit-btn:hover {
  background: #33dfb4;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 214, 160, 0.35);
}

.topbar__audit-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.page {
  padding: 48px 0 64px;
}

.page--narrow {
  width: min(840px, calc(100vw - 32px));
}

.license-card h1 {
  margin: 0 0 12px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1;
}

.license-card a {
  color: #047857;
  font-weight: 800;
}

.license-text {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(38, 37, 38, 0.12);
}

.license-text h2 {
  margin: 0 0 12px;
  font-size: 22px;
}

.license-text p {
  margin: 0 0 14px;
  color: rgba(38, 37, 38, 0.72);
  font-size: 15px;
  line-height: 1.7;
}

.site-footer {
  padding: 0 0 20px;
}

.site-footer__inner {
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.site-footer__brand {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.65);
}

.site-footer__disclaimer {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.site-footer__links a {
  color: rgba(255, 255, 255, 0.65);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-footer__links a:hover {
  color: var(--text-light);
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.hero__eyebrow,
.section-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.05;
  font-weight: 800;
}

.hero h1 span {
  color: var(--accent);
}

.hero__copy {
  width: min(720px, 100%);
  margin: 16px auto 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
}

.hero__help {
  margin: 10px auto 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 500;
}

.hero__help a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.hero__help a:hover {
  color: #33dfb4;
  text-decoration: underline;
}

.hero--compact {
  margin-bottom: 22px;
}

.glass-card {
  background: var(--bg-light);
  color: var(--text-dark);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}

.start-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.start-mode-card {
  display: grid;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  text-align: left;
  color: var(--text-dark);
  background: rgba(38, 37, 38, 0.03);
  cursor: pointer;
}

.start-mode-card strong {
  font-size: 17px;
}

.start-mode-card span {
  color: rgba(38, 37, 38, 0.7);
  font-size: 14px;
}

.start-mode-card.is-active {
  border-color: rgba(6, 214, 160, 0.48);
  background: var(--accent-soft);
}

.panel-header,
.lookup-row,
.action-row,
.footer-actions,
.app-summary,
.category-list {
  display: flex;
}

.app-summary {
  justify-content: space-between;
  gap: 18px;
}

.panel-header {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.panel-header--tight {
  margin-bottom: 14px;
}

.panel-header h2,
.panel-header h3,
.app-summary h3 {
  margin: 0;
}

.progress-pill,
.meta-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
}

.progress-pill--light {
  background: rgba(38, 37, 38, 0.06);
}

.progress-pill,
.meta-chip--accent {
  background: var(--accent-soft);
  color: var(--text-dark);
}

.lookup-row,
.footer-actions,
.action-row {
  gap: 14px;
  align-items: end;
}

.footer-actions {
  margin-top: 24px;
  padding-top: 8px;
}

.field {
  display: block;
  flex: 1;
}

.field__label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 14px;
  padding: 16px 18px;
  color: var(--text-dark);
  background: #fff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select,
textarea {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 14px;
  padding: 16px 18px;
  color: var(--text-dark);
  background: #fff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
  min-height: 180px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(6, 214, 160, 0.18);
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 16px 20px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-primary {
  background: var(--accent-strong);
  color: var(--text-light);
  box-shadow: 0 4px 12px rgba(6, 214, 160, 0.35);
}

.btn-secondary {
  background: rgba(38, 37, 38, 0.08);
  color: var(--text-dark);
}

.btn-success {
  background: #16a34a;
  color: var(--text-light);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.28);
}

.status {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
}

.text-neutral {
  background: rgba(38, 37, 38, 0.06);
  color: rgba(38, 37, 38, 0.82);
}

.text-success {
  background: rgba(6, 214, 160, 0.12);
  color: #047857;
}

.text-warning {
  background: rgba(183, 121, 31, 0.12);
  color: var(--warning);
}

.text-danger {
  background: rgba(230, 57, 70, 0.12);
  color: var(--danger);
}

.app-summary {
  margin-top: 20px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(38, 37, 38, 0.04);
  align-items: start;
}

.muted {
  color: rgba(38, 37, 38, 0.7);
}

.panel-copy {
  margin: 8px 0 0;
  color: rgba(38, 37, 38, 0.72);
  font-size: 14px;
}

.app-summary__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.meta-chip {
  flex-direction: column;
  align-items: start;
  border-radius: 16px;
  background: rgba(38, 37, 38, 0.06);
}

.meta-chip__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(38, 37, 38, 0.62);
  margin-bottom: 4px;
}

.category-section {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--border-soft);
}

.category-list {
  flex-wrap: wrap;
  gap: 10px;
}

.category-option {
  position: relative;
}

.category-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.category-option span {
  display: inline-flex;
  align-items: center;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid rgba(38, 37, 38, 0.12);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.category-option input:checked + span {
  background: var(--accent-soft);
  border-color: rgba(6, 214, 160, 0.45);
}

.category-option--count span {
  gap: 8px;
}

.category-option--count small {
  color: rgba(38, 37, 38, 0.56);
  font-size: 12px;
  font-weight: 700;
}

.category-action-row {
  display: block;
  margin-top: 32px;
}

.niche-top-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 24px;
  align-items: stretch;
}

.niche-category-panel {
  min-width: 0;
}

.niche-category-panel h2 {
  margin: 0;
}

.category-picker {
  margin-top: 18px;
}

.popular-panel {
  border-left: 1px solid var(--border-soft);
  padding-left: 24px;
  min-height: 0;
}

.popular-panel__header {
  margin-bottom: 14px;
}

.popular-panel__header h3 {
  margin: 0;
  font-size: 22px;
}

.niche-results-panel {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
}

.niche-results-header {
  display: flex;
  align-items: end;
  gap: 14px;
}

.niche-category-list {
  margin-top: 12px;
}

.single-word-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(38, 37, 38, 0.03);
}

.single-word-toggle[hidden] {
  display: none;
}

.single-word-toggle input {
  width: auto;
  margin-top: 3px;
}

.single-word-toggle span {
  display: grid;
  gap: 4px;
}

.single-word-toggle strong {
  font-size: 14px;
}

.single-word-toggle small {
  color: rgba(38, 37, 38, 0.62);
  font-size: 13px;
  font-weight: 600;
}

.niche-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 560px;
  overflow-y: auto;
  margin-top: 18px;
  scroll-margin-top: 96px;
}

#nicheStatus {
  scroll-margin-top: 96px;
}

.popular-niche-list {
  display: grid;
  gap: 0;
  max-height: 420px;
  overflow-y: auto;
  border-top: 1px solid var(--border-soft);
}

.popular-niche-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-dark);
  text-align: left;
  cursor: pointer;
}

.popular-niche-row:hover {
  background: rgba(38, 37, 38, 0.03);
}

.popular-niche-row span {
  color: rgba(38, 37, 38, 0.48);
  font-size: 13px;
  font-weight: 800;
}

.popular-niche-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.popular-niche-row small {
  color: rgba(38, 37, 38, 0.62);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.niche-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(38, 37, 38, 0.03);
}

.niche-card__check {
  flex: 0 0 auto;
  padding-top: 2px;
}

.niche-card__check input {
  width: auto;
  padding: 0;
  margin: 0;
}

.niche-card--compact {
  padding: 12px 14px;
  border-radius: 14px;
}

.niche-card__main {
  display: grid;
  gap: 7px;
}

.niche-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: rgba(38, 37, 38, 0.7);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
}

.table-wrap--step7-scroll {
  max-height: 780px;
  overflow-y: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
}

.results-table thead {
  background: rgba(38, 37, 38, 0.05);
}

.table-wrap--step7-scroll .results-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.results-table th,
.results-table td {
  padding: 16px 18px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(38, 37, 38, 0.08);
}

.results-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.results-table tbody tr:hover {
  background: rgba(38, 37, 38, 0.03);
}

.compact-table th,
.compact-table td {
  padding: 12px 14px;
  font-size: 13px;
}

.app-link {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.app-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.checkbox-cell input {
  width: 18px;
  height: 18px;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(38, 37, 38, 0.06);
  font-weight: 700;
}

.match-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.match-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(6, 214, 160, 0.12);
  font-size: 12px;
  font-weight: 700;
}

.similar-list {
  display: grid;
  gap: 12px;
}

.ranked-list,
.enrichment-list,
.keyword-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.similar-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 42%);
  gap: 18px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: rgba(38, 37, 38, 0.03);
}

.similar-card--selected {
  border-color: rgba(6, 214, 160, 0.34);
  background: rgba(6, 214, 160, 0.04);
}

.app-info-panel {
  display: grid;
  grid-template-columns: 22px 64px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.app-select-control {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 22px;
}

.app-select-control input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.app-icon {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 14px;
  object-fit: cover;
  background: rgba(38, 37, 38, 0.06);
}

.app-detail-card {
  display: grid;
  gap: 9px;
  width: 100%;
  min-width: 0;
}

.app-detail-card p {
  margin: 0;
  color: rgba(38, 37, 38, 0.76);
  font-size: 15px;
}

.app-detail-card p:first-child {
  color: var(--text-dark);
  font-size: 17px;
}

.app-detail-card strong {
  color: var(--text-dark);
}

.app-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.app-metrics-grid span {
  min-width: 0;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(38, 37, 38, 0.05);
  color: rgba(38, 37, 38, 0.76);
  font-size: 13px;
}

.app-screenshot-strip {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  height: 150px;
  overflow: hidden;
}

.app-screenshot {
  width: 72px;
  height: 150px;
  flex: 0 0 auto;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  object-fit: cover;
  background: rgba(38, 37, 38, 0.06);
}

.app-screenshot-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: rgba(38, 37, 38, 0.05);
  color: rgba(38, 37, 38, 0.52);
  font-size: 13px;
  font-weight: 700;
}

.chart-shell {
  position: relative;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: #fff;
  min-height: 360px;
  padding: 16px;
}

.bubble-chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart-caption {
  margin-top: 12px;
  color: rgba(38, 37, 38, 0.68);
  font-size: 13px;
}

.bubble-chart__point {
  cursor: pointer;
}

.chart-tooltip {
  position: absolute;
  min-width: 220px;
  max-width: 280px;
  border: 1px solid rgba(38, 37, 38, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  padding: 12px;
  pointer-events: none;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip__title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-dark);
}

.chart-tooltip__table {
  width: 100%;
  border-collapse: collapse;
}

.chart-tooltip__table th,
.chart-tooltip__table td {
  padding: 4px 0;
  font-size: 12px;
  text-align: left;
  vertical-align: top;
}

.chart-tooltip__table th {
  width: 50%;
  color: rgba(38, 37, 38, 0.65);
  font-weight: 700;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.chart-legend__dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.similar-card__main {
  display: grid;
  gap: 6px;
}

.similar-card__title {
  color: var(--text-dark);
}

.similar-card__subtitle {
  color: rgba(38, 37, 38, 0.7);
  font-size: 14px;
}

.keyword-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(38, 37, 38, 0.03);
}

.enrichment-group {
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(38, 37, 38, 0.03);
  overflow: hidden;
}

.enrichment-group__summary {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
}

.enrichment-group__main {
  display: grid;
  gap: 4px;
  flex: 1;
}

.enrichment-group__action {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.enrichment-group__children {
  display: grid;
  gap: 8px;
  padding: 0 16px 14px 48px;
}

.enrichment-child {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

@media (max-width: 720px) {
  .start-mode-grid {
    grid-template-columns: 1fr;
  }

  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

.ranked-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: rgba(38, 37, 38, 0.03);
}

.ranked-card__main {
  display: grid;
  gap: 8px;
  width: 100%;
}

.ranked-card__header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.ranked-card__subtitle {
  color: rgba(38, 37, 38, 0.7);
  font-size: 14px;
}

.keyword-card strong {
  font-size: 15px;
}

.keyword-meta {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  margin-bottom: 18px;
}

.step3-explainer {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: rgba(38, 37, 38, 0.82);
}

.step3-app-copy {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(38, 37, 38, 0.03);
}

@media (max-width: 720px) {
  body {
    -webkit-tap-highlight-color: transparent;
  }

  .topbar,
  .category-option,
  .popular-niche-row,
  .niche-card,
  .similar-card,
  .progress-pill,
  .status,
  .match-chip,
  .single-word-toggle {
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
  }

  input,
  textarea,
  select {
    -webkit-user-select: text;
    user-select: text;
  }

  .topbar__inner {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px 16px;
    padding: 16px 0;
  }

  .topbar__actions {
    grid-column: 2;
    min-width: 0;
    align-items: flex-end;
    gap: 10px;
  }

  .topbar__link {
    max-width: 100%;
    text-align: right;
    font-size: 13px;
    line-height: 1.25;
  }

  .brand__logo {
    height: 26px;
  }

  .topbar__audit-btn {
    padding: 9px 14px;
    font-size: 13px;
    white-space: nowrap;
  }
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-actions--tight {
  justify-content: flex-start;
}

.section-break {
  margin-top: 26px;
}

.three-up-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.subcard {
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: rgba(38, 37, 38, 0.03);
  padding: 18px;
}

.subcard__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.subcard__header h4 {
  margin: 0;
}

.btn-small {
  padding: 10px 12px;
  font-size: 13px;
}

.btn-compact {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
}

.inline-action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 0 0;
}

.table-section-header {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(38, 37, 38, 0.08);
  background: rgba(38, 37, 38, 0.03);
}

.table-section-header h4 {
  margin: 0;
}

.metric-help,
.metric-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
}

.metric-help {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(38, 37, 38, 0.12);
  color: rgba(38, 37, 38, 0.78);
  font-size: 11px;
  font-weight: 900;
  text-transform: none;
  letter-spacing: 0;
}

.metric-help > span,
.metric-cell > span {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  z-index: 12;
  display: none;
  width: 260px;
  transform: translateX(-50%);
  border-radius: 12px;
  background: #262526;
  color: #fff;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

.metric-help:hover > span,
.metric-help:focus > span,
.metric-cell:hover > span,
.metric-cell:focus > span {
  display: block;
}

.title-optimization-table {
  overflow: visible;
}

.difficulty-header-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.difficulty-sort-header {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  text-align: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.difficulty-sort-header:hover {
  color: var(--accent-strong);
}

.compact-table th,
.compact-table td {
  padding: 12px 14px;
  font-size: 13px;
}

.chart-shell {
  position: relative;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: #fff;
  min-height: 360px;
  padding: 16px;
}

.bubble-chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart-caption {
  margin-top: 12px;
  color: rgba(38, 37, 38, 0.68);
  font-size: 13px;
}

.bubble-chart__point {
  cursor: pointer;
}

.chart-tooltip {
  position: absolute;
  min-width: 220px;
  max-width: 280px;
  border: 1px solid rgba(38, 37, 38, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  padding: 12px;
  pointer-events: none;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip__title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-dark);
}

.chart-tooltip__table {
  width: 100%;
  border-collapse: collapse;
}

.chart-tooltip__table th,
.chart-tooltip__table td {
  padding: 4px 0;
  font-size: 12px;
  text-align: left;
  vertical-align: top;
}

.chart-tooltip__table th {
  width: 50%;
  color: rgba(38, 37, 38, 0.65);
  font-weight: 700;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.chart-legend__dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.filter-grid,
.metadata-grid,
.metadata-insights {
  display: grid;
  gap: 12px;
}

.filter-grid {
  grid-template-columns: minmax(260px, 1.7fr) repeat(3, minmax(132px, 0.8fr)) minmax(94px, 0.45fr) minmax(112px, 0.45fr);
  align-items: end;
  margin-bottom: 16px;
}

.filter-field--regex,
.filter-field--sap {
  min-width: 0;
}

.filter-field--regex input,
.filter-field--sap input {
  height: 54px;
  padding-top: 0;
  padding-bottom: 0;
}

.filter-field > span {
  display: flex;
  align-items: center;
  min-height: 16px;
  margin-bottom: 8px;
  color: rgba(38, 37, 38, 0.72);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filter-menu {
  position: relative;
}

.filter-menu__label,
.filter-action__label {
  display: block;
  min-height: 16px;
  margin-bottom: 8px;
  color: rgba(38, 37, 38, 0.72);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filter-menu summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 54px;
  border: 1px solid rgba(38, 37, 38, 0.12);
  border-radius: 14px;
  background: #fff;
  color: var(--text-dark);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.filter-menu summary::-webkit-details-marker {
  display: none;
}

.filter-menu summary::after {
  content: "⌄";
  color: rgba(38, 37, 38, 0.55);
  font-size: 14px;
}

.filter-menu[open] summary::after {
  content: "⌃";
}

.filter-menu summary strong {
  color: var(--text-dark);
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.filter-options {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5;
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid rgba(38, 37, 38, 0.12);
  border-radius: 14px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.14);
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(38, 37, 38, 0.82);
  font-size: 13px;
  font-weight: 700;
}

.filter-check input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.filter-check span {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 700;
}

.regex-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 999px;
  background: rgba(38, 37, 38, 0.12);
  color: rgba(38, 37, 38, 0.78);
  font-size: 11px;
  font-weight: 900;
  text-transform: none;
  letter-spacing: 0;
  cursor: help;
}

.regex-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 10;
  display: none;
  width: 280px;
  transform: translateX(-50%);
  border-radius: 12px;
  background: #262526;
  color: #fff;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

.regex-help:hover .regex-tooltip,
.regex-help:focus .regex-tooltip {
  display: block;
}

.filter-action .btn {
  width: 100%;
  height: 54px;
  padding: 0 12px;
  border-radius: 14px;
}

.selected-keywords {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

#keywordMapSection .table-wrap {
  border-radius: 14px;
}

#keywordMapSection .results-table {
  table-layout: fixed;
}

#keywordMapSection .results-table th,
#keywordMapSection .results-table td {
  padding: 13px 16px;
  white-space: nowrap;
}

#keywordMapSection .results-table th:nth-child(1),
#keywordMapSection .results-table td:nth-child(1) {
  width: 88px;
}

#keywordMapSection .results-table th:nth-child(2),
#keywordMapSection .results-table td:nth-child(2) {
  width: 34%;
  white-space: normal;
}

#keywordMapSection .results-table th:nth-child(3),
#keywordMapSection .results-table td:nth-child(3) {
  width: 120px;
}

#keywordMapSection .results-table th:nth-child(4),
#keywordMapSection .results-table td:nth-child(4) {
  width: 190px;
  white-space: normal;
}

#keywordMapSection .results-table th:nth-child(5),
#keywordMapSection .results-table td:nth-child(5) {
  width: 150px;
}

#keywordMapSection .results-table th:nth-child(6),
#keywordMapSection .results-table td:nth-child(6) {
  width: 80px;
  text-align: right;
}

.sort-header {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  text-align: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.sort-header:hover {
  color: var(--accent-strong);
}

.metadata-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.current-metadata-panel {
  margin-bottom: 18px;
}

.current-metadata-panel .lookup-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
}

.current-metadata-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.current-metadata-summary div {
  border: 1px solid rgba(38, 37, 38, 0.1);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(38, 37, 38, 0.035);
}

.current-metadata-summary span {
  display: block;
  margin-bottom: 4px;
  color: rgba(38, 37, 38, 0.62);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.current-metadata-summary strong {
  display: block;
  color: var(--text-dark);
  font-size: 14px;
}

.metadata-grid__wide {
  grid-column: 1 / -1;
}

.metadata-insights {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.insight-copy,
.mini-muted {
  color: rgba(38, 37, 38, 0.72);
  font-size: 14px;
  line-height: 1.5;
}

.mini-muted {
  margin-top: 8px;
}

.metadata-coverage-grid {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.metadata-coverage-grid span {
  display: block;
}

.coverage-keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.coverage-keyword {
  color: rgba(38, 37, 38, 0.72);
  font-size: 13px;
  font-weight: 800;
}

.coverage-keyword--covered {
  color: #047857;
}

.suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(38, 37, 38, 0.12);
  border-radius: 999px;
  padding: 9px 12px;
  background: #fff;
  color: var(--text-dark);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.word-chip:hover {
  border-color: rgba(6, 214, 160, 0.45);
  background: var(--accent-soft);
}

.word-chip span {
  color: rgba(38, 37, 38, 0.58);
  font-size: 12px;
}

.word-chip--selected {
  background: var(--accent-soft);
  border-color: rgba(6, 214, 160, 0.4);
}

.table-wrap--mini {
  max-height: 320px;
  overflow-y: auto;
}

.text-danger-inline {
  color: var(--danger);
}

.empty-state {
  text-align: center;
  color: rgba(38, 37, 38, 0.7);
  padding: 44px 18px;
}

@media (max-width: 860px) {
  .lookup-row,
  .app-summary,
  .footer-actions,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page {
    width: min(1100px, calc(100vw - 20px));
    padding-top: 28px;
  }

  .three-up-grid {
    grid-template-columns: 1fr;
  }

  .niche-top-layout {
    grid-template-columns: 1fr;
  }

  .popular-panel {
    border-left: 0;
    border-top: 1px solid var(--border-soft);
    padding-left: 0;
    padding-top: 22px;
  }

  .niche-results-header {
    flex-direction: column;
    align-items: stretch;
  }

  .niche-list {
    grid-template-columns: 1fr;
  }

  .app-metrics-grid {
    grid-template-columns: 1fr;
  }

  .similar-card {
    grid-template-columns: 1fr;
  }

  .app-screenshot-strip {
    justify-content: flex-start;
    height: 132px;
  }

  .app-screenshot {
    width: 64px;
    height: 132px;
  }

  .filter-grid,
  .metadata-grid,
  .metadata-insights,
  .current-metadata-panel .lookup-row,
  .current-metadata-summary {
    grid-template-columns: 1fr;
  }

  .filter-options {
    position: static;
    margin-top: 6px;
  }

  .subcard__header {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .glass-card {
    padding: 20px;
    border-radius: 20px;
  }
}
