/* Mobile application shell and interaction layout. */
.mobile-table-toolbar {
  display: none;
}


.creator-picker-close,
.profile-picker-close {
  display: none;
}

@media (max-width: 720px) {
  html {
    overflow-x: hidden;
    background: var(--bg);
  }

  body {
    min-width: 320px;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  .shell {
    display: block;
    min-height: 100dvh;
  }

  .shell > aside {
    position: fixed;
    z-index: 1000;
    inset: auto 0 0;
    display: block;
    width: 100%;
    height: calc(72px + env(safe-area-inset-bottom));
    padding: 6px 8px env(safe-area-inset-bottom);
    border: 0;
    border-top: 1px solid var(--line);
    background: rgba(6, 16, 29, .96);
    box-shadow: 0 -14px 34px rgba(0, 0, 0, .34);
    backdrop-filter: blur(18px);
  }

  .shell > aside .logo,
  .shell > aside .plan,
  .shell > aside .user {
    display: none !important;
  }

  .shell > aside nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    height: 60px;
  }

  .shell > aside .nav {
    display: flex;
    height: 58px;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.05;
    text-align: center;
  }

  .shell > aside .nav i {
    width: 24px;
    height: 24px;
    margin: 0;
  }

  .shell > aside .nav .nav-icon {
    width: 22px;
    height: 22px;
  }

  .shell > aside .nav span {
    display: block !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .shell > aside .nav.on {
    background: linear-gradient(180deg, rgba(119, 75, 230, .34), rgba(63, 42, 126, .46));
  }

  main {
    width: 100%;
    padding: 18px 14px calc(96px + env(safe-area-inset-bottom));
  }

  h1 {
    font-size: clamp(27px, 8vw, 32px);
    line-height: 1.14;
  }

  h2 {
    line-height: 1.24;
  }

  .row.between.top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
  }

  .row.between.top h1 {
    min-width: 0;
    margin-bottom: 4px;
    overflow-wrap: anywhere;
  }

  .row.between.top > .btn,
  .compare-header-actions .btn {
    min-height: 44px;
  }

  .btn,
  .input,
  .select,
  button,
  select,
  textarea {
    touch-action: manipulation;
  }

  .btn,
  .input,
  .select {
    min-height: 44px;
  }

  .crumb {
    margin-bottom: 16px;
    line-height: 1.45;
  }

  .tabs {
    display: flex;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .tabs button {
    min-width: 0;
    min-height: 44px;
    flex: 1 1 0;
    padding: 0 8px;
    font-size: 12px;
  }

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

  .filters > *,
  .content-filter {
    min-width: 0;
    width: 100%;
  }

  .custom-filter-trigger,
  .content-filter .select {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .custom-filter-trigger {
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) 14px;
  }

  .custom-filter-trigger > span,
  .custom-filter-trigger > b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .preliminary-toggle,
  .clear-content-filters {
    grid-column: 1 / -1;
    width: 100%;
  }

  .custom-filter-panel,
  .account-panel {
    position: fixed;
    z-index: 1600;
    inset: 12px 10px calc(84px + env(safe-area-inset-bottom));
    width: auto;
    max-height: none;
    overflow: auto;
    border-radius: 16px;
  }

  .custom-filter-options {
    max-height: none;
  }

  /* Content and competitor tables become full-information cards. */
  .table-card {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .mobile-table-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(145deg, #101d30, #091524);
  }

  .mobile-table-toolbar label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-table-toolbar select {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 10px;
    border: 1px solid #3b4e68;
    border-radius: 8px;
    background: #091626;
    color: #f4f6fa;
    font: inherit;
  }

  .mobile-table-toolbar button {
    display: grid;
    place-items: center;
    width: 48px;
    height: 44px;
    border: 1px solid #5e45a2;
    border-radius: 8px;
    background: #211a42;
    color: #c5a0ff;
    font-size: 20px;
    cursor: pointer;
  }

  .table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .table thead {
    display: none;
  }

  .table tbody {
    display: grid;
    gap: 12px;
  }

  .table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(145deg, #101d30, #091524);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .12);
  }

  .table tbody td,
  .table tbody td.muted {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    padding: 9px 8px;
    border: 0;
    border-top: 1px solid rgba(48, 64, 87, .66);
    color: #e8edf5;
    font-size: 13px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .table tbody td::before {
    color: #7f8ea4;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .table tbody td:nth-child(1) {
    grid-column: 1 / -1;
    padding: 0 0 14px;
    border-top: 0;
  }

  .table tbody td:nth-child(1)::before { content: none; }
  .table tbody td:nth-child(2)::before { content: "Account"; }
  .table tbody td:nth-child(3)::before { content: "Type"; }
  .table tbody td:nth-child(4)::before { content: "Date"; }
  .table tbody td:nth-child(5)::before { content: "Duration"; }
  .table tbody td:nth-child(6)::before { content: "Views"; }
  .table tbody td:nth-child(7)::before { content: "vs Baseline"; }
  .table tbody td:nth-child(8)::before { content: "ER"; }
  .table tbody td:nth-child(9)::before { content: "Creative"; }
  .table tbody td:nth-child(10)::before { content: "Performance"; }
  .table tbody td:nth-child(11)::before { content: "Final"; }
  .table tbody td:nth-child(12)::before { content: "Hook"; }
  .table tbody td:nth-child(13)::before { content: "CTA"; }

  .table .media {
    width: 100%;
    min-width: 0;
    align-items: center;
    gap: 13px;
  }

  .table .thumb {
    width: 64px;
    height: 86px;
    border-radius: 10px;
  }

  .table .media > span,
  .table .content-title {
    display: -webkit-box;
    width: auto;
    min-width: 0;
    flex: 1;
    overflow: hidden;
    line-height: 1.38;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .table .media > span > small {
    display: block;
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .table-profile-name {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .table .score {
    min-height: 36px;
  }

  .table-card .footer {
    display: block;
    padding: 14px 2px;
    line-height: 1.5;
  }

  .table-card .footer span:not(:first-child) {
    display: none;
  }

  /* Add-content and import flows. */
  .source-form,
  .form-card,
  .steps,
  .source-list,
  .available,
  .preview-card {
    padding: 18px;
  }

  .bulk-row {
    grid-template-columns: 34px minmax(0, 1fr) 40px;
    gap: 9px;
    padding: 12px 10px;
  }

  .bulk-row > i {
    grid-column: 1;
    grid-row: 1;
  }

  .bulk-row .bulk-input,
  .bulk-row > .input {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .bulk-row .bulk-limit,
  .bulk-row .single-label {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    text-align: left;
  }

  .bulk-row .bulk-limit select {
    width: 100%;
    height: 42px;
  }

  .bulk-row .remove-source {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
    width: 40px;
    height: 40px;
  }

  .bulk-summary {
    gap: 14px;
  }

  .bulk-summary label {
    display: flex;
    align-items: center;
    gap: 9px;
    white-space: normal;
  }

  .bulk-summary input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }

  .urlrow {
    grid-template-columns: 1fr;
  }

  .urlrow .btn {
    width: 100%;
  }

  .account-found {
    align-items: flex-start;
    padding: 16px;
  }

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

  .metrics3 > * {
    min-width: 0;
  }

  .metric b {
    font-size: 19px;
  }

  /* Import, confirmation and toast layers. */
  .modal-backdrop {
    z-index: 2000;
    align-items: end;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }

  .modal {
    width: 100%;
    max-height: calc(100dvh - 20px - env(safe-area-inset-bottom));
    padding: 24px 18px 18px;
    overflow: auto;
    border-radius: 20px 20px 14px 14px;
  }

  .modal h2 {
    padding-right: 28px;
    font-size: 23px;
  }

  .modal-close {
    width: 44px;
    height: 44px;
    right: 9px;
    top: 8px;
  }

  .limit-pills > * {
    flex: 1 1 calc(33.333% - 8px);
    justify-content: center;
  }

  .toast {
    z-index: 2100;
    right: 14px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    left: 14px;
    text-align: center;
  }

  /* Detail screen. */
  .detail-navigation {
    width: 100%;
  }

  .detail-back-button {
    min-height: 44px;
  }

  .iphone-frame {
    width: min(100%, 340px);
  }

  .detail-side .score-panel,
  .detail-side-context .publication-details,
  .detail-metrics-panel,
  .instagram-section,
  .intelligence-section,
  .audio-content-timeline,
  .comments-panel {
    padding-right: 16px;
    padding-left: 16px;
  }

  .hero-scores {
    gap: 14px;
  }

  .detail-side .big-score,
  .detail-side .hero-scores strong {
    font-size: 34px;
  }

  .ai-status.ready {
    align-items: center;
  }

  .ai-status .ai-verdict-copy span {
    display: block;
  }

  .audio-file {
    min-width: 0;
  }

  .audio-file > div:last-child {
    min-width: 0;
  }

  .audio-file b,
  .audio-file small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .audio-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(3, 44px);
    width: 100%;
  }

  .audio-clock {
    min-width: 0;
    justify-content: center;
  }

  .public-comment {
    padding: 16px;
  }

  .public-comment > p {
    font-size: 14px;
    line-height: 1.5;
  }

  .comments-load-all {
    width: 100%;
  }

  /* Competitor intelligence. */
  .competitor-hero {
    padding: 16px;
  }

  .competitor-hero .actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 9px;
  }

  .competitor-hero .actions > span {
    margin-bottom: 2px;
  }

  .competitor-hero .actions .btn {
    width: 100%;
  }

  .summary5 {
    gap: 10px;
  }

  .summary5 .card {
    min-height: 132px;
    padding: 15px;
  }

  .summary5 b {
    overflow: visible;
    font-size: 19px;
    line-height: 1.18;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .patterns,
  .bars {
    padding: 16px;
  }

  .patterns h2,
  .bars h2 {
    font-size: 17px;
  }

  .pattern {
    padding-right: 70px;
  }

  .performance-distribution {
    gap: 7px;
    padding-right: 6px;
    padding-left: 6px;
  }

  .distribution-legend {
    margin: 0 4px;
    flex-wrap: wrap;
  }

  .publishing-frequency {
    padding: 16px;
    overflow: hidden;
  }

  .frequency-head {
    min-width: 0;
    flex-direction: column;
    gap: 14px;
  }

  .frequency-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, .8fr);
    width: 100%;
  }

  .frequency-toggle,
  .frequency-controls .select {
    width: 100%;
    min-width: 0;
  }

  .frequency-toggle button {
    min-width: 0;
    min-height: 44px;
    flex: 1;
    padding: 0 8px;
  }

  .frequency-chart {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(6, minmax(36px, 1fr));
    grid-auto-flow: column;
    grid-auto-columns: minmax(36px, 1fr);
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .frequency-column {
    min-width: 38px;
  }

  .frequency-footer {
    display: grid;
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .frequency-legend {
    margin: 3px 0 0;
    flex-wrap: wrap;
  }

  .tracked-profile-trigger {
    min-height: 70px;
    padding: 9px 12px;
  }

  .competitor-dropdown {
    position: fixed;
    z-index: 1700;
    inset: 12px 10px calc(84px + env(safe-area-inset-bottom));
    width: auto;
    max-height: none;
    overflow: auto;
    border-radius: 16px;
  }

  .creator-picker-close,
  .profile-picker-close {
    position: absolute;
    z-index: 4;
    top: 6px;
    right: 7px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: #15243a;
    color: #d9e2f1;
    font: 24px/1 inherit;
  }

  .competitor-dropdown > h3 {
    padding-right: 42px;
  }

  .competitor-options {
    max-height: none;
  }

  .profile-search {
    margin-right: 14px;
    margin-left: 14px;
  }

  .competitor-option {
    min-height: 76px;
    padding: 10px 12px;
  }

  .competitor-detail-backdrop,
  .competitor-crawl-backdrop,
  .profile-remove-backdrop {
    z-index: 1900;
    align-items: end;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }

  .competitor-detail-modal,
  .competitor-crawl-modal,
  .profile-remove-dialog {
    width: 100%;
    max-height: calc(100dvh - 20px - env(safe-area-inset-bottom));
    border-radius: 18px 18px 12px 12px;
  }

  .competitor-bar {
    grid-template-columns: minmax(96px, 1fr) minmax(80px, 1fr) 38px;
    gap: 8px;
  }

  .competitor-example {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .competitor-example > strong {
    grid-column: 2;
    text-align: left;
  }

  /* Comparison and shared publication picker. */
  .compare-lead,
  .experiment-lead,
  .processing-lead {
    margin-top: 0;
    line-height: 1.45;
  }

  .compare-selector {
    min-height: 0;
    padding: 16px;
  }

  .compare-selector.empty {
    min-height: 280px;
  }

  .compare-selector-body {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
  }

  .compare-thumb {
    height: 96px;
  }

  .compare-selector h2 {
    font-size: 16px;
  }

  .compare-header-actions {
    min-width: 0;
  }

  .creator-picker-panel,
  .experiment-pair .creator-picker-panel,
  .experiment-media-card.variant > .creator-content-picker .creator-picker-panel {
    position: fixed;
    z-index: 1800;
    inset: 12px 10px calc(84px + env(safe-area-inset-bottom));
    width: auto;
    min-width: 0;
    height: auto;
    border-radius: 16px;
  }

  .creator-content-picker.open {
    z-index: 1850;
  }

  .creator-picker-search {
    padding-right: 52px;
  }

  .creator-picker-layout {
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100% - 52px);
  }

  .creator-picker-layout aside {
    position: static;
    top: auto;
    display: flex;
    width: auto;
    height: auto;
    max-height: 112px;
    flex-direction: row;
    gap: 6px;
    padding: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
  }

  .creator-choice {
    min-width: 154px;
    min-height: 54px;
    flex: 0 0 154px;
  }

  .creator-publication {
    min-height: 68px;
  }

  .compare-verdict > div {
    padding: 16px 0;
    border: 0;
    border-top: 1px solid var(--line);
  }

  .compare-verdict > div:first-child {
    padding-top: 0;
    border-top: 0;
  }

  .compare-metric > div {
    gap: 12px;
  }

  .mechanics-grid {
    grid-template-columns: 1fr;
  }

  .mechanics-column + * {
    margin-top: 12px;
    padding: 12px 0 0;
    border: 0;
    border-top: 1px solid var(--line);
  }

  .response-grid {
    grid-template-columns: minmax(82px, 1.1fr) minmax(0, 1fr) minmax(0, 1fr);
  }

  .response-grid > * {
    padding: 8px 4px;
    font-size: 11px;
  }

  .compare-waiting {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 4px;
  }

  /* Experiment builder. */
  .experiment-pair {
    gap: 12px;
  }

  .experiment-link {
    min-height: 58px;
  }

  .experiment-media-card {
    min-height: 0;
    padding: 18px;
  }

  .experiment-media-body {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
  }

  .experiment-poster {
    height: 150px;
  }

  .experiment-observed {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .experiment-observed b {
    min-width: 0;
    padding: 0 7px;
  }

  .variant-source-tabs button {
    min-width: 0;
    height: 50px;
    padding: 4px 6px;
    font-size: 10px;
    line-height: 1.2;
  }

  .variant-source-tabs .ui-icon {
    display: none;
  }

  .variant-option {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 8px 10px;
    min-height: 72px;
  }

  .variant-option em,
  .variant-option i {
    grid-column: 2;
  }

  .variant-option i {
    justify-self: start;
  }

  .experiment-config,
  .experiment-summary {
    padding: 16px;
  }

  .experiment-alternatives {
    grid-template-columns: 1fr;
  }

  .experiment-change {
    grid-template-columns: 32px minmax(0, 1fr) 30px;
  }

  .experiment-change > i,
  .experiment-change > em {
    display: none;
  }

  .experiment-summary-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .experiment-summary-row > button {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 42px;
  }

  .experiment-actions,
  .experiment-actions > div {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 9px;
  }

  .experiment-actions .btn,
  .experiment-actions .btn.primary {
    width: 100%;
    min-width: 0;
  }

  .experiment-video-dropzone {
    min-height: 96px;
  }

  /* Processing and review screens. */
  .process-job-label {
    font-size: 16px;
  }

  .process-overall-label b {
    font-size: 30px;
  }

  .process-step-status {
    min-height: 30px;
    display: flex;
    align-items: center;
  }

  .review-form .row {
    align-items: stretch;
    flex-direction: column;
  }

  .timeline-table {
    overflow-x: auto;
  }

  .timeline-table .table {
    display: table;
    min-width: 680px;
  }

  .timeline-table .table thead {
    display: table-header-group;
  }

  .timeline-table .table tbody {
    display: table-row-group;
  }

  .timeline-table .table tr {
    display: table-row;
    padding: 0;
    background: transparent;
  }

  .timeline-table .table td {
    display: table-cell;
    padding: 10px 11px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
  }

  .timeline-table .table td::before {
    content: none;
  }

  .bottom-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    margin: 18px 0 0;
    padding: 14px 0 0;
  }

  .bottom-actions .btn {
    width: 100%;
  }
}

@media (max-width: 390px) {
  main {
    padding-right: 12px;
    padding-left: 12px;
  }

  .row.between.top {
    grid-template-columns: 1fr;
  }

  .row.between.top > .btn,
  .row.between.top > .compare-header-actions,
  .compare-header-actions .btn {
    width: 100%;
  }

  .compare-header-actions {
    display: block;
  }

  .summary5 {
    grid-template-columns: 1fr 1fr;
  }

  .experiment-media-body {
    grid-template-columns: 1fr;
  }

  .experiment-poster {
    width: 100%;
    height: 210px;
  }
}

/* Compact mobile comparison matrix: both publications stay visible side by side. */
@media (max-width: 720px) {
  #app:has(.compare-selectors) {
    display: flex;
    flex-direction: column;
  }

  #app:has(.compare-selectors) > .row.between.top {
    order: 1;
  }

  #app:has(.compare-selectors) > .compare-lead {
    order: 2;
  }

  #app:has(.compare-selectors) > .compare-selectors {
    order: 3;
  }

  #app:has(.compare-selectors) > .compare-eligibility {
    order: 4;
  }

  #app:has(.compare-selectors) > .compare-metrics {
    order: 5;
  }

  #app:has(.compare-selectors) > .compare-context {
    order: 6;
  }

  #app:has(.compare-selectors) > .compare-verdict-card {
    order: 7;
  }

  #app:has(.compare-selectors) > .compare-analysis-grid {
    order: 8;
  }

  #app:has(.compare-selectors) > .compare-action-plan,
  #app:has(.compare-selectors) > .compare-waiting-card {
    order: 9;
  }

  .row.between.top:has(.compare-header-actions) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .row.between.top:has(.compare-header-actions) h1 {
    margin: 0;
    font-size: clamp(25px, 7vw, 30px);
  }

  .row.between.top:has(.compare-header-actions) > .compare-header-actions,
  .row.between.top:has(.compare-header-actions) .compare-header-actions .btn {
    width: auto;
  }

  .row.between.top:has(.compare-header-actions) .compare-header-actions .btn {
    min-height: 40px;
    padding: 0 12px;
    font-size: 12px;
  }

  .compare-lead {
    margin-bottom: 12px;
    font-size: 11px;
  }

  .compare-selectors {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
    gap: 6px;
    align-items: stretch;
  }

  .compare-selector,
  .compare-selector.empty {
    min-width: 0;
    min-height: 126px;
    padding: 10px;
    border-radius: 10px;
  }

  .compare-selector > span {
    font-size: 9px;
    letter-spacing: .03em;
  }

  .compare-selector-body {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 7px;
    margin-top: 8px;
  }

  .compare-thumb {
    height: 62px;
    border-radius: 7px;
  }

  .compare-selector-body b {
    font-size: 10px;
  }

  .compare-selector h2 {
    min-height: 30px;
    margin: 3px 0;
    font-size: 11px;
    line-height: 1.3;
  }

  .compare-selector-body small {
    font-size: 8px;
  }

  .compare-selector:not(.empty) .creator-content-picker {
    margin: 7px 0 0;
  }

  .compare-selector:not(.empty) .creator-picker-trigger {
    display: flex;
    min-height: 34px;
    justify-content: center;
    gap: 5px;
    padding: 4px 7px;
  }

  .compare-selector:not(.empty) .creator-picker-trigger > span:first-child,
  .compare-selector:not(.empty) .creator-picker-trigger small {
    display: none;
  }

  .compare-selector:not(.empty) .creator-picker-trigger b {
    font-size: 9px;
    white-space: nowrap;
  }

  .compare-selector:not(.empty) .creator-picker-trigger > i {
    font-size: 12px;
  }

  .compare-vs {
    align-self: center;
    width: 28px;
    height: 28px;
    margin: 0;
    font-size: 9px;
  }

  .compare-selector.empty {
    justify-content: flex-start;
    min-height: 218px;
  }

  .compare-selector.empty .compare-empty-icon {
    width: 42px;
    height: 42px;
    margin: 10px auto 8px;
  }

  .compare-selector.empty h2 {
    min-height: 0;
    font-size: 12px;
  }

  .compare-selector.empty p {
    display: -webkit-box;
    min-height: 31px;
    overflow: hidden;
    font-size: 9px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .compare-selector.empty .creator-content-picker {
    margin: 10px 0 5px;
  }

  .compare-selector.empty .creator-picker-trigger {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    min-height: 48px;
    gap: 6px;
    padding: 6px;
  }

  .compare-selector.empty .creator-picker-trigger > span:first-child {
    width: 30px;
    height: 30px;
  }

  .compare-selector.empty .creator-picker-trigger b {
    font-size: 9px;
  }

  .compare-selector.empty .creator-picker-trigger small,
  .compare-selector.empty > small {
    display: none;
  }

  .compare-eligibility {
    width: 100%;
    max-width: none;
    margin: 10px 0 12px;
    padding: 7px 10px;
    font-size: 9px;
    line-height: 1.35;
  }

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

  .compare-metric {
    padding: 10px;
  }

  .compare-metric small {
    font-size: 9px;
  }

  .compare-metric > div {
    gap: 5px;
    margin-top: 6px;
  }

  .compare-metric b {
    font-size: 17px;
  }

  .compare-metric span {
    font-size: 9px;
  }

  .compare-metric:last-child {
    grid-column: 1 / -1;
  }

  .compare-context {
    padding: 9px 4px;
    font-size: 9px;
    text-align: center;
  }
}

