/* Final mobile results pass: shortcut rail, lower deck, plain copy status, and lighter app chrome. */
.mobile-results-pref-rail {
  display: none;
}

@media (max-width: 680px) {
  body:has(#appStep[data-results-view]:not([hidden])) .page-controls {
    align-items: center;
    gap: 10px !important;
  }

  body:has(#appStep[data-results-view]:not([hidden])) .user-feature-shell {
    margin-left: 4px;
    order: 5;
  }

  body:has(#appStep[data-results-view]:not([hidden])) .invite-quick {
    order: 2;
  }

  body:has(#appStep[data-results-view]:not([hidden])) .results-quick {
    order: 3;
  }

  body:has(#appStep[data-results-view]:not([hidden])) .theme-toggle {
    order: 4;
  }

  body:has(#appStep[data-results-view]:not([hidden])) .quick-copy-status {
    position: static;
    flex: 0 1 auto;
    order: 1;
    max-width: min(54vw, 180px);
    transform: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0 -2px 0 0;
    background: transparent;
    box-shadow: none;
    color: color-mix(in srgb, var(--text) 78%, var(--muted-text));
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0;
    line-height: 1;
    pointer-events: none;
    text-align: right;
    white-space: nowrap;
  }

  body:has(#appStep[data-results-view]:not([hidden])) .quick-copy-status.is-success,
  body:has(#appStep[data-results-view]:not([hidden])) .quick-copy-status.is-error {
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body:has(#appStep[data-results-view]:not([hidden])) .quick-copy-status[hidden] {
    display: none !important;
  }

  :root[data-theme="dark"] body:has(#appStep[data-results-view]:not([hidden])) .quick-copy-status {
    color: color-mix(in srgb, var(--soft-white, #f2ecdf) 78%, var(--accent));
  }

  #appStep:not([hidden]) .app-heading,
  #appStep[data-wizard-active]:not([data-results-view]) .app-heading {
    grid-template-columns: 42px minmax(0, 1fr) !important;
    column-gap: 9px !important;
    align-items: center !important;
    min-height: 42px !important;
  }

  #appStep:not([hidden]) .brand-menu-shell,
  #appStep[data-wizard-active]:not([data-results-view]) .app-heading .brand-menu-shell {
    align-self: center !important;
    width: 42px !important;
    height: 42px !important;
  }

  #appStep:not([hidden]) .app-heading .brand-mark,
  #appStep[data-wizard-active]:not([data-results-view]) .app-heading .brand-mark {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background-color: transparent !important;
    background-size: 100% 100% !important;
    box-shadow: none !important;
  }

  #appStep[data-results-view] .restaurant-card {
    align-content: start !important;
    grid-template-rows: auto minmax(0, 1fr);
  }

  #appStep[data-results-view] .mobile-results-pref-rail {
    display: flex;
    width: min(calc(100vw - 36px), 360px);
    min-height: 52px;
    justify-content: center;
    gap: 7px;
    margin: 10px auto 18px;
    padding: 0;
    position: relative;
    z-index: 260;
  }

  #appStep[data-results-view] .mobile-results-pref-button {
    display: grid;
    width: 46px;
    min-width: 46px;
    height: 46px;
    min-height: 46px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
    border-radius: 999px;
    padding: 0;
    background: color-mix(in srgb, var(--panel-bg) 94%, transparent);
    color: color-mix(in srgb, var(--text) 70%, var(--accent));
    box-shadow: 0 11px 24px rgba(31, 24, 14, 0.1);
  }

  #appStep[data-results-view] .mobile-results-pref-button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  #appStep[data-results-view] .mobile-results-pref-button:active {
    transform: translateY(1px);
  }

  :root[data-theme="dark"] #appStep[data-results-view] .mobile-results-pref-button {
    border-color: rgba(255, 250, 242, 0.13);
    background: rgba(255, 250, 242, 0.1);
    color: color-mix(in srgb, var(--soft-white, #f2ecdf) 76%, var(--accent));
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
  }

  #appStep[data-results-view] .rcs:not(.is-expanded):not(.is-detail-open) {
    margin-top: 38px !important;
  }

  #appStep[data-results-view] .rcs:not(.is-expanded):not(.is-detail-open) .rcs-stage {
    min-height: 438px !important;
  }

  #appStep[data-results-view] .rcs:not(.is-expanded):not(.is-detail-open) .rcs-card {
    top: 40px !important;
  }

  #appStep[data-results-view] .rcs:not(.is-expanded):not(.is-detail-open) .rcs-mode-toolbar {
    top: 58px !important;
  }

  #appStep[data-results-view] .rcs:not(.is-expanded):not(.is-detail-open) .rcs-nav-toolbar {
    top: calc(var(--rcs-card-h) + 96px) !important;
  }

  body:has(.rcs.is-detail-open) #appStep[data-results-view] .mobile-results-pref-rail {
    display: none !important;
  }
}

@media (max-width: 374px) {
  #appStep[data-results-view] .mobile-results-pref-rail {
    width: min(calc(100vw - 22px), 342px);
    gap: 5px;
  }

  #appStep[data-results-view] .mobile-results-pref-button {
    width: 43px;
    min-width: 43px;
    height: 43px;
    min-height: 43px;
  }
}

@media (max-width: 680px) and (max-height: 780px) {
  #appStep[data-results-view] .mobile-results-pref-rail {
    min-height: 46px;
    margin: 6px auto 10px;
  }

  #appStep[data-results-view] .mobile-results-pref-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
  }

  #appStep[data-results-view] .mobile-results-pref-button svg {
    width: 20px;
    height: 20px;
  }

  #appStep[data-results-view] .rcs:not(.is-expanded):not(.is-detail-open) {
    --rcs-card-h: 340px;
    margin-top: 8px !important;
  }

  #appStep[data-results-view] .rcs:not(.is-expanded):not(.is-detail-open) .rcs-stage {
    min-height: 402px !important;
  }

  #appStep[data-results-view] .rcs:not(.is-expanded):not(.is-detail-open) .rcs-card {
    top: 28px !important;
    grid-template-rows: 168px minmax(0, 1fr);
  }

  #appStep[data-results-view] .rcs:not(.is-expanded):not(.is-detail-open) .rcs-thumb {
    height: 168px;
  }

  #appStep[data-results-view] .rcs:not(.is-expanded):not(.is-detail-open) .rcs-mode-toolbar {
    top: 46px !important;
  }

  #appStep[data-results-view] .rcs:not(.is-expanded):not(.is-detail-open) .rcs-nav-toolbar {
    top: calc(var(--rcs-card-h) + 84px) !important;
  }
}
