.desktop-preview {
  background:
    linear-gradient(180deg, rgba(99, 215, 232, 0.05), transparent 260px),
    #020710;
}

.desktop-preview .app-header {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.compare-home-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 900;
  text-decoration: none;
}

.compare-home-button:hover,
.compare-home-button:focus-visible {
  border-color: var(--cyan);
  color: var(--cyan);
  outline: none;
}

.compare-home-button svg {
  width: 18px;
  height: 18px;
}

.view-mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #071321;
}

.view-mode-switch a {
  min-width: 92px;
  padding: 8px 12px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.view-mode-switch a.is-active {
  background: var(--cyan);
  color: #04121b;
}

@media (max-width: 899px) {
  .desktop-preview .view-mode-switch,
  .desktop-preview .preview-badge {
    display: none;
  }

  .desktop-preview .app-header {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
}

@media (max-width: 540px) {
  .compare-home-button {
    width: 42px;
    min-width: 42px;
    padding: 0;
  }

  .compare-home-button span {
    display: none;
  }
}

@media (max-width: 760px) {
  .view-mode-switch a {
    min-width: 72px;
    padding: 7px 9px;
  }
}

@media (min-width: 900px) {
  .desktop-preview {
    padding: 0;
  }

  .desktop-preview .preview-app {
    display: flex;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    margin: 0;
    flex-direction: column;
    border: 0;
    box-shadow: none;
  }

  .desktop-preview .app-header {
    order: 1;
    top: 0;
    min-height: 72px;
    padding: 10px max(24px, calc((100vw - 1320px) / 2));
  }

  .desktop-preview .app-brand {
    max-width: 300px;
  }

  .desktop-preview .app-brand img {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .desktop-preview .app-brand strong {
    font-size: 1.08rem;
  }

  .desktop-preview .app-brand small {
    font-size: 0.76rem;
  }

  .desktop-preview .safety-strip {
    order: 2;
    padding-right: max(24px, calc((100vw - 1320px) / 2));
    padding-left: max(24px, calc((100vw - 1320px) / 2));
  }

  .desktop-preview .bottom-nav {
    position: sticky;
    z-index: 38;
    top: 72px;
    right: auto;
    bottom: auto;
    left: auto;
    order: 3;
    width: min(calc(100% - 48px), 720px);
    min-height: 58px;
    margin: 16px auto 0;
    padding: 5px;
    transform: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(9, 22, 36, 0.97);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
  }

  .desktop-preview .bottom-nav button {
    min-height: 46px;
    flex-direction: row;
    gap: 8px;
    font-size: 0.82rem;
  }

  .desktop-preview .bottom-nav button svg {
    width: 18px;
    height: 18px;
  }

  .desktop-preview .app-main {
    order: 4;
    width: 100%;
    max-width: 1376px;
    margin: 0 auto;
    padding: 0 28px 110px;
  }

  .desktop-preview .app-screen {
    min-height: 640px;
    padding: 28px 0 36px;
  }

  .desktop-preview .screen-heading {
    align-items: center;
    margin-bottom: 20px;
  }

  .desktop-preview .screen-heading h1 {
    font-size: 2rem;
  }

  .desktop-preview .screen-heading p:not(.step-label) {
    max-width: 720px;
    font-size: 0.96rem;
  }

  .desktop-preview .filter-surface {
    display: grid;
    grid-template-columns: minmax(300px, 1.5fr) minmax(250px, 0.8fr) minmax(360px, 1fr);
    align-items: end;
    gap: 14px;
    padding: 14px;
  }

  .desktop-preview .format-switch,
  .desktop-preview .filter-row {
    margin-top: 0;
  }

  .desktop-preview .cell-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .desktop-preview .cell-card {
    min-height: 116px;
    align-items: center;
    padding: 14px;
  }

  .desktop-preview .cell-title h2 {
    font-size: 1.02rem;
  }

  .desktop-preview .selected-chip-row {
    margin: -2px 0 14px;
    padding: 2px 0 6px;
  }

  .desktop-preview .metric-switch {
    width: min(100%, 620px);
    margin-bottom: 12px;
  }

  .desktop-preview .metric-switch button {
    min-height: 48px;
    flex-direction: row;
    gap: 7px;
    font-size: 0.76rem;
  }

  .desktop-preview .plot-surface {
    border-color: var(--line);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
  }

  .desktop-preview .mobile-chart {
    height: 590px;
    min-height: 590px;
  }

  .desktop-preview .quick-read {
    margin-top: 18px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .desktop-preview .quick-read-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .desktop-preview .quick-card {
    min-height: 96px;
    padding: 13px;
    background: var(--surface);
  }

  .desktop-preview .ranking-control {
    width: min(100%, 430px);
    margin-bottom: 16px;
  }

  .desktop-preview .ranking-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .desktop-preview .ranking-card {
    min-height: 188px;
    padding: 16px;
  }

  .desktop-preview .selection-action {
    right: 26px;
    bottom: 24px;
    left: auto;
    width: 430px;
    transform: none;
  }

  .desktop-preview .bottom-sheet {
    right: 28px;
    bottom: 28px;
    left: auto;
    width: min(560px, calc(100vw - 56px));
    max-width: 560px;
    max-height: calc(100vh - 56px);
    padding: 10px 16px 18px;
    border-bottom: 1px solid var(--line);
    border-radius: 8px;
    animation-name: desktop-sheet-in;
  }

  .desktop-preview .current-choices {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .desktop-preview .toast {
    right: 28px;
    bottom: 104px;
    left: auto;
    width: 430px;
  }

  @keyframes desktop-sheet-in {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (min-width: 900px) and (max-width: 1120px) {
  .desktop-preview .filter-surface {
    grid-template-columns: minmax(280px, 1.2fr) minmax(230px, 0.8fr);
  }

  .desktop-preview .filter-row {
    grid-column: 1 / -1;
  }

  .desktop-preview .cell-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .desktop-preview .mobile-chart {
    height: 520px;
    min-height: 520px;
  }
}

/* Desktop completion for Compare visual refresh v3 */
@media (min-width: 900px) {
  .desktop-preview .app-header {
    grid-template-columns: minmax(190px, 235px) minmax(0, 1fr) auto;
    gap: 16px;
  }

  .desktop-preview .app-brand {
    width: 225px;
    max-width: 225px;
  }

  .desktop-preview .app-brand img {
    width: 100%;
    height: auto;
    max-height: 62px;
    flex-basis: auto;
    object-fit: contain;
  }

  .desktop-preview .compare-header-actions {
    grid-column: 3;
  }

  .desktop-preview .compare-lab-banner {
    min-height: 184px;
    margin-bottom: 24px;
    padding: 24px 28px;
    background-position: center 48%;
  }

  .desktop-preview .compare-lab-copy h1 {
    max-width: 760px;
    font-size: 2rem;
  }

  .desktop-preview .purpose-filter-bar {
    grid-template-columns: 175px minmax(0, 1fr);
    align-items: center;
    margin-top: 14px;
    padding: 12px 14px;
  }

  .desktop-preview .purpose-filter-intro {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
  }

  .desktop-preview .purpose-filter-buttons {
    overflow: visible;
  }

  .desktop-preview .cell-card {
    grid-template-columns: 82px minmax(0, 1fr) auto;
    min-height: 142px;
  }

  .desktop-preview .cell-photo {
    width: 82px;
    height: 104px;
    grid-row: auto;
  }

  .desktop-preview .cell-action {
    grid-column: auto;
  }
}

@media (min-width: 1360px) {
  .desktop-preview .compare-primary-nav {
    display: flex;
  }

  .desktop-preview .app-header .icon-button {
    display: none;
  }
}

@media (min-width: 900px) and (max-width: 1359px) {
  .desktop-preview .compare-primary-nav {
    display: none;
  }

  .desktop-preview .app-header .icon-button {
    display: inline-grid;
  }
}

@media (min-width: 900px) and (max-width: 1120px) {
  .desktop-preview .cell-card {
    grid-template-columns: 78px minmax(0, 1fr) auto;
  }

  .desktop-preview .cell-photo {
    width: 78px;
    height: 96px;
  }
}