/* Compact publication cards and controls introduced for the final mobile layout. */
.mobile-publication-card,
.mobile-content-controls {
  display: none;
}

@media (max-width: 720px) {
  /* Content controls stay on one row; the complete filter set opens below. */
  .mobile-content-controls {
    display: grid;
    grid-template-columns: 44px 44px minmax(0, 1fr);
    gap: 7px;
    margin: 10px 0;
  }

  .mobile-filter-toggle,
  .mobile-preliminary-toggle,
  .mobile-sort-control > button {
    position: relative;
    display: grid;
    width: 44px;
    height: 42px;
    min-height: 42px;
    place-items: center;
    padding: 0;
    border: 1px solid #30435d;
    border-radius: 10px;
    background: #0b1727;
    color: #9facbf;
  }

  .mobile-filter-toggle.active,
  .mobile-preliminary-toggle.on {
    border-color: #7d5ee6;
    background: #211a42;
    color: #c8adff;
  }

  .mobile-filter-toggle .ui-icon,
  .mobile-preliminary-toggle .ui-icon {
    width: 20px;
    height: 20px;
  }

  .mobile-filter-toggle small,
  .mobile-preliminary-toggle small {
    position: absolute;
    top: -5px;
    right: -4px;
    display: grid;
    min-width: 17px;
    height: 17px;
    place-items: center;
    padding: 0 4px;
    border: 2px solid var(--bg);
    border-radius: 20px;
    background: #805fe8;
    color: white;
    font-size: 8px;
    font-weight: 800;
  }

  .mobile-sort-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    min-width: 0;
    gap: 6px;
    padding: 0;
  }

  .mobile-sort-control label {
    position: relative;
    min-width: 0;
  }

  .mobile-sort-control label > span {
    position: absolute;
    z-index: 1;
    top: 5px;
    left: 10px;
    color: #74849a;
    font-size: 7px;
    font-weight: 800;
    letter-spacing: .07em;
    line-height: 1;
    text-transform: uppercase;
    pointer-events: none;
  }

  .mobile-sort-control select {
    width: 100%;
    height: 42px;
    min-width: 0;
    padding: 13px 24px 2px 9px;
    border: 1px solid #30435d;
    border-radius: 10px;
    outline: 0;
    background: #0b1727;
    color: #edf2f8;
    font-size: 11px;
    font-weight: 700;
  }

  .mobile-sort-control > button {
    width: 38px;
    color: #c6a8ff;
    font-size: 18px;
  }

  .content-page .table-card > .mobile-table-toolbar {
    display: none;
  }

  .content-page .mobile-filters-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 11px;
    padding: 11px;
    border: 1px solid #2f415a;
    border-radius: 12px;
    background: linear-gradient(145deg, #101d30, #091524);
    box-shadow: 0 15px 34px rgba(0, 0, 0, .2);
  }

  .content-page .mobile-filters-panel[hidden] {
    display: none !important;
  }

  .mobile-filter-panel-head {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    padding: 1px 1px 4px;
  }

  .mobile-filter-panel-head div {
    display: grid;
    gap: 2px;
  }

  .mobile-filter-panel-head b {
    font-size: 13px;
  }

  .mobile-filter-panel-head small {
    color: var(--muted);
    font-size: 9px;
  }

  .mobile-filter-panel-head button {
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid #684cb9;
    border-radius: 8px;
    background: #211a42;
    color: #ceb8ff;
    font-size: 10px;
    font-weight: 800;
  }

  .content-page .mobile-filters-panel .preliminary-toggle {
    display: none;
  }

  /* A mobile row is a single horizontal score card. */
  .table tbody tr,
  .table tbody tr:hover {
    display: block;
    padding: 0;
    border: 1px solid #263950;
    border-radius: 13px;
    background: linear-gradient(145deg, #101d30, #091524);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
    overflow: hidden;
  }

  .table tbody tr[hidden] {
    display: none !important;
  }

  .table tbody td,
  .table tbody td.muted {
    display: none !important;
  }

  .table tbody td.mobile-publication-card {
    display: grid !important;
    grid-template-columns: 70px minmax(0, 1fr) 12px;
    align-items: stretch;
    gap: 9px;
    padding: 9px;
    border: 0;
    color: #edf2f8;
    white-space: normal;
  }

  .mobile-publication-card::before {
    content: none !important;
  }

  .mobile-publication-thumb {
    position: relative;
    display: block;
    width: 70px;
    min-height: 118px;
    align-self: stretch;
    border-radius: 9px;
    background: linear-gradient(145deg, #31245d, #13243b) center / cover no-repeat;
    overflow: hidden;
  }

  .mobile-publication-thumb::after {
    position: absolute;
    inset: 0;
    content: "";
    background: linear-gradient(180deg, transparent 52%, rgba(4, 10, 18, .72));
  }

  .mobile-publication-thumb > i {
    position: absolute;
    z-index: 1;
    top: 7px;
    left: 7px;
    display: grid;
    width: 23px;
    height: 23px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 50%;
    background: rgba(5, 12, 22, .62);
    color: white;
  }

  .mobile-publication-thumb .ui-icon {
    width: 13px;
    height: 13px;
  }

  .mobile-publication-thumb > small {
    position: absolute;
    z-index: 1;
    right: 6px;
    bottom: 5px;
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(4, 10, 18, .72);
    color: #f4f7fb;
    font-size: 8px;
    font-weight: 700;
  }

  .mobile-publication-body {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 5px;
  }

  .mobile-publication-head {
    display: grid;
    grid-template-columns: 21px minmax(0, auto) minmax(0, 1fr) auto;
    min-width: 0;
    align-items: center;
    gap: 5px;
  }

  .mobile-publication-head > i {
    display: grid;
    width: 21px;
    height: 21px;
    place-items: center;
    border: 1px solid #6f55c6;
    border-radius: 50%;
    background: #201840;
    color: #d5c2ff;
    font-size: 7px;
    font-style: normal;
    font-weight: 800;
  }

  .mobile-publication-head > b {
    min-width: 0;
    max-width: 112px;
    overflow: hidden;
    color: #f5f7fb;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-publication-head > small {
    min-width: 0;
    overflow: hidden;
    color: #6f8096;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-publication-head > time {
    color: #7e8ca0;
    font-size: 8px;
    white-space: nowrap;
  }

  .mobile-publication-title {
    display: -webkit-box;
    min-width: 0;
    overflow: hidden;
    color: #e9eef5;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  .mobile-publication-hook {
    display: flex;
    min-width: 0;
    gap: 5px;
    overflow: hidden;
    color: #aab5c5;
    font-size: 8px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-publication-hook em {
    flex: none;
    color: #9c7ef1;
    font-size: 7px;
    font-style: normal;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .mobile-publication-meta {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 5px;
    overflow: hidden;
  }

  .mobile-publication-meta > b {
    padding-right: 5px;
    border-right: 1px solid #28394d;
    color: #a8b3c1;
    font-size: 7px;
    font-weight: 600;
    white-space: nowrap;
  }

  .mobile-publication-meta > b.green { color: #64d58b; }
  .mobile-publication-meta > b.red { color: #ff7c83; }

  .mobile-publication-meta > small {
    display: flex;
    align-items: center;
    gap: 2px;
    color: #d7a94f;
    font-size: 7px;
    white-space: nowrap;
  }

  .mobile-publication-meta .ui-icon {
    width: 9px;
    height: 9px;
  }

  .mobile-score-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
    overflow: hidden;
    border: 1px solid #2c4057;
    border-radius: 7px;
    background: #081522;
  }

  .mobile-score-strip > span {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2px;
    min-width: 0;
    padding: 4px 5px;
    border-right: 1px solid #2c4057;
  }

  .mobile-score-strip > span:last-child { border-right: 0; }
  .mobile-score-strip .creative { box-shadow: inset 0 2px #36c6d3; }
  .mobile-score-strip .performance { box-shadow: inset 0 2px #5b9cf0; }
  .mobile-score-strip .final { box-shadow: inset 0 2px #9b6af1; }
  .mobile-score-strip .preliminary { background: rgba(196, 145, 54, .06); }

  .mobile-score-strip small {
    min-width: 0;
    overflow: hidden;
    color: #77889d;
    font-size: 6px;
    font-weight: 800;
    letter-spacing: .02em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .mobile-score-strip b {
    color: #f4f7fb;
    font-size: 12px;
    line-height: 1;
  }

  .mobile-publication-topic {
    display: none;
  }

  .mobile-publication-chevron {
    align-self: center;
    color: #64758a;
    font-size: 19px;
    font-style: normal;
  }

  .table-card .footer {
    margin-top: 7px;
    padding: 8px 4px;
  }

  .content-page .table-card .footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    text-align: center;
  }

  .content-page .table-card .footer > span:last-child {
    display: none;
  }

  .mobile-load-more {
    width: 100%;
    min-height: 40px;
    border: 1px solid #6449b7;
    border-radius: 10px;
    background: #211a42;
    color: #d1bcff;
    font-size: 11px;
    font-weight: 800;
  }

  /* Competitor actions sit with the selected profile, followed by a compact KPI rail. */
  .competitor-page > .row.between.top > .btn {
    min-height: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 10px;
  }

  .competitor-page .competitor-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    padding: 11px;
  }

  .competitor-page .tracked-profile-select,
  .competitor-page .tracked-profile-trigger {
    width: 100%;
  }

  .competitor-page .tracked-profile-select > label {
    margin-bottom: 5px;
    font-size: 9px;
  }

  .competitor-page .tracked-profile-trigger {
    min-height: 54px;
    padding: 7px 9px;
  }

  .competitor-page .profile-trigger-count {
    font-size: 8px;
  }

  .competitor-page .competitor-hero .actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    gap: 6px;
    margin: 0;
  }

  .competitor-page .competitor-hero .actions > span {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 8px;
    line-height: 1;
  }

  .competitor-page .competitor-hero .actions .btn {
    width: 100%;
    min-height: 32px;
    height: 32px;
    padding: 0 6px;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .competitor-page .summary5 {
    display: flex;
    gap: 7px;
    margin: 9px -14px 11px;
    padding: 0 14px 3px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .competitor-page .summary5::-webkit-scrollbar {
    display: none;
  }

  .competitor-page .summary5 .card {
    min-width: 126px;
    min-height: 78px;
    flex: 0 0 126px;
    padding: 9px 10px;
    scroll-snap-align: start;
  }

  .competitor-page .summary5 .competitor-summary-action {
    padding-bottom: 9px !important;
  }

  .competitor-page .summary5 .summary-open {
    display: none;
  }

  .competitor-page .summary5 .summary-label {
    gap: 4px;
    font-size: 7px;
    white-space: nowrap;
  }

  .competitor-page .summary5 .summary-label .ui-icon {
    width: 12px;
    height: 12px;
  }

  .competitor-page .summary5 b {
    display: -webkit-box;
    margin-top: 6px;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.12;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .competitor-page .summary5 small {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    color: var(--muted);
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 390px) {
  .content-page .row.between.top,
  .competitor-page .row.between.top {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .content-page .row.between.top > .btn,
  .competitor-page .row.between.top > .btn {
    width: auto;
  }

  .competitor-page .summary5 {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .table tbody td.mobile-publication-card {
    grid-template-columns: 62px minmax(0, 1fr) 10px;
    gap: 7px;
    padding: 8px;
  }

  .mobile-publication-thumb {
    width: 62px;
    min-height: 116px;
  }

  .mobile-publication-head > small {
    display: none;
  }

  .mobile-publication-head {
    grid-template-columns: 21px minmax(0, 1fr) auto;
  }

  .mobile-score-strip > span {
    display: block;
    padding: 4px;
    text-align: center;
  }

  .mobile-score-strip small {
    display: block;
    margin-bottom: 2px;
    font-size: 5px;
  }
}

@media (max-width: 720px) {
  .competitor-directory-page > .row.between.top {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .competitor-directory-page > .row.between.top > .btn {
    width: auto;
    min-height: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 10px;
  }

  .competitor-directory-lead {
    margin-top: -7px;
    margin-bottom: 13px;
    font-size: 10px;
  }

  .competitor-directory-toolbar {
    display: grid;
    align-items: stretch;
    gap: 10px;
    padding: 11px;
    margin-bottom: 9px;
  }

  .competitor-directory-toolbar > div > b {
    font-size: 13px;
  }

  .competitor-directory-toolbar > div > small,
  .competitor-directory-toolbar > label {
    font-size: 9px;
  }

  .competitor-directory-toolbar .select {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    height: 38px;
    font-size: 11px;
  }

  .competitor-directory-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .competitor-directory-card {
    padding: 10px;
    border-radius: 10px;
  }

  .competitor-directory-card:hover {
    transform: none;
  }

  .competitor-directory-card-head {
    grid-template-columns: 24px 36px minmax(0, 1fr) auto auto;
    gap: 7px;
  }

  .competitor-directory-rank {
    width: 22px;
    height: 22px;
    font-size: 9px;
  }

  .competitor-directory-avatar {
    width: 36px;
    height: 36px;
    font-size: 9px;
  }

  .competitor-directory-profile > b {
    font-size: 11px;
  }

  .competitor-directory-profile > small {
    font-size: 8px;
  }

  .competitor-directory-you {
    padding: 3px 4px;
    font-size: 7px;
  }

  .competitor-directory-final {
    min-width: 32px;
  }

  .competitor-directory-final > b {
    font-size: 16px;
  }

  .competitor-directory-final > small {
    font-size: 7px;
  }

  .competitor-directory-scores {
    gap: 5px;
    margin: 9px 0 7px;
  }

  .competitor-directory-scores > span {
    padding: 6px 5px;
  }

  .competitor-directory-scores small {
    font-size: 6px;
  }

  .competitor-directory-scores b {
    font-size: 12px;
  }

  .competitor-directory-meta,
  .competitor-directory-hook {
    margin-left: 0;
    padding-top: 7px;
    font-size: 8px;
  }

  .competitor-directory-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .competitor-directory-meta .ui-icon {
    width: 12px;
    height: 12px;
  }

  .competitor-directory-hook {
    margin-top: 7px;
  }

  .competitor-directory-hook small {
    font-size: 6px;
  }

  .competitor-directory-hook b {
    font-size: 9px;
  }

  .competitor-directory-hook > i {
    font-size: 7px;
  }

  .competitor-directory-hook > em {
    font-size: 15px;
  }

  .competitor-intelligence-navigation {
    margin-bottom: 2px;
  }
}

@media (max-width: 350px) {
  .competitor-directory-you {
    display: none;
  }

  .competitor-directory-card-head {
    grid-template-columns: 22px 34px minmax(0, 1fr) auto;
  }
}
